Fix errors when materials attached to 3d object are not freed

This commit is contained in:
Yuri Rubinsky 2022-05-26 09:12:20 +03:00
parent 08e540a2ac
commit 8f57d9519e
2 changed files with 10 additions and 0 deletions

View File

@ -496,3 +496,12 @@ void GeometryInstance3D::_bind_methods() {
GeometryInstance3D::GeometryInstance3D() {
//RS::get_singleton()->instance_geometry_set_baked_light_texture_index(get_instance(),0);
}
GeometryInstance3D::~GeometryInstance3D() {
if (material_overlay.is_valid()) {
set_material_overlay(Ref<Material>());
}
if (material_override.is_valid()) {
set_material_override(Ref<Material>());
}
}

View File

@ -188,6 +188,7 @@ public:
TypedArray<String> get_configuration_warnings() const override;
GeometryInstance3D();
virtual ~GeometryInstance3D();
};
VARIANT_ENUM_CAST(GeometryInstance3D::ShadowCastingSetting);