Allow switching to already active scene if in studio mode

Preview and program scene can differ in regards to the active scene
items.
Thus it can make sense to switch to the already active scene.
This commit is contained in:
WarmUpTill 2022-02-21 20:08:06 +01:00 committed by WarmUpTill
parent 02e380a9f2
commit c94a791d19
3 changed files with 5 additions and 4 deletions

View File

@ -343,7 +343,7 @@ bool SwitcherData::checkForMatch(OBSWeakSource &scene,
return match;
}
void switchScene(const sceneSwitchInfo &sceneSwitch)
void switchScene(const sceneSwitchInfo &sceneSwitch, bool force)
{
if (!sceneSwitch.scene && switcher->verbose) {
blog(LOG_INFO, "nothing to switch to");
@ -353,7 +353,7 @@ void switchScene(const sceneSwitchInfo &sceneSwitch)
obs_source_t *source = obs_weak_source_get_source(sceneSwitch.scene);
obs_source_t *currentSource = obs_frontend_get_current_scene();
if (source && source != currentSource) {
if (source && (source != currentSource || force)) {
transitionData currentTransitionData;
setNextTransition(sceneSwitch, currentSource,
currentTransitionData);

View File

@ -302,7 +302,7 @@ void setNextTransition(const sceneSwitchInfo &ssi, obs_source_t *currentSource,
void overwriteTransitionOverride(const sceneSwitchInfo &ssi,
transitionData &td);
void restoreTransitionOverride(obs_source_t *scene, const transitionData &td);
void switchScene(const sceneSwitchInfo &ssi);
void switchScene(const sceneSwitchInfo &ssi, bool force = false);
void switchPreviewScene(const OBSWeakSource &ws);
/******************************************************************************

View File

@ -39,7 +39,8 @@ bool MacroActionSwitchScene::PerformAction()
{
auto scene = _scene.GetScene();
switchScene({scene, _transition.GetTransition(),
(int)(_duration.seconds * 1000)});
(int)(_duration.seconds * 1000)},
obs_frontend_preview_program_mode_active());
if (_blockUntilTransitionDone && scene) {
waitForTransitionChange(scene);
return !switcher->abortMacroWait;