Use static self-registration for action queue and variable setup
Some checks failed
debian-build / build (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled

Removes explicit setup calls from the plugin core. Each module now
registers its own save/load/cleanup steps via a static initializer,
decoupling them from InitSceneSwitcher and SwitcherData.
This commit is contained in:
WarmUpTill
2026-04-30 15:59:01 +02:00
committed by WarmUpTill
parent c02896ea17
commit 4f3d9e3a00
6 changed files with 20 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
#include "variable.hpp"
#include "math-helpers.hpp"
#include "obs-module-helper.hpp"
#include "plugin-state-helpers.hpp"
#include "ui-helpers.hpp"
#include "utility.hpp"
@@ -17,6 +18,15 @@ static std::deque<std::shared_ptr<Item>> variables;
static std::mutex lastVariableChangeMutex;
static std::chrono::high_resolution_clock::time_point lastVariableChange{};
static bool setup()
{
AddSaveStep(SaveVariables);
AddLoadStep(LoadVariables);
AddPluginCleanupStep([]() { variables.clear(); });
return true;
}
static bool setupDone = setup();
static void setLastVariableChangeTime()
{
std::lock_guard<std::mutex> lock(lastVariableChangeMutex);