From 6b1a01de5e7a42c044b45e332b2d7c5fa8a43dfb Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sun, 18 Oct 2020 19:21:52 +0200 Subject: [PATCH] move transition warning label and change default transition only once per scene change --- forms/advanced-scene-switcher.ui | 22 +++++++++++----------- src/advanced-scene-switcher.cpp | 3 ++- src/headers/switcher-data-structs.hpp | 1 + src/switch-transitions.cpp | 8 +++++++- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/forms/advanced-scene-switcher.ui b/forms/advanced-scene-switcher.ui index 83b552e3..13790d0a 100644 --- a/forms/advanced-scene-switcher.ui +++ b/forms/advanced-scene-switcher.ui @@ -614,22 +614,22 @@ - - - - <html><head/><body><p>The settings below only affect scene transitions caused by the scene switcher and not the ones you are causing manually. Additionally they will take priority over transition settings configured elsewhere in the scene switcher.</p></body></html> - - - true - - - - Use transition for automated scene switch from scene1 to scene2 + Use transition for automated scene switch from scene A to scene B + + + + <html><head/><body><p><span style=" font-style:italic;">Only</span> transitions caused by the scene switcher and not the ones you are causing manually are affected by these settings. <br/>Settings defined here take priority over transition settings configured elsewhere in the scene switcher.</p></body></html> + + + true + + + diff --git a/src/advanced-scene-switcher.cpp b/src/advanced-scene-switcher.cpp index 347d603d..0d386430 100644 --- a/src/advanced-scene-switcher.cpp +++ b/src/advanced-scene-switcher.cpp @@ -534,8 +534,9 @@ void handleSceneChange(SwitcherData *s) s->PreviousScene2 = ws; } - //reset autostart + //reset events only hanled on scene change s->autoStartedRecently = false; + s->changedDefTransitionRecently = false; } void setLiveTime(SwitcherData *s) diff --git a/src/headers/switcher-data-structs.hpp b/src/headers/switcher-data-structs.hpp index 73d154bf..a9db27af 100644 --- a/src/headers/switcher-data-structs.hpp +++ b/src/headers/switcher-data-structs.hpp @@ -93,6 +93,7 @@ struct SwitcherData { std::deque sceneTransitions; std::deque defaultSceneTransitions; + bool changedDefTransitionRecently = false; std::deque mediaSwitches; diff --git a/src/switch-transitions.cpp b/src/switch-transitions.cpp index 37411f10..608c97b1 100644 --- a/src/switch-transitions.cpp +++ b/src/switch-transitions.cpp @@ -144,6 +144,9 @@ void AdvSceneSwitcher::on_defaultTransitionsDown_clicked() void SwitcherData::setDefaultSceneTransitions() { + if (changedDefTransitionRecently) + return; + obs_source_t *currentSource = obs_frontend_get_current_scene(); obs_weak_source_t *ws = obs_source_get_weak_source(currentSource); @@ -167,6 +170,7 @@ void SwitcherData::setDefaultSceneTransitions() } obs_source_release(currentSource); obs_weak_source_release(ws); + changedDefTransitionRecently = true; } void AdvSceneSwitcher::on_transitionOverridecheckBox_stateChanged(int state) @@ -191,8 +195,10 @@ obs_weak_source_t *getNextTransition(obs_weak_source_t *scene1, if (!t.initialized()) continue; - if (t.scene == scene1 && t.scene2 == scene2) + if (t.scene == scene1 && t.scene2 == scene2) { ws = t.transition; + break; + } } obs_weak_source_addref(ws); }