UI: Fix OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED

OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED is supposed to be called
whenever the user changes the current preview scene -- it was almost
never being triggered.
This commit is contained in:
jp9000 2018-03-04 12:07:13 -08:00 committed by Stéphane L
parent 57121478ac
commit f81d106b2a
2 changed files with 13 additions and 4 deletions

View file

@ -639,12 +639,11 @@ void OBSBasic::SetCurrentScene(OBSSource scene, bool force, bool direct)
ui->scenes->blockSignals(true);
ui->scenes->setCurrentItem(item);
ui->scenes->blockSignals(false);
if (api)
api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
break;
}
}
if (api && IsPreviewProgramMode())
api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
}
UpdateSceneSelection(scene);

View file

@ -900,8 +900,10 @@ retryScene:
disableSaving--;
if (api)
if (api) {
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
}
}
#define SERVICE_PATH "service.json"
@ -2271,6 +2273,11 @@ void OBSBasic::UpdateSceneSelection(OBSSource source)
sceneChanging = false;
UpdateSources(scene);
OBSScene curScene =
GetOBSRef<OBSScene>(ui->scenes->currentItem());
if (api && scene != curScene)
api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
}
}
}
@ -3508,6 +3515,9 @@ void OBSBasic::on_scenes_currentItemChanged(QListWidgetItem *current,
SetCurrentScene(source);
if (api)
api->on_event(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
UNUSED_PARAMETER(prev);
}