Added option for single or multiple tags in a scenegraph node

This commit is contained in:
GPayne
2017-04-10 15:05:06 -06:00
parent fcd2becd34
commit d66561a1d3
3 changed files with 47 additions and 12 deletions
+17 -4
View File
@@ -41,7 +41,7 @@ namespace {
const char* keyStart = "StartTime";
const char* keyEnd = "EndTime";
const char* KeyType = "Type";
const char* keyTag = "Tag";
const char* KeyTag = "Tag";
}
namespace openspace {
@@ -112,10 +112,23 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
dictionary.getValue(keyStart, _startTime);
dictionary.getValue(keyEnd, _endTime);
std::string tagName;
dictionary.getValue(keyTag, tagName);
if (! tagName.empty())
addTag(tagName);
ghoul::Dictionary tagNames;
if (dictionary.hasKeyAndValue<std::string>(KeyTag)) {
dictionary.getValue(KeyTag, tagName);
if (! tagName.empty())
addTag(tagName);
} else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
dictionary.getValue(KeyTag, tagNames);
std::vector<std::string> keys = tagNames.keys();
for (const std::string key : keys) {
tagNames.getValue(key, tagName);
if (! tagName.empty())
addTag(tagName);
}
}
if (_startTime != "" && _endTime != "") {
_hasTimeInterval = true;
}
+15 -4
View File
@@ -47,7 +47,7 @@ namespace {
const char* KeyScale = "Scale";
const char* KeyDepth = "Depth";
const char* KeyAlpha = "Alpha";
const char* keyTag = "Tag";
const char* KeyTag = "Tag";
const float PlaneDepth = -2.f;
}
@@ -147,9 +147,20 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
dictionary.getValue(KeyAlpha, _alpha);
std::string tagName;
dictionary.getValue(keyTag, tagName);
if (! tagName.empty())
addTag(tagName);
ghoul::Dictionary tagNames;
if (dictionary.hasKeyAndValue<std::string>(KeyTag)) {
dictionary.getValue(KeyTag, tagName);
if (! tagName.empty())
addTag(tagName);
} else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
dictionary.getValue(KeyTag, tagNames);
std::vector<std::string> keys = tagNames.keys();
for (const std::string key : keys) {
tagNames.getValue(key, tagName);
if (! tagName.empty())
addTag(tagName);
}
}
// Setting spherical/euclidean onchange handler
_useFlatScreen.onChange([this](){