diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-01-15 21:38:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 21:38:52 +0100 |
commit | 05f5c8725ba7d2b2132d3b0a54dc18a46de83411 (patch) | |
tree | e343700bbb496fccaf806e78e121dd37bd86c955 | |
parent | 2c68cb1a5671e35da82cda8940037ba953c6531c (diff) | |
parent | 881c8da0a09426f736f65f83dd7098099d33e30b (diff) |
Merge pull request #45218 from KoBeWi/new_regression_coming_in_3_2_1
Unify single and multiscene instancing
-rw-r--r-- | editor/scene_tree_dock.cpp | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index bbedb4f033..afacc4ba1f 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -57,10 +57,7 @@ void SceneTreeDock::_nodes_drag_begin() { } void SceneTreeDock::_quick_open() { - Vector<String> files = quick_open->get_selected_files(); - for (int i = 0; i < files.size(); i++) { - instance(files[i]); - } + instance_scenes(quick_open->get_selected_files(), scene_tree->get_selected()); } void SceneTreeDock::_input(Ref<InputEvent> p_event) { @@ -123,24 +120,9 @@ void SceneTreeDock::_unhandled_key_input(Ref<InputEvent> p_event) { } void SceneTreeDock::instance(const String &p_file) { - Node *parent = scene_tree->get_selected(); - - if (!parent) { - parent = edited_scene; - }; - - if (!edited_scene) { - current_option = -1; - accept->set_text(TTR("No parent to instance a child at.")); - accept->popup_centered(); - return; - }; - - ERR_FAIL_COND(!parent); - Vector<String> scenes; scenes.push_back(p_file); - _perform_instance_scenes(scenes, parent, -1); + instance_scenes(scenes, scene_tree->get_selected()); } void SceneTreeDock::instance_scenes(const Vector<String> &p_files, Node *p_parent) { @@ -151,7 +133,11 @@ void SceneTreeDock::instance_scenes(const Vector<String> &p_files, Node *p_paren } if (!parent || !edited_scene) { - accept->set_text(TTR("No parent to instance the scenes at.")); + if (p_files.size() == 1) { + accept->set_text(TTR("No parent to instance a child at.")); + } else { + accept->set_text(TTR("No parent to instance the scenes at.")); + } accept->popup_centered(); return; }; |