Merge pull request #22071 from DualMatrix/preserve_group

Made duplicate_and_reown preserve groups
This commit is contained in:
Rémi Verschelde 2018-09-20 15:50:14 +02:00 committed by GitHub
commit 88ebd710f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2116,6 +2116,12 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
node->set(name, value);
}
List<GroupInfo> groups;
get_groups(&groups);
for (List<GroupInfo>::Element *E = groups.front(); E; E = E->next())
node->add_to_group(E->get().name, E->get().persistent);
node->set_name(get_name());
p_new_parent->add_child(node);
@ -2210,6 +2216,12 @@ Node *Node::duplicate_and_reown(const Map<Node *, Node *> &p_reown_map) const {
node->set(name, get(name));
}
List<GroupInfo> groups;
get_groups(&groups);
for (List<GroupInfo>::Element *E = groups.front(); E; E = E->next())
node->add_to_group(E->get().name, E->get().persistent);
for (int i = 0; i < get_child_count(); i++) {
get_child(i)->_duplicate_and_reown(node, p_reown_map);