You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
property remove parent owned nodes when using replace, fixes #4128
This commit is contained in:
@@ -1388,6 +1388,13 @@ void SceneTreeDock::_create() {
|
||||
}
|
||||
|
||||
String newname=n->get_name();
|
||||
|
||||
List<Node*> to_erase;
|
||||
for(int i=0;i<n->get_child_count();i++) {
|
||||
if (n->get_child(i)->get_owner()==NULL && n->is_owned_by_parent()) {
|
||||
to_erase.push_back(n->get_child(i));
|
||||
}
|
||||
}
|
||||
n->replace_by(newnode,true);
|
||||
|
||||
if (n==edited_scene) {
|
||||
@@ -1408,6 +1415,11 @@ void SceneTreeDock::_create() {
|
||||
|
||||
memdelete(n);
|
||||
|
||||
while(to_erase.front()) {
|
||||
memdelete(to_erase.front()->get());
|
||||
to_erase.pop_front();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user