summaryrefslogtreecommitdiff
path: root/editor/groups_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/groups_editor.cpp')
-rw-r--r--editor/groups_editor.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index 686ca869a6..98b216acda 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -68,7 +68,7 @@ void GroupDialog::_load_nodes(Node *p_current) {
keep = false;
}
- TreeItem *node = NULL;
+ TreeItem *node = nullptr;
NodePath path = scene_tree->get_edited_scene_root()->get_path_to(p_current);
if (keep && p_current->is_in_group(selected_group)) {
if (remove_filter->get_text().is_subsequence_ofi(String(p_current->get_name()))) {
@@ -122,7 +122,7 @@ bool GroupDialog::_can_edit(Node *p_node, String p_group) {
}
void GroupDialog::_add_pressed() {
- TreeItem *selected = nodes_to_add->get_next_selected(NULL);
+ TreeItem *selected = nodes_to_add->get_next_selected(nullptr);
if (!selected) {
return;
@@ -151,7 +151,7 @@ void GroupDialog::_add_pressed() {
}
void GroupDialog::_removed_pressed() {
- TreeItem *selected = nodes_to_remove->get_next_selected(NULL);
+ TreeItem *selected = nodes_to_remove->get_next_selected(nullptr);
if (!selected) {
return;
@@ -300,8 +300,9 @@ void GroupDialog::_load_groups(Node *p_current) {
void GroupDialog::_delete_group_pressed(Object *p_item, int p_column, int p_id) {
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
- if (!ti)
+ if (!ti) {
return;
+ }
String name = ti->get_text(0);
@@ -536,16 +537,18 @@ GroupDialog::GroupDialog() {
////////////////////////////////////////////////////////////////////////////////
void GroupsEditor::_add_group(const String &p_group) {
-
- if (!node)
+ if (!node) {
return;
+ }
const String name = group_name->get_text().strip_edges();
- if (name.empty())
+ if (name.empty()) {
return;
+ }
- if (node->is_in_group(name))
+ if (node->is_in_group(name)) {
return;
+ }
undo_redo->create_action(TTR("Add to Group"));
@@ -564,13 +567,14 @@ void GroupsEditor::_add_group(const String &p_group) {
}
void GroupsEditor::_remove_group(Object *p_item, int p_column, int p_id) {
-
- if (!node)
+ if (!node) {
return;
+ }
TreeItem *ti = Object::cast_to<TreeItem>(p_item);
- if (!ti)
+ if (!ti) {
return;
+ }
String name = ti->get_text(0);
@@ -589,18 +593,17 @@ void GroupsEditor::_remove_group(Object *p_item, int p_column, int p_id) {
}
struct _GroupInfoComparator {
-
bool operator()(const Node::GroupInfo &p_a, const Node::GroupInfo &p_b) const {
return p_a.name.operator String() < p_b.name.operator String();
}
};
void GroupsEditor::update_tree() {
-
tree->clear();
- if (!node)
+ if (!node) {
return;
+ }
List<Node::GroupInfo> groups;
node->get_groups(&groups);
@@ -609,20 +612,18 @@ void GroupsEditor::update_tree() {
TreeItem *root = tree->create_item();
for (List<GroupInfo>::Element *E = groups.front(); E; E = E->next()) {
-
Node::GroupInfo gi = E->get();
- if (!gi.persistent)
+ if (!gi.persistent) {
continue;
+ }
Node *n = node;
bool can_be_deleted = true;
while (n) {
-
Ref<SceneState> ss = (n == EditorNode::get_singleton()->get_edited_scene()) ? n->get_scene_inherited_state() : n->get_scene_instance_state();
if (ss.is_valid()) {
-
int path = ss->find_node_by_path(n->get_path_to(node));
if (path != -1) {
if (ss->is_node_in_group(path, gi.name)) {
@@ -645,13 +646,11 @@ void GroupsEditor::update_tree() {
}
void GroupsEditor::set_current(Node *p_node) {
-
node = p_node;
update_tree();
}
void GroupsEditor::_show_group_dialog() {
-
group_dialog->edit();
group_dialog->set_undo_redo(undo_redo);
}
@@ -661,8 +660,7 @@ void GroupsEditor::_bind_methods() {
}
GroupsEditor::GroupsEditor() {
-
- node = NULL;
+ node = nullptr;
VBoxContainer *vbc = this;