splineIKSolver & Spline_IK_Control

This has been driving me nuts all day.

Essentally I want to create a script that will help with common rigging elements.

I'm trying to script the creation of a spine through the use of a SplineIKChain.

I can create the bones, the ikChain and generally get most of the
elements working, except, it does not work the same way as it does when
done manually.

The first two things to put up are:
1. I have to align the helpers created by Spline_IK_Control manually.
This is no big issue as it is eaiser enough to follow the spline
2. When you pull a helper, it should pull the spline out of shape, this does not happen on the scripted version.

When created manually:
- Select bone creation from the create pane.
- Select the SplineIKSolver from the avaliable solvers drop down
- Select assign to children, leave apply to root selected
- Draw spine shape (usually 5-6 bones)
- On the spline ik dialog, select auto create spline, 5 spline knots,
create helpers...pretty much the default settings click okay...all is
done.

When you pull one of the helpers, it pulls the spline out of shape.

Basically, i want to script the above process, but when I do, the
helpers have no effect of the spline. I've gone through the schamtic
view, and as best as I can tell, the setup is idenitical...but
obviously i'm missing something...


--- Basic Script follows ---


-- The guide is a spline line created by the user and is used to layout the bone
-- structure. We steal it for our own uses
shpSpine = copy guide
shpSpine.name = "shpSpline"
shpSpine.wirecolor = (color 64 64 64)

-- lstBones is an array of bones, in order, that represent the overall spine
ikSpine = createIKChain lstBones[1] lstBones[lstBones.count] ikType:"SplineIKSolver"
ikSpine.name = "ikSpline"
ikSpine.transform.controller.splineKnotCount = ((numKnots shpSpine) - 1)
ikSpine.transform.controller.pickShape = shpSpine

modSplineIKControl = Spline_IK_Control()
modSplineIKControl.linkTypes = 1
modSplineIKControl.linkToRoot()

addModifier shpSpine modSplineIKControl

modSplineIKControl.createHelper ((numKnots shpSpine 1) - 1)

iIndex = 0
for hlpSpine in modSplineIKControl.helper_list do (
hlpSpine.name = uniquename "hlpSpine"

iIndex += 1

-- Position the helper along the spline
per = ((iIndex as float) / (modSplineIKControl.getHelperCount() as float)) as float
pos = lengthInterp shpSpine 1 per
hlpSpine.pos = pos
)

-- Link the first helper to the ikSpine
hlpSpine = modSplineIKControl.helper_list[1]
ikSpine.controller.upnode = hlpSpine

lstBones[1].transform.controller.FK_Sub_Control.controller.Position.controller = Path_Constraint ()
lstBones[1].transform.controller.FK_Sub_Control.controller.Position.controller.path = shpSpine

--- Basic Script follows ---

Any help, advice or suggestions is greatly appricated.
Thanks
Shane

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Foreshore's picture

Wow! This is just, what I

Wow! This is just, what I was looking for. Great script....!!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.