[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15735] branches/harmonic-skeleton/source/ blender/src/autoarmature.c: Propagate control bones repositioning ( can deal with chains of control bones)
Martin Poirier
theeth at yahoo.com
Thu Jul 24 16:11:37 CEST 2008
Revision: 15735
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15735
Author: theeth
Date: 2008-07-24 16:11:36 +0200 (Thu, 24 Jul 2008)
Log Message:
-----------
Propagate control bones repositioning (can deal with chains of control bones)
Retargetting IK/FK switcher setups should work ok now (worked on a setup I did, need to test with more)
Modified Paths:
--------------
branches/harmonic-skeleton/source/blender/src/autoarmature.c
Modified: branches/harmonic-skeleton/source/blender/src/autoarmature.c
===================================================================
--- branches/harmonic-skeleton/source/blender/src/autoarmature.c 2008-07-24 12:27:31 UTC (rev 15734)
+++ branches/harmonic-skeleton/source/blender/src/autoarmature.c 2008-07-24 14:11:36 UTC (rev 15735)
@@ -139,11 +139,14 @@
EditBone *bone;
} RigEdge;
+#define RIG_CTRL_DONE 1
+
typedef struct RigControl {
struct RigControl *next, *prev;
EditBone *bone;
EditBone *parent;
- float offset[3];
+ float offset[3];
+ int flag;
} RigControl;
/*******************************************************************************************************/
@@ -622,11 +625,13 @@
/************************************ RETARGETTING *****************************************************/
-static void repositionControl(RigControl *ctrl, float parent[3], float qrot[4], float resize)
+static void repositionControl(RigGraph *rigg, RigControl *ctrl, float parent[3], float qrot[4], float resize)
{
+ RigControl *ctrl_child;
float parent_offset[3], tail_offset[3];
VecSubf(tail_offset, ctrl->bone->tail, ctrl->bone->head);
+ VecMulf(tail_offset, resize);
VECCOPY(parent_offset, ctrl->offset);
VecMulf(parent_offset, resize);
@@ -636,6 +641,18 @@
VecAddf(ctrl->bone->head, parent, parent_offset);
VecAddf(ctrl->bone->tail, ctrl->bone->head, tail_offset);
+
+ ctrl->flag |= RIG_CTRL_DONE;
+
+ /* Cascade to connected control bones */
+ for (ctrl_child = rigg->controls.first; ctrl_child; ctrl_child = ctrl_child->next)
+ {
+ if (ctrl_child->parent == ctrl->bone)
+ {
+ repositionControl(rigg, ctrl_child, ctrl->bone->tail, qrot, resize);
+ }
+ }
+
}
static void repositionBone(RigGraph *rigg, EditBone *bone, float vec0[3], float vec1[3])
@@ -665,7 +682,7 @@
RotationBetweenVectorsToQuat(qrot, v1, v2);
}
- repositionControl(ctrl, vec1, qrot, resize);
+ repositionControl(rigg, ctrl, vec1, qrot, resize);
}
}
More information about the Bf-blender-cvs
mailing list