== 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).
This commit is contained in:
Joshua Leung
2007-10-30 11:18:50 +00:00
parent b617c191aa
commit 0fb83a87b9
2 changed files with 24 additions and 12 deletions

View File

@@ -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);

View File

@@ -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));
}