diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-30 19:28:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-30 19:28:05 +0200 |
commit | 29325935198f981e1f59a774cfa5eff6564140b7 (patch) | |
tree | 4262a2ac02506fe6f7730fbf25f3b14689394379 /scene/3d/mesh_instance_3d.cpp | |
parent | 74b14317797403799dee6b3405d1537d1c5a5c31 (diff) | |
parent | 76b4041f380d9678ccd89462381c3f1321d2c757 (diff) |
Merge pull request #64554 from nongvantinh/material_are_not_applied
Diffstat (limited to 'scene/3d/mesh_instance_3d.cpp')
-rw-r--r-- | scene/3d/mesh_instance_3d.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scene/3d/mesh_instance_3d.cpp b/scene/3d/mesh_instance_3d.cpp index 31993f898d..a76f4dd0d5 100644 --- a/scene/3d/mesh_instance_3d.cpp +++ b/scene/3d/mesh_instance_3d.cpp @@ -115,8 +115,8 @@ void MeshInstance3D::set_mesh(const Ref<Mesh> &p_mesh) { if (mesh.is_valid()) { mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed)); - _mesh_changed(); set_base(mesh->get_rid()); + _mesh_changed(); } else { blend_shape_tracks.clear(); blend_shape_properties.clear(); @@ -380,6 +380,13 @@ void MeshInstance3D::_mesh_changed() { } } + int surface_count = mesh->get_surface_count(); + for (int surface_index = 0; surface_index < surface_count; ++surface_index) { + if (surface_override_materials[surface_index].is_valid()) { + RS::get_singleton()->instance_set_surface_override_material(get_instance(), surface_index, surface_override_materials[surface_index]->get_rid()); + } + } + update_gizmos(); } |