From 32932eacf52ad057ae453c2a84b5e352c36e40e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Sun, 4 Dec 2016 20:38:49 +0100 Subject: [PATCH] Fixes #18 --- WSEvents.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/WSEvents.cpp b/WSEvents.cpp index 94f233f86..1365a0702 100644 --- a/WSEvents.cpp +++ b/WSEvents.cpp @@ -92,15 +92,28 @@ void WSEvents::broadcastUpdate(const char *updateType, obs_data_t *additionalFie void WSEvents::OnSceneChange() { // Implements an existing update type from bilhamil's OBS Remote + + // Default behavior : get the new scene from the running transition obs_source_t *transition = obs_frontend_get_current_transition(); obs_source_t *new_scene = obs_transition_get_source(transition, OBS_TRANSITION_SOURCE_B); if (!new_scene) { obs_source_release(transition); return; } + + const char *scene_name = obs_source_get_name(new_scene); + if (!scene_name) { + // Fallback behaviour : get the new scene straight from the API + obs_source_release(new_scene); + new_scene = obs_frontend_get_current_scene(); + + if (new_scene) { + scene_name = obs_source_get_name(new_scene); + } + } obs_data_t *data = obs_data_create(); - obs_data_set_string(data, "scene-name", obs_source_get_name(new_scene)); + obs_data_set_string(data, "scene-name", scene_name); broadcastUpdate("SwitchScenes", data);