diff --git a/data/locale/en-US.ini b/data/locale/en-US.ini index 1de939bd..2518a62e 100644 --- a/data/locale/en-US.ini +++ b/data/locale/en-US.ini @@ -1774,6 +1774,9 @@ AdvSceneSwitcher.tempVar.run.process.stream.output="Process standard output stre AdvSceneSwitcher.tempVar.run.process.stream.output.description="Full standard output stream, usually numbered 1 and what you see in CLI after running the command." AdvSceneSwitcher.tempVar.run.process.stream.error="Process standard error stream" AdvSceneSwitcher.tempVar.run.process.stream.error.description="Full standard error stream, usually numbered 2." +AdvSceneSwitcher.tempVar.run.process.none.description="Full standard error stream, usually numbered 2." +AdvSceneSwitcher.tempVar.run.process.none="No variables available for the \"Run\" action!" +AdvSceneSwitcher.tempVar.run.process.none.description="When not waiting for the action to finish no variables will be available.\nThe option to wait for the action to complete can be found in the advanced settings." AdvSceneSwitcher.tempVar.recording.durationSeconds="Recording duration" AdvSceneSwitcher.tempVar.recording.durationSeconds.description="Recording duration in seconds.\nThis value does not change while the recording is paused and will be reset to zero if the recording is stopped." diff --git a/plugins/base/macro-action-run.cpp b/plugins/base/macro-action-run.cpp index f4b7b6f7..59680e5e 100644 --- a/plugins/base/macro-action-run.cpp +++ b/plugins/base/macro-action-run.cpp @@ -43,6 +43,16 @@ void MacroActionRun::SetupTempVars() { MacroAction::SetupTempVars(); + if (!_wait) { + AddTempvar( + "process.none", + obs_module_text( + "AdvSceneSwitcher.tempVar.run.process.none"), + obs_module_text( + "AdvSceneSwitcher.tempVar.run.process.none.description")); + return; + } + AddTempvar( "process.id", obs_module_text("AdvSceneSwitcher.tempVar.run.process.id"), @@ -122,6 +132,12 @@ void MacroActionRun::ResolveVariablesToFixedValues() _timeout.ResolveVariables(); } +void MacroActionRun::SetWaitEnabled(bool value) +{ + _wait = value; + SetupTempVars(); +} + MacroActionRunEdit::MacroActionRunEdit( QWidget *parent, std::shared_ptr entryData) : QWidget(parent), @@ -167,7 +183,7 @@ void MacroActionRunEdit::UpdateEntryData() return; } _procConfig->SetProcessConfig(_entryData->_procConfig); - _wait->setChecked(_entryData->_wait); + _wait->setChecked(_entryData->IsWaitEnabled()); _timeout->SetDuration(_entryData->_timeout); } @@ -178,29 +194,19 @@ void MacroActionRunEdit::ProcessConfigAdvancedSettingsShown() void MacroActionRunEdit::WaitChanged(int value) { - if (_loading || !_entryData) { - return; - } - auto lock = LockContext(); - _entryData->_wait = value; + GUARD_LOADING_AND_LOCK(); + _entryData->SetWaitEnabled(value); } void MacroActionRunEdit::TimeoutChanged(const Duration &timeout) { - if (_loading || !_entryData) { - return; - } - auto lock = LockContext(); + GUARD_LOADING_AND_LOCK(); _entryData->_timeout = timeout; } void MacroActionRunEdit::ProcessConfigChanged(const ProcessConfig &conf) { - if (_loading || !_entryData) { - return; - } - - auto lock = LockContext(); + GUARD_LOADING_AND_LOCK(); _entryData->_procConfig = conf; adjustSize(); updateGeometry(); diff --git a/plugins/base/macro-action-run.hpp b/plugins/base/macro-action-run.hpp index b16acf48..3d9e1f05 100644 --- a/plugins/base/macro-action-run.hpp +++ b/plugins/base/macro-action-run.hpp @@ -20,15 +20,17 @@ public: static std::shared_ptr Create(Macro *m); std::shared_ptr Copy() const; void ResolveVariablesToFixedValues(); + void SetWaitEnabled(bool value); + bool IsWaitEnabled() const { return _wait; } ProcessConfig _procConfig; - bool _wait = false; Duration _timeout = 1; private: void SetupTempVars(); void SetTempVarValues(); + bool _wait = false; static bool _registered; static const std::string id; };