mirror of
https://github.com/godotengine/godot.git
synced 2025-01-22 10:32:54 -05:00
Merge pull request #101014 from BattyBovine/cs3d-separation-ray-fix-2
Prevent errors when drawing debug meshes with no mesh data.
This commit is contained in:
commit
bacf8d198d
2 changed files with 7 additions and 4 deletions
|
@ -350,7 +350,7 @@ void CollisionShape3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
|
||||||
|
|
||||||
if (cs->get_debug_fill_enabled()) {
|
if (cs->get_debug_fill_enabled()) {
|
||||||
Ref<ArrayMesh> array_mesh = s->get_debug_arraymesh_faces(collision_color);
|
Ref<ArrayMesh> array_mesh = s->get_debug_arraymesh_faces(collision_color);
|
||||||
if (array_mesh.is_valid()) {
|
if (array_mesh.is_valid() && array_mesh->get_surface_count() > 0) {
|
||||||
p_gizmo->add_mesh(array_mesh, material_arraymesh);
|
p_gizmo->add_mesh(array_mesh, material_arraymesh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -132,11 +132,14 @@ Ref<ArrayMesh> Shape3D::get_debug_mesh() {
|
||||||
debug_mesh_cache->surface_set_material(0, material);
|
debug_mesh_cache->surface_set_material(0, material);
|
||||||
|
|
||||||
if (debug_fill) {
|
if (debug_fill) {
|
||||||
Array solid_array = get_debug_arraymesh_faces(debug_color * Color(1.0, 1.0, 1.0, 0.0625))->surface_get_arrays(0);
|
Ref<ArrayMesh> array_mesh = get_debug_arraymesh_faces(debug_color * Color(1.0, 1.0, 1.0, 0.0625));
|
||||||
|
if (array_mesh.is_valid() && array_mesh->get_surface_count() > 0) {
|
||||||
|
Array solid_array = array_mesh->surface_get_arrays(0);
|
||||||
debug_mesh_cache->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, solid_array);
|
debug_mesh_cache->add_surface_from_arrays(Mesh::PRIMITIVE_TRIANGLES, solid_array);
|
||||||
debug_mesh_cache->surface_set_material(1, material);
|
debug_mesh_cache->surface_set_material(1, material);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return debug_mesh_cache;
|
return debug_mesh_cache;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue