diff --git a/Source/SceneEntities/Loader/imstkVisualObjectImporter.cpp b/Source/SceneEntities/Loader/imstkVisualObjectImporter.cpp index 6662eab0b12c1f17184fcdf51614a1ac1c0110be..51d4875ffceade3c546b648011cac15f0b7be2ad 100644 --- a/Source/SceneEntities/Loader/imstkVisualObjectImporter.cpp +++ b/Source/SceneEntities/Loader/imstkVisualObjectImporter.cpp @@ -89,7 +89,8 @@ ObjectIO::importSceneObject( const aiScene* scene = importer.ReadFile(modelFilePath, AssimpMeshIO::getDefaultPostProcessSteps()); // Check if there is actually a mesh or if the file can be read - CHECK(scene != nullptr && scene->HasMeshes()) << "AssimpMeshIO::readMeshData error: could not read with reader."; + CHECK(scene != nullptr && scene->HasMeshes()) << "AssimpMeshIO::readMeshData error: could not read with reader: " + << modelFilePath; // Iterate over each material std::vector<std::shared_ptr<RenderMaterial>> materials(scene->mNumMaterials); diff --git a/Source/SimulationManager/imstkMouseSceneControl.cpp b/Source/SimulationManager/imstkMouseSceneControl.cpp index e7c7ca19a60dfad705a1ef4032a231bbc962e9e6..11e3b10235386f4213bf54f3bad2ff9f23642857 100644 --- a/Source/SimulationManager/imstkMouseSceneControl.cpp +++ b/Source/SimulationManager/imstkMouseSceneControl.cpp @@ -46,7 +46,6 @@ MouseSceneControl::printControls() void MouseSceneControl::OnButtonPress(const int key) { - // If no mode currently selected if (m_mode == Mode::None) { // Set the mode @@ -77,8 +76,7 @@ MouseSceneControl::OnButtonRelease(const int key) void MouseSceneControl::OnScroll(const double dx) { - // This control is disabled in simulation mode - if (m_sceneManager->getMode() == SceneManager::Mode::Simulation) + if (!getEnabled()) { return; } @@ -106,8 +104,7 @@ MouseSceneControl::OnScroll(const double dx) void MouseSceneControl::OnMouseMove(const Vec2d& pos) { - // Controls disabled in simulation mode - if (m_sceneManager->getMode() == SceneManager::Mode::Simulation) + if (!getEnabled()) { return; } @@ -165,15 +162,14 @@ MouseSceneControl::OnMouseMove(const Vec2d& pos) } void -MouseSceneControl::update(const double imstkNotUsed(dt)) +MouseSceneControl::setEnabled(bool enable) { - // Directly set it - //m_camera->getView() = m_targetViewTransform; - - // Slerp the camera rotation - /*const Quatd currOrientation = Quatd(m_camera->getView().block<3, 3>(0, 0)).normalized(); - const Quatd targetOrientation = Quatd(m_targetViewTransform.block<3, 3>(0, 0)).normalized(); - const Quatd newOrientation = currOrientation.slerp(0.1, targetOrientation).normalized(); - m_camera->getView().block<3, 3>(0, 0) = newOrientation.toRotationMatrix();*/ + m_enabled = enable; +} + +bool +MouseSceneControl::getEnabled() const +{ + return (m_sceneManager->getMode() == SceneManager::Mode::Debug) || m_enabled; } } \ No newline at end of file diff --git a/Source/SimulationManager/imstkMouseSceneControl.h b/Source/SimulationManager/imstkMouseSceneControl.h index af21faf3825f2b6acacbd35d190c408fb2aa6a4d..495f585efd8a2de9ee9590632c1fe17fc81120a9 100644 --- a/Source/SimulationManager/imstkMouseSceneControl.h +++ b/Source/SimulationManager/imstkMouseSceneControl.h @@ -69,10 +69,20 @@ public: /// /// \brief Set the scene manager to be controlled - /// The active scene's camera will be controllable depending on SceneManager's mode + /// The active scene's camera will be controllable depending on SceneManager's mode, or the /// void setSceneManager(std::shared_ptr<SceneManager> manager) { m_sceneManager = manager; } + /// + /// \brief Enable the mouse control, independent of the debug mode + /// + void setEnabled(bool enable); + + /// + /// \return true if the controls are enabled, either explicitly or debug is on in the scenecontrol + /// + bool getEnabled() const; + public: void printControls() override; @@ -84,10 +94,6 @@ public: void OnScroll(const double dx) override; void OnMouseMove(const Vec2d& pos) override; - // How to handle mouse movements? - // Mouse movements best done in update func or event? event would still require update for interpolation - void update(const double dt) override; - protected: std::shared_ptr<SceneManager> m_sceneManager; Mode m_mode = Mode::None; @@ -103,5 +109,7 @@ protected: double m_zoomFactor = 1.0; double m_rotateFactor = 5.0; double m_panFactor = 1.0; + + bool m_enabled = false; }; } \ No newline at end of file