diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-10-31 09:57:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-31 09:57:45 +0100 |
commit | 3439196eede778bed7f55efcdf41be668c961165 (patch) | |
tree | 3b15ea6c227556508de8a32b146df983675178db | |
parent | 16f066c8f18b1231e88e950233a0fad0993ed434 (diff) | |
parent | 839f3d5eebe1f0238451a41dcb8b7ca5d2995a97 (diff) |
Merge pull request #23381 from Alien1993/renaming_tree_nodes
Warning dialog is now shown if trying to set Node name to empty string
-rw-r--r-- | editor/scene_tree_editor.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 848e4def6d..6614e24df7 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -665,6 +665,13 @@ void SceneTreeEditor::_renamed() { Node *n = get_node(np); ERR_FAIL_COND(!n); + // Empty node names are not allowed, so resets it to previous text and show warning + if (which->get_text(0).strip_edges().empty()) { + which->set_text(0, n->get_name()); + EditorNode::get_singleton()->show_warning(TTR("No name provided")); + return; + } + String new_name = which->get_text(0); if (!Node::_validate_node_name(new_name)) { |