diff --git a/include/openspace/documentation/documentation.h b/include/openspace/documentation/documentation.h index 2725272987..867b3c7c04 100644 --- a/include/openspace/documentation/documentation.h +++ b/include/openspace/documentation/documentation.h @@ -294,7 +294,11 @@ void testSpecificationAndThrow(const Documentation& documentation, namespace std { +std::string to_string(openspace::documentation::TestResult testResult); + +std::string to_string(openspace::documentation::TestResult::Offense offense); std::string to_string(openspace::documentation::TestResult::Offense::Reason reason); +std::string to_string(openspace::documentation::TestResult::Warning warning); std::string to_string(openspace::documentation::TestResult::Warning::Reason reason); } // namespace std diff --git a/openspace.cfg b/openspace.cfg index 493d2efbc0..0e70714f75 100644 --- a/openspace.cfg +++ b/openspace.cfg @@ -31,10 +31,10 @@ return { -- of all entities that will be visible during an instance of OpenSpace Asset = "default", - -- Scene = "${SCENE}/newhorizons.scene", - -- Scene = "${SCENE}/rosetta.scene", - -- Scene = "${SCENE}/osirisrex.scene", - -- Scene = "${SCENE}/voyager.scene", + -- Asset = "newhorizons", + -- Asset = "rosetta", + -- Asset = "osirisrex", + -- Asset = "voyager", TasksRoot = "${OPENSPACE_DATA}/tasks", diff --git a/src/documentation/documentation.cpp b/src/documentation/documentation.cpp index 941b50d5b5..f86e0c58dc 100644 --- a/src/documentation/documentation.cpp +++ b/src/documentation/documentation.cpp @@ -68,6 +68,32 @@ std::string to_string(std::string value) { return value; } +std::string to_string(openspace::documentation::TestResult testResult) { + using namespace openspace::documentation; + + if (testResult.success) { + return "Success"; + } + else { + std::stringstream stream; + stream << "Failure." << '\n'; + + for (const TestResult::Offense& offense : testResult.offenses) { + stream << " " << std::to_string(offense) << '\n'; + } + + for (const TestResult::Warning& warning : testResult.warnings) { + stream << " " << std::to_string(warning) << '\n'; + } + + return stream.str(); + } +} + +std::string to_string(openspace::documentation::TestResult::Offense offense) { + return offense.offender + ": " + std::to_string(offense.reason); +} + std::string to_string(openspace::documentation::TestResult::Offense::Reason reason) { switch (reason) { case openspace::documentation::TestResult::Offense::Reason::ExtraKey: @@ -85,6 +111,10 @@ std::string to_string(openspace::documentation::TestResult::Offense::Reason reas } } +std::string to_string(openspace::documentation::TestResult::Warning warning) { + return warning.offender + ": " + std::to_string(warning.reason); +} + std::string to_string(openspace::documentation::TestResult::Warning::Reason reason) { switch (reason) { case openspace::documentation::TestResult::Warning::Reason::Deprecated: diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index edc554f6d9..42ad933e13 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -22,6 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include + #include namespace openspace { @@ -364,6 +366,14 @@ int addSceneGraphNode(lua_State* L) { } OsEng.renderEngine().scene()->initializeNode(node); + } + catch (const documentation::SpecificationError& e) { + return luaL_error( + L, + "Error loading scene graph node: %s: %s", + e.what(), + std::to_string(e.result).c_str() + ); } catch (const ghoul::RuntimeError& e) { return luaL_error(L, "Error loading scene graph node: %s", e.what()); }