diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-01-16 15:13:36 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-01-17 05:53:04 +0400 |
commit | 5c74ac2c2a41e70b487321fc6e1afb2625704b1c (patch) | |
tree | c69246c3c0f197fd9bef025d63b7c5f3bcb7bf95 /source/blender/modifiers | |
parent | 607df8090b4eeb2d7762734a2adb83e67e83124f (diff) |
Build Modifier - Add "Reversed" Option
This commit introduces the ability to make the Build Modifier operate in reverse,
essentially allowing it to be used as a "deconstruction" effect.
(See D219 for more details about use cases for this)
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_build.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c index d74044fa1ef..58fcbf76e8d 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.c @@ -119,7 +119,11 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), frac = (BKE_scene_frame_get(md->scene) - bmd->start) / bmd->length; CLAMP(frac, 0.0f, 1.0f); - + + if (bmd->flag & MOD_BUILD_FLAG_REVERSE) { + frac = 1.0 - frac; + } + numFaces_dst = numPoly_src * frac; numEdges_dst = numEdge_src * frac; @@ -129,7 +133,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), MLoop *ml, *mloop; MEdge *medge; - if (bmd->randomize) { + if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) { BLI_array_randomize(faceMap, sizeof(*faceMap), numPoly_src, bmd->seed); } @@ -174,7 +178,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), else if (numEdges_dst) { MEdge *medge, *me; - if (bmd->randomize) + if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) BLI_array_randomize(edgeMap, sizeof(*edgeMap), numEdge_src, bmd->seed); @@ -207,7 +211,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob), else { int numVerts = numVert_src * frac; - if (bmd->randomize) { + if (bmd->flag & MOD_BUILD_FLAG_RANDOMIZE) { BLI_array_randomize(vertMap, sizeof(*vertMap), numVert_src, bmd->seed); } |