mirror of
https://github.com/godotengine/godot.git
synced 2024-11-13 23:52:41 +00:00
Merge pull request #45218 from KoBeWi/new_regression_coming_in_3_2_1
Unify single and multiscene instancing
This commit is contained in:
commit
05f5c8725b
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user