Merge pull request #23381 from Alien1993/renaming_tree_nodes

Warning dialog is now shown if trying to set Node name to empty string
This commit is contained in:
Rémi Verschelde 2018-10-31 09:57:45 +01:00 committed by GitHub
commit 3439196eed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)) {