summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-09-24 15:21:59 +0200
committerGitHub <noreply@github.com>2020-09-24 15:21:59 +0200
commit6cb11cf41cfdaa0802aac7e1a49c0cccdfcd7e13 (patch)
treebbe1c22cd10408477855fa46d9795be0631e16bb
parent4b3a566cf1e46bbb9057fa5e89760a1caca4ee14 (diff)
parent32e52217ff71195818c270c5203245b99a8beeaf (diff)
Merge pull request #42014 from Leleat/strip-edges-on-node-rename
Strip edges on node rename in SceneTreeDock
-rw-r--r--editor/scene_tree_editor.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index a62448169d..5a504da397 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -777,6 +777,9 @@ void SceneTreeEditor::_renamed() {
return;
}
+ // Trim leading/trailing whitespace to prevent node names from containing accidental whitespace, which would make it more difficult to get the node via `get_node()`.
+ new_name = new_name.strip_edges();
+
if (!undo_redo) {
n->set_name(new_name);
which->set_metadata(0, n->get_path());