use 'normal' orientation rather then 'local' with individual origins to use the per...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 1 May 2013 05:26:10 +0000 (05:26 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 1 May 2013 05:26:10 +0000 (05:26 +0000)
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_constraints.c

index a07ddbdb0924e17fd7c0f70002ebc3b23ad9158f..989525fffb80d6c050f55ff6538b4f9a2c307286 100644 (file)
@@ -7540,4 +7540,17 @@ bool checkUseLocalCenter_GraphEdit(TransInfo *t)
        return ((t->around == V3D_LOCAL) && !ELEM3(t->mode, TFM_TRANSLATION, TFM_TIME_TRANSLATE, TFM_TIME_SLIDE));
 }
 
+bool checkUseAxisMatrix(TransInfo *t)
+{
+       /* currenly only checks for editmode */
+       if (t->flag & T_EDIT) {
+               if ((t->around == V3D_LOCAL) && (ELEM3(t->obedit->type, OB_MESH, OB_MBALL, OB_ARMATURE))) {
+                       /* not all editmode supports axis-matrix */
+                       return true;
+               }
+       }
+
+       return false;
+}
+
 #undef MAX_INFO_LEN
index ed9657b0586c05ecc79deb19d30227741d2eed7a..26f36db2f4c85c83f5de5149361a718b994ccee3 100644 (file)
@@ -622,6 +622,7 @@ void drawConstraint(TransInfo *t);
 
 void getConstraintMatrix(TransInfo *t);
 void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[]);
+void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[]);
 void setLocalConstraint(TransInfo *t, int mode, const char text[]);
 void setUserConstraint(TransInfo *t, short orientation, int mode, const char text[]);
 
@@ -752,5 +753,6 @@ void freeVertSlideVerts(TransInfo *t);
 
 /* TODO. transform_queries.c */
 bool checkUseLocalCenter_GraphEdit(TransInfo *t);
+bool checkUseAxisMatrix(TransInfo *t);
 
 #endif
index ab03b7f75ea1bb156da8776423b3ca1fa0a3262d..27b25a50eff77e6d95349b8df4651e6c8c38bddd 100644 (file)
@@ -572,36 +572,36 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
        t->redraw = 1;
 }
 
+/* applies individual td->axismtx constraints */
+void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[])
+{
+       if (t->total == 1) {
+               setConstraint(t, t->data->axismtx, mode, text);
+       }
+       else {
+               BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
+               copy_m3_m3(t->con.mtx, t->data->axismtx);
+               t->con.mode = mode;
+               getConstraintMatrix(t);
+
+               startConstraint(t);
+
+               t->con.drawExtra = drawObjectConstraint;
+               t->con.applyVec = applyObjectConstraintVec;
+               t->con.applySize = applyObjectConstraintSize;
+               t->con.applyRot = applyObjectConstraintRot;
+               t->redraw = 1;
+       }
+}
+
 void setLocalConstraint(TransInfo *t, int mode, const char text[])
 {
        /* edit-mode now allows local transforms too */
-#if 1
-       if ((t->flag & T_EDIT) &&
-           /* not all editmode supports axis-matrix */
-           ((t->around != V3D_LOCAL) || (!ELEM3(t->obedit->type, OB_MESH, OB_MBALL, OB_ARMATURE))))
-       {
+       if (t->flag & T_EDIT) {
                setConstraint(t, t->obedit_mat, mode, text);
        }
-       else
-#endif
-       {
-               if (t->total == 1) {
-                       setConstraint(t, t->data->axismtx, mode, text);
-               }
-               else {
-                       BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1);
-                       copy_m3_m3(t->con.mtx, t->data->axismtx);
-                       t->con.mode = mode;
-                       getConstraintMatrix(t);
-
-                       startConstraint(t);
-
-                       t->con.drawExtra = drawObjectConstraint;
-                       t->con.applyVec = applyObjectConstraintVec;
-                       t->con.applySize = applyObjectConstraintSize;
-                       t->con.applyRot = applyObjectConstraintRot;
-                       t->redraw = 1;
-               }
+       else {
+               setAxisMatrixConstraint(t, mode, text);
        }
 }
 
@@ -629,7 +629,12 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
                        break;
                case V3D_MANIP_NORMAL:
                        BLI_snprintf(text, sizeof(text), ftext, IFACE_("normal"));
-                       setConstraint(t, t->spacemtx, mode, text);
+                       if (checkUseAxisMatrix(t)) {
+                               setAxisMatrixConstraint(t, mode, text);
+                       }
+                       else {
+                               setConstraint(t, t->spacemtx, mode, text);
+                       }
                        break;
                case V3D_MANIP_VIEW:
                        BLI_snprintf(text, sizeof(text), ftext, IFACE_("view"));