From 54e7b2c769be6b8dc1afcc0eb25cedaf8f8ada3d Mon Sep 17 00:00:00 2001 From: Clayton Groeneveld Date: Wed, 9 Oct 2019 04:01:55 -0500 Subject: [PATCH] UI: Fix swap scene issue with double click mode --- UI/window-basic-main-transitions.cpp | 24 ++++++++++-------------- UI/window-basic-main.cpp | 8 ++------ UI/window-basic-main.hpp | 10 +++------- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/UI/window-basic-main-transitions.cpp b/UI/window-basic-main-transitions.cpp index f047e07fe..42f275fd6 100644 --- a/UI/window-basic-main-transitions.cpp +++ b/UI/window-basic-main-transitions.cpp @@ -131,7 +131,7 @@ void OBSBasic::TriggerQuickTransition(int id) overridingTransition = true; } - TransitionToScene(source, false, false, true, qt->duration, + TransitionToScene(source, false, true, qt->duration, qt->fadeToBlack); } } @@ -255,10 +255,10 @@ obs_source_t *OBSBasic::FindTransition(const char *name) return nullptr; } -void OBSBasic::TransitionToScene(OBSScene scene, bool force, bool direct) +void OBSBasic::TransitionToScene(OBSScene scene, bool force) { obs_source_t *source = obs_scene_get_source(scene); - TransitionToScene(source, force, direct); + TransitionToScene(source, force); } void OBSBasic::TransitionStopped() @@ -304,7 +304,7 @@ void OBSBasic::TransitionFullyStopped() } } -void OBSBasic::TransitionToScene(OBSSource source, bool force, bool direct, +void OBSBasic::TransitionToScene(OBSSource source, bool force, bool quickTransition, int quickDuration, bool black) { @@ -319,7 +319,7 @@ void OBSBasic::TransitionToScene(OBSSource source, bool force, bool direct, lastProgramScene = programScene; programScene = OBSGetWeakRef(source); - if (swapScenesMode && !force && !direct && !black) { + if (swapScenesMode && !force && !black) { OBSSource newScene = OBSGetStrongRef(lastProgramScene); if (!sceneDuplicationMode && newScene == source) @@ -676,10 +676,10 @@ int OBSBasic::GetQuickTransitionIdx(int id) return -1; } -void OBSBasic::SetCurrentScene(obs_scene_t *scene, bool force, bool direct) +void OBSBasic::SetCurrentScene(obs_scene_t *scene, bool force) { obs_source_t *source = obs_scene_get_source(scene); - SetCurrentScene(source, force, direct); + SetCurrentScene(source, force); } template static T GetOBSRef(QListWidgetItem *item) @@ -687,14 +687,10 @@ template static T GetOBSRef(QListWidgetItem *item) return item->data(static_cast(QtDataRole::OBSRef)).value(); } -void OBSBasic::SetCurrentScene(OBSSource scene, bool force, bool direct) +void OBSBasic::SetCurrentScene(OBSSource scene, bool force) { - if (!IsPreviewProgramMode() && !direct) { - TransitionToScene(scene, force, false); - - } else if (IsPreviewProgramMode() && direct) { - TransitionToScene(scene, force, true); - + if (!IsPreviewProgramMode()) { + TransitionToScene(scene, force); } else { OBSSource actualLastScene = OBSGetStrongRef(lastScene); if (actualLastScene != scene) { diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index 6419fd6c2..139d11fad 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -4561,12 +4561,8 @@ void OBSBasic::on_scenes_itemDoubleClicked(QListWidgetItem *witem) config_get_bool(App()->GlobalConfig(), "BasicWindow", "TransitionOnDoubleClick"); - if (doubleClickSwitch) { - OBSScene scene = GetCurrentScene(); - - if (scene) - SetCurrentScene(scene, false, true); - } + if (doubleClickSwitch) + TransitionClicked(); } } diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index f7a37dbe4..f826d4231 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -372,8 +372,7 @@ private: void SetPreviewProgramMode(bool enabled); void ResizeProgram(uint32_t cx, uint32_t cy); - void SetCurrentScene(obs_scene_t *scene, bool force = false, - bool direct = false); + void SetCurrentScene(obs_scene_t *scene, bool force = false); static void RenderProgram(void *data, uint32_t cx, uint32_t cy); std::vector quickTransitions; @@ -477,14 +476,11 @@ public slots: void SetTransition(OBSSource transition); void OverrideTransition(OBSSource transition); - void TransitionToScene(OBSScene scene, bool force = false, - bool direct = false); + void TransitionToScene(OBSScene scene, bool force = false); void TransitionToScene(OBSSource scene, bool force = false, - bool direct = false, bool quickTransition = false, int quickDuration = 0, bool black = false); - void SetCurrentScene(OBSSource scene, bool force = false, - bool direct = false); + void SetCurrentScene(OBSSource scene, bool force = false); bool AddSceneCollection(bool create_new, const QString &name = QString());