diff options
author | Ton Roosendaal <ton@blender.org> | 2005-10-29 15:36:21 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-10-29 15:36:21 +0400 |
commit | 750e801683faa2175218cec7a10c4020a43bf7bb (patch) | |
tree | f4308c7e3fdf568cf184e5f0b9c28cf262d7c846 /source/blender/src/transform_generics.c | |
parent | 16bc29816848b26fa56d1f5435b370d96d88fced (diff) |
New: Mirror Modifier now has option "Do Clipping", which prevents vertices
during Transform to go through the mirror. Note that it is *only* during
transform, and ESC restores the non-clipped positions of vertices.
Diffstat (limited to 'source/blender/src/transform_generics.c')
-rwxr-xr-x | source/blender/src/transform_generics.c | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c index 2173628a11b..3d8c4bddcf1 100755 --- a/source/blender/src/transform_generics.c +++ b/source/blender/src/transform_generics.c @@ -122,13 +122,49 @@ void getViewVector(float coord[3], float vec[3]) /* ************************** GENERICS **************************** */ -/* called for objects updating while transform acts, once per redraw */ +static void clipMirrorModifier(TransInfo *t, Object *ob) +{ + ModifierData *md= ob->modifiers.first; + + for (; md; md=md->next) + if (md->type==eModifierType_Mirror) + break; + if(md) { + MirrorModifierData *mmd = (MirrorModifierData*) md; + + if(mmd->flag & MOD_MIR_CLIPPING) { + TransData *td = t->data; + int i; + + for(i = 0 ; i < t->total; i++, td++) { + if (td->flag & TD_NOACTION) + break; + if(mmd->axis==0) { + if(td->loc[0]<0.0f) td->loc[0]= 0.0f; + } + else if(mmd->axis==1) { + if(td->loc[1]<0.0f) td->loc[1]= 0.0f; + } + else { + if(td->loc[2]<0.0f) td->loc[2]= 0.0f; + } + } + } + } +} + +/* called for updating while transform acts, once per redraw */ void recalcData(TransInfo *t) { Base *base; if (G.obedit) { if (G.obedit->type == OB_MESH) { + + /* mirror modifier clipping? */ + if(t->state != TRANS_CANCEL) + clipMirrorModifier(t, G.obedit); + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */ recalc_editnormals(); |