summaryrefslogtreecommitdiff
path: root/editor/scene_tree_dock.cpp
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2019-09-03 23:14:59 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2019-09-03 23:14:59 +0200
commit284548c4b74646c331a1a5e0b32c54d8929c3fc0 (patch)
treeda8955970806ada51e223f594bc8dede102a6b6f /editor/scene_tree_dock.cpp
parent750f8d4926edb14269d9f6a117c5a9fd4765373a (diff)
Improve the node deletion confirmation message
The confirmation message now displays the number of nodes to delete, or the node's name if only one node is selected.
Diffstat (limited to 'editor/scene_tree_dock.cpp')
-rw-r--r--editor/scene_tree_dock.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp
index f0114b393d..16f1575757 100644
--- a/editor/scene_tree_dock.cpp
+++ b/editor/scene_tree_dock.cpp
@@ -759,7 +759,16 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
_delete_confirm();
} else {
- delete_dialog->set_text(TTR("Delete Node(s)?"));
+ if (remove_list.size() > 1) {
+ delete_dialog->set_text(vformat(TTR("Delete %d nodes?"), remove_list.size()));
+ } else {
+ delete_dialog->set_text(vformat(TTR("Delete node \"%s\"?"), remove_list[0]->get_name()));
+ }
+
+ // Resize the dialog to its minimum size.
+ // This prevents the dialog from being too wide after displaying
+ // a deletion confirmation for a node with a long name.
+ delete_dialog->set_size(Size2());
delete_dialog->popup_centered_minsize();
}