diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-28 21:54:22 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-02-28 22:47:50 +0300 |
commit | 090b8c14d2fc7e90e905906e5a7bb552583b7563 (patch) | |
tree | 14f782f6d54a10ba52b48388ade36343790774ff /source/blender/modifiers | |
parent | 7d0fcaa69a64eed8a37598213b120582f12fb437 (diff) |
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?
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weighted_normal.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c index 036cb6cc23c..6321d1ac3cb 100644 --- a/source/blender/modifiers/intern/MOD_weighted_normal.c +++ b/source/blender/modifiers/intern/MOD_weighted_normal.c @@ -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; } |