From 0dc8e070ff07b691d8d0b0fa45d57901bae85bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Fri, 27 Nov 2020 16:57:47 +0100 Subject: [PATCH] events(SceneCollectionListChanged): add scene collections list property --- src/WSEvents.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/WSEvents.cpp b/src/WSEvents.cpp index d04b2880..705a3184 100644 --- a/src/WSEvents.cpp +++ b/src/WSEvents.cpp @@ -501,13 +501,23 @@ void WSEvents::OnSceneCollectionChange() { /** * Triggered when a scene collection is created, added, renamed, or removed. * + * @return {Array} `sceneCollections` Scene collections list. + * @return {String} `sceneCollections.*.name` Scene collection name. + * * @api events * @name SceneCollectionListChanged * @category scenes * @since 4.0.0 */ void WSEvents::OnSceneCollectionListChange() { - broadcastUpdate("SceneCollectionListChanged"); + char** sceneCollections = obs_frontend_get_scene_collections(); + OBSDataArrayAutoRelease sceneCollectionsList = + Utils::StringListToArray(sceneCollections, "name"); + bfree(sceneCollections); + + OBSDataAutoRelease fields = obs_data_create(); + obs_data_set_array(fields, "sceneCollections", sceneCollectionsList); + broadcastUpdate("SceneCollectionListChanged", fields); } /** @@ -568,7 +578,9 @@ void WSEvents::OnProfileChange() { * @since 4.0.0 */ void WSEvents::OnProfileListChange() { - broadcastUpdate("ProfileListChanged"); + OBSDataAutoRelease fields = obs_data_create(); + // TODO provide new profile list + broadcastUpdate("ProfileListChanged", fields); } /**