Skip to content

Commit

Permalink
Fix errors when materials attached to 3d object are not freed
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed May 26, 2022
1 parent 08e540a commit 8f57d95
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scene/3d/visual_instance_3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>());
}
}
1 change: 1 addition & 0 deletions scene/3d/visual_instance_3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class GeometryInstance3D : public VisualInstance3D {

TypedArray<String> get_configuration_warnings() const override;
GeometryInstance3D();
virtual ~GeometryInstance3D();
};

VARIANT_ENUM_CAST(GeometryInstance3D::ShadowCastingSetting);
Expand Down

0 comments on commit 8f57d95

Please sign in to comment.