Revision: 52522
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52522
Author:   blendix
Date:     2012-11-24 00:18:34 +0000 (Sat, 24 Nov 2012)
Log Message:
-----------
IK Solver:
* Rename Legacy to Standard, it's not being deprecated as far as I know.
* Make option to toggle off Location solving work with Standard.
* Make it converge a bit better in some cases by enforcing a minimum number of
  iterations before giving up.
* Move IK solver choice out of bone panel, it's an armature level setting and
  should be set there.

Modified Paths:
--------------
    trunk/blender/intern/iksolver/intern/IK_QJacobianSolver.cpp
    trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py
    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/blenkernel/intern/action.c
    trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/makesrna/intern/rna_constraint.c
    trunk/blender/source/blender/makesrna/intern/rna_pose.c

Modified: trunk/blender/intern/iksolver/intern/IK_QJacobianSolver.cpp
===================================================================
--- trunk/blender/intern/iksolver/intern/IK_QJacobianSolver.cpp 2012-11-23 
21:22:13 UTC (rev 52521)
+++ trunk/blender/intern/iksolver/intern/IK_QJacobianSolver.cpp 2012-11-24 
00:18:34 UTC (rev 52522)
@@ -377,7 +377,7 @@
                        norm = maxnorm;
 
                // check for convergence
-               if (norm < 1e-3) {
+               if (norm < 1e-3 && iterations > 10) {
                        solved = true;
                        break;
                }

Modified: 
trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py     
2012-11-23 21:22:13 UTC (rev 52521)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_armature.py     
2012-11-24 00:18:34 UTC (rev 52522)
@@ -239,7 +239,7 @@
 
 
 class DATA_PT_iksolver_itasc(ArmatureButtonsPanel, Panel):
-    bl_label = "iTaSC parameters"
+    bl_label = "Inverse Kinematics"
     bl_options = {'DEFAULT_CLOSED'}
 
     @classmethod

Modified: trunk/blender/release/scripts/startup/bl_ui/properties_data_bone.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_data_bone.py 
2012-11-23 21:22:13 UTC (rev 52521)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_data_bone.py 
2012-11-24 00:18:34 UTC (rev 52522)
@@ -244,7 +244,6 @@
         pchan = ob.pose.bones[bone.name]
 
         row = layout.row()
-        row.prop(ob.pose, "ik_solver")
 
         active = pchan.is_in_ik_chain
 

Modified: 
trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py 
2012-11-23 21:22:13 UTC (rev 52521)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_object_constraint.py 
2012-11-24 00:18:34 UTC (rev 52522)
@@ -134,7 +134,7 @@
             layout.prop(con, "ik_type")
             getattr(self, 'IK_' + con.ik_type)(context, layout, con)
         else:
-            # Legacy IK constraint
+            # Standard IK constraint
             self.target_template(layout, con)
             layout.prop(con, "pole_target")
 
@@ -151,18 +151,28 @@
             col.prop(con, "iterations")
             col.prop(con, "chain_count")
 
-            col.label(text="Weight:")
-            col.prop(con, "weight", text="Position", slider=True)
-            sub = col.column()
-            sub.active = con.use_rotation
-            sub.prop(con, "orient_weight", text="Rotation", slider=True)
-
             col = split.column()
             col.prop(con, "use_tail")
             col.prop(con, "use_stretch")
-            col.separator()
-            col.prop(con, "use_rotation")
 
+            layout.label(text="Weight:")
+
+            split = layout.split()
+            col = split.column()
+            row = col.row(align=True)
+            row.prop(con, "use_location", text="")
+            sub = row.row()
+            sub.active = con.use_location
+            sub.prop(con, "weight", text="Position", slider=True)
+
+            col = split.column()
+            row = col.row(align=True)
+            row.prop(con, "use_rotation", text="")
+            sub = row.row()
+            sub.active = con.use_rotation
+            sub.prop(con, "orient_weight", text="Rotation", slider=True)
+
+
     def IK_COPY_POSE(self, context, layout, con):
         self.target_template(layout, con)
         self.ik_template(layout, con)

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c     2012-11-23 
21:22:13 UTC (rev 52521)
+++ trunk/blender/source/blender/blenkernel/intern/action.c     2012-11-24 
00:18:34 UTC (rev 52522)
@@ -512,7 +512,7 @@
 {
        if (pose) {
                switch (pose->iksolver) {
-                       case IKSOLVER_LEGACY:
+                       case IKSOLVER_STANDARD:
                                return NULL;
                        case IKSOLVER_ITASC:
                                return "bItasc";
@@ -587,7 +587,7 @@
                        BKE_pose_itasc_init(itasc);
                        pose->ikparam = itasc;
                        break;
-               case IKSOLVER_LEGACY:
+               case IKSOLVER_STANDARD:
                default:
                        pose->ikparam = NULL;
                        break;

Modified: trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c
===================================================================
--- trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c      
2012-11-23 21:22:13 UTC (rev 52521)
+++ trunk/blender/source/blender/ikplugin/intern/iksolver_plugin.c      
2012-11-24 00:18:34 UTC (rev 52522)
@@ -379,6 +379,7 @@
 
                copy_v3_v3(goalpos, goal[3]);
                copy_m3_m4(goalrot, goal);
+               normalize_m3(goalrot);
 
                /* same for pole vector target */
                if (data->poletar) {
@@ -433,7 +434,7 @@
 
                iktarget = iktree[target->tip];
 
-               if (data->weight != 0.0f) {
+               if ((data->flag & CONSTRAINT_IK_POS) && data->weight != 0.0f) {
                        if (poleconstrain)
                                IK_SolverSetPoleVectorConstraint(solver, 
iktarget, goalpos,
                                                                 polepos, 
data->poleangle, (poleangledata == data));

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h    2012-11-23 
21:22:13 UTC (rev 52521)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h    2012-11-24 
00:18:34 UTC (rev 52522)
@@ -372,7 +372,7 @@
 
 /* bPose->iksolver and bPose->ikparam->iksolver */
 typedef enum ePose_IKSolverType {
-       IKSOLVER_LEGACY = 0,
+       IKSOLVER_STANDARD = 0,
        IKSOLVER_ITASC = 1
 } ePose_IKSolverType;
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_constraint.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_constraint.c       
2012-11-23 21:22:13 UTC (rev 52521)
+++ trunk/blender/source/blender/makesrna/intern/rna_constraint.c       
2012-11-24 00:18:34 UTC (rev 52522)
@@ -614,7 +614,7 @@
        RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, 
"rna_Constraint_dependency_update");
 
        prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
-       RNA_def_property_range(prop, 1, 10000);
+       RNA_def_property_range(prop, 0, 10000);
        RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving 
iterations");
        RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, 
"rna_Constraint_update");
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_pose.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_pose.c     2012-11-23 
21:22:13 UTC (rev 52521)
+++ trunk/blender/source/blender/makesrna/intern/rna_pose.c     2012-11-24 
00:18:34 UTC (rev 52522)
@@ -675,7 +675,7 @@
 }
 
 static EnumPropertyItem prop_iksolver_items[] = {
-       {IKSOLVER_LEGACY, "LEGACY", 0, "Legacy", "Original IK solver"},
+       {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
        {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK 
solver"},
        {0, NULL, 0, NULL, NULL}
 };
@@ -1126,7 +1126,7 @@
 
        prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
        RNA_def_property_int_sdna(prop, NULL, "numiter");
-       RNA_def_property_range(prop, 1.f, 1000.f);
+       RNA_def_property_range(prop, 0, 1000);
        RNA_def_property_ui_text(prop, "Iterations",
                                 "Maximum number of iterations for convergence 
in case of reiteration");
        RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
@@ -1221,8 +1221,7 @@
        RNA_def_property_enum_sdna(prop, NULL, "iksolver");
        RNA_def_property_clear_flag(prop, PROP_EDITABLE);
        RNA_def_property_enum_items(prop, prop_iksolver_items);
-       RNA_def_property_ui_text(prop, "IK Solver",
-                                "IK solver for which these parameters are 
defined, 0 for Legacy, 1 for iTaSC");
+       RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these 
parameters are defined");
 }
 
 /* pose.bone_groups */
@@ -1285,8 +1284,7 @@
        RNA_def_property_enum_sdna(prop, NULL, "iksolver");
        RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
        RNA_def_property_enum_items(prop, prop_iksolver_items);
-       RNA_def_property_ui_text(prop, "IK Solver",
-                                "Selection of IK solver for IK chain, current 
choice is 0 for Legacy, 1 for iTaSC");
+       RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for 
IK chain");
        RNA_def_property_update(prop, NC_OBJECT | ND_POSE, 
"rna_Pose_ik_solver_update");
 
        prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to