Skip to content

Commit

Permalink
Fix temp var references not being resolved on macro copy and import
Browse files Browse the repository at this point in the history
  • Loading branch information
WarmUpTill committed Feb 17, 2024
1 parent 6cbfc48 commit aa1b104
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 3 deletions.
4 changes: 1 addition & 3 deletions lib/general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,7 @@ void SwitcherData::LoadSettings(obs_data_t *obj)
LoadHotkeys(obj);
LoadUISettings(obj);

for (const auto &func : postLoadSteps) {
func();
}
RunPostLoadSteps();

// Reset on startup and scene collection change
switcher->lastOpenedTab = -1;
Expand Down
2 changes: 2 additions & 0 deletions lib/macro/macro-tab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ void AdvSceneSwitcher::ImportMacros()
for (const auto &macro : importedMacros) {
macro->PostLoad();
}
RunPostLoadSteps();

ui->macros->Reset(GetMacros(),
GetGlobalMacroProperties()._highlightExecuted);
Expand Down Expand Up @@ -995,6 +996,7 @@ void AdvSceneSwitcher::CopyMacro()
newMacro->Load(data);
newMacro->PostLoad();
newMacro->SetName(name);
RunPostLoadSteps();
Macro::PrepareMoveToGroup(macro->Parent(), newMacro);

ui->macros->Add(newMacro, macro);
Expand Down
8 changes: 8 additions & 0 deletions lib/switcher-data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ void SwitcherData::AddIntervalResetStep(std::function<void()> function,
resetIntervalSteps.emplace_back(function);
}

void SwitcherData::RunPostLoadSteps()
{
for (const auto &func : postLoadSteps) {
func();
}
postLoadSteps.clear();
}

void SwitcherData::AddPluginInitStep(std::function<void()> function)
{
std::lock_guard<std::mutex> lock(switcher->m);
Expand Down
1 change: 1 addition & 0 deletions lib/switcher-data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class SwitcherData {
void AddLoadStep(std::function<void(obs_data_t *)>);
void AddPostLoadStep(std::function<void()>);
void AddIntervalResetStep(std::function<void()>, bool lock = true);
void RunPostLoadSteps();
void AddPluginInitStep(std::function<void()>);
void AddPluginPostLoadStep(std::function<void()>);
void AddPluginCleanupStep(std::function<void()>);
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/plugin-state-helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ void AddIntervalResetStep(std::function<void()> step, bool lock)
GetSwitcher()->AddIntervalResetStep(step, lock);
}

void RunPostLoadSteps()
{
GetSwitcher()->RunPostLoadSteps();
}

void AddPluginInitStep(std::function<void()> step)
{
GetSwitcher()->AddPluginInitStep(step);
Expand Down
1 change: 1 addition & 0 deletions lib/utils/plugin-state-helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ EXPORT void AddSaveStep(std::function<void(obs_data_t *)>);
EXPORT void AddLoadStep(std::function<void(obs_data_t *)>);
EXPORT void AddPostLoadStep(std::function<void()>);
EXPORT void AddIntervalResetStep(std::function<void()>, bool lock = true);
EXPORT void RunPostLoadSteps();

EXPORT void AddPluginInitStep(std::function<void()>);
EXPORT void AddPluginPostLoadStep(std::function<void()>);
Expand Down

0 comments on commit aa1b104

Please sign in to comment.