From f81d106b2a4f196ae805eeefa29248248b153483 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sun, 4 Mar 2018 12:07:13 -0800 Subject: [PATCH] UI: Fix OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED is supposed to be called whenever the user changes the current preview scene -- it was almost never being triggered. --- UI/window-basic-main-transitions.cpp | 5 ++--- UI/window-basic-main.cpp | 12 +++++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/UI/window-basic-main-transitions.cpp b/UI/window-basic-main-transitions.cpp index 726eea134..a1cd8267f 100644 --- a/UI/window-basic-main-transitions.cpp +++ b/UI/window-basic-main-transitions.cpp @@ -639,12 +639,11 @@ void OBSBasic::SetCurrentScene(OBSSource scene, bool force, bool direct) ui->scenes->blockSignals(true); ui->scenes->setCurrentItem(item); ui->scenes->blockSignals(false); + if (api) + api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); break; } } - - if (api && IsPreviewProgramMode()) - api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); } UpdateSceneSelection(scene); diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index b7860de19..a72864476 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -900,8 +900,10 @@ retryScene: disableSaving--; - if (api) + if (api) { api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED); + api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); + } } #define SERVICE_PATH "service.json" @@ -2271,6 +2273,11 @@ void OBSBasic::UpdateSceneSelection(OBSSource source) sceneChanging = false; UpdateSources(scene); + + OBSScene curScene = + GetOBSRef(ui->scenes->currentItem()); + if (api && scene != curScene) + api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); } } } @@ -3508,6 +3515,9 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current, SetCurrentScene(source); + if (api) + api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED); + UNUSED_PARAMETER(prev); }