mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-07 17:16:00 -05:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1020a1909 | ||
|
|
8b0bd4193b |
@@ -459,7 +459,7 @@ void SwitcherData::LoadSettings(obs_data_t *obj)
|
|||||||
LoadHotkeys(obj);
|
LoadHotkeys(obj);
|
||||||
LoadUISettings(obj);
|
LoadUISettings(obj);
|
||||||
|
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
|
|
||||||
// Reset on startup and scene collection change
|
// Reset on startup and scene collection change
|
||||||
ResetLastOpenedTab();
|
ResetLastOpenedTab();
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ void MacroActionEdit::ActionSelectionChanged(const QString &text)
|
|||||||
*_entryData = MacroActionFactory::Create(id, macro);
|
*_entryData = MacroActionFactory::Create(id, macro);
|
||||||
(*_entryData)->SetIndex(idx);
|
(*_entryData)->SetIndex(idx);
|
||||||
(*_entryData)->PostLoad();
|
(*_entryData)->PostLoad();
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
}
|
}
|
||||||
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
auto widget = MacroActionFactory::CreateWidget(id, this, *_entryData);
|
||||||
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
QWidget::connect(widget, SIGNAL(HeaderInfoChanged(const QString &)),
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ void MacroConditionEdit::ConditionSelectionChanged(const QString &text)
|
|||||||
(*_entryData)->SetIndex(idx);
|
(*_entryData)->SetIndex(idx);
|
||||||
(*_entryData)->SetLogicType(logic);
|
(*_entryData)->SetLogicType(logic);
|
||||||
(*_entryData)->PostLoad();
|
(*_entryData)->PostLoad();
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
}
|
}
|
||||||
auto widget =
|
auto widget =
|
||||||
MacroConditionFactory::CreateWidget(id, this, *_entryData);
|
MacroConditionFactory::CreateWidget(id, this, *_entryData);
|
||||||
|
|||||||
@@ -1080,7 +1080,7 @@ void MacroEdit::AddMacroAction(Macro *macro, int idx, const std::string &id,
|
|||||||
macro->Actions().at(idx)->Load(data);
|
macro->Actions().at(idx)->Load(data);
|
||||||
}
|
}
|
||||||
macro->Actions().at(idx)->PostLoad();
|
macro->Actions().at(idx)->PostLoad();
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
macro->UpdateActionIndices();
|
macro->UpdateActionIndices();
|
||||||
ui->actionsList->Insert(
|
ui->actionsList->Insert(
|
||||||
idx,
|
idx,
|
||||||
@@ -1383,7 +1383,7 @@ void MacroEdit::AddMacroElseAction(Macro *macro, int idx, const std::string &id,
|
|||||||
macro->ElseActions().at(idx)->Load(data);
|
macro->ElseActions().at(idx)->Load(data);
|
||||||
}
|
}
|
||||||
macro->ElseActions().at(idx)->PostLoad();
|
macro->ElseActions().at(idx)->PostLoad();
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
macro->UpdateElseActionIndices();
|
macro->UpdateElseActionIndices();
|
||||||
ui->elseActionsList->Insert(
|
ui->elseActionsList->Insert(
|
||||||
idx, new MacroActionEdit(
|
idx, new MacroActionEdit(
|
||||||
@@ -1583,7 +1583,7 @@ void MacroEdit::AddMacroCondition(Macro *macro, int idx, const std::string &id,
|
|||||||
macro->Conditions().at(idx)->Load(data);
|
macro->Conditions().at(idx)->Load(data);
|
||||||
}
|
}
|
||||||
macro->Conditions().at(idx)->PostLoad();
|
macro->Conditions().at(idx)->PostLoad();
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
(*cond)->SetLogicType(logic);
|
(*cond)->SetLogicType(logic);
|
||||||
macro->UpdateConditionIndices();
|
macro->UpdateConditionIndices();
|
||||||
ui->conditionsList->Insert(
|
ui->conditionsList->Insert(
|
||||||
|
|||||||
@@ -416,7 +416,7 @@ void AdvSceneSwitcher::ImportMacros()
|
|||||||
OBSDataAutoRelease array_obj = obs_data_array_item(array, i);
|
OBSDataAutoRelease array_obj = obs_data_array_item(array, i);
|
||||||
auto macro = std::make_shared<Macro>();
|
auto macro = std::make_shared<Macro>();
|
||||||
macro->Load(array_obj);
|
macro->Load(array_obj);
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
|
|
||||||
if (macroNameExists(macro->Name()) &&
|
if (macroNameExists(macro->Name()) &&
|
||||||
!ResolveMacroImportNameConflict(macro)) {
|
!ResolveMacroImportNameConflict(macro)) {
|
||||||
@@ -444,7 +444,7 @@ void AdvSceneSwitcher::ImportMacros()
|
|||||||
for (const auto ¯o : importedMacros) {
|
for (const auto ¯o : importedMacros) {
|
||||||
macro->PostLoad();
|
macro->PostLoad();
|
||||||
}
|
}
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
|
|
||||||
ui->macros->Reset(GetMacros(),
|
ui->macros->Reset(GetMacros(),
|
||||||
GetGlobalMacroSettings()._highlightExecuted);
|
GetGlobalMacroSettings()._highlightExecuted);
|
||||||
@@ -752,7 +752,7 @@ void AdvSceneSwitcher::CopyMacro()
|
|||||||
newMacro->Load(data);
|
newMacro->Load(data);
|
||||||
newMacro->PostLoad();
|
newMacro->PostLoad();
|
||||||
newMacro->SetName(name);
|
newMacro->SetName(name);
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
Macro::PrepareMoveToGroup(macro->Parent(), newMacro);
|
Macro::PrepareMoveToGroup(macro->Parent(), newMacro);
|
||||||
|
|
||||||
ui->macros->Add(newMacro, macro);
|
ui->macros->Add(newMacro, macro);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ void ActionQueue::Add(const std::shared_ptr<MacroAction> &action)
|
|||||||
action->Save(data);
|
action->Save(data);
|
||||||
copy->Load(data);
|
copy->Load(data);
|
||||||
copy->PostLoad();
|
copy->PostLoad();
|
||||||
RunPostLoadSteps();
|
RunAndClearPostLoadSteps();
|
||||||
copy->ResolveVariablesToFixedValues();
|
copy->ResolveVariablesToFixedValues();
|
||||||
_actions.emplace_back(copy);
|
_actions.emplace_back(copy);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -113,12 +113,13 @@ void RunLoadSteps(obs_data_t *obj)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RunPostLoadSteps()
|
void RunAndClearPostLoadSteps()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(postLoadMutex);
|
std::lock_guard<std::mutex> lock(postLoadMutex);
|
||||||
for (const auto &func : getPostLoadSteps()) {
|
for (const auto &func : getPostLoadSteps()) {
|
||||||
func();
|
func();
|
||||||
}
|
}
|
||||||
|
getPostLoadSteps().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearPostLoadSteps()
|
void ClearPostLoadSteps()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ EXPORT void AddPostLoadStep(std::function<void()>);
|
|||||||
EXPORT void AddIntervalResetStep(std::function<void()>);
|
EXPORT void AddIntervalResetStep(std::function<void()>);
|
||||||
void RunSaveSteps(obs_data_t *);
|
void RunSaveSteps(obs_data_t *);
|
||||||
void RunLoadSteps(obs_data_t *);
|
void RunLoadSteps(obs_data_t *);
|
||||||
EXPORT void RunPostLoadSteps();
|
EXPORT void RunAndClearPostLoadSteps();
|
||||||
void ClearPostLoadSteps();
|
void ClearPostLoadSteps();
|
||||||
|
|
||||||
EXPORT void AddPluginInitStep(std::function<void()>);
|
EXPORT void AddPluginInitStep(std::function<void()>);
|
||||||
|
|||||||
@@ -202,6 +202,8 @@ static void appendNestedMacros(std::deque<std::shared_ptr<Macro>> ¯os,
|
|||||||
dynamic_cast<MacroActionMacro *>(action.get());
|
dynamic_cast<MacroActionMacro *>(action.get());
|
||||||
if (nestedMacroAction) {
|
if (nestedMacroAction) {
|
||||||
macros.push_back(nestedMacroAction->_nestedMacro);
|
macros.push_back(nestedMacroAction->_nestedMacro);
|
||||||
|
appendNestedMacros(
|
||||||
|
macros, nestedMacroAction->_nestedMacro.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const auto &action : macro->ElseActions()) {
|
for (const auto &action : macro->ElseActions()) {
|
||||||
@@ -209,6 +211,8 @@ static void appendNestedMacros(std::deque<std::shared_ptr<Macro>> ¯os,
|
|||||||
dynamic_cast<MacroActionMacro *>(action.get());
|
dynamic_cast<MacroActionMacro *>(action.get());
|
||||||
if (nestedMacroAction) {
|
if (nestedMacroAction) {
|
||||||
macros.push_back(nestedMacroAction->_nestedMacro);
|
macros.push_back(nestedMacroAction->_nestedMacro);
|
||||||
|
appendNestedMacros(
|
||||||
|
macros, nestedMacroAction->_nestedMacro.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -301,8 +305,13 @@ void TempVariableRef::Save(obs_data_t *obj, Macro *macro,
|
|||||||
|
|
||||||
void TempVariableRef::Load(obs_data_t *obj, Macro *macroPtr, const char *name)
|
void TempVariableRef::Load(obs_data_t *obj, Macro *macroPtr, const char *name)
|
||||||
{
|
{
|
||||||
|
std::deque<std::shared_ptr<Macro>> allMacros = GetMacros();
|
||||||
|
for (const auto &topLevelMacro : GetMacros()) {
|
||||||
|
appendNestedMacros(allMacros, topLevelMacro.get());
|
||||||
|
}
|
||||||
|
|
||||||
std::weak_ptr<Macro> macro;
|
std::weak_ptr<Macro> macro;
|
||||||
for (const auto ¯oShared : GetMacros()) {
|
for (const auto ¯oShared : allMacros) {
|
||||||
if (macroShared.get() == macroPtr) {
|
if (macroShared.get() == macroPtr) {
|
||||||
macro = macroShared;
|
macro = macroShared;
|
||||||
break;
|
break;
|
||||||
@@ -340,7 +349,7 @@ void TempVariableRef::PostLoad(int idx, SegmentType type,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Macro *macro = nullptr;
|
auto macro = childMacro.get();
|
||||||
for (int i = 0; i < _depth; i++) {
|
for (int i = 0; i < _depth; i++) {
|
||||||
macro = getParentMacro(childMacro.get());
|
macro = getParentMacro(childMacro.get());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
void PostLoad(int idx, SegmentType, const std::weak_ptr<Macro> &);
|
void PostLoad(int idx, SegmentType, const std::weak_ptr<Macro> &);
|
||||||
|
|
||||||
std::string _id = "";
|
std::string _id = "";
|
||||||
std::weak_ptr<MacroSegment> _segment;
|
std::weak_ptr<MacroSegment> _segment = {};
|
||||||
int _depth = 0;
|
int _depth = 0;
|
||||||
|
|
||||||
friend TempVariable;
|
friend TempVariable;
|
||||||
|
|||||||
Reference in New Issue
Block a user