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:
authorCampbell Barton <ideasman42@gmail.com>2013-05-01 09:26:10 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-05-01 09:26:10 +0400
commit30c7183874b64da9b7058399979d06b2e0bec3c4 (patch)
tree9b468858980ceb6319eea41f40ce88fafa51ed18
parent12476d157a240aec48cee4ddb648701fb2ba188e (diff)
use 'normal' orientation rather then 'local' with individual origins to use the per-element axis-matrix.
-rw-r--r--source/blender/editors/transform/transform.c13
-rw-r--r--source/blender/editors/transform/transform.h2
-rw-r--r--source/blender/editors/transform/transform_constraints.c57
3 files changed, 46 insertions, 26 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index a07ddbdb092..989525fffb8 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -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
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index ed9657b0586..26f36db2f4c 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -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
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index ab03b7f75ea..27b25a50eff 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -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"));