Fix #32964: IK constraint had a "Target" option, which actually is an internal
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 24 Oct 2012 22:36:06 +0000 (22:36 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 24 Oct 2012 22:36:06 +0000 (22:36 +0000)
flag that shouldn't have been exposed in the user interface. Also avoided many
calls to pchan.is_in_ik_chain in UI script, it's somewhat slow.

release/scripts/startup/bl_ui/properties_data_bone.py
release/scripts/startup/bl_ui/properties_object_constraint.py
source/blender/blenloader/intern/readfile.c
source/blender/makesrna/intern/rna_constraint.c

index 1e70483..1441c64 100644 (file)
@@ -246,72 +246,74 @@ class BONE_PT_inverse_kinematics(BoneButtonsPanel, Panel):
         row = layout.row()
         row.prop(ob.pose, "ik_solver")
 
+        active = pchan.is_in_ik_chain
+
         split = layout.split(percentage=0.25)
         split.prop(pchan, "lock_ik_x", icon='LOCKED' if pchan.lock_ik_x else 'UNLOCKED', text="X")
-        split.active = pchan.is_in_ik_chain
+        split.active = active
         row = split.row()
         row.prop(pchan, "ik_stiffness_x", text="Stiffness", slider=True)
-        row.active = pchan.lock_ik_x is False and pchan.is_in_ik_chain
+        row.active = pchan.lock_ik_x is False and active
 
         split = layout.split(percentage=0.25)
         sub = split.row()
 
         sub.prop(pchan, "use_ik_limit_x", text="Limit")
-        sub.active = pchan.lock_ik_x is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_x is False and active
         sub = split.row(align=True)
         sub.prop(pchan, "ik_min_x", text="")
         sub.prop(pchan, "ik_max_x", text="")
-        sub.active = pchan.lock_ik_x is False and pchan.use_ik_limit_x and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_x is False and pchan.use_ik_limit_x and active
 
         split = layout.split(percentage=0.25)
         split.prop(pchan, "lock_ik_y", icon='LOCKED' if pchan.lock_ik_y else 'UNLOCKED', text="Y")
-        split.active = pchan.is_in_ik_chain
+        split.active = active
         row = split.row()
         row.prop(pchan, "ik_stiffness_y", text="Stiffness", slider=True)
-        row.active = pchan.lock_ik_y is False and pchan.is_in_ik_chain
+        row.active = pchan.lock_ik_y is False and active
 
         split = layout.split(percentage=0.25)
         sub = split.row()
 
         sub.prop(pchan, "use_ik_limit_y", text="Limit")
-        sub.active = pchan.lock_ik_y is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_y is False and active
 
         sub = split.row(align=True)
         sub.prop(pchan, "ik_min_y", text="")
         sub.prop(pchan, "ik_max_y", text="")
-        sub.active = pchan.lock_ik_y is False and pchan.use_ik_limit_y and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_y is False and pchan.use_ik_limit_y and active
 
         split = layout.split(percentage=0.25)
         split.prop(pchan, "lock_ik_z", icon='LOCKED' if pchan.lock_ik_z else 'UNLOCKED', text="Z")
-        split.active = pchan.is_in_ik_chain
+        split.active = active
         sub = split.row()
         sub.prop(pchan, "ik_stiffness_z", text="Stiffness", slider=True)
-        sub.active = pchan.lock_ik_z is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_z is False and active
 
         split = layout.split(percentage=0.25)
         sub = split.row()
 
         sub.prop(pchan, "use_ik_limit_z", text="Limit")
-        sub.active = pchan.lock_ik_z is False and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_z is False and active
         sub = split.row(align=True)
         sub.prop(pchan, "ik_min_z", text="")
         sub.prop(pchan, "ik_max_z", text="")
-        sub.active = pchan.lock_ik_z is False and pchan.use_ik_limit_z and pchan.is_in_ik_chain
+        sub.active = pchan.lock_ik_z is False and pchan.use_ik_limit_z and active
 
         split = layout.split(percentage=0.25)
         split.label(text="Stretch:")
         sub = split.row()
         sub.prop(pchan, "ik_stretch", text="", slider=True)
-        sub.active = pchan.is_in_ik_chain
+        sub.active = active
 
         if ob.pose.ik_solver == 'ITASC':
             split = layout.split()
             col = split.column()
             col.prop(pchan, "use_ik_rotation_control", text="Control Rotation")
-            col.active = pchan.is_in_ik_chain
+            col.active = active
             col = split.column()
             col.prop(pchan, "ik_rotation_weight", text="Weight", slider=True)
-            col.active = pchan.is_in_ik_chain
+            col.active = active
             # not supported yet
             #row = layout.row()
             #row.prop(pchan, "use_ik_linear_control", text="Joint Size")
index 1eac232..3fa63ba 100644 (file)
@@ -88,7 +88,6 @@ class ConstraintButtonsPanel():
 
         col = split.column()
         col.prop(con, "chain_count")
-        col.prop(con, "use_target")
 
     def CHILD_OF(self, context, layout, con):
         self.target_template(layout, con)
@@ -162,7 +161,6 @@ class ConstraintButtonsPanel():
             col.prop(con, "use_tail")
             col.prop(con, "use_stretch")
             col.separator()
-            col.prop(con, "use_target")
             col.prop(con, "use_rotation")
 
     def IK_COPY_POSE(self, context, layout, con):
index 135f23e..9dc75ad 100644 (file)
@@ -2543,8 +2543,13 @@ static void direct_link_constraints(FileData *fd, ListBase *lb)
                                break;
                        case CONSTRAINT_TYPE_KINEMATIC:
                        {
+                               bKinematicConstraint *data = con->data;
+
                                con->lin_error = 0.f;
                                con->rot_error = 0.f;
+
+                               /* version patch for runtime flag, was not cleared in some case */
+                               data->flag &= ~CONSTRAINT_IK_AUTO;
                        }
                        case CONSTRAINT_TYPE_CHILDOF:
                        {
index f2454a2..dcf2148 100644 (file)
@@ -703,11 +703,6 @@ static void rna_def_constraint_kinematic(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Lock Z Rot", "Constraint rotation along Z axis");
        RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
 
-       prop = RNA_def_property(srna, "use_target", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_AUTO);
-       RNA_def_property_ui_text(prop, "Target", "Disable for targetless IK");
-       RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
        prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
        RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");