mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 06:10:52 +02:00
Added triggers to AnimVariantMap.
This commit is contained in:
parent
778521f664
commit
637e3b0a15
1 changed files with 8 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
class AnimVariant {
|
class AnimVariant {
|
||||||
public:
|
public:
|
||||||
|
@ -69,8 +70,11 @@ class AnimVariantMap {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool lookup(const std::string& key, bool defaultValue) const {
|
bool lookup(const std::string& key, bool defaultValue) const {
|
||||||
|
// check triggers first, then map
|
||||||
if (key.empty()) {
|
if (key.empty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
} else if (_triggers.find(key) != _triggers.end()) {
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
auto iter = _map.find(key);
|
auto iter = _map.find(key);
|
||||||
return iter != _map.end() ? iter->second.getBool() : defaultValue;
|
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::quat& value) { _map[key] = AnimVariant(value); }
|
||||||
void set(const std::string& key, const glm::mat4& 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:
|
protected:
|
||||||
std::map<std::string, AnimVariant> _map;
|
std::map<std::string, AnimVariant> _map;
|
||||||
|
std::set<std::string> _triggers;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AnimVariant_h
|
#endif // hifi_AnimVariant_h
|
||||||
|
|
Loading…
Reference in a new issue