mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-22 01:44:49 -05:00
Fix previous scene not working for some sequences
If a duration for a transition is used that is longer than the scene switcher check interval it could happen that the "incorrect" previous scene could be chosen for uninterruptible scene sequences, as at the time the sequence check was preformed the "previous scene" variable was not yet updated as the transition was still ongoing.
This commit is contained in:
parent
1310d0b3f3
commit
d9dfc1913d
|
|
@ -479,6 +479,9 @@ void SwitcherData::Thread()
|
|||
bool match = false;
|
||||
OBSWeakSource scene;
|
||||
OBSWeakSource transition;
|
||||
// The previous scene might have changed during the linger duration,
|
||||
// if a longer transition is used than the configured check interval
|
||||
bool setPrevSceneAfterLinger = false;
|
||||
|
||||
endTime = std::chrono::high_resolution_clock::now();
|
||||
|
||||
|
|
@ -512,7 +515,8 @@ void SwitcherData::Thread()
|
|||
if (checkPause()) {
|
||||
continue;
|
||||
}
|
||||
match = checkForMatch(scene, transition, linger);
|
||||
match = checkForMatch(scene, transition, linger,
|
||||
setPrevSceneAfterLinger);
|
||||
if (switcher->stop) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -536,6 +540,8 @@ void SwitcherData::Thread()
|
|||
|
||||
match = false;
|
||||
linger = 0;
|
||||
} else if (setPrevSceneAfterLinger) {
|
||||
scene = previousScene;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -563,12 +569,14 @@ void SwitcherData::Thread()
|
|||
}
|
||||
|
||||
bool SwitcherData::checkForMatch(OBSWeakSource &scene,
|
||||
OBSWeakSource &transition, int &linger)
|
||||
OBSWeakSource &transition, int &linger,
|
||||
bool &setPrevSceneAfterLinger)
|
||||
{
|
||||
bool match = false;
|
||||
|
||||
if (uninterruptibleSceneSequenceActive) {
|
||||
match = checkSceneSequence(scene, transition, linger);
|
||||
match = checkSceneSequence(scene, transition, linger,
|
||||
setPrevSceneAfterLinger);
|
||||
if (match) {
|
||||
return match;
|
||||
}
|
||||
|
|
@ -593,7 +601,8 @@ bool SwitcherData::checkForMatch(OBSWeakSource &scene,
|
|||
match = checkWindowTitleSwitch(scene, transition);
|
||||
break;
|
||||
case round_trip_func:
|
||||
match = checkSceneSequence(scene, transition, linger);
|
||||
match = checkSceneSequence(scene, transition, linger,
|
||||
setPrevSceneAfterLinger);
|
||||
break;
|
||||
case media_func:
|
||||
match = checkMediaSwitch(scene, transition);
|
||||
|
|
|
|||
|
|
@ -188,9 +188,9 @@ struct SwitcherData {
|
|||
void writeToStatusFile(QString status);
|
||||
|
||||
bool checkForMatch(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||
int &linger);
|
||||
int &linger, bool &setPreviousSceneAsMatch);
|
||||
bool checkSceneSequence(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||
int &linger);
|
||||
int &linger, bool &setPrevSceneAfterLinger);
|
||||
bool checkIdleSwitch(OBSWeakSource &scene, OBSWeakSource &transition);
|
||||
bool checkWindowTitleSwitch(OBSWeakSource &scene,
|
||||
OBSWeakSource &transition);
|
||||
|
|
|
|||
|
|
@ -180,7 +180,8 @@ void AdvSceneSwitcher::on_sceneSequenceSwitches_itemDoubleClicked(
|
|||
}
|
||||
|
||||
bool SwitcherData::checkSceneSequence(OBSWeakSource &scene,
|
||||
OBSWeakSource &transition, int &linger)
|
||||
OBSWeakSource &transition, int &linger,
|
||||
bool &setPrevSceneAfterLinger)
|
||||
{
|
||||
if (SceneSequenceSwitch::pause) {
|
||||
return false;
|
||||
|
|
@ -206,9 +207,12 @@ bool SwitcherData::checkSceneSequence(OBSWeakSource &scene,
|
|||
if (s.activeSequence) {
|
||||
scene = s.activeSequence->getScene();
|
||||
transition = s.activeSequence->transition;
|
||||
setPrevSceneAfterLinger =
|
||||
s.activeSequence->usePreviousScene;
|
||||
} else {
|
||||
scene = s.getScene();
|
||||
transition = s.transition;
|
||||
setPrevSceneAfterLinger = s.usePreviousScene;
|
||||
if (verbose) {
|
||||
s.logMatch();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user