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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-10-30 14:18:50 +0300
committerJoshua Leung <aligorith@gmail.com>2007-10-30 14:18:50 +0300
commit0fb83a87b9e42c5216d5507a9ce19f53e2ae8095 (patch)
tree2a3c8d6956c29646c67d8d890cd3fd0d892f077f /source
parentb617c191aaa039a783b77769d0bd15d898adbd8c (diff)
== Copy Rotation Constraint - Peach (Cessen) Request ==
Copy Rotation constraint now has ability for the owner's rotation to be added on top of the copied rotation (i.e. an 'offset' like for the Copy Location constraint).
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/constraint.c33
-rw-r--r--source/blender/src/buttons_object.c3
2 files changed, 24 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index aceef7d628b..1e6f7e4d9e3 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -1695,25 +1695,34 @@ static void rotlike_evaluate (bConstraint *con, bConstraintOb *cob, ListBase *ta
Mat4ToEul(ct->matrix, eul);
Mat4ToEul(cob->matrix, obeul);
- if ((data->flag & ROTLIKE_X)==0) {
+ if ((data->flag & ROTLIKE_X)==0)
eul[0] = obeul[0];
+ else {
+ if (data->flag & ROTLIKE_OFFSET)
+ euler_rot(eul, obeul[0], 'x');
+
+ if (data->flag & ROTLIKE_X_INVERT)
+ eul[0] *= -1;
}
- else if (data->flag & ROTLIKE_X_INVERT) {
- eul[0] *= -1;
- }
- if ((data->flag & ROTLIKE_Y)==0) {
+ if ((data->flag & ROTLIKE_Y)==0)
eul[1] = obeul[1];
- }
- else if (data->flag & ROTLIKE_Y_INVERT) {
- eul[1] *= -1;
+ else {
+ if (data->flag & ROTLIKE_OFFSET)
+ euler_rot(eul, obeul[1], 'y');
+
+ if (data->flag & ROTLIKE_Y_INVERT)
+ eul[1] *= -1;
}
- if ((data->flag & ROTLIKE_Z)==0) {
+ if ((data->flag & ROTLIKE_Z)==0)
eul[2] = obeul[2];
- }
- else if (data->flag & ROTLIKE_Z_INVERT) {
- eul[2] *= -1;
+ else {
+ if (data->flag & ROTLIKE_OFFSET)
+ euler_rot(eul, obeul[2], 'z');
+
+ if (data->flag & ROTLIKE_Z_INVERT)
+ eul[2] *= -1;
}
compatible_eul(eul, obeul);
diff --git a/source/blender/src/buttons_object.c b/source/blender/src/buttons_object.c
index 35db9294af1..52163fa150b 100644
--- a/source/blender/src/buttons_object.c
+++ b/source/blender/src/buttons_object.c
@@ -850,6 +850,9 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
uiDefButBitI(block, TOG, ROTLIKE_Z_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+128), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Z component");
uiBlockEndAlign(block);
+ /* draw offset toggle */
+ uiDefButBitI(block, TOG, ROTLIKE_OFFSET, B_CONSTRAINT_TEST, "Offset", *xco, *yco-64, 80, 18, &data->flag, 0, 24, 0, 0, "Copy X component");
+
/* constraint space settings */
draw_constraint_spaceselect(block, con, *xco, *yco-94, is_armature_owner(ob), is_armature_target(data->tar));
}