diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_multires.h | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/multires.c | 17 | ||||
-rw-r--r-- | source/blender/editors/object/object_bake.c | 6 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_multires.c | 6 |
4 files changed, 27 insertions, 13 deletions
diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index bc34b0131bf..e695fb83c23 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -59,8 +59,15 @@ void multires_modifier_update_hidden(struct DerivedMesh *dm); void multiresModifier_set_levels_from_disps(struct MultiresModifierData *mmd, struct Object *ob); -struct DerivedMesh *multires_dm_create_from_derived(struct MultiresModifierData*, - int local_mmd, struct DerivedMesh*, struct Object *, int); +typedef enum { + MULTIRES_USE_LOCAL_MMD = 1, + MULTIRES_USE_RENDER_PARAMS = 2, +} MultiresFlags; + +struct DerivedMesh *multires_make_derived_from_derived(struct DerivedMesh *dm, + struct MultiresModifierData *mmd, + struct Object *ob, + MultiresFlags flags); struct MultiresModifierData *find_multires_modifier_before(struct Scene *scene, struct ModifierData *lastmd); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 886278eb809..37407ce7342 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -678,7 +678,7 @@ static DerivedMesh *multires_dm_create_local(Object *ob, DerivedMesh *dm, int lv mmd.totlvl = totlvl; mmd.simple = simple; - return multires_dm_create_from_derived(&mmd, 1, dm, ob, 0); + return multires_make_derived_from_derived(dm, &mmd, ob, MULTIRES_USE_LOCAL_MMD); } static DerivedMesh *subsurf_dm_create_local(Object *ob, DerivedMesh *dm, int lvl, int simple, int optimal, int plain_uv) @@ -1326,15 +1326,16 @@ void multires_stitch_grids(Object *ob) } } -DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, - int local_mmd, DerivedMesh *dm, - Object *ob, int useRenderParams) +DerivedMesh *multires_make_derived_from_derived(DerivedMesh *dm, + MultiresModifierData *mmd, + Object *ob, + MultiresFlags flags) { Mesh *me = ob->data; DerivedMesh *result; CCGDerivedMesh *ccgdm = NULL; DMGridData **gridData, **subGridData; - int lvl = multires_get_level(ob, mmd, useRenderParams); + int lvl = multires_get_level(ob, mmd, (flags & MULTIRES_USE_RENDER_PARAMS)); int i, gridSize, numGrids; if (lvl == 0) @@ -1344,12 +1345,12 @@ DerivedMesh *multires_dm_create_from_derived(MultiresModifierData *mmd, mmd->simple, mmd->flags & eMultiresModifierFlag_ControlEdges, mmd->flags & eMultiresModifierFlag_PlainUv); - if (!local_mmd) { + if (!(flags & MULTIRES_USE_LOCAL_MMD)) { ccgdm = (CCGDerivedMesh *)result; ccgdm->multires.ob = ob; ccgdm->multires.mmd = mmd; - ccgdm->multires.local_mmd = local_mmd; + ccgdm->multires.local_mmd = 0; ccgdm->multires.lvl = lvl; ccgdm->multires.totlvl = mmd->totlvl; ccgdm->multires.modified_flags = 0; @@ -1993,7 +1994,7 @@ void multires_load_old(Object *ob, Mesh *me) mmd->lvl = mmd->totlvl; orig = CDDM_from_mesh(me, NULL); - dm = multires_dm_create_from_derived(mmd, 0, orig, ob, 0); + dm = multires_make_derived_from_derived(orig, mmd, ob, 0); multires_load_old_dm(dm, me, mmd->totlvl + 1); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 1aaf42ae785..91acb18dfda 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -1020,7 +1020,8 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l tmp_mmd.lvl = *lvl; tmp_mmd.sculptlvl = *lvl; - dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0); + dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, + MULTIRES_USE_LOCAL_MMD); cddm->release(cddm); } @@ -1040,7 +1041,8 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l tmp_mmd.lvl = mmd->totlvl; tmp_mmd.sculptlvl = mmd->totlvl; - dm = multires_dm_create_from_derived(&tmp_mmd, 1, cddm, ob, 0); + dm = multires_make_derived_from_derived(cddm, &tmp_mmd, ob, + MULTIRES_USE_LOCAL_MMD); cddm->release(cddm); return dm; diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index 6b181bd2c6d..ee2c7c82c42 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -77,6 +77,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, DerivedMesh *result; Mesh *me = (Mesh *)ob->data; const int useRenderParams = flag & MOD_APPLY_RENDER; + MultiresFlags flags = 0; if (mmd->totlvl) { if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) { @@ -85,7 +86,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, } } - result = multires_dm_create_from_derived(mmd, 0, dm, ob, useRenderParams); + if (useRenderParams) + flags |= MULTIRES_USE_RENDER_PARAMS; + + result = multires_make_derived_from_derived(dm, mmd, ob, flags); if (result == dm) return dm; |