From 15610bb2969159c92dcd4c5090b54293ff2e32f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Thu, 16 May 2019 13:37:04 +0200 Subject: [PATCH] Utils(GetSceneItemData): add children list --- src/Utils.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Utils.cpp b/src/Utils.cpp index 38b457c2..8cb8ed8d 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -35,13 +35,14 @@ with this program. If not, see * @property {int} `id` Scene item ID * @property {Boolean} `render` Whether or not this Scene Item is set to "visible". * @property {Boolean} `locked` Whether or not this Scene Item is locked and can't be moved around -* @property {Boolean} `isGroup` Whether or not this Scene Item is a group * @property {Number} `source_cx` * @property {Number} `source_cy` * @property {String} `type` Source type. Value is one of the following: "input", "filter", "transition", "scene" or "unknown" * @property {Number} `volume` * @property {Number} `x` * @property {Number} `y` +* @property {Boolean} `isGroup` Whether or not this Scene Item is a group +* @property {Array (optional)} `children` List of children (if item is a group) */ Q_DECLARE_METATYPE(OBSScene); @@ -149,6 +150,19 @@ obs_data_t* Utils::GetSceneItemData(obs_sceneitem_t* item) { obs_data_set_bool(data, "locked", obs_sceneitem_locked(item)); obs_data_set_bool(data, "isGroup", obs_sceneitem_is_group(item)); + if (obs_sceneitem_is_group(item)) { + OBSDataArrayAutoRelease children = obs_data_array_create(); + obs_sceneitem_group_enum_items(item, [](obs_scene_t*, obs_sceneitem_t* currentItem, void* param) { + obs_data_array_t* items = reinterpret_cast(param); + + OBSDataAutoRelease itemData = GetSceneItemData(currentItem); + obs_data_array_push_back(items, itemData); + + return true; + }, children); + obs_data_set_array(data, "children", children); + } + return data; }