UI: Fix redo recreating sources in the wrong scene
Fixes an issue where if creating a new source was re-done from a different scene, the source would be created first in that scene and then OBS would switch to the scene where the source originally was created. Changes the order of these two operations, which makes OBS create the source in the correct scene.
This commit is contained in:
@@ -269,6 +269,11 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
obs_data_set_bool(wrapper, "visible", visible);
|
||||
|
||||
auto redo = [scene_name, main](const std::string &data) {
|
||||
obs_source_t *scene_source =
|
||||
obs_get_source_by_name(scene_name.c_str());
|
||||
main->SetCurrentScene(scene_source, true);
|
||||
obs_source_release(scene_source);
|
||||
|
||||
obs_data_t *dat =
|
||||
obs_data_create_from_json(data.c_str());
|
||||
OBSSource source;
|
||||
@@ -280,11 +285,6 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
|
||||
obs_sceneitem_set_id(item, (int64_t)obs_data_get_int(
|
||||
dat, "item_id"));
|
||||
|
||||
obs_source_t *scene_source =
|
||||
obs_get_source_by_name(scene_name.c_str());
|
||||
main->SetCurrentScene(scene_source, true);
|
||||
obs_source_release(scene_source);
|
||||
|
||||
main->RefreshSources(main->GetCurrentScene());
|
||||
obs_data_release(dat);
|
||||
obs_sceneitem_release(item);
|
||||
|
Reference in New Issue
Block a user