=== Constraints ===
authorMartin Poirier <theeth@yahoo.com>
Sun, 18 Mar 2007 14:53:17 +0000 (14:53 +0000)
committerMartin Poirier <theeth@yahoo.com>
Sun, 18 Mar 2007 14:53:17 +0000 (14:53 +0000)
Patch by Juho Vepsäläinen (bebraw)
[ #5850 ] Inverted axis' buttons to Copy Rotation and Copy Location constraints

This patch adds the options to invert the value being copied from each axis of the Copy Rot/Copy Loc constraints.

This commit also includes some slight code sanitization and tool tips cleanup (for the two track constraints, the tool tips were really unuseful).

source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/constraint.c
source/blender/makesdna/DNA_constraint_types.h
source/blender/src/buttons_object.c

index f40c6ed9ceb5ef1674a79fc42994ec6576268ff6..9c764f58315a501a50da7e8d0b62644fa5e30bfe 100644 (file)
@@ -1620,6 +1620,12 @@ static void do_local_constraint(bPoseChannel *pchan, bConstraint *con)
                                                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);
                                }
                        }
                }
@@ -1639,6 +1645,9 @@ static void do_local_constraint(bPoseChannel *pchan, bConstraint *con)
                                                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 70a5a5220a0c1cdeedcdf0f60eacc4c912123cee..19bd843edbee120733154e1ccc7e31895dea4210 100644 (file)
@@ -1241,7 +1241,6 @@ short get_constraint_target_matrix (bConstraint *con, short ownertype, void* own
        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 */
@@ -1277,12 +1276,21 @@ void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype,
 
                        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:
@@ -1301,12 +1309,25 @@ void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype,
                        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 2eb1139dd07d0dbb4c17b61a828ab5d8d5a01eb9..0aa78a12a9f004fc2d8d71ae62e11d79e143cc30 100644 (file)
@@ -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 de80909433f88ab6cd556028988dd452d76c8b4b..e1ace701e888a52579b823783bbf4c66b55fac91 100644 (file)
@@ -581,8 +581,9 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                        BIF_ThemeColor(TH_REDALERT);
                        uiBlockSetCol(block, TH_REDALERT);
                }
-               else
+               else {
                        BIF_ThemeColor(curCol);
+               }
 
                /*if (type==TARGET_BONE)
                        but = uiDefButC(block, MENU, B_CONSTRAINT_TEST, "Bone Constraint%t|Track To%x2|IK Solver%x3|Copy Rotation%x8|Copy Location%x9|Action%x12|Null%x0", *xco+20, *yco, 100, 20, &con->type, 0.0, 0.0, 0.0, 0.0, "Constraint type"); 
@@ -603,8 +604,9 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                        uiBlockSetCol(block, TH_REDALERT);
                        BIF_ThemeColor(TH_REDALERT);
                }
-               else
+               else {
                        BIF_ThemeColor(curCol);
+               }
                
                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, typestr, *xco+10, *yco, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
                
@@ -644,8 +646,10 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
 
                                /* Draw action button */
@@ -681,17 +685,23 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
                                
                                /* Draw XYZ toggles */
                                uiBlockBeginAlign(block);
                                if (is_armature_target)
                                        uiDefButBitS(block, TOG, CONSTRAINT_LOCAL, B_CONSTRAINT_TEST, "Local", *xco+((width/2)-98), *yco-64, 50, 18, &con->flag, 0, 24, 0, 0, "Work on a Pose's local transform");
+                                       
                                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, "-", *xco+((width/2)-16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert 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_Y_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Y component");
+                               but=uiDefButBitI(block, TOG, LOCLIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+96), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component");
+                               but=uiDefButBitI(block, TOG, LOCLIKE_Z_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+128), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Z component");
                                uiBlockEndAlign(block);
                        }
                        break;
@@ -712,17 +722,23 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
                                
                                /* Draw XYZ toggles */
                                uiBlockBeginAlign(block);
                                if (is_armature_target)
                                        uiDefButBitS(block, TOG, CONSTRAINT_LOCAL, B_CONSTRAINT_TEST, "Local", *xco+((width/2)-98), *yco-64, 50, 18, &con->flag, 0, 24, 0, 0, "Work on a Pose's local transform");
+                                       
                                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, "-", *xco+((width/2)-16), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert 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_Y_INVERT, B_CONSTRAINT_TEST, "-", *xco+((width/2)+48), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Invert Y component");
+                               but=uiDefButBitI(block, TOG, ROTLIKE_Z, B_CONSTRAINT_TEST, "Z", *xco+((width/2)+96), *yco-64, 32, 18, &data->flag, 0, 24, 0, 0, "Copy Z component");
+                               but=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);
                        }
                        break;
@@ -743,8 +759,10 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
 
                                /* Draw XYZ toggles */
@@ -776,8 +794,9 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,19, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
        
                                uiBlockBeginAlign(block);
                                uiDefButBitS(block, TOG, CONSTRAINT_IK_TIP, B_CONSTRAINT_TEST, "Use Tip", *xco, *yco-64, 137, 19, &data->flag, 0, 0, 0, 0, "Include Bone's tip als last element in Chain");
@@ -811,8 +830,10 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
 
                                uiBlockBeginAlign(block);
@@ -824,20 +845,20 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                uiBlockBeginAlign(block);
                                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", *xco+12, *yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
                                
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+39, *yco-64,17,18, &data->reserved1, 12.0, 0.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+56, *yco-64,17,18, &data->reserved1, 12.0, 1.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+73, *yco-64,17,18, &data->reserved1, 12.0, 2.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X",    *xco+90, *yco-64,24,18, &data->reserved1, 12.0, 3.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y",    *xco+114, *yco-64,24,18, &data->reserved1, 12.0, 4.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z",    *xco+138, *yco-64,24,18, &data->reserved1, 12.0, 5.0, 0, 0, "The axis that points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+39, *yco-64,17,18, &data->reserved1, 12.0, 0.0, 0, 0, "X axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+56, *yco-64,17,18, &data->reserved1, 12.0, 1.0, 0, 0, "Y axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+73, *yco-64,17,18, &data->reserved1, 12.0, 2.0, 0, 0, "Z axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X",    *xco+90, *yco-64,24,18, &data->reserved1, 12.0, 3.0, 0, 0, "-X axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y",    *xco+114, *yco-64,24,18, &data->reserved1, 12.0, 4.0, 0, 0, "-Y axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z",    *xco+138, *yco-64,24,18, &data->reserved1, 12.0, 5.0, 0, 0, "-Z axis points to the target object");
                                uiBlockEndAlign(block);
                                
                                uiBlockBeginAlign(block);
                                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Up:", *xco+174, *yco-64, 30, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
                                
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+204, *yco-64,17,18, &data->reserved2, 13.0, 0.0, 0, 0, "The axis that points upward");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+221, *yco-64,17,18, &data->reserved2, 13.0, 1.0, 0, 0, "The axis that points upward");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+238, *yco-64,17,18, &data->reserved2, 13.0, 2.0, 0, 0, "The axis that points upward");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+204, *yco-64,17,18, &data->reserved2, 13.0, 0.0, 0, 0, "X axis points upward");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+221, *yco-64,17,18, &data->reserved2, 13.0, 1.0, 0, 0, "Y axis points upward");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+238, *yco-64,17,18, &data->reserved2, 13.0, 2.0, 0, 0, "Z axis points upward");
                                uiBlockEndAlign(block);
                        }
                        break;
@@ -860,8 +881,10 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
 
                                but=uiDefButI(block, TOG|BIT|0, B_CONSTRAINT_TEST, "Sticky", *xco, *yco-24, 44, 18, &data->flag, 0, 24, 0, 0, "Immobilize object while constrained");
@@ -895,27 +918,29 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
                                
                                uiBlockBeginAlign(block);
                                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "To:", *xco+12, *yco-64, 25, 18, NULL, 0.0, 0.0, 0.0, 0.0, ""); 
                                
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X",    *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y",    *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "The axis that points to the target object");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z",    *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "The axis that points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+39, *yco-64,17,18, &data->trackflag, 12.0, 0.0, 0, 0, "X axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+56, *yco-64,17,18, &data->trackflag, 12.0, 1.0, 0, 0, "Y axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+73, *yco-64,17,18, &data->trackflag, 12.0, 2.0, 0, 0, "Z axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-X",    *xco+90, *yco-64,24,18, &data->trackflag, 12.0, 3.0, 0, 0, "-X axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Y",    *xco+114, *yco-64,24,18, &data->trackflag, 12.0, 4.0, 0, 0, "-Y axis points to the target object");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"-Z",    *xco+138, *yco-64,24,18, &data->trackflag, 12.0, 5.0, 0, 0, "-Z axis points to the target object");
                                uiBlockEndAlign(block);
                                
                                uiBlockBeginAlign(block);
                                uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Lock:", *xco+166, *yco-64, 38, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
                                
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+204, *yco-64,17,18, &data->lockflag, 13.0, 0.0, 0, 0, "The axis that is locked");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+221, *yco-64,17,18, &data->lockflag, 13.0, 1.0, 0, 0, "The axis that is locked");
-                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+238, *yco-64,17,18, &data->lockflag, 13.0, 2.0, 0, 0, "The axis that is locked");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"X",     *xco+204, *yco-64,17,18, &data->lockflag, 13.0, 0.0, 0, 0, "X axis is locked");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Y",     *xco+221, *yco-64,17,18, &data->lockflag, 13.0, 1.0, 0, 0, "Y axis is locked");
+                               uiDefButI(block, ROW,B_CONSTRAINT_TEST,"Z",     *xco+238, *yco-64,17,18, &data->lockflag, 13.0, 2.0, 0, 0, "Z axis is locked");
                                uiBlockEndAlign(block);
                        }
                        break;
@@ -974,8 +999,10 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", *xco+120, *yco-42,135,18, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
                                        uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
                                }
-                               else
+                               else {
                                        strcpy (data->subtarget, "");
+                               }
+                               
                                uiBlockEndAlign(block);
 
                                
@@ -1106,6 +1133,7 @@ static void draw_constraint (uiBlock *block, ListBase *list, bConstraint *con, s
                                        height = 106; 
                                else
                                        height = 78;
+                                       
                                uiDefBut(block, ROUNDBOX, B_DIFF, "", *xco-10, *yco-height, width+40,height-1, NULL, 5.0, 0.0, 12, rb_col, ""); 
                                
                                /* Draw Pairs of LimitToggle+LimitValue */