You've already forked godot
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:
@@ -380,17 +380,17 @@ Ref<Material> MeshInstance3D::get_active_material(int p_surface) const {
|
|||||||
return mat_override;
|
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);
|
Ref<Material> surface_material = get_surface_override_material(p_surface);
|
||||||
if (surface_material.is_valid()) {
|
if (surface_material.is_valid()) {
|
||||||
return surface_material;
|
return surface_material;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<Mesh> m = get_mesh();
|
return m->surface_get_material(p_surface);
|
||||||
if (m.is_valid()) {
|
|
||||||
return m->surface_get_material(p_surface);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ref<Material>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeshInstance3D::_mesh_changed() {
|
void MeshInstance3D::_mesh_changed() {
|
||||||
|
|||||||
Reference in New Issue
Block a user