Skip to content

Commit

Permalink
Merge pull request #410 from NVlabs/SessionProgressFix
Browse files Browse the repository at this point in the history
Session progress fix
  • Loading branch information
jspjutNV committed Jan 10, 2023
2 parents 6a73a2e + 5d8bc4b commit 13b4ade
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions source/FPSciApp.cpp
Expand Up @@ -434,7 +434,7 @@ void FPSciApp::makeGUI() {
// Add the control panes here
updateUserMenu = true;
// If we require a new user show the menu on startup regardless of configuration
m_showUserMenu = experimentConfig.menu.showMenuOnStartup || experimentConfig.menu.requireUserAdd;
showUserMenu = experimentConfig.menu.showMenuOnStartup || experimentConfig.menu.requireUserAdd;
updateDeveloperControls(std::make_shared<FpsConfig>((FpsConfig)experimentConfig));
}

Expand Down Expand Up @@ -658,7 +658,7 @@ void FPSciApp::updateSession(const String& id, const bool forceSceneReload) {

// Update the application w/ the session parameters
updateUserMenu = true;
if (!m_firstSession) m_showUserMenu = sessConfig->menu.showMenuBetweenSessions;
if (!m_firstSession) showUserMenu = sessConfig->menu.showMenuBetweenSessions;
updateConfigParameters(sessConfig, forceSceneReload, true, false);

// Handle results files
Expand Down Expand Up @@ -1193,8 +1193,8 @@ void FPSciApp::onAfterEvents() {
m_userSettingsWindow = UserMenu::create(this, userTable, userStatusTable, trialConfig->menu, theme, Rect2D::xywh(0.0f, 0.0f, 10.0f, 10.0f));
m_userSettingsWindow->setSelectedSession(selSess);
moveToCenter(m_userSettingsWindow);
m_userSettingsWindow->setVisible(m_showUserMenu);
setMouseInputMode(m_showUserMenu ? MouseInputMode::MOUSE_CURSOR : MouseInputMode::MOUSE_FPM);
m_userSettingsWindow->setVisible(showUserMenu);
setMouseInputMode(showUserMenu ? MouseInputMode::MOUSE_CURSOR : MouseInputMode::MOUSE_FPM);

// Add the new settings window and clear the semaphore
addWidget(m_userSettingsWindow);
Expand Down
3 changes: 2 additions & 1 deletion source/FPSciApp.h
Expand Up @@ -102,7 +102,6 @@ class FPSciApp : public GApp {

shared_ptr<UserMenu> m_userSettingsWindow; ///< User settings window
MouseInputMode m_mouseInputMode = MouseInputMode::MOUSE_CURSOR; ///< Does the mouse currently have control over the view
bool m_showUserMenu = true; ///< Show the user menu after update?

bool m_firstSession = true; ///< Flag indicating that this is the first session run
UserConfig m_lastSavedUser; ///< Used to track if user has changed since last save
Expand Down Expand Up @@ -172,6 +171,8 @@ class FPSciApp : public GApp {

ReticleConfig reticleConfig; ///< Config for the active reticle
shared_ptr<Texture> reticleTexture; ///< Texture used for reticle
bool showUserMenu = true; ///< Show the user menu after update?


Table<String, shared_ptr<Texture>> hudTextures; ///< Textures used for the HUD
shared_ptr<GuiTheme> theme;
Expand Down
5 changes: 4 additions & 1 deletion source/Session.cpp
Expand Up @@ -209,6 +209,9 @@ bool Session::nextCondition() {
// Respawn player for first trial in session (override session-level spawn position)
m_app->updateTrial(m_trialConfig, false, m_firstTrial);
if (m_firstTrial) m_firstTrial = false;
else {
m_app->showUserMenu = false; // Override showing the user menu after the first trial in the session
}

// Update session fields (if changed) from trial
m_player = m_app->scene()->typedEntity<PlayerEntity>("player");
Expand Down Expand Up @@ -449,6 +452,7 @@ void Session::updatePresentationState()
// State for showing the trial reference target
if (remainingTargets == 0) {
newState = PresentationState::pretrial;
m_feedbackMessage = "";
}

}
Expand Down Expand Up @@ -564,7 +568,6 @@ void Session::updatePresentationState()
m_app->quitRequest();
}
}
moveOn = true; // Check for session complete (signal start of next session)
}
}
else {
Expand Down

0 comments on commit 13b4ade

Please sign in to comment.