From c7305889c367b4021f25447a645140d2dc4e5679 Mon Sep 17 00:00:00 2001 From: Palakis Date: Thu, 20 Apr 2017 19:41:58 +0200 Subject: [PATCH] Events: add scene description to SwitchScenes and PreviewSceneChanged --- PROTOCOL.md | 3 +++ WSEvents.cpp | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/PROTOCOL.md b/PROTOCOL.md index 79f5d6d4..ad6cd806 100644 --- a/PROTOCOL.md +++ b/PROTOCOL.md @@ -94,6 +94,7 @@ Additional fields will be present in the event message depending on the event ty #### "SwitchScenes" OBS is switching to another scene (called at the end of the transition). - **scene-name** (string) : The name of the scene being switched to. +- **sources** (array of objects) : List of sources composing the scene. Same specification as [`GetCurrentScene`](#getcurrentscene). --- @@ -164,6 +165,8 @@ A transition other than "Cut" has begun. #### "PreviewSceneChanged" The selected Preview scene changed (only in Studio Mode). +- **scene-name** (string) : Name of the scene being previewed. +- **sources** (array of objects) : List of sources composing the scene. Same specification as [`GetCurrentScene`](#getcurrentscene). --- diff --git a/WSEvents.cpp b/WSEvents.cpp index 343e0f02..90fc617a 100644 --- a/WSEvents.cpp +++ b/WSEvents.cpp @@ -283,14 +283,17 @@ void WSEvents::OnSceneChange() obs_data_t *data = obs_data_create(); obs_source_t* current_scene = obs_frontend_get_current_scene(); + obs_data_array_t* scene_items = Utils::GetSceneItems(current_scene); connectSceneSignals(current_scene); obs_data_set_string(data, "scene-name", obs_source_get_name(current_scene)); - + obs_data_set_array(data, "sources", scene_items); + broadcastUpdate("SwitchScenes", data); - obs_data_release(data); + obs_data_array_release(scene_items); obs_source_release(current_scene); + obs_data_release(data); } void WSEvents::OnSceneListChange() @@ -585,12 +588,15 @@ void WSEvents::SelectedSceneChanged(QListWidgetItem *current, QListWidgetItem *p if (!scene) return; obs_source_t* scene_source = obs_scene_get_source(scene); + obs_data_array_t* scene_items = Utils::GetSceneItems(scene_source); obs_data_t* data = obs_data_create(); obs_data_set_string(data, "scene-name", obs_source_get_name(scene_source)); + obs_data_set_array(data, "sources", scene_items); broadcastUpdate("PreviewSceneChanged", data); + obs_data_array_release(scene_items); obs_data_release(data); } }