mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-09 18:55:57 -05:00
Fix temp var values of actions not being accessible
This a bug introduced with ec3052c823.
This commit is contained in:
parent
b02259e926
commit
df42538319
|
|
@ -167,6 +167,24 @@ bool MacroSegment::IsTempVarInUse(const std::string &id) const
|
|||
return false;
|
||||
}
|
||||
|
||||
void MacroSegment::CopyTempVarValuesFrom(const MacroSegment &other)
|
||||
{
|
||||
for (const auto &src : other._tempVariables) {
|
||||
for (auto &dst : _tempVariables) {
|
||||
if (dst.ID() != src.ID()) {
|
||||
continue;
|
||||
}
|
||||
auto value = src.Value();
|
||||
if (value) {
|
||||
dst.SetValue(*value);
|
||||
} else {
|
||||
dst.InvalidateValue();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MacroSegment::SetTempVarValue(const std::string &id,
|
||||
const std::string &value)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ protected:
|
|||
|
||||
bool IsTempVarInUse(const std::string &id) const;
|
||||
void SetTempVarValue(const std::string &id, const std::string &value);
|
||||
void CopyTempVarValuesFrom(const MacroSegment &other);
|
||||
|
||||
template<typename T, typename = std::enable_if_t<
|
||||
std::is_same<std::decay_t<T>, bool>::value>>
|
||||
|
|
|
|||
|
|
@ -433,6 +433,9 @@ bool Macro::RunActionsHelper(
|
|||
actionCopy = action->Copy();
|
||||
});
|
||||
bool actionResult = actionCopy->PerformAction();
|
||||
action->WithLock([&action, &actionCopy]() {
|
||||
action->CopyTempVarValuesFrom(*actionCopy);
|
||||
});
|
||||
actionsExecutedSuccessfully =
|
||||
actionsExecutedSuccessfully && actionResult;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user