mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-06 04:44:32 -05:00
Add PostLoad()
Used to reslove values that only can be resolved after all macros / macro segments have been set up initally.
This commit is contained in:
parent
1c3ff927a5
commit
334d173dc9
|
|
@ -25,6 +25,11 @@ bool MacroSegment::Load(obs_data_t *obj)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool MacroSegment::PostLoad()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string MacroSegment::GetShortDesc() const
|
||||
{
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public:
|
|||
bool GetCollapsed() const { return _collapsed; }
|
||||
virtual bool Save(obs_data_t *obj) const = 0;
|
||||
virtual bool Load(obs_data_t *obj) = 0;
|
||||
virtual bool PostLoad();
|
||||
virtual std::string GetShortDesc() const;
|
||||
virtual std::string GetId() const = 0;
|
||||
void SetHighlight();
|
||||
|
|
|
|||
|
|
@ -489,6 +489,18 @@ bool Macro::Load(obs_data_t *obj)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Macro::PostLoad()
|
||||
{
|
||||
ResolveMacroRef();
|
||||
for (auto &c : _conditions) {
|
||||
c->PostLoad();
|
||||
}
|
||||
for (auto &a : _actions) {
|
||||
a->PostLoad();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void Macro::ResolveMacroRef()
|
||||
{
|
||||
for (auto &c : _conditions) {
|
||||
|
|
@ -699,7 +711,6 @@ void SwitcherData::loadMacros(obs_data_t *obj)
|
|||
int groupCount = 0;
|
||||
Macro *group = nullptr;
|
||||
for (auto &m : macros) {
|
||||
m->ResolveMacroRef();
|
||||
if (groupCount) {
|
||||
m->SetParent(group);
|
||||
groupCount--;
|
||||
|
|
@ -708,6 +719,7 @@ void SwitcherData::loadMacros(obs_data_t *obj)
|
|||
groupCount = m->GroupSize();
|
||||
group = m.get();
|
||||
}
|
||||
m->PostLoad();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public:
|
|||
|
||||
bool Save(obs_data_t *obj) const;
|
||||
bool Load(obs_data_t *obj);
|
||||
bool PostLoad();
|
||||
// Some macros can refer to other macros, which are not yet loaded.
|
||||
// Use this function to set these references after loading is complete.
|
||||
void ResolveMacroRef();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user