Some minor changes and added tag support to screenspacerenderable

This commit is contained in:
GPayne
2017-03-31 15:14:00 -06:00
parent 40de0a9624
commit bcdd906ad7
5 changed files with 12 additions and 9 deletions

View File

@@ -212,7 +212,7 @@ public:
* trying to find a match for a desired batch operation on Properties.
* \return Pointer to vector of string tags that were assigned to the Property
*/
const std::vector<std::string>* getTags(void) const;
const std::vector<std::string> tags() const;
/**
* Adds a tag to the Property's list of assigned tags. Tags are useful for creating

View File

@@ -324,8 +324,8 @@ const std::string& PropertyOwner::name() const {
return _name;
}
const std::vector<std::string>* PropertyOwner::getTags(void) const {
return &_tags;
const std::vector<std::string> PropertyOwner::tags() const {
return _tags;
}
void PropertyOwner::addTag(std::string tag) {

View File

@@ -41,7 +41,6 @@ namespace {
const char* keyStart = "StartTime";
const char* keyEnd = "EndTime";
const char* KeyType = "Type";
const char* keyTag = "Tag";
}
@@ -117,7 +116,6 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
dictionary.getValue(keyTag, tagName);
if (! tagName.empty())
addTag(tagName);
if (_startTime != "" && _endTime != "") {
_hasTimeInterval = true;
}

View File

@@ -47,7 +47,7 @@ namespace {
const char* KeyScale = "Scale";
const char* KeyDepth = "Depth";
const char* KeyAlpha = "Alpha";
const char* keyTag = "Tag";
const float PlaneDepth = -2.f;
}
@@ -146,6 +146,11 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
dictionary.getValue(KeyDepth, _depth);
dictionary.getValue(KeyAlpha, _alpha);
std::string tagName;
dictionary.getValue(keyTag, tagName);
if (! tagName.empty())
addTag(tagName);
// Setting spherical/euclidean onchange handler
_useFlatScreen.onChange([this](){
if (_useFlatScreen) {

View File

@@ -46,8 +46,8 @@ const std::string tagToMatch) {
properties::PropertyOwner* owner = prop->owner();
if (owner != nullptr) {
std::vector<std::string>* tags = (std::vector<std::string>*)owner->getTags();
for (std::string currTag : *tags) {
std::vector<std::string> tags = (std::vector<std::string>)owner->tags();
for (std::string currTag : tags) {
if (tagToMatch.compare(currTag) == 0) {
tagMatchOwner = owner;
break;
@@ -67,7 +67,7 @@ void applyRegularExpression(lua_State* L, std::regex regex,
std::string groupName = "") {
using ghoul::lua::errorLocation;
using ghoul::lua::luaTypeToString;
bool isGroupMode = (groupName.compare("") != 0) ? true : false;
bool isGroupMode = (groupName.empty()) ? false : true;
for (properties::Property* prop : properties) {
// Check the regular expression for all properties