mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Add support for registering additional save and load steps
Also renamed the reset steps to make it more clear what their use is.
This commit is contained in:
parent
07b86dda41
commit
9c848938f8
|
|
@ -334,7 +334,7 @@ void SwitcherData::ResetForNextInterval()
|
|||
// Core reset functions
|
||||
ClearWebsocketMessages();
|
||||
// Plugin reset functions
|
||||
for (const auto &func : resetForNextIntervalFuncs) {
|
||||
for (const auto &func : resetIntervalSteps) {
|
||||
func();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -505,6 +505,11 @@ void SwitcherData::LoadSettings(obs_data_t *obj)
|
|||
loadSceneGroups(obj);
|
||||
LoadVariables(obj);
|
||||
LoadConnections(obj);
|
||||
|
||||
for (const auto &func : loadSteps) {
|
||||
func(obj);
|
||||
}
|
||||
|
||||
LoadMacros(obj);
|
||||
loadWindowTitleSwitches(obj);
|
||||
loadScreenRegionSwitches(obj);
|
||||
|
|
@ -559,6 +564,10 @@ void SwitcherData::SaveSettings(obs_data_t *obj)
|
|||
SaveHotkeys(obj);
|
||||
SaveUISettings(obj);
|
||||
SaveVersion(obj, g_GIT_SHA1);
|
||||
|
||||
for (const auto &func : saveSteps) {
|
||||
func(obj);
|
||||
}
|
||||
}
|
||||
|
||||
void SwitcherData::SaveGeneralSettings(obs_data_t *obj)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace advss {
|
|||
static std::map<std::pair<MidiDeviceType, int>, MidiDeviceInstance *>
|
||||
SetupMidiMessageVector()
|
||||
{
|
||||
GetSwitcher()->AddResetForNextIntervalFunction(
|
||||
GetSwitcher()->AddIntervalResetStep(
|
||||
MidiDeviceInstance::ClearMessageBuffersOfAllDevices);
|
||||
return {};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,11 +168,22 @@ void SwitcherData::SaveVersion(obs_data_t *obj,
|
|||
obs_data_set_string(obj, "version", currentVersion.c_str());
|
||||
}
|
||||
|
||||
void SwitcherData::AddResetForNextIntervalFunction(
|
||||
std::function<void()> function)
|
||||
void SwitcherData::AddIntervalResetStep(std::function<void()> function)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
resetForNextIntervalFuncs.emplace_back(function);
|
||||
resetIntervalSteps.emplace_back(function);
|
||||
}
|
||||
|
||||
void SwitcherData::AddSaveStep(std::function<void(obs_data_t *)> function)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
saveSteps.emplace_back(function);
|
||||
}
|
||||
|
||||
void SwitcherData::AddLoadStep(std::function<void(obs_data_t *)> function)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
loadSteps.emplace_back(function);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ public:
|
|||
|
||||
void SetPreconditions();
|
||||
void ResetForNextInterval();
|
||||
void AddResetForNextIntervalFunction(std::function<void()>);
|
||||
void AddSaveStep(std::function<void(obs_data_t *)>);
|
||||
void AddLoadStep(std::function<void(obs_data_t *)>);
|
||||
void AddIntervalResetStep(std::function<void()>);
|
||||
bool CheckForMatch(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||
int &linger, bool &setPreviousSceneAsMatch,
|
||||
bool ¯oMatch);
|
||||
|
|
@ -112,7 +114,9 @@ public:
|
|||
std::atomic_bool abortMacroWait = {false};
|
||||
std::condition_variable macroTransitionCv;
|
||||
|
||||
std::vector<std::function<void()>> resetForNextIntervalFuncs;
|
||||
std::vector<std::function<void(obs_data_t *)>> saveSteps;
|
||||
std::vector<std::function<void(obs_data_t *)>> loadSteps;
|
||||
std::vector<std::function<void()>> resetIntervalSteps;
|
||||
|
||||
bool firstBoot = true;
|
||||
bool transitionActive = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user