Merge pull request #42014 from Leleat/strip-edges-on-node-rename

Strip edges on node rename in SceneTreeDock
This commit is contained in:
Rémi Verschelde 2020-09-24 15:21:59 +02:00 committed by GitHub
commit 6cb11cf41c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -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());