mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-22 01:05:53 -05:00
fix previous scene handling
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
bool SceneSwitcherEntry::initialized()
|
||||
{
|
||||
return scene && transition;
|
||||
return (usePreviousScene || WeakSourceValid(scene)) && transition;
|
||||
}
|
||||
|
||||
bool SceneSwitcherEntry::valid()
|
||||
@@ -17,9 +17,11 @@ bool SceneSwitcherEntry::valid()
|
||||
|
||||
void SceneSwitcherEntry::logMatch()
|
||||
{
|
||||
obs_source_t *s = obs_weak_source_get_source(scene);
|
||||
const char *sceneName = obs_source_get_name(s);
|
||||
obs_source_release(s);
|
||||
const char *sceneName = previous_scene_name;
|
||||
if (!usePreviousScene) {
|
||||
OBSSource s = obs_weak_source_get_source(scene);
|
||||
const char *sceneName = obs_source_get_name(s);
|
||||
}
|
||||
blog(LOG_INFO, "match for '%s' - switch to scene '%s'", getType(),
|
||||
sceneName);
|
||||
}
|
||||
@@ -39,7 +41,11 @@ SwitchWidget::SwitchWidget(SceneSwitcherEntry *s, bool usePreviousScene)
|
||||
AdvSceneSwitcher::populateTransitionSelection(transitions);
|
||||
|
||||
if (s) {
|
||||
scenes->setCurrentText(GetWeakSourceName(s->scene).c_str());
|
||||
if (s->usePreviousScene)
|
||||
scenes->setCurrentText(previous_scene_name);
|
||||
else
|
||||
scenes->setCurrentText(
|
||||
GetWeakSourceName(s->scene).c_str());
|
||||
transitions->setCurrentText(
|
||||
GetWeakSourceName(s->transition).c_str());
|
||||
}
|
||||
@@ -69,6 +75,7 @@ void SwitchWidget::SceneChanged(const QString &text)
|
||||
if (loading || !switchData)
|
||||
return;
|
||||
std::lock_guard<std::mutex> lock(switcher->m);
|
||||
switchData->usePreviousScene = text.compare(previous_scene_name) == 0;
|
||||
switchData->scene = GetWeakSourceByQString(text);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user