UI: Don't transition in studio mode if scenes are the same

Fixes an issue where when "Duplicate Scenes" and "Switch Preview/Program
after Transitioning" were disabled and preview and program were the same
scene, pressing "Transition" would just disable the menus without
anything happening. This is because a transition is initiated, but never
actually starts transitioning (since both scenes are the same). The
check for this already exists, but was only triggered in swapScenesMode.

Also renames the newScene variable to lastScene to make it more obvious
what it actually is (especially since now, it's not only the new scene
anymore).
This commit is contained in:
gxalpha 2022-05-18 12:48:27 +02:00 committed by Jim
parent a8c481a80e
commit 8328609b20

View file

@ -359,13 +359,14 @@ void OBSBasic::TransitionToScene(OBSSource source, bool force,
lastProgramScene = programScene;
programScene = OBSGetWeakRef(source);
if (swapScenesMode && !force && !black) {
OBSSource newScene = OBSGetStrongRef(lastProgramScene);
if (!force && !black) {
OBSSource lastScene = OBSGetStrongRef(lastProgramScene);
if (!sceneDuplicationMode && newScene == source)
if (!sceneDuplicationMode && lastScene == source)
return;
if (newScene && newScene != GetCurrentSceneSource())
if (swapScenesMode && lastScene &&
lastScene != GetCurrentSceneSource())
swapScene = lastProgramScene;
}
}