From 839f3d5eebe1f0238451a41dcb8b7ca5d2995a97 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Mon, 29 Oct 2018 14:47:53 +0100 Subject: 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 --- editor/scene_tree_editor.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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)) { -- cgit v1.2.3