mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Fix MeshInstance3D::get_active_material() error on empty mesh or empty surfaces
FixesMeshInstance3D::get_active_material() error on empty mesh or empty surfaces.
This commit is contained in:
parent
8de08c7c21
commit
4bbafc8d0e
1 changed files with 6 additions and 6 deletions
|
|
@ -380,17 +380,17 @@ Ref<Material> MeshInstance3D::get_active_material(int p_surface) const {
|
|||
return mat_override;
|
||||
}
|
||||
|
||||
Ref<Mesh> m = get_mesh();
|
||||
if (m.is_null() || m->get_surface_count() == 0) {
|
||||
return Ref<Material>();
|
||||
}
|
||||
|
||||
Ref<Material> surface_material = get_surface_override_material(p_surface);
|
||||
if (surface_material.is_valid()) {
|
||||
return surface_material;
|
||||
}
|
||||
|
||||
Ref<Mesh> m = get_mesh();
|
||||
if (m.is_valid()) {
|
||||
return m->surface_get_material(p_surface);
|
||||
}
|
||||
|
||||
return Ref<Material>();
|
||||
return m->surface_get_material(p_surface);
|
||||
}
|
||||
|
||||
void MeshInstance3D::_mesh_changed() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue