1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +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:
smix8
2025-06-19 02:55:54 +02:00
parent 8de08c7c21
commit 4bbafc8d0e

View File

@@ -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() {