Fix (unreported) assert in modifier evaluation of weighted normals.
Currently modifier stack assumes there are no poly normals data passed around, so in case a modifier generates such data, it has to clean it up after usage. Whole handling of normals is a bit annoying and week currently, we can probably enhance that once fully per-mesh item type cddata masks are in?
This commit is contained in:
parent
7d0fcaa69a
commit
090b8c14d2
Notes:
blender-bot
2023-02-14 02:43:21 +01:00
Referenced by issue #84664, Crash/Assert with two modifiers that require normals data [e.g. DataTransfer] Referenced by issue #73941, Custom normals from normal edit modifier ignored by further modifiers
|
@ -523,6 +523,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
|||
float (*polynors)[3] = CustomData_get_layer(pdata, CD_NORMAL);
|
||||
if (!polynors) {
|
||||
polynors = CustomData_add_layer(pdata, CD_NORMAL, CD_CALLOC, NULL, numPolys);
|
||||
CustomData_set_layer_flag(pdata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
||||
}
|
||||
BKE_mesh_calc_normals_poly(mvert, NULL, numVerts, mloop, mpoly, numLoops, numPolys, polynors, false);
|
||||
|
||||
|
@ -587,6 +588,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
|
|||
MEM_SAFE_FREE(wn_data.mode_pair);
|
||||
MEM_SAFE_FREE(wn_data.items_data);
|
||||
|
||||
/* Currently Modifier stack assumes there is no poly normal data passed around... */
|
||||
CustomData_free_layers(pdata, CD_NORMAL, numPolys);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue