mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Events: add scene description to SwitchScenes and PreviewSceneChanged
This commit is contained in:
parent
ed4526751e
commit
c7305889c3
@ -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).
|
||||
|
||||
---
|
||||
|
||||
|
10
WSEvents.cpp
10
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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user