diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-06-19 12:19:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-06-19 12:19:36 +0400 |
commit | fed8f760983054169eed995b684bd44a7c224e55 (patch) | |
tree | 6e9af5973d8023e7cd2e1018b314b1db5506c40f /source/blender | |
parent | d9ec2efe8fc8d19628ebf425b8cc61c16f82bab1 (diff) |
fix [#35795] Edge split modifier do not show result in viewport with curves.
caused by recent changes in normal calculation, however curves were not being very smart about calculating modifiers (calling unneeded re-tessellation for every modifier)
Diffstat (limited to 'source/blender')
-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; } |