mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-18 16:17:23 -05:00
Run macros even if they are paused when pressing "Run Macro"
This commit is contained in:
parent
2c1b97e5cd
commit
d31ae77176
|
|
@ -73,7 +73,8 @@ public:
|
|||
virtual ~Macro();
|
||||
|
||||
bool CeckMatch();
|
||||
bool PerformAction(bool forceParallel = false);
|
||||
bool PerformAction(bool forceParallel = false,
|
||||
bool ignorePause = false);
|
||||
bool Matched() { return _matched; }
|
||||
std::string Name() { return _name; }
|
||||
void SetName(const std::string &name);
|
||||
|
|
@ -105,8 +106,8 @@ private:
|
|||
void ClearHotkeys();
|
||||
void SetHotkeysDesc();
|
||||
void ResetTimers();
|
||||
void RunActions(bool &ret);
|
||||
void RunActions();
|
||||
void RunActions(bool &ret, bool ignorePause);
|
||||
void RunActions(bool ignorePause);
|
||||
|
||||
std::string _name = "";
|
||||
std::deque<std::shared_ptr<MacroCondition>> _conditions;
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ void AdvSceneSwitcher::on_runMacro_clicked()
|
|||
return;
|
||||
}
|
||||
|
||||
bool ret = macro->PerformAction(true);
|
||||
bool ret = macro->PerformAction(true, true);
|
||||
if (!ret) {
|
||||
QString err =
|
||||
obs_module_text("AdvSceneSwitcher.macroTab.runFail");
|
||||
|
|
|
|||
|
|
@ -108,11 +108,11 @@ bool Macro::CeckMatch()
|
|||
return _matched;
|
||||
}
|
||||
|
||||
bool Macro::PerformAction(bool forceParallel)
|
||||
bool Macro::PerformAction(bool forceParallel, bool ignorePause)
|
||||
{
|
||||
if (!_done) {
|
||||
vblog(LOG_INFO, "macro %s already running", _name.c_str());
|
||||
return true;
|
||||
return !forceParallel;
|
||||
}
|
||||
|
||||
bool ret = true;
|
||||
|
|
@ -121,9 +121,10 @@ bool Macro::PerformAction(bool forceParallel)
|
|||
if (_thread.joinable()) {
|
||||
_thread.join();
|
||||
}
|
||||
_thread = std::thread([this] { RunActions(); });
|
||||
_thread = std::thread(
|
||||
[this, ignorePause] { RunActions(ignorePause); });
|
||||
} else {
|
||||
RunActions(ret);
|
||||
RunActions(ret, ignorePause);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -141,13 +142,13 @@ void Macro::ResetTimers()
|
|||
}
|
||||
}
|
||||
|
||||
void Macro::RunActions(bool &retVal)
|
||||
void Macro::RunActions(bool &retVal, bool ignorePause)
|
||||
{
|
||||
bool ret = true;
|
||||
for (auto &a : _actions) {
|
||||
a->LogAction();
|
||||
ret = ret && a->PerformAction();
|
||||
if (!ret || _stop || _paused) {
|
||||
if (!ret || _stop || (_paused && !ignorePause)) {
|
||||
retVal = ret;
|
||||
_done = true;
|
||||
return;
|
||||
|
|
@ -156,10 +157,10 @@ void Macro::RunActions(bool &retVal)
|
|||
_done = true;
|
||||
}
|
||||
|
||||
void Macro::RunActions()
|
||||
void Macro::RunActions(bool ignorePause)
|
||||
{
|
||||
bool unused;
|
||||
RunActions(unused);
|
||||
RunActions(unused, ignorePause);
|
||||
}
|
||||
|
||||
void Macro::SetPaused(bool pause)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user