Deleting multiple nodes displays correct message.
(cherry picked from commit 8b046ed477
)
This commit is contained in:
parent
46590fa3b0
commit
4c54f39dbe
1 changed files with 19 additions and 8 deletions
|
@ -734,17 +734,28 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||||
_delete_confirm();
|
_delete_confirm();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (remove_list.size() >= 2) {
|
String msg;
|
||||||
delete_dialog->set_text(vformat(TTR("Delete %d nodes?"), remove_list.size()));
|
if (remove_list.size() > 1) {
|
||||||
} else if (remove_list.size() == 1 && remove_list[0] == editor_data->get_edited_scene_root()) {
|
bool any_children = false;
|
||||||
delete_dialog->set_text(vformat(TTR("Delete the root node \"%s\"?"), remove_list[0]->get_name()));
|
for (int i = 0; !any_children && i < remove_list.size(); i++) {
|
||||||
} else if (remove_list.size() == 1 && remove_list[0]->get_filename() == "" && remove_list[0]->get_child_count() >= 1) {
|
any_children = remove_list[i]->get_child_count() > 0;
|
||||||
// Display this message only for non-instanced scenes
|
}
|
||||||
delete_dialog->set_text(vformat(TTR("Delete node \"%s\" and its children?"), remove_list[0]->get_name()));
|
|
||||||
|
msg = vformat(any_children ? TTR("Delete %d nodes and any children?") : TTR("Delete %d nodes?"), remove_list.size());
|
||||||
} else {
|
} else {
|
||||||
delete_dialog->set_text(vformat(TTR("Delete node \"%s\"?"), remove_list[0]->get_name()));
|
Node *node = remove_list[0];
|
||||||
|
if (node == editor_data->get_edited_scene_root()) {
|
||||||
|
msg = vformat(TTR("Delete the root node \"%s\"?"), node->get_name());
|
||||||
|
} else if (node->get_filename() == "" && node->get_child_count() > 0) {
|
||||||
|
// Display this message only for non-instanced scenes
|
||||||
|
msg = vformat(TTR("Delete node \"%s\" and its children?"), node->get_name());
|
||||||
|
} else {
|
||||||
|
msg = vformat(TTR("Delete node \"%s\"?"), node->get_name());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete_dialog->set_text(msg);
|
||||||
|
|
||||||
// Resize the dialog to its minimum size.
|
// Resize the dialog to its minimum size.
|
||||||
// This prevents the dialog from being too wide after displaying
|
// This prevents the dialog from being too wide after displaying
|
||||||
// a deletion confirmation for a node with a long name.
|
// a deletion confirmation for a node with a long name.
|
||||||
|
|
Loading…
Reference in a new issue