Changed logic for updating GUI tracking

pull/615/head
Mads Buvik Sandvei 5 years ago
parent 6474d703ae
commit 5fba3b17e7

@ -1572,8 +1572,7 @@ namespace MWGui
return
!mGuiModes.empty() ||
isConsoleMode() ||
(mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox()) ||
mVideoEnabled;
(mMessageBoxManager && mMessageBoxManager->isInteractiveMessageBox());
}
bool WindowManager::isConsoleMode() const
@ -1897,12 +1896,6 @@ namespace MWGui
mVideoEnabled = true;
mVideoWidget->playVideo("video\\" + name);
#ifdef USE_OPENXR
// Temporary hack to force update of menu placement
// (Menu gets recreated next tick)
auto* xrMenuManager = MWVR::Environment::get().getGUIManager();
#endif
mVideoWidget->eventKeyButtonPressed.clear();
mVideoBackground->eventKeyButtonPressed.clear();
if (allowSkipping)
@ -1940,15 +1933,6 @@ namespace MWGui
frameTimer.setStartTick();
MWBase::Environment::get().getInputManager()->update(dt, true, false);
#ifdef USE_OPENXR
// Temporary hack to force update of menu placement
// (Menu gets recreated next tick)
if (xrMenuManager)
{
xrMenuManager->updateTracking();
xrMenuManager = nullptr;
}
#endif
if (!MWBase::Environment::get().getInputManager()->isWindowVisible())
OpenThreads::Thread::microSleep(5000);

@ -1056,9 +1056,16 @@ private:
mRealisticCombat.reset(new RealisticCombat::StateMachine(player));
bool enabled = !guiMode && mPlayer->getDrawState() == MWMechanics::DrawState_Weapon && !mPlayer->isDisabled();
mRealisticCombat->update(dt, enabled);
}
};
updateHead();
// Update tracking every frame if player is not currently in GUI mode.
// This ensures certain widgets like Notifications will be visible.
if (!guiMode)
{
vrGuiManager->updateTracking();
}
}
void OpenXRInputManager::processAction(const Action* action)

@ -580,15 +580,7 @@ void VRGUIManager::insertLayer(const std::string& name)
}
if (config.trackingMode == TrackingMode::Menu)
{
// Update tracking when a menu is opened
// But don't automatically update it again until all menus have been closed
if (mVisibleMenus == 0)
updateTracking();
else
layer->updateTracking(mHeadPose);
mVisibleMenus++;
}
layer->updateTracking(mHeadPose);
}
void VRGUIManager::insertWidget(MWGui::Layout* widget)
@ -634,9 +626,6 @@ void VRGUIManager::removeLayer(const std::string& name)
if (it->second.get() == mFocusLayer)
setFocusLayer(nullptr);
if (it->second->mConfig.trackingMode == TrackingMode::Menu)
mVisibleMenus--;
mLayers.erase(it);
}

@ -155,7 +155,6 @@ namespace MWVR
std::map<std::string, std::shared_ptr<VRGUILayer>> mLayers;
std::vector<std::shared_ptr<VRGUILayer> > mSideBySideLayers;
int mVisibleMenus{ 0 };
Pose mHeadPose{};
osg::Vec2i mGuiCursor{};
VRGUILayer* mFocusLayer{ nullptr };

Loading…
Cancel
Save