diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 21 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_edgesplit.c | 22 |
2 files changed, 22 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index f3de4001dea..ed8d7bd3d2f 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -976,7 +976,6 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba dm = tdm; CDDM_apply_vert_coords(dm, vertCos); - CDDM_calc_normals_mapping(dm); } } else { @@ -989,8 +988,6 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba } dm = CDDM_from_curve_displist(ob, dispbase); - - CDDM_calc_normals_mapping(dm); } if (vertCos) { @@ -1001,7 +998,8 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba if (useCache) appf |= MOD_APPLY_USECACHE; - ndm = mti->applyModifier(md, ob, dm, appf); + + ndm = modwrap_applyModifier(md, ob, dm, appf); if (ndm) { /* Modifier returned a new derived mesh */ @@ -1031,8 +1029,19 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba } if (derivedFinal) { - if (dm) - DM_ensure_tessface(dm); /* needed for drawing */ + if (dm) { + /* see: mesh_calc_modifiers */ + if (dm->getNumTessFaces(dm) == 0) { + dm->recalcTessellation(dm); + } + /* Even if tessellation is not needed, some modifiers might have modified CD layers + * (like mloopcol or mloopuv), hence we have to update those. */ + else if (dm->dirty & DM_DIRTY_TESS_CDLAYERS) { + DM_update_tessface_data(dm); + } + + CDDM_calc_normals_mapping_ex(dm, (dm->dirty & DM_DIRTY_NORMALS) ? false : true); + } (*derivedFinal) = dm; } diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index d877932b81d..e37fc56d08c 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -49,7 +49,7 @@ #include "DNA_object_types.h" -static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Object *UNUSED(ob)) +static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) { DerivedMesh *result; BMesh *bm; @@ -97,7 +97,8 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj result = CDDM_from_bmesh(bm, TRUE); BM_mesh_free(bm); - + + result->dirty |= DM_DIRTY_NORMALS; return result; } @@ -119,25 +120,16 @@ static void copyData(ModifierData *md, ModifierData *target) temd->flags = emd->flags; } -static DerivedMesh *edgesplitModifier_do(EdgeSplitModifierData *emd, - Object *ob, DerivedMesh *dm) -{ - if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG))) - return dm; - - return doEdgeSplit(dm, emd, ob); -} - -static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *derivedData, +static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), DerivedMesh *dm, ModifierApplyFlag UNUSED(flag)) { DerivedMesh *result; EdgeSplitModifierData *emd = (EdgeSplitModifierData *) md; - result = edgesplitModifier_do(emd, ob, derivedData); + if (!(emd->flags & (MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG))) + return dm; - if (result != derivedData) - result->dirty |= DM_DIRTY_NORMALS; + result = doEdgeSplit(dm, emd); return result; } |