diff --git a/src/headers/switcher-data-structs.hpp b/src/headers/switcher-data-structs.hpp index 0ff019d0..1e6020b1 100644 --- a/src/headers/switcher-data-structs.hpp +++ b/src/headers/switcher-data-structs.hpp @@ -68,6 +68,7 @@ struct SwitcherData { OBSWeakSource previousScene = nullptr; OBSWeakSource previousSceneHelper = nullptr; OBSWeakSource lastRandomScene; + SceneGroup *lastRandomSceneGroup; OBSWeakSource nonMatchingScene; NoMatch switchIfNotMatching = NO_SWITCH; double noMatchDelay; diff --git a/src/switch-random.cpp b/src/switch-random.cpp index 6743b48a..209837c7 100644 --- a/src/switch-random.cpp +++ b/src/switch-random.cpp @@ -52,8 +52,15 @@ void SwitcherData::checkRandom(bool &match, OBSWeakSource &scene, continue; } - if (r.scene == lastRandomScene && randomSwitches.size() != 1) { - continue; + if (randomSwitches.size() != 1) { + if (r.targetType == SwitchTargetType::Scene && + r.scene == lastRandomScene) { + continue; + } else if (r.targetType == + SwitchTargetType::SceneGroup && + r.group && r.group == lastRandomSceneGroup) { + continue; + } } scene = r.getScene(); @@ -61,6 +68,7 @@ void SwitcherData::checkRandom(bool &match, OBSWeakSource &scene, delay = (int)r.delay * 1000; match = true; lastRandomScene = r.scene; + lastRandomSceneGroup = r.group; if (verbose) { r.logMatch();