diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-04-04 13:20:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-04-04 13:20:46 +0400 |
commit | ef1af9f9c41a9cb33550bcaf396023ff840a3dab (patch) | |
tree | 0fa1e51908c7c1603d826eac5fbfca5dd4bef807 /source/blender/editors/transform/transform_constraints.c | |
parent | 82636ab0fbbeeccd3ca76d6ceb7ab018445acbc1 (diff) |
fix [#34802] Individual Transformation Confusing in Edit Mode
Individual transformation now works in editmode mesh faces/edge, armature bones and metaballs.
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r-- | source/blender/editors/transform/transform_constraints.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index f3026205ea2..7678051fd38 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -557,13 +557,17 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]) void setLocalConstraint(TransInfo *t, int mode, const char text[]) { + /* edit-mode now allows local transforms too */ +#if 0 if (t->flag & T_EDIT) { float obmat[3][3]; copy_m3_m4(obmat, t->scene->obedit->obmat); normalize_m3(obmat); setConstraint(t, obmat, mode, text); } - else { + else +#endif + { if (t->total == 1) { setConstraint(t, t->data->axismtx, mode, text); } @@ -743,37 +747,42 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) static void drawObjectConstraint(TransInfo *t) { - int i; - TransData *td = t->data; - /* Draw the first one lighter because that's the one who controls the others. * Meaning the transformation is projected on that one and just copied on the others * constraint space. * In a nutshell, the object with light axis is controlled by the user and the others follow. * Without drawing the first light, users have little clue what they are doing. */ - if (t->con.mode & CON_AXIS0) { - drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', DRAWLIGHT); - } - if (t->con.mode & CON_AXIS1) { - drawLine(t, td->ob->obmat[3], td->axismtx[1], 'Y', DRAWLIGHT); - } - if (t->con.mode & CON_AXIS2) { - drawLine(t, td->ob->obmat[3], td->axismtx[2], 'Z', DRAWLIGHT); - } + short options = DRAWLIGHT; + TransData *td = t->data; + int i; - td++; + for (i = 0; i < t->total; i++, td++) { + float co[3]; + + if (t->flag & T_OBJECT) { + copy_v3_v3(co, td->ob->obmat[3]); + } + else if (t->flag & T_EDIT) { + mul_v3_m4v3(co, t->obedit->obmat, td->center); + } + else if (t->flag & T_POSE) { + mul_v3_m4v3(co, t->poseobj->obmat, td->center); + } + else { + copy_v3_v3(co, td->center); + } - for (i = 1; i < t->total; i++, td++) { if (t->con.mode & CON_AXIS0) { - drawLine(t, td->ob->obmat[3], td->axismtx[0], 'X', 0); + drawLine(t, td->center, td->axismtx[0], 'X', options); } if (t->con.mode & CON_AXIS1) { - drawLine(t, td->ob->obmat[3], td->axismtx[1], 'Y', 0); + drawLine(t, td->center, td->axismtx[1], 'Y', options); } if (t->con.mode & CON_AXIS2) { - drawLine(t, td->ob->obmat[3], td->axismtx[2], 'Z', 0); + drawLine(t, td->center, td->axismtx[2], 'Z', options); } + options &= ~DRAWLIGHT; } } @@ -992,20 +1001,20 @@ char constraintModeToChar(TransInfo *t) } -int isLockConstraint(TransInfo *t) +bool isLockConstraint(TransInfo *t) { int mode = t->con.mode; if ((mode & (CON_AXIS0 | CON_AXIS1)) == (CON_AXIS0 | CON_AXIS1)) - return 1; + return true; if ((mode & (CON_AXIS1 | CON_AXIS2)) == (CON_AXIS1 | CON_AXIS2)) - return 1; + return true; if ((mode & (CON_AXIS0 | CON_AXIS2)) == (CON_AXIS0 | CON_AXIS2)) - return 1; + return true; - return 0; + return false; } /* |