From befcc59bcdd33b0687ff64227453180507720ec2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Sat, 11 Oct 2014 14:45:34 +0200 Subject: [PATCH] Load common module automatically without the need to declare it in the scenefile Drastically remove the amount of false-positive errors during runtime --- ext/ghoul | 2 +- include/openspace/properties/propertyowner.h | 5 +++-- openspace-data | 2 +- src/properties/propertyowner.cpp | 4 ---- src/scenegraph/scenegraph.cpp | 7 +++++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index f8e1ba97c3..1f1386215e 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit f8e1ba97c3d70ac456a3db3843d4160a6733d6b3 +Subproject commit 1f1386215e517179f7a4e80e64693fd3ebc2b339 diff --git a/include/openspace/properties/propertyowner.h b/include/openspace/properties/propertyowner.h index b2030f9951..ad7f136d92 100644 --- a/include/openspace/properties/propertyowner.h +++ b/include/openspace/properties/propertyowner.h @@ -91,8 +91,9 @@ public: * more ., the first part of the name will be recursively extracted and * used as a name for a sub-owner and only the last part of the identifier is * referring to a Property owned by PropertyOwner named by the second-but-last name. - * \param URI The identifier of the Property that should be extracted. If the Property - * cannot be found, nullptr is returned + * \param URI The identifier of the Property that should be extracted + * \return If the Property cannot be found, nullptr is returned, + * otherwise the pointer to the Property is returned */ Property* property(const std::string& URI) const; diff --git a/openspace-data b/openspace-data index 5100d9e5b8..4d3fc5402c 160000 --- a/openspace-data +++ b/openspace-data @@ -1 +1 @@ -Subproject commit 5100d9e5b8366034809ff57890f0aafb63cc5677 +Subproject commit 4d3fc5402c0f4fe271dbff7f437423cd956245c8 diff --git a/src/properties/propertyowner.cpp b/src/properties/propertyowner.cpp index 6c626c035e..f2cefb6dac 100644 --- a/src/properties/propertyowner.cpp +++ b/src/properties/propertyowner.cpp @@ -77,8 +77,6 @@ Property* PropertyOwner::property(const std::string& id) const const size_t ownerSeparator = id.find(URISeparator); if (ownerSeparator == std::string::npos) { // if we do not own the property and there is no separator, it does not exist - LERROR("The identifier '" << id << "' did not exist in PropertyOwner '" << - name() << "'"); return nullptr; } else { @@ -87,8 +85,6 @@ Property* PropertyOwner::property(const std::string& id) const PropertyOwner* owner = subOwner(ownerName); if (owner == nullptr) { - LERROR("Sub PropertyOwner '" << owner - << "' did not exist for PropertyOwner '" << name() << "'"); return nullptr; } else { diff --git a/src/scenegraph/scenegraph.cpp b/src/scenegraph/scenegraph.cpp index 781afab522..26d5d6d9e9 100644 --- a/src/scenegraph/scenegraph.cpp +++ b/src/scenegraph/scenegraph.cpp @@ -367,6 +367,9 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath) return false; } + LDEBUG("Loading common module folder '" << commonDirectory << "'"); + loadModule(FileSys.pathByAppendingComponent(moduleDirectory, commonDirectory)); + Dictionary moduleDictionary; if (dictionary.getValue(constants::scenegraph::keyModules, moduleDictionary)) { std::vector keys = moduleDictionary.keys(); @@ -374,7 +377,7 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath) for (const std::string& key : keys) { std::string moduleFolder; if (moduleDictionary.getValue(key, moduleFolder)) - loadModule(moduleDirectory + "/" + moduleFolder); + loadModule(FileSys.pathByAppendingComponent(moduleDirectory, moduleFolder)); } } @@ -465,7 +468,7 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath) void SceneGraph::loadModule(const std::string& modulePath) { - auto pos = modulePath.find_last_of("/"); + auto pos = modulePath.find_last_of(ghoul::filesystem::FileSystem::PathSeparator); if (pos == modulePath.npos) { LERROR("Bad format for module path: " << modulePath); return;