Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2009-10-16 01:54:22 +0400
committerMartin Poirier <theeth@yahoo.com>2009-10-16 01:54:22 +0400
commit6ffb79107c9509f01019c8bf9af2caf0348ca330 (patch)
tree14c81cb738c3ffc7a1efc6d0121ee45a6e51f068 /source/blender/editors
parentdcecd8e043962c9f38b15d569849d0303773af32 (diff)
X Mirror editmesh with PET
Lock vertice near the middle (|x| < 0.0001) on the mirror's plane. Don't propagate transformation across mirror plane (this could probably be smarter)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/transform/transform.h5
-rw-r--r--source/blender/editors/transform/transform_conversions.c16
-rw-r--r--source/blender/editors/transform/transform_generics.c15
3 files changed, 34 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 5cee1f51b0a..fc31fad622a 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -215,7 +215,7 @@ typedef struct TransData {
TransDataExtension *ext; /* for objects, poses. 1 single malloc per TransInfo! */
TransDataCurveHandleFlags *hdata; /* for curves, stores handle flags for modification/cancel */
void *extra; /* extra data (mirrored element pointer, in editmode mesh to EditVert) (editbone for roll fixing) (...) */
- short flag; /* Various flags */
+ int flag; /* Various flags */
short protectflag; /* If set, copy of Object or PoseChannel protection */
int rotOrder; /* rotation mode, as defined in eRotationModes (DNA_action_types.h) */
} TransData;
@@ -289,6 +289,8 @@ typedef struct TransInfo {
short current_orientation;
short prop_mode;
+
+ short mirror;
float values[4];
float auto_values[4];
@@ -398,6 +400,7 @@ typedef struct TransInfo {
#define TD_NO_LOC (1 << 13) /* when this is set, don't apply translation changes to this element */
#define TD_NOTIMESNAP (1 << 14) /* for Graph Editor autosnap, indicates that point should not undergo autosnapping */
#define TD_INTVALUES (1 << 15) /* for Graph Editor - curves that can only have int-values need their keyframes tagged with this */
+#define TD_MIRROR_EDGE (1 << 16) /* For editmode mirror, clamp to x = 0 */
/* transsnap->status */
#define SNAP_ON 1
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 317457ee33f..496a9665371 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2214,7 +2214,10 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
for (eve=em->verts.first; eve; eve=eve->next) {
if(eve->h==0 && eve->f1 && eve->co[0]!=0.0f) {
if(eve->co[0]<0.0f)
+ {
+ t->mirror = -1;
mirror = -1;
+ }
break;
}
}
@@ -2280,6 +2283,19 @@ static void createTransEditVerts(bContext *C, TransInfo *t)
}
}
}
+
+ if (mirror != 0)
+ {
+ tob = t->data;
+ for( a = 0; a < t->total; a++, tob++ )
+ {
+ if (ABS(tob->loc[0]) <= 0.00001f)
+ {
+ tob->flag |= TD_MIRROR_EDGE;
+ }
+ }
+ }
+
if (propmode) {
MEM_freeN(vectors);
MEM_freeN(nears);
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index 47f76aab4ca..8dc71710d82 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -259,11 +259,16 @@ static void editmesh_apply_to_mirror(TransInfo *t)
continue;
eve = td->extra;
- if(eve) {
+ if (eve) {
eve->co[0]= -td->loc[0];
eve->co[1]= td->loc[1];
eve->co[2]= td->loc[2];
}
+
+ if (td->flag & TD_MIRROR_EDGE)
+ {
+ td->loc[0] = 0;
+ }
}
}
@@ -969,6 +974,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (RNA_boolean_get(op->ptr, "mirror"))
{
t->flag |= T_MIRROR;
+ t->mirror = 1;
}
}
// Need stuff to take it from edit mesh or whatnot here
@@ -977,6 +983,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X))
{
t->flag |= T_MIRROR;
+ t->mirror = 1;
}
}
@@ -1373,6 +1380,12 @@ void calculatePropRatio(TransInfo *t)
if (td->flag & TD_SELECTED) {
td->factor = 1.0f;
}
+ else if (t->flag & T_MIRROR && td->loc[0] * t->mirror < -0.00001f)
+ {
+ td->flag |= TD_SKIP;
+ td->factor = 0.0f;
+ restoreElement(td);
+ }
else if ((connected &&
(td->flag & TD_NOTCONNECTED || td->dist > t->prop_size))
||