Reimplemented mesh data instance creation in _prop_preprocess. Also don't set owners, so things won't show up in the editor.

This commit is contained in:
Relintai 2021-04-27 17:06:46 +02:00
parent 8667cc8eaf
commit 5b71d7a931

View File

@ -114,7 +114,7 @@ void PropInstance::_prop_preprocess(Transform transform, const Ref<PropData> &pr
Node *n = sc->instance();
add_child(n);
n->set_owner(this);
//n->set_owner(this);
Spatial *sp = Object::cast_to<Spatial>(n);
@ -153,9 +153,14 @@ void PropInstance::_prop_preprocess(Transform transform, const Ref<PropData> &pr
if (!mdr.is_valid())
continue;
//add to job
//job could merge textures if needed
//chunk->mesh_data_resource_add(t, mdr, mesh_data->get_texture());
MeshDataInstance *mdi = memnew(MeshDataInstance);
add_child(mdi);
//mdi->set_owner(this);
mdi->set_transform(t);
//not yet sure how it would be best to do this
//Maybe giving this class a material, and setting it could work
//mdi->set_material();
mdi->set_mesh_data(mdr);
continue;
}