mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-12 04:11:06 -05:00
Add ResolveVariables()
Settings will be set to fixed values based on the values of the variables used.
This commit is contained in:
@@ -140,6 +140,11 @@ void OSCBlob::Load(obs_data_t *obj, const char *name)
|
||||
_stringRep.Load(obj, name);
|
||||
}
|
||||
|
||||
void OSCBlob::ResolveVariables()
|
||||
{
|
||||
_stringRep.ResolveVariables();
|
||||
}
|
||||
|
||||
void OSCTrue::Save(obs_data_t *obj, const char *name) const
|
||||
{
|
||||
obs_data_set_bool(obj, name, true);
|
||||
@@ -201,6 +206,14 @@ std::optional<std::vector<char>> OSCMessage::GetBuffer() const
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void OSCMessage::ResolveVariables()
|
||||
{
|
||||
_address.ResolveVariables();
|
||||
for (auto &element : _elements) {
|
||||
element.ResolveVariables();
|
||||
}
|
||||
}
|
||||
|
||||
const char *OSCMessageElement::GetTypeTag() const
|
||||
{
|
||||
return GetTypeTag(*this);
|
||||
@@ -216,6 +229,21 @@ const char *OSCMessageElement::GetTypeTag(const OSCMessageElement &element)
|
||||
return _typeNames.at(element._value.index()).tag;
|
||||
}
|
||||
|
||||
void OSCMessageElement::ResolveVariables()
|
||||
{
|
||||
std::visit(
|
||||
[](auto &&arg) {
|
||||
using T = std::decay_t<decltype(arg)>;
|
||||
if constexpr (std::is_same_v<T, StringVariable> ||
|
||||
std::is_same_v<T, DoubleVariable> ||
|
||||
std::is_same_v<T, OSCBlob> ||
|
||||
std::is_same_v<T, IntVariable>) {
|
||||
arg.ResolveVariables();
|
||||
}
|
||||
},
|
||||
_value);
|
||||
}
|
||||
|
||||
const char *OSCMessageElement::GetTypeName(const OSCMessageElement &element)
|
||||
{
|
||||
return obs_module_text(
|
||||
|
||||
Reference in New Issue
Block a user