From 02a204fe67eeefbe9c1485e109a21c786645585b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Sep 2020 15:12:28 +1000 Subject: [PATCH] Fix T68024: Crash from missing original-index mesh layer Constructive modifiers were not initializing an original index layer in the case a previous deform modifier created 'mesh_final'. This happened in the case of multiple deform modifiers that deform along normals, as requesting normals caused the final mesh to be created. Ensure mapping data is created in the case only non-constructive modifiers have run. --- source/blender/blenkernel/intern/DerivedMesh.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 2f910f66cce..ecc0413b8cc 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1104,7 +1104,11 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, bool check_for_needs_mapping = false; /* apply vertex coordinates or build a Mesh as necessary */ if (mesh_final != NULL) { - /* pass */ + if (have_non_onlydeform_modifiers_appled == false) { + /* If we only deformed, we won't have initialized #CD_ORIGINDEX. + * as this is the only part of the function that initializes mapping. */ + check_for_needs_mapping = true; + } } else { mesh_final = BKE_mesh_copy_for_eval(mesh_input, true);