Events: add scene description to SwitchScenes and PreviewSceneChanged

This commit is contained in:
Palakis 2017-04-20 19:41:58 +02:00
parent ed4526751e
commit c7305889c3
2 changed files with 11 additions and 2 deletions

View File

@ -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).
---

View File

@ -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);
}
}