diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-11 00:31:55 +0400 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2012-05-11 00:31:55 +0400 |
commit | 6dbfbabcd62164391a838a7ac4cf23a57f96e306 (patch) | |
tree | 1f4f2166161aff81c64bdb149d7bcf72887665b4 /source/blender/blenkernel/intern/subsurf_ccg.c | |
parent | 072a882d035936c7eeca6abeb8781a330ebd07d5 (diff) |
Code cleanup for parameters of subsurf_make_derived_from_derived.
This is the first commit of the sculpt masking merge. Documentation:
http://wiki.blender.org/index.php/User:Nicholasbishop/PaintMasks
Thanks to Brecht for reviewing!
Replaced four boolean parameters with a single flag and a new enum,
SubsurfFlags.
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index e81cab6b912..becdf585259 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -3367,8 +3367,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, struct DerivedMesh *subsurf_make_derived_from_derived( struct DerivedMesh *dm, struct SubsurfModifierData *smd, - int useRenderParams, float (*vertCos)[3], - int isFinalCalc, int forEditMode, int inEditMode) + float (*vertCos)[3], + SubsurfFlags flags) { int useSimple = smd->subdivType == ME_SIMPLE_SUBSURF; CCGFlags useAging = smd->flags & eSubsurfModifierFlag_DebugIncr ? CCG_USE_AGING : 0; @@ -3376,7 +3376,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived( int drawInteriorEdges = !(smd->flags & eSubsurfModifierFlag_ControlEdges); CCGDerivedMesh *result; - if (forEditMode) { + if (flags & SUBSURF_FOR_EDIT_MODE) { int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->levels) : smd->levels; smd->emCache = _getSubSurf(smd->emCache, levels, useAging | CCG_CALC_NORMALS); @@ -3386,7 +3386,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived( drawInteriorEdges, useSubsurfUv, dm); } - else if (useRenderParams) { + else if (flags & SUBSURF_USE_RENDER_PARAMS) { /* Do not use cache in render mode. */ CCGSubSurf *ss; int levels = (smd->modifier.scene) ? get_render_subsurf_level(&smd->modifier.scene->r, smd->renderLevels) : smd->renderLevels; @@ -3419,14 +3419,13 @@ struct DerivedMesh *subsurf_make_derived_from_derived( * Addendum: we can't really ensure that this is never called in edit * mode, so now we have a parameter to verify it. - brecht */ - if (!inEditMode && smd->emCache) { + if (!(flags & SUBSURF_IN_EDIT_MODE) && smd->emCache) { ccgSubSurf_free(smd->emCache); smd->emCache = NULL; } - if (useIncremental && isFinalCalc) { + if (useIncremental && (flags & SUBSURF_IS_FINAL_CALC)) { smd->mCache = ss = _getSubSurf(smd->mCache, levels, useAging | CCG_CALC_NORMALS); - ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple); result = getCCGDerivedMesh(smd->mCache, @@ -3434,7 +3433,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived( useSubsurfUv, dm); } else { - if (smd->mCache && isFinalCalc) { + if (smd->mCache && (flags & SUBSURF_IS_FINAL_CALC)) { ccgSubSurf_free(smd->mCache); smd->mCache = NULL; } @@ -3444,7 +3443,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived( result = getCCGDerivedMesh(ss, drawInteriorEdges, useSubsurfUv, dm); - if (isFinalCalc) + if (flags & SUBSURF_IS_FINAL_CALC) smd->mCache = ss; else result->freeSS = 1; |