diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/groups_editor.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index c19bee321a..83259afb35 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -215,7 +215,7 @@ void GroupDialog::_group_renamed() { return; } - String name = renamed_group->get_text(0).strip_edges(); + const String name = renamed_group->get_text(0).strip_edges(); for (TreeItem *E = groups_root->get_children(); E; E = E->get_next()) { if (E != renamed_group && E->get_text(0) == name) { renamed_group->set_text(0, selected_group); @@ -232,6 +232,8 @@ void GroupDialog::_group_renamed() { return; } + renamed_group->set_text(0, name); // Spaces trimmed. + undo_redo->create_action(TTR("Rename Group")); List<Node *> nodes; @@ -254,8 +256,8 @@ void GroupDialog::_group_renamed() { undo_redo->add_undo_method(this, "_delete_group_item", selected_group); } - undo_redo->add_do_method(this, "_rename_group_item", selected_group, renamed_group->get_text(0)); - undo_redo->add_undo_method(this, "_rename_group_item", renamed_group->get_text(0), selected_group); + undo_redo->add_do_method(this, "_rename_group_item", selected_group, name); + undo_redo->add_undo_method(this, "_rename_group_item", name, selected_group); undo_redo->add_do_method(this, "_group_selected"); undo_redo->add_undo_method(this, "_group_selected"); undo_redo->add_do_method(this, "emit_signal", "group_edited"); @@ -550,8 +552,8 @@ void GroupsEditor::_add_group(const String &p_group) { if (!node) return; - String name = group_name->get_text(); - if (name.strip_edges() == "") + const String name = group_name->get_text().strip_edges(); + if (name.empty()) return; if (node->is_in_group(name)) |