summaryrefslogtreecommitdiff
path: root/editor/scene_tree_editor.cpp
diff options
context:
space:
mode:
authorSilvano Cerza <silvanocerza@gmail.com>2018-10-29 14:47:53 +0100
committerSilvano Cerza <silvanocerza@gmail.com>2018-10-30 12:44:54 +0100
commit839f3d5eebe1f0238451a41dcb8b7ca5d2995a97 (patch)
tree6329a90e9e298f3964bf3c6c4284ebab94a22638 /editor/scene_tree_editor.cpp
parentbfd1f09ac515706e4c55335cf4be22676adefd6d (diff)
Warning dialog is now shown if trying to set Node name to empty string
If the user tried to change a Node name to an empty string in the Scene Tree Editor an error would be returned to console, now a warning dialog is shown with a clear message
Diffstat (limited to 'editor/scene_tree_editor.cpp')
-rw-r--r--editor/scene_tree_editor.cpp7
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)) {