mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-26 19:26:04 -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:
@@ -479,6 +479,9 @@ void SwitcherData::Thread()
|
|||||||
bool match = false;
|
bool match = false;
|
||||||
OBSWeakSource scene;
|
OBSWeakSource scene;
|
||||||
OBSWeakSource transition;
|
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();
|
endTime = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
@@ -512,7 +515,8 @@ void SwitcherData::Thread()
|
|||||||
if (checkPause()) {
|
if (checkPause()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
match = checkForMatch(scene, transition, linger);
|
match = checkForMatch(scene, transition, linger,
|
||||||
|
setPrevSceneAfterLinger);
|
||||||
if (switcher->stop) {
|
if (switcher->stop) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -536,6 +540,8 @@ void SwitcherData::Thread()
|
|||||||
|
|
||||||
match = false;
|
match = false;
|
||||||
linger = 0;
|
linger = 0;
|
||||||
|
} else if (setPrevSceneAfterLinger) {
|
||||||
|
scene = previousScene;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -563,12 +569,14 @@ void SwitcherData::Thread()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SwitcherData::checkForMatch(OBSWeakSource &scene,
|
bool SwitcherData::checkForMatch(OBSWeakSource &scene,
|
||||||
OBSWeakSource &transition, int &linger)
|
OBSWeakSource &transition, int &linger,
|
||||||
|
bool &setPrevSceneAfterLinger)
|
||||||
{
|
{
|
||||||
bool match = false;
|
bool match = false;
|
||||||
|
|
||||||
if (uninterruptibleSceneSequenceActive) {
|
if (uninterruptibleSceneSequenceActive) {
|
||||||
match = checkSceneSequence(scene, transition, linger);
|
match = checkSceneSequence(scene, transition, linger,
|
||||||
|
setPrevSceneAfterLinger);
|
||||||
if (match) {
|
if (match) {
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
@@ -593,7 +601,8 @@ bool SwitcherData::checkForMatch(OBSWeakSource &scene,
|
|||||||
match = checkWindowTitleSwitch(scene, transition);
|
match = checkWindowTitleSwitch(scene, transition);
|
||||||
break;
|
break;
|
||||||
case round_trip_func:
|
case round_trip_func:
|
||||||
match = checkSceneSequence(scene, transition, linger);
|
match = checkSceneSequence(scene, transition, linger,
|
||||||
|
setPrevSceneAfterLinger);
|
||||||
break;
|
break;
|
||||||
case media_func:
|
case media_func:
|
||||||
match = checkMediaSwitch(scene, transition);
|
match = checkMediaSwitch(scene, transition);
|
||||||
|
|||||||
@@ -188,9 +188,9 @@ struct SwitcherData {
|
|||||||
void writeToStatusFile(QString status);
|
void writeToStatusFile(QString status);
|
||||||
|
|
||||||
bool checkForMatch(OBSWeakSource &scene, OBSWeakSource &transition,
|
bool checkForMatch(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||||
int &linger);
|
int &linger, bool &setPreviousSceneAsMatch);
|
||||||
bool checkSceneSequence(OBSWeakSource &scene, OBSWeakSource &transition,
|
bool checkSceneSequence(OBSWeakSource &scene, OBSWeakSource &transition,
|
||||||
int &linger);
|
int &linger, bool &setPrevSceneAfterLinger);
|
||||||
bool checkIdleSwitch(OBSWeakSource &scene, OBSWeakSource &transition);
|
bool checkIdleSwitch(OBSWeakSource &scene, OBSWeakSource &transition);
|
||||||
bool checkWindowTitleSwitch(OBSWeakSource &scene,
|
bool checkWindowTitleSwitch(OBSWeakSource &scene,
|
||||||
OBSWeakSource &transition);
|
OBSWeakSource &transition);
|
||||||
|
|||||||
@@ -180,7 +180,8 @@ void AdvSceneSwitcher::on_sceneSequenceSwitches_itemDoubleClicked(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SwitcherData::checkSceneSequence(OBSWeakSource &scene,
|
bool SwitcherData::checkSceneSequence(OBSWeakSource &scene,
|
||||||
OBSWeakSource &transition, int &linger)
|
OBSWeakSource &transition, int &linger,
|
||||||
|
bool &setPrevSceneAfterLinger)
|
||||||
{
|
{
|
||||||
if (SceneSequenceSwitch::pause) {
|
if (SceneSequenceSwitch::pause) {
|
||||||
return false;
|
return false;
|
||||||
@@ -206,9 +207,12 @@ bool SwitcherData::checkSceneSequence(OBSWeakSource &scene,
|
|||||||
if (s.activeSequence) {
|
if (s.activeSequence) {
|
||||||
scene = s.activeSequence->getScene();
|
scene = s.activeSequence->getScene();
|
||||||
transition = s.activeSequence->transition;
|
transition = s.activeSequence->transition;
|
||||||
|
setPrevSceneAfterLinger =
|
||||||
|
s.activeSequence->usePreviousScene;
|
||||||
} else {
|
} else {
|
||||||
scene = s.getScene();
|
scene = s.getScene();
|
||||||
transition = s.transition;
|
transition = s.transition;
|
||||||
|
setPrevSceneAfterLinger = s.usePreviousScene;
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
s.logMatch();
|
s.logMatch();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user