mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-30 21:25:32 -05:00
Add helper functions to save / load list of macro refs
This commit is contained in:
@@ -74,15 +74,7 @@ void MacroActionSequence::LogAction()
|
||||
bool MacroActionSequence::Save(obs_data_t *obj)
|
||||
{
|
||||
MacroAction::Save(obj);
|
||||
obs_data_array_t *args = obs_data_array_create();
|
||||
for (auto &m : _macros) {
|
||||
obs_data_t *array_obj = obs_data_create();
|
||||
m.Save(array_obj);
|
||||
obs_data_array_push_back(args, array_obj);
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_set_array(obj, "macros", args);
|
||||
obs_data_array_release(args);
|
||||
SaveMacroList(obj, _macros);
|
||||
obs_data_set_bool(obj, "restart", _restart);
|
||||
return true;
|
||||
}
|
||||
@@ -90,16 +82,7 @@ bool MacroActionSequence::Save(obs_data_t *obj)
|
||||
bool MacroActionSequence::Load(obs_data_t *obj)
|
||||
{
|
||||
MacroAction::Load(obj);
|
||||
obs_data_array_t *args = obs_data_get_array(obj, "macros");
|
||||
size_t count = obs_data_array_count(args);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
obs_data_t *array_obj = obs_data_array_item(args, i);
|
||||
MacroRef ref;
|
||||
ref.Load(array_obj);
|
||||
_macros.push_back(ref);
|
||||
obs_data_release(array_obj);
|
||||
}
|
||||
obs_data_array_release(args);
|
||||
LoadMacroList(obj, _macros);
|
||||
_restart = obs_data_get_bool(obj, "restart");
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user