diff options
Diffstat (limited to 'editor/groups_editor.cpp')
-rw-r--r-- | editor/groups_editor.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 4cefb53617..83259afb35 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -31,6 +31,7 @@ #include "groups_editor.h" #include "editor/scene_tree_editor.h" #include "editor_node.h" +#include "editor_scale.h" #include "scene/gui/box_container.h" #include "scene/gui/label.h" #include "scene/resources/packed_scene.h" @@ -120,7 +121,7 @@ bool GroupDialog::_can_edit(Node *p_node, String p_group) { } void GroupDialog::_add_pressed() { - TreeItem *selected = nodes_to_add->get_selected(); + TreeItem *selected = nodes_to_add->get_next_selected(NULL); if (!selected) { return; @@ -149,7 +150,7 @@ void GroupDialog::_add_pressed() { } void GroupDialog::_removed_pressed() { - TreeItem *selected = nodes_to_remove->get_selected(); + TreeItem *selected = nodes_to_remove->get_next_selected(NULL); if (!selected) { return; @@ -214,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); @@ -231,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; @@ -253,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"); @@ -404,7 +407,7 @@ void GroupDialog::_bind_methods() { } GroupDialog::GroupDialog() { - set_custom_minimum_size(Size2(600, 400)); + set_custom_minimum_size(Size2(600, 400) * EDSCALE); scene_tree = SceneTree::get_singleton(); @@ -446,7 +449,7 @@ GroupDialog::GroupDialog() { add_group_text->connect("text_entered", this, "_add_group_pressed"); Button *add_group_button = memnew(Button); - add_group_button->set_text("Add"); + add_group_button->set_text(TTR("Add")); chbc->add_child(add_group_button); add_group_button->connect("pressed", this, "_add_group_pressed", varray(String())); @@ -529,6 +532,7 @@ GroupDialog::GroupDialog() { group_empty->set_valign(Label::VALIGN_CENTER); group_empty->set_align(Label::ALIGN_CENTER); group_empty->set_autowrap(true); + group_empty->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); nodes_to_remove->add_child(group_empty); group_empty->set_anchors_and_margins_preset(PRESET_WIDE, PRESET_MODE_KEEP_SIZE, 8 * EDSCALE); @@ -548,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)) |