Wednesday, January 19, 2011

FK Control Creation

I have refined my earlier script to accept a selection of multiple joints. Basically, I have added a loop that runs through the selection, and creates, sets, constrains each joint to their respective control, and constrains the control group to the joint up in the hierarchy using a parent constraint. It looks something like this:

while ($positionInSelectionArray < $selectionArraySize) {

Create Control with part of joint name and orient it;
Freeze Transforms; Create Group for control;

Select Joint then Group;
Find the position of the joint in world space using xform;

Use xform to position the group to the joint's position;
Obtain the name of the NURBS control inside the group and select;
Add joint to selection;

Assign NURBS circle to $cjDriver;
Assign Joint to $cjDriven;
Find the group name and parent of the joint and assign them to variables;

Select $cjDriver;
Select $cjDriven;

Orient constrain joint to NURBS circle;
Select parent of joint; Select control group;
Parent Constrain control group to joint parent;
select -cl;

$positionInSelectionArray = $positionInSelectionArray + 1;

}

I am currently working on options in the GUI to allow the user to change the shape of their control NURBS to either a circle or star. There will be another option to either parent the control group to the joint's parent, or parent constrain the control group to the joint's parent. I am also working on an option so the user will be allowed to pick the axis to which the control NURBS will be oriented to. For example:

Currently the code is good for joints that point down the X axis of the joint chain. A user may be more comfortable with a different axis that points down their joint chain, say for example the Y axis. This extra option will rotate the circle to align with a user specified axis. Basically:

if (check box Y axis = true) {

Rotate circle to align with the y axis;
Freeze Transforms;

}

else if (check box Z axis = true) {

Rotate circle to align with the Z axis;
Freeze Transforms;


}

This will allow the tool to be more robust and user friendly. Still working on hosting my scripts some where.

No comments:

Post a Comment