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>2005-05-10 08:21:11 +0400
committerMartin Poirier <theeth@yahoo.com>2005-05-10 08:21:11 +0400
commitd07dccc3869943c8c24275c59917429af4eae452 (patch)
tree8488705a716557daa0bfd2a8782db29f04306b87 /source/blender/src/transform_constraints.c
parent0c3f0556770ba1ef599400546beec62577904b35 (diff)
Found some time do sanitize the big Transform call:
- Splited off the event treatment into a fonction of its own - Splited off the initialisation phase into a function of its own (will have to do it for the manipulator function too) Calling transform now works like this: initTransform(mode, context) - possible post init calls, constraints mostly Transform() - eventually, the postTransform function, so that Transform is just a simple big loop which could in the end just be tied in the blender event system instead. - Added a state variable in TransInfo to replace the ret_val local variable. Possible values are: TRANS_RUNNING, TRANS_CANCEL, TRANS_CONFIRM - Tied MMB and the hotkey select for constraint together, so selecting an axis with MMB and pressing the axis key after that goes to local mode on that axis. Much less confusing.
Diffstat (limited to 'source/blender/src/transform_constraints.c')
-rwxr-xr-xsource/blender/src/transform_constraints.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
index fbcff3e7ef8..9ffce8f3544 100755
--- a/source/blender/src/transform_constraints.c
+++ b/source/blender/src/transform_constraints.c
@@ -552,17 +552,15 @@ void setConstraint(TransInfo *t, float space[3][3], int mode, const char text[])
void BIF_setLocalAxisConstraint(char axis, char *text) {
TransInfo *t = BIF_GetTransInfo();
- strncpy(t->con.text, text, 48);
-
switch (axis) {
case 'X':
- t->con.mode = (CON_AXIS0|CON_APPLY);
+ setLocalConstraint(t, CON_AXIS0, text);
break;
case 'Y':
- t->con.mode = (CON_AXIS1|CON_APPLY);
+ setLocalConstraint(t, CON_AXIS1, text);
break;
case 'Z':
- t->con.mode = (CON_AXIS2|CON_APPLY);
+ setLocalConstraint(t, CON_AXIS2, text);
break;
}
}
@@ -570,17 +568,15 @@ void BIF_setLocalAxisConstraint(char axis, char *text) {
void BIF_setLocalLockConstraint(char axis, char *text) {
TransInfo *t = BIF_GetTransInfo();
- strncpy(t->con.text, text, 48);
-
switch (axis) {
case 'x':
- t->con.mode = (CON_AXIS1|CON_AXIS2|CON_APPLY);
+ setLocalConstraint(t, (CON_AXIS1|CON_AXIS2), text);
break;
case 'y':
- t->con.mode = (CON_AXIS0|CON_AXIS2|CON_APPLY);
+ setLocalConstraint(t, (CON_AXIS0|CON_AXIS2), text);
break;
case 'z':
- t->con.mode = (CON_AXIS0|CON_AXIS1|CON_APPLY);
+ setLocalConstraint(t, (CON_AXIS0|CON_AXIS1), text);
break;
}
}
@@ -589,11 +585,11 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) {
if (t->flag & T_EDIT) {
float obmat[3][3];
Mat3CpyMat4(obmat, G.obedit->obmat);
- setConstraint(t, obmat, mode, text);
+ setConstraint(t, obmat, mode|CON_LOCAL, text);
}
else {
if (t->total == 1) {
- setConstraint(t, t->data->axismtx, mode, text);
+ setConstraint(t, t->data->axismtx, mode|CON_LOCAL, text);
}
else {
strncpy(t->con.text + 1, text, 48);
@@ -627,8 +623,6 @@ void BIF_setSingleAxisConstraint(float vec[3], char *text) {
Crossf(space[2], vec, space[1]);
Mat3Ortho(space);
- Mat3Ortho(space);
-
Mat3CpyMat3(t->con.mtx, space);
t->con.mode = (CON_AXIS0|CON_APPLY);
getConstraintMatrix(t);
@@ -796,6 +790,7 @@ void initSelectConstraint(TransInfo *t, float mtx[3][3])
Mat3CpyMat3(t->con.mtx, mtx);
t->con.mode |= CON_APPLY;
t->con.mode |= CON_SELECT;
+ t->con.mode &= ~CON_LOCAL;
setNearestAxis(t);
t->con.drawExtra = NULL;
@@ -893,3 +888,22 @@ void setNearestAxis(TransInfo *t)
}
getConstraintMatrix(t);
}
+
+char constraintModeToChar(TransInfo *t) {
+ if ((t->con.mode & CON_APPLY)==0) {
+ return '\0';
+ }
+ switch (t->con.mode & (CON_AXIS0|CON_AXIS1|CON_AXIS2)) {
+ case (CON_AXIS0):
+ case (CON_AXIS1|CON_AXIS2):
+ return 'X';
+ case (CON_AXIS1):
+ case (CON_AXIS0|CON_AXIS2):
+ return 'Y';
+ case (CON_AXIS2):
+ case (CON_AXIS0|CON_AXIS1):
+ return 'Z';
+ default:
+ return '\0';
+ }
+}