mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-20 00:05:41 -05:00
Add ResolveVariables()
Settings will be set to fixed values based on the values of the variables used.
This commit is contained in:
@@ -22,6 +22,7 @@ public:
|
||||
Type GetType() const { return _type; }
|
||||
bool IsFixedType() const { return _type == Type::FIXED_VALUE; }
|
||||
std::weak_ptr<Variable> GetVariable() const { return _variable; }
|
||||
void ResolveVariables();
|
||||
|
||||
private:
|
||||
Type _type = Type::FIXED_VALUE;
|
||||
|
||||
@@ -93,3 +93,9 @@ template<typename T> NumberVariable<T>::operator T() const
|
||||
{
|
||||
return GetValue();
|
||||
}
|
||||
|
||||
template<typename T> void NumberVariable<T>::ResolveVariables()
|
||||
{
|
||||
_value = GetValue();
|
||||
_type = Type::FIXED_VALUE;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,12 @@ void StringVariable::Save(obs_data_t *obj, const char *name) const
|
||||
obs_data_set_string(obj, name, _value.c_str());
|
||||
}
|
||||
|
||||
void StringVariable::ResolveVariables()
|
||||
{
|
||||
Resolve();
|
||||
_value = _resolvedValue;
|
||||
}
|
||||
|
||||
const char *StringVariable::c_str()
|
||||
{
|
||||
Resolve();
|
||||
|
||||
@@ -27,6 +27,8 @@ public:
|
||||
EXPORT void Load(obs_data_t *obj, const char *name);
|
||||
EXPORT void Save(obs_data_t *obj, const char *name) const;
|
||||
|
||||
EXPORT void ResolveVariables();
|
||||
|
||||
private:
|
||||
void Resolve() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user