[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51603] trunk/blender: Fix #32964: IK constraint had a "Target" option, which actually is an internal

Brecht Van Lommel brechtvanlommel at pandora.be
Thu Oct 25 00:36:07 CEST 2012


Revision: 51603
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51603
Author:   blendix
Date:     2012-10-24 22:36:06 +0000 (Wed, 24 Oct 2012)
Log Message:
-----------
Fix #32964: IK constraint had a "Target" option, which actually is an internal
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.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_ui/properties_data_bone.py
    trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py
    trunk/blender/source/blender/blenloader/intern/readfile.c
    trunk/blender/source/blender/makesrna/intern/rna_constraint.c

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_bone.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_bone.py	2012-10-24 21:57:16 UTC (rev 51602)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_bone.py	2012-10-24 22:36:06 UTC (rev 51603)
@@ -246,72 +246,74 @@
         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")

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py	2012-10-24 21:57:16 UTC (rev 51602)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py	2012-10-24 22:36:06 UTC (rev 51603)
@@ -88,7 +88,6 @@
 
         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 @@
             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):

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2012-10-24 21:57:16 UTC (rev 51602)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2012-10-24 22:36:06 UTC (rev 51603)
@@ -2543,8 +2543,13 @@
 				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:
 			{

Modified: trunk/blender/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_constraint.c	2012-10-24 21:57:16 UTC (rev 51602)
+++ trunk/blender/source/blender/makesrna/intern/rna_constraint.c	2012-10-24 22:36:06 UTC (rev 51603)
@@ -703,11 +703,6 @@
 	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");




More information about the Bf-blender-cvs mailing list