Browse Source

striped edges on node rename in SceneTreeDock

(cherry picked from commit 32e52217ff71195818c270c5203245b99a8beeaf)
Leleat 5 years ago
parent
commit
15c56de212
1 changed files with 3 additions and 0 deletions
  1. 3 0
      editor/scene_tree_editor.cpp

+ 3 - 0
editor/scene_tree_editor.cpp

@@ -794,6 +794,9 @@ void SceneTreeEditor::_renamed() {
 	if (new_name == n->get_name())
 		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());