Revision: 17559
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17559
Author:   theeth
Date:     2008-11-24 18:48:40 +0100 (Mon, 24 Nov 2008)

Log Message:
-----------
Link pole controls to the parent of the bone with the IK constraint.

Presumably, this should give better result, but tests where not conclusive.

Modified Paths:
--------------
    branches/etch-a-ton/source/blender/src/editarmature_retarget.c

Modified: branches/etch-a-ton/source/blender/src/editarmature_retarget.c
===================================================================
--- branches/etch-a-ton/source/blender/src/editarmature_retarget.c      
2008-11-24 15:51:55 UTC (rev 17558)
+++ branches/etch-a-ton/source/blender/src/editarmature_retarget.c      
2008-11-24 17:48:40 UTC (rev 17559)
@@ -805,15 +805,26 @@
                                /* constraint targets */
                                if (cti && cti->get_constraint_targets)
                                {
+                                       int target_index;
+                                       
                                        cti->get_constraint_targets(con, 
&targets);
                                        
-                                       for (ct= targets.first; ct; ct= 
ct->next)
+                                       for (target_index = 0, ct= 
targets.first; ct; target_index++, ct= ct->next)
                                        {
                                                if ((ct->tar == rg->ob) && 
strcmp(ct->subtarget, ctrl->bone->name) == 0)
                                                {
                                                        /* SET bone link to 
bone corresponding to pchan */
                                                        EditBone *link = 
BLI_ghash_lookup(rg->bones_map, pchan->name);
                                                        
+                                                       /* for pole targets, 
link to parent bone instead, if possible */
+                                                       if (con->type == 
CONSTRAINT_TYPE_KINEMATIC && target_index == 1)
+                                                       {
+                                                               if 
(link->parent && BLI_ghash_haskey(rg->bones_map, link->parent->name))
+                                                               {
+                                                                       link = 
link->parent;
+                                                               }
+                                                       }
+                                                       
                                                        found = 
RIG_parentControl(ctrl, link);
                                                }
                                        }
@@ -1011,14 +1022,12 @@
                                {
                                        if (VecLenf(ctrl->bone->tail, 
bone->head) < 0.01)
                                        {
-                                               printf("%s -> %s: TL_HEAD\n", 
ctrl->bone->name, bone->name);
                                                ctrl->tail_mode = TL_HEAD;
                                                ctrl->link_tail = bone;
                                                break;
                                        }
                                        else if (VecLenf(ctrl->bone->tail, 
bone->tail) < 0.01)
                                        {
-                                               printf("%s -> %s: TL_TAIL\n", 
ctrl->bone->name, bone->name);
                                                ctrl->tail_mode = TL_TAIL;
                                                ctrl->link_tail = bone;
                                                break;
@@ -1031,10 +1040,6 @@
                        {
                        }
                }
-               else
-               {
-                       printf("%s FIT\n", ctrl->bone->name);
-               }
        }
        
 }
@@ -1808,7 +1813,18 @@
        if ((ctrl->flag & RIG_CTRL_DONE) == RIG_CTRL_DONE)
        {
                RigControl *ctrl_child;
+
+#if 0          
+               printf("CTRL: %s LINK: %s", ctrl->bone->name, ctrl->link->name);
                
+               if (ctrl->link_tail)
+               {
+                       printf(" TAIL: %s", ctrl->link_tail->name);
+               }
+               
+               printf("\n");
+#endif
+               
                /* if there was a tail link: apply link, recalc resize factor 
and qrot */
                if (ctrl->tail_mode != TL_NONE)
                {


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to