diff --git a/src/general.cpp b/src/general.cpp index e83f6653..e56b1182 100644 --- a/src/general.cpp +++ b/src/general.cpp @@ -499,6 +499,9 @@ void SwitcherData::LoadSettings(obs_data_t *obj) return; } + // New post load steps to be declared during load + postLoadSteps.clear(); + // Needs to be loaded before any entries which might rely on scene group // selections to be available. loadSceneGroups(obj); @@ -529,6 +532,10 @@ void SwitcherData::LoadSettings(obs_data_t *obj) LoadHotkeys(obj); LoadUISettings(obj); + for (const auto &func : postLoadSteps) { + func(); + } + // Reset on startup and scene collection change switcher->lastOpenedTab = -1; startupLoadDone = true; diff --git a/src/switcher-data.cpp b/src/switcher-data.cpp index 2bd915df..b252bfa0 100644 --- a/src/switcher-data.cpp +++ b/src/switcher-data.cpp @@ -186,4 +186,9 @@ void SwitcherData::AddLoadStep(std::function function) loadSteps.emplace_back(function); } +void SwitcherData::AddPostLoadStep(std::function function) +{ + postLoadSteps.emplace_back(function); +} + } // namespace advss diff --git a/src/switcher-data.hpp b/src/switcher-data.hpp index bb706d97..fa1e57af 100644 --- a/src/switcher-data.hpp +++ b/src/switcher-data.hpp @@ -66,6 +66,7 @@ public: void ResetForNextInterval(); void AddSaveStep(std::function); void AddLoadStep(std::function); + void AddPostLoadStep(std::function); void AddIntervalResetStep(std::function); bool CheckForMatch(OBSWeakSource &scene, OBSWeakSource &transition, int &linger, bool &setPreviousSceneAsMatch, @@ -116,6 +117,7 @@ public: std::vector> saveSteps; std::vector> loadSteps; + std::vector> postLoadSteps; std::vector> resetIntervalSteps; bool firstBoot = true;