diff options
| author | Juan Linietsky | 2016-06-07 22:08:12 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2016-06-07 22:10:09 -0300 |
| commit | d61b91cbe0c05466182b15a6dd1899e92fcac749 (patch) | |
| tree | 3021e43e4e99650062275407616d613b105e13d8 /scene/main/node.cpp | |
| parent | 193272aa8a809168b836dde3535cf96ce1f52264 (diff) | |
| download | godot-d61b91cbe0c05466182b15a6dd1899e92fcac749.tar.gz godot-d61b91cbe0c05466182b15a6dd1899e92fcac749.tar.zst godot-d61b91cbe0c05466182b15a6dd1899e92fcac749.zip | |
Diffstat (limited to 'scene/main/node.cpp')
| -rw-r--r-- | scene/main/node.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 29925b62f..f8af83e23 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -168,11 +168,8 @@ void Node::_propagate_enter_tree() { data.inside_tree=true; - const StringName *K=NULL; - - while ((K=data.grouped.next(K))) { - - data.tree->add_to_group(*K,this); + for (Map< StringName, GroupData>::Element *E=data.grouped.front();E;E=E->next()) { + E->get().group=data.tree->add_to_group(E->key(),this); } @@ -257,13 +254,13 @@ void Node::_propagate_exit_tree() { data.tree->node_removed(this); // exit groups - const StringName *K=NULL; - while ((K=data.grouped.next(K))) { - - data.tree->remove_from_group(*K,this); + for (Map< StringName, GroupData>::Element *E=data.grouped.front();E;E=E->next()) { + data.tree->remove_from_group(E->key(),this); + E->get().group=NULL; } + data.viewport = NULL; if (data.tree) @@ -307,6 +304,9 @@ void Node::move_child(Node *p_child,int p_pos) { data.children[i]->notification( NOTIFICATION_MOVED_IN_PARENT ); } + for (const Map< StringName, GroupData>::Element *E=p_child->data.grouped.front();E;E=E->next()) { + E->get().group->changed=true; + } data.blocked--; @@ -1193,8 +1193,12 @@ void Node::add_to_group(const StringName& p_identifier,bool p_persistent) { GroupData gd; - if (data.tree) - data.tree->add_to_group(p_identifier,this); + SceneTree::Group *gptr=NULL; + if (data.tree) { + gd.group=data.tree->add_to_group(p_identifier,this); + } else { + gd.group=NULL; + } gd.persistent=p_persistent; @@ -1207,14 +1211,15 @@ void Node::remove_from_group(const StringName& p_identifier) { ERR_FAIL_COND(!data.grouped.has(p_identifier) ); - GroupData *g=data.grouped.getptr(p_identifier); - ERR_FAIL_COND(!g); + Map< StringName, GroupData>::Element *E=data.grouped.find(p_identifier); + + ERR_FAIL_COND(!E); if (data.tree) - data.tree->remove_from_group(p_identifier,this); + data.tree->remove_from_group(E->key(),this); - data.grouped.erase(p_identifier); + data.grouped.erase(E); } @@ -1232,13 +1237,11 @@ Array Node::_get_groups() const { void Node::get_groups(List<GroupInfo> *p_groups) const { - const StringName *K=NULL; - - while ((K=data.grouped.next(K))) { + for (const Map< StringName, GroupData>::Element *E=data.grouped.front();E;E=E->next()) { GroupInfo gi; - gi.name=*K; - gi.persistent=data.grouped[*K].persistent; + gi.name=E->key(); + gi.persistent=E->get().persistent; p_groups->push_back(gi); } @@ -1246,16 +1249,16 @@ void Node::get_groups(List<GroupInfo> *p_groups) const { bool Node::has_persistent_groups() const { - const StringName *K=NULL; - while ((K=data.grouped.next(K))) { - - if (data.grouped[*K].persistent) + for (const Map< StringName, GroupData>::Element *E=data.grouped.front();E;E=E->next()) { + if (E->get().persistent) return true; } + return false; + } void Node::_print_tree(const Node *p_node) { |
