From c4a1d655aeb54abcb4bdf02491e002d69020a786 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 1 Dec 2005 19:04:57 +0000 Subject: True X-mirror mesh editing! Set the option in EditMode, in 2nd mesh tools panel. It only works on transform options now (grab/rot/scale), and of course assumes a near- perfect symmetrical mesh. Mesh Object itself can be on any location though (and rotated etc). --- source/blender/src/transform_generics.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'source/blender/src/transform_generics.c') diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c index 0003ce71471..78aa7fe6122 100755 --- a/source/blender/src/transform_generics.c +++ b/source/blender/src/transform_generics.c @@ -57,6 +57,7 @@ #include "BIF_editarmature.h" #include "BIF_editmesh.h" #include "BIF_editsima.h" +#include "BIF_meshtools.h" #include "BKE_action.h" #include "BKE_anim.h" @@ -78,6 +79,7 @@ #include "BLI_arithb.h" #include "BLI_blenlib.h" +#include "BLI_editVert.h" #include "blendef.h" @@ -174,6 +176,28 @@ static void clipMirrorModifier(TransInfo *t, Object *ob) } } +/* assumes G.obedit set to mesh object */ +static void editmesh_apply_to_mirror(TransInfo *t) +{ + TransData *td = t->data; + EditVert *eve; + int i; + + for(i = 0 ; i < t->total; i++, td++) { + if (td->flag & TD_NOACTION) + break; + if (td->loc==NULL) + break; + + eve= td->tdmir; + if(eve) { + eve->co[0]= -td->loc[0]; + eve->co[1]= td->loc[1]; + eve->co[2]= td->loc[2]; + } + } +} + /* called for updating while transform acts, once per redraw */ void recalcData(TransInfo *t) { @@ -186,6 +210,9 @@ void recalcData(TransInfo *t) if(t->state != TRANS_CANCEL) clipMirrorModifier(t, G.obedit); + if(G.scene->toolsettings->editbutflag & B_MESH_X_MIRROR) + editmesh_apply_to_mirror(t); + DAG_object_flush_update(G.scene, G.obedit, OB_RECALC_DATA); /* sets recalc flags */ recalc_editnormals(); -- cgit v1.2.3