Also clear the nodes if _prop_data is not valid.

This commit is contained in:
Relintai 2021-08-10 10:55:49 +02:00
parent 9320f0c3c4
commit 6a4c4ad1aa

View File

@ -386,11 +386,20 @@ void PropInstanceMerger::_build() {
_building = true;
_build_queued = false;
if (!_prop_data.is_valid()) {
if (_job.is_valid()) {
_job->reset_meshes();
}
for (int i = 0; i < get_child_count(); ++i) {
Node *n = get_child(i);
//this way we won't delete the user's nodes
if (n->get_owner() == NULL) {
n->queue_delete();
}
}
if (!_prop_data.is_valid()) {
_building = false;
return;
}
@ -441,18 +450,6 @@ void PropInstanceMerger::_build() {
_job->set_material_cache(cache);
for (int i = 0; i < get_child_count(); ++i) {
Node *n = get_child(i);
//this way we won't delete the user's nodes
if (n->get_owner() == NULL) {
n->queue_delete();
}
}
if (!_prop_data.is_valid())
return;
prop_preprocess(Transform(), _prop_data);
#if THREAD_POOL_PRESENT