From 637e3b0a155a8f85491ca8bdd2f97aeff2f0a393 Mon Sep 17 00:00:00 2001 From: "Anthony J. Thibault" Date: Thu, 27 Aug 2015 10:41:01 -0700 Subject: [PATCH] Added triggers to AnimVariantMap. --- libraries/animation/src/AnimVariant.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libraries/animation/src/AnimVariant.h b/libraries/animation/src/AnimVariant.h index 36d189f85c..7c14bfd096 100644 --- a/libraries/animation/src/AnimVariant.h +++ b/libraries/animation/src/AnimVariant.h @@ -14,6 +14,7 @@ #include #include #include +#include class AnimVariant { public: @@ -69,8 +70,11 @@ class AnimVariantMap { public: bool lookup(const std::string& key, bool defaultValue) const { + // check triggers first, then map if (key.empty()) { return defaultValue; + } else if (_triggers.find(key) != _triggers.end()) { + return true; } else { auto iter = _map.find(key); return iter != _map.end() ? iter->second.getBool() : defaultValue; @@ -129,8 +133,12 @@ public: void set(const std::string& key, const glm::quat& value) { _map[key] = AnimVariant(value); } void set(const std::string& key, const glm::mat4& value) { _map[key] = AnimVariant(value); } + void setTrigger(const std::string& key) { _triggers.insert(key); } + void clearTirggers() { _triggers.clear(); } + protected: std::map _map; + std::set _triggers; }; #endif // hifi_AnimVariant_h