From 15064f0097d49126271e9187800360120b75dce2 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Thu, 28 Feb 2019 14:04:22 -0800 Subject: [PATCH] fix lasers and keyboard on reload --- interface/src/Application.cpp | 5 +++++ interface/src/ui/Keyboard.cpp | 8 ++++++++ interface/src/ui/Keyboard.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ebc1176ee1..bfae3e7303 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -5770,6 +5770,11 @@ void Application::reloadResourceCaches() { DependencyManager::get()->reset(); // Force redownload of .fst models + DependencyManager::get()->reloadAllScripts(); + getOffscreenUI()->clearCache(); + + DependencyManager::get()->createKeyboard(); + getMyAvatar()->resetFullAvatarURL(); } diff --git a/interface/src/ui/Keyboard.cpp b/interface/src/ui/Keyboard.cpp index 1ff1c0248b..d344e27d54 100644 --- a/interface/src/ui/Keyboard.cpp +++ b/interface/src/ui/Keyboard.cpp @@ -259,6 +259,12 @@ void Keyboard::setUse3DKeyboard(bool use) { void Keyboard::createKeyboard() { auto pointerManager = DependencyManager::get(); + if (_created) { + pointerManager->removePointer(_leftHandStylus); + pointerManager->removePointer(_rightHandStylus); + clearKeyboardKeys(); + } + QVariantMap modelProperties { { "url", MALLET_MODEL_URL } }; @@ -289,6 +295,8 @@ void Keyboard::createKeyboard() { loadKeyboardFile(keyboardSvg); _keySound = DependencyManager::get()->getSound(SOUND_FILE); + + _created = true; } bool Keyboard::isRaised() const { diff --git a/interface/src/ui/Keyboard.h b/interface/src/ui/Keyboard.h index 627eb68dfd..b3358e486d 100644 --- a/interface/src/ui/Keyboard.h +++ b/interface/src/ui/Keyboard.h @@ -193,6 +193,8 @@ private: QSet _itemsToIgnore; std::vector> _keyboardLayers; + + bool _created { false }; }; #endif