Load common module automatically without the need to declare it in the scenefile

Drastically remove the amount of false-positive errors during runtime
This commit is contained in:
Alexander Bock
2014-10-11 14:45:34 +02:00
parent c226e9b82f
commit befcc59bcd
5 changed files with 10 additions and 10 deletions

View File

@@ -91,8 +91,9 @@ public:
* more <code>.</code>, 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, <code>nullptr</code> is returned
* \param URI The identifier of the Property that should be extracted
* \return If the Property cannot be found, <code>nullptr</code> is returned,
* otherwise the pointer to the Property is returned
*/
Property* property(const std::string& URI) const;

View File

@@ -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 {

View File

@@ -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<std::string> 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;