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.
This commit is contained in:
Campbell Barton 2020-09-23 15:12:28 +10:00
parent ea5c8c4e84
commit 02a204fe67
Notes: blender-bot 2023-02-14 01:26:51 +01:00
Referenced by issue #80396, Potential candidates for corrective releases
Referenced by issue #68024, Crash using Weight Paint Gradient on mesh with specific modifiers (2 mods depending on normals + generative mod) - missing CD_ORIGINDEX layer then
1 changed files with 5 additions and 1 deletions

View File

@ -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);