Improve the node deletion confirmation message

- Add "the root node" in the beginning if the selected node
  is the current scene's root
- Add "and its children" at the end of the message if the node
  has at least one child and is not an instanced scene
This commit is contained in:
Hugo Locurcio 2019-09-11 23:11:00 +02:00
parent 24e1039eb6
commit fd1b5cc39f
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C

View file

@ -759,8 +759,13 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
_delete_confirm();
} else {
if (remove_list.size() > 1) {
if (remove_list.size() >= 2) {
delete_dialog->set_text(vformat(TTR("Delete %d nodes?"), remove_list.size()));
} else if (remove_list.size() == 1 && remove_list[0] == editor_data->get_edited_scene_root()) {
delete_dialog->set_text(vformat(TTR("Delete the root node \"%s\"?"), remove_list[0]->get_name()));
} else if (remove_list.size() == 1 && remove_list[0]->get_filename() == "" && remove_list[0]->get_child_count() >= 1) {
// 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()));
} else {
delete_dialog->set_text(vformat(TTR("Delete node \"%s\"?"), remove_list[0]->get_name()));
}