Fix #133764: Collada crash (editmode + triangulate + apply modifiers)

Exposed by bc0b86797c
(but even before we had Asserts in a debug build -- also crashed
WITH_ASSERT_ABORT OFF)

The call to ensure Mesh data from a mesh in edit mode needs
to happen before the triangulation which uses Mesh. This gets rid of
the crash and also previous asserts.

Pull Request: https://projects.blender.org/blender/blender/pulls/133859
This commit is contained in:
Philipp Oeser
2025-01-31 15:46:12 +01:00
committed by Philipp Oeser
parent f97c54ff76
commit 7397fda92b

View File

@@ -285,14 +285,14 @@ Mesh *bc_get_mesh_copy(BlenderContext &blender_context,
Mesh *mesh = BKE_mesh_copy_for_eval(*tmpmesh);
/* Ensure data exists if currently in edit mode. */
BKE_mesh_wrapper_ensure_mdata(mesh);
if (triangulate) {
bc_triangulate_mesh(mesh);
}
BKE_mesh_tessface_ensure(mesh);
/* Ensure data exists if currently in edit mode. */
BKE_mesh_wrapper_ensure_mdata(mesh);
return mesh;
}