Browse Source

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).
gxalpha 3 years ago
parent
commit
8328609b20
1 changed files with 5 additions and 4 deletions
  1. 5 4
      UI/window-basic-main-transitions.cpp

+ 5 - 4
UI/window-basic-main-transitions.cpp

@@ -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;
 		}
 	}