Merge pull request #64554 from nongvantinh/material_are_not_applied
This commit is contained in:
commit
2932593519
1 changed files with 8 additions and 1 deletions
|
@ -115,8 +115,8 @@ void MeshInstance3D::set_mesh(const Ref<Mesh> &p_mesh) {
|
||||||
|
|
||||||
if (mesh.is_valid()) {
|
if (mesh.is_valid()) {
|
||||||
mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed));
|
mesh->connect(CoreStringNames::get_singleton()->changed, callable_mp(this, &MeshInstance3D::_mesh_changed));
|
||||||
_mesh_changed();
|
|
||||||
set_base(mesh->get_rid());
|
set_base(mesh->get_rid());
|
||||||
|
_mesh_changed();
|
||||||
} else {
|
} else {
|
||||||
blend_shape_tracks.clear();
|
blend_shape_tracks.clear();
|
||||||
blend_shape_properties.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();
|
update_gizmos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue