summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2021-01-15 20:13:09 +0100
committerkobewi <kobewi4e@gmail.com>2021-01-15 20:13:09 +0100
commit881c8da0a09426f736f65f83dd7098099d33e30b (patch)
tree89662884be64fa26b75fbeb843e46c1894825486 /editor
parentc7fb7674c8f9163a717beaa922cd7e6c8aeb77b6 (diff)
Unify single and multiscene instancing
Diffstat (limited to 'editor')
-rw-r--r--editor/scene_tree_dock.cpp28
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;
};