diff --git a/ext/ghoul b/ext/ghoul index 38271e30e0..1c9cbb5317 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 38271e30e019bc130ea25da26dff51a71c5053c7 +Subproject commit 1c9cbb53178eb3cb9cc50e145e91ddfe72cc89d6 diff --git a/include/openspace/scene/scenegraphnode.h b/include/openspace/scene/scenegraphnode.h index 37b14e9ad4..c944074f64 100644 --- a/include/openspace/scene/scenegraphnode.h +++ b/include/openspace/scene/scenegraphnode.h @@ -34,6 +34,8 @@ #include #include + //#define Debugging_Core_SceneGraphNode_Indices + namespace ghoul { class Dictionary; } namespace openspace { @@ -180,6 +182,11 @@ private: glm::dmat4 _modelTransformCached; glm::dmat4 _inverseModelTransformCached; + +#ifdef Debugging_Core_SceneGraphNode_Indices + int index = 0; + static int nextIndex; +#endif // Debugging_Core_SceneGraphNode_Indices }; } // namespace openspace diff --git a/modules/imgui/src/guipropertycomponent.cpp b/modules/imgui/src/guipropertycomponent.cpp index 3b4faf7296..343bc95211 100644 --- a/modules/imgui/src/guipropertycomponent.cpp +++ b/modules/imgui/src/guipropertycomponent.cpp @@ -30,7 +30,7 @@ #include #include -//#define Debugging_ImGui_TreeNode +//#define Debugging_ImGui_TreeNode_Indices namespace { const ImVec2 Size = ImVec2(350, 500); @@ -85,26 +85,26 @@ namespace { struct TreeNode { TreeNode(std::string p) : path(std::move(p)) -#ifdef Debugging_ImGui_TreeNode +#ifdef Debugging_ImGui_TreeNode_Indices , index(nextIndex++) -#endif // Debugging_ImGui_TreeNode +#endif // Debugging_ImGui_TreeNode_Indices {} std::string path; std::vector> children; std::vector nodes; -#ifdef Debugging_ImGui_TreeNode +#ifdef Debugging_ImGui_TreeNode_Indices int index = 0; static int nextIndex; -#endif // Debugging_ImGui_TreeNode +#endif // Debugging_ImGui_TreeNode_Indices }; -#ifdef Debugging_ImGui_TreeNode +#ifdef Debugging_ImGui_TreeNode_Indices int TreeNode::nextIndex = 0; -#endif // Debugging_ImGui_TreeNode +#endif // Debugging_ImGui_TreeNode_Indices void addPathToTree(TreeNode& node, const std::vector& path, openspace::SceneGraphNode* owner) diff --git a/modules/space/rotation/spicerotation.cpp b/modules/space/rotation/spicerotation.cpp index 67c9c6c502..a8683747ca 100644 --- a/modules/space/rotation/spicerotation.cpp +++ b/modules/space/rotation/spicerotation.cpp @@ -124,16 +124,11 @@ SpiceRotation::SpiceRotation(const ghoul::Dictionary& dictionary) } glm::dmat3 SpiceRotation::matrix(const Time& time) const { - try { - return SpiceManager::ref().positionTransformMatrix( - _sourceFrame, - _destinationFrame, - time.j2000Seconds() - ); - } - catch (const SpiceManager::SpiceException&) { - return glm::dmat3(1.0); - } + return SpiceManager::ref().positionTransformMatrix( + _sourceFrame, + _destinationFrame, + time.j2000Seconds() + ); } } // namespace openspace diff --git a/modules/space/spacemodule.cpp b/modules/space/spacemodule.cpp index 37f092cd99..265f3aa0b1 100644 --- a/modules/space/spacemodule.cpp +++ b/modules/space/spacemodule.cpp @@ -37,14 +37,32 @@ #include #include #include +#include #include #include +namespace { + constexpr openspace::properties::Property::PropertyInfo SpiceExceptionInfo = { + "ShowExceptions", + "Show Exceptions", + "If enabled, errors from SPICE will be thrown and show up in the log. If " + "disabled, the errors will be ignored silently." + }; +} // namespace + namespace openspace { ghoul::opengl::ProgramObjectManager SpaceModule::ProgramObjectManager; -SpaceModule::SpaceModule() : OpenSpaceModule(Name) {} +SpaceModule::SpaceModule() + : OpenSpaceModule(Name) + , _showSpiceExceptions(SpiceExceptionInfo, true) +{ + _showSpiceExceptions.onChange([&t = _showSpiceExceptions](){ + SpiceManager::ref().setExceptionHandling(SpiceManager::UseException(t)); + }); + addProperty(_showSpiceExceptions); +} void SpaceModule::internalInitialize(const ghoul::Dictionary&) { FactoryManager::ref().addFactory( diff --git a/modules/space/spacemodule.h b/modules/space/spacemodule.h index c158959826..7b6544a2ae 100644 --- a/modules/space/spacemodule.h +++ b/modules/space/spacemodule.h @@ -27,6 +27,7 @@ #include +#include #include namespace openspace { @@ -44,6 +45,8 @@ public: private: void internalInitialize(const ghoul::Dictionary&) override; void internalDeinitializeGL() override; + + properties::BoolProperty _showSpiceExceptions; }; } // namespace openspace diff --git a/src/scene/scenegraphnode.cpp b/src/scene/scenegraphnode.cpp index 4847c87372..f089d45d51 100644 --- a/src/scene/scenegraphnode.cpp +++ b/src/scene/scenegraphnode.cpp @@ -52,6 +52,10 @@ namespace { namespace openspace { +#ifdef Debugging_Core_SceneGraphNode_Indices +int SceneGraphNode::nextIndex = 0; +#endif // Debugging_Core_SceneGraphNode_Indices + std::unique_ptr SceneGraphNode::createFromDictionary( const ghoul::Dictionary& dictionary) { @@ -62,6 +66,9 @@ std::unique_ptr SceneGraphNode::createFromDictionary( ); std::unique_ptr result = std::make_unique(); +#ifdef Debugging_Core_SceneGraphNode_Indices + result->index = nextIndex++; +#endif // Debugging_Core_SceneGraphNode_Indices std::string identifier = dictionary.value(KeyIdentifier); result->setIdentifier(std::move(identifier)); @@ -614,7 +621,7 @@ glm::dvec3 SceneGraphNode::calculateWorldPosition() const { } bool SceneGraphNode::isTimeFrameActive(const Time& time) const { - for (const auto& dep : _dependencies) { + for (SceneGraphNode* dep : _dependencies) { if (!dep->isTimeFrameActive(time)) { return false; } diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp index 2b5cb33eed..38b5cba88e 100644 --- a/src/util/spicemanager.cpp +++ b/src/util/spicemanager.cpp @@ -401,7 +401,7 @@ bool SpiceManager::hasFrameId(const std::string& frame) const { } void getValueInternal(const std::string& body, const std::string& value, int size, - double* v) + double* v) { ghoul_assert(!body.empty(), "Empty body"); ghoul_assert(!value.empty(), "Empty value");