Portals - fix duplication of instanced scenes during conversion

During room conversion, if a prefixed Spatial is converted to a Room / RoomGroup etc, when using instanced scenes the owner was incorrectly set, resulting in the instanced scene objects being duplicated.

This PR corrects this.

(cherry picked from commit 4ec4b5a60d)
This commit is contained in:
lawnjelly 2022-03-01 09:44:40 +00:00 committed by Rémi Verschelde
parent a57dc1881b
commit 855a079664

View File

@ -2040,9 +2040,10 @@ void RoomManager::_flip_portals_recursive(Spatial *p_node) {
}
void RoomManager::_set_owner_recursive(Node *p_node, Node *p_owner) {
if (p_node != p_owner) {
if (!p_node->get_owner() && (p_node != p_owner)) {
p_node->set_owner(p_owner);
}
for (int n = 0; n < p_node->get_child_count(); n++) {
_set_owner_recursive(p_node->get_child(n), p_owner);
}