Fix MultiMeshInstance crash in navmesh baking when MultiMesh Resource is empty
Fix MultiMeshInstance crash in navmesh baking when MultiMesh Resource is empty
(cherry picked from commit caceceab08
)
This commit is contained in:
parent
ed4e597027
commit
47ade6786f
|
@ -174,14 +174,16 @@ void NavigationMeshGenerator::_parse_geometry(const Transform &p_navmesh_xform,
|
||||||
if (Object::cast_to<MultiMeshInstance>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) {
|
if (Object::cast_to<MultiMeshInstance>(p_node) && p_generate_from != NavigationMesh::PARSED_GEOMETRY_STATIC_COLLIDERS) {
|
||||||
MultiMeshInstance *multimesh_instance = Object::cast_to<MultiMeshInstance>(p_node);
|
MultiMeshInstance *multimesh_instance = Object::cast_to<MultiMeshInstance>(p_node);
|
||||||
Ref<MultiMesh> multimesh = multimesh_instance->get_multimesh();
|
Ref<MultiMesh> multimesh = multimesh_instance->get_multimesh();
|
||||||
Ref<Mesh> mesh = multimesh->get_mesh();
|
if (multimesh.is_valid()) {
|
||||||
if (mesh.is_valid()) {
|
Ref<Mesh> mesh = multimesh->get_mesh();
|
||||||
int n = multimesh->get_visible_instance_count();
|
if (mesh.is_valid()) {
|
||||||
if (n == -1) {
|
int n = multimesh->get_visible_instance_count();
|
||||||
n = multimesh->get_instance_count();
|
if (n == -1) {
|
||||||
}
|
n = multimesh->get_instance_count();
|
||||||
for (int i = 0; i < n; i++) {
|
}
|
||||||
_add_mesh(mesh, p_navmesh_xform * multimesh_instance->get_global_transform() * multimesh->get_instance_transform(i), p_vertices, p_indices);
|
for (int i = 0; i < n; i++) {
|
||||||
|
_add_mesh(mesh, p_navmesh_xform * multimesh_instance->get_global_transform() * multimesh->get_instance_transform(i), p_vertices, p_indices);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue