Index: source/blender/blenkernel/intern/armature.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/armature.c,v retrieving revision 1.97 diff -u -p -u -r1.97 armature.c --- source/blender/blenkernel/intern/armature.c 28 Jan 2007 11:44:32 -0000 1.97 +++ source/blender/blenkernel/intern/armature.c 2 Feb 2007 08:57:42 -0000 @@ -1602,6 +1602,12 @@ static void do_local_constraint(bPoseCha pchan->loc[1]= FloatLerpf(pchant->loc[1], pchan->loc[1], fac); if (data->flag & LOCLIKE_Z) pchan->loc[2]= FloatLerpf(pchant->loc[2], pchan->loc[2], fac); + if (data->flag & LOCLIKE_X_INVERT) + pchan->loc[0]= FloatLerpf(pchant->loc[0], pchan->loc[0], -fac); + if (data->flag & LOCLIKE_Y_INVERT) + pchan->loc[1]= FloatLerpf(pchant->loc[1], pchan->loc[1], -fac); + if (data->flag & LOCLIKE_Z_INVERT) + pchan->loc[2]= FloatLerpf(pchant->loc[2], pchan->loc[2], -fac); } } } @@ -1621,6 +1627,9 @@ static void do_local_constraint(bPoseCha if(data->flag & ROTLIKE_X) euln[0]= FloatLerpf(eult[0], eul[0], fac); if(data->flag & ROTLIKE_Y) euln[1]= FloatLerpf(eult[1], eul[1], fac); if(data->flag & ROTLIKE_Z) euln[2]= FloatLerpf(eult[2], eul[2], fac); + if(data->flag & ROTLIKE_X_INVERT) euln[0]= FloatLerpf(eult[0], eul[0], -fac); + if(data->flag & ROTLIKE_Y_INVERT) euln[1]= FloatLerpf(eult[1], eul[1], -fac); + if(data->flag & ROTLIKE_Z_INVERT) euln[2]= FloatLerpf(eult[2], eul[2], -fac); compatible_eul(eul, euln); EulToQuat(euln, pchan->quat); } Index: source/blender/blenkernel/intern/constraint.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/constraint.c,v retrieving revision 1.61 diff -u -p -u -r1.61 constraint.c --- source/blender/blenkernel/intern/constraint.c 14 Jan 2007 23:42:06 -0000 1.61 +++ source/blender/blenkernel/intern/constraint.c 2 Feb 2007 08:57:42 -0000 @@ -1285,7 +1285,6 @@ short get_constraint_target_matrix (bCon return valid; } - /* only called during solve_constraints */ /* bone constraints create a fake object to work on, then ob is a workob */ /* if ownerdata is set, it's the posechannel */ @@ -1317,12 +1316,21 @@ void evaluate_constraint (bConstraint *c data = constraint->data; - if (data->flag & LOCLIKE_X) + if (data->flag & LOCLIKE_X) { ob->obmat[3][0] = targetmat[3][0]; - if (data->flag & LOCLIKE_Y) + + if(data->flag & LOCLIKE_X_INVERT) ob->obmat[3][0] *= -1; + } + if (data->flag & LOCLIKE_Y) { ob->obmat[3][1] = targetmat[3][1]; - if (data->flag & LOCLIKE_Z) + + if(data->flag & LOCLIKE_Y_INVERT) ob->obmat[3][1] *= -1; + } + if (data->flag & LOCLIKE_Z) { ob->obmat[3][2] = targetmat[3][2]; + + if(data->flag & LOCLIKE_Z_INVERT) ob->obmat[3][2] *= -1; + } } break; case CONSTRAINT_TYPE_ROTLIKE: @@ -1341,12 +1349,25 @@ void evaluate_constraint (bConstraint *c Mat4ToEul(ob->obmat, obeul); if(data->flag != (ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z)) { - if(!(data->flag & ROTLIKE_X)) eul[0]= obeul[0]; - if(!(data->flag & ROTLIKE_Y)) eul[1]= obeul[1]; - if(!(data->flag & ROTLIKE_Z)) eul[2]= obeul[2]; + if(!(data->flag & ROTLIKE_X)) { + eul[0]= obeul[0]; + } + if(!(data->flag & ROTLIKE_Y)) { + eul[1]= obeul[1]; + } + if(!(data->flag & ROTLIKE_Z)) { + eul[2]= obeul[2]; + } compatible_eul(eul, obeul); } - + + if((data->flag & ROTLIKE_X) && (data->flag & ROTLIKE_X_INVERT)) + eul[0]*=-1; + if((data->flag & ROTLIKE_Y) && (data->flag & ROTLIKE_Y_INVERT)) + eul[1]*=-1; + if((data->flag & ROTLIKE_Z) && (data->flag & ROTLIKE_Z_INVERT)) + eul[2]*=-1; + LocEulSizeToMat4(ob->obmat, loc, eul, size); } break; Index: source/blender/makesdna/DNA_constraint_types.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_constraint_types.h,v retrieving revision 1.34 diff -u -p -u -r1.34 DNA_constraint_types.h --- source/blender/makesdna/DNA_constraint_types.h 16 Dec 2006 05:49:05 -0000 1.34 +++ source/blender/makesdna/DNA_constraint_types.h 2 Feb 2007 08:57:42 -0000 @@ -253,15 +253,21 @@ typedef struct bRigidBodyJointConstraint #define CONSTRAINT_CHANNEL_PROTECTED 0x02 /* bRotateLikeConstraint.flag */ -#define ROTLIKE_X 0x01 -#define ROTLIKE_Y 0x02 -#define ROTLIKE_Z 0x04 +#define ROTLIKE_X 0x01 +#define ROTLIKE_Y 0x02 +#define ROTLIKE_Z 0x04 +#define ROTLIKE_X_INVERT 0x08 +#define ROTLIKE_Y_INVERT 0x10 +#define ROTLIKE_Z_INVERT 0x20 /* bLocateLikeConstraint.flag */ -#define LOCLIKE_X 0x01 -#define LOCLIKE_Y 0x02 -#define LOCLIKE_Z 0x04 -#define LOCSPACE 0x08 +#define LOCLIKE_X 0x01 +#define LOCLIKE_Y 0x02 +#define LOCLIKE_Z 0x04 +#define LOCSPACE 0x08 +#define LOCLIKE_X_INVERT 0x10 +#define LOCLIKE_Y_INVERT 0x20 +#define LOCLIKE_Z_INVERT 0x40 /* bSizeLikeConstraint.flag */ #define SIZELIKE_X 0x01 @@ -333,4 +339,3 @@ typedef struct bRigidBodyJointConstraint #define CONSTRAINT_RB_GENERIC6DOF 12 #endif - Index: source/blender/src/buttons_object.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_object.c,v retrieving revision 1.210 diff -u -p -u -r1.210 buttons_object.c --- source/blender/src/buttons_object.c 6 Jan 2007 10:59:07 -0000 1.210 +++ source/blender/src/buttons_object.c 2 Feb 2007 08:57:43 -0000 @@ -692,6 +692,9 @@ static void draw_constraint (uiBlock *bl but=uiDefButBitI(block, TOG, LOCLIKE_X, B_CONSTRAINT_TEST, "X", *xco+((width/2)-48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy X component"); but=uiDefButBitI(block, TOG, LOCLIKE_Y, B_CONSTRAINT_TEST, "Y", *xco+((width/2)-16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Y component"); but=uiDefButBitI(block, TOG, LOCLIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component"); + but=uiDefButBitI(block, TOG, LOCLIKE_X_INVERT, B_CONSTRAINT_TEST, "X-", *xco+((width/2)+48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert X component"); + but=uiDefButBitI(block, TOG, LOCLIKE_Y_INVERT, B_CONSTRAINT_TEST, "Y-", *xco+((width/2)+96), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Y component"); + but=uiDefButBitI(block, TOG, LOCLIKE_Z_INVERT, B_CONSTRAINT_TEST, "Z-", *xco+((width/2)+128), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Z component"); uiBlockEndAlign(block); } break; @@ -723,6 +726,9 @@ static void draw_constraint (uiBlock *bl but=uiDefButBitI(block, TOG, ROTLIKE_X, B_CONSTRAINT_TEST, "X", *xco+((width/2)-48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy X component"); but=uiDefButBitI(block, TOG, ROTLIKE_Y, B_CONSTRAINT_TEST, "Y", *xco+((width/2)-16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Y component"); but=uiDefButBitI(block, TOG, ROTLIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component"); + but=uiDefButBitI(block, TOG, ROTLIKE_X_INVERT, B_CONSTRAINT_TEST, "X-", *xco+((width/2)+48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert X component"); + but=uiDefButBitI(block, TOG, ROTLIKE_Y_INVERT, B_CONSTRAINT_TEST, "Y-", *xco+((width/2)+96), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Y component"); + but=uiDefButBitI(block, TOG, ROTLIKE_Z_INVERT, B_CONSTRAINT_TEST, "Z-", *xco+((width/2)+128), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Z component"); uiBlockEndAlign(block); } break; @@ -3129,4 +3135,3 @@ void physics_panels() object_panel_fluidsim(ob); } } -