[Python] Defining a HumanIK Skeleton


#1

Hey everyone, I’m working on a script to define an HIK skeleton, but I can’t seem to find any clear examples of how to go about doing this. The closest I’ve gotten is the characterize command, but it keeps giving me an error.

Here’s a quick summary of the code:

import maya.cmds as mc

mc.characterize(sk="pelvis Hips,hip HipsTranslation,L_ThighBend LeftUpLeg,R_ThighBend RightUpLeg,L_ThighTwist LeftUpLegRoll,R_ThighTwist RightUpLegRoll,L_Shin LeftLeg,R_Shin RightLeg,L_Foot LeftFoot,R_Foot RightFoot,abdomenLower Spine,abdomenUpper Spine1,chestLower Spine2,chestUpper Spine3,neckLower Neck,neckUpper Neck1,head Head,L_Collar LeftShoulder,R_Collar RightShoulder,L_ShldrBend LeftArm,R_ShldrBend RightArm,L_ShldrTwist LeftArmRoll,R_ShldrTwist RightArmRoll,L_ForearmBend LeftForeArm,R_ForearmBend RightForeArm,L_ForearmTwist LeftForeArmRoll,R_ForearmTwist RightForeArmRoll,L_Hand LeftHand,R_Hand RightHand")

# Error: RuntimeError: file <maya console> line 1: The neck or spine joint naming is out of order.  Joints must be named spine,spine1,spine2... and neck,neck1,neck2... #

I’ve tried to figure out what’s wrong, but according to the maya python documentation and example code, it should work. As a last resort I tried changing all the spine and neck names to lowercase, but that wasn’t it either. I’m at a loss at this point.

I have the joints in the scene in all the correct places and orientations. I can manually define the rig using the exact joints listed above with no issue, but I can’t find any way to automate that process. All I want to do is figure out how to tell maya where all the joints are at once.

Thanks!


#2

…it keeps giving me an error.
What is the error?


#3

Error: RuntimeError: file <maya console> line 1: The neck or spine joint naming is out of order. Joints must be named spine,spine1,spine2… and neck,neck1,neck2…


#4

Have you tried renaming these?
[ul]
[li]abdomenLower Spine
[/li][li]abdomenUpper Spine1
[/li][li]chestLower Spine2
[/li][li]chestUpper Spine3
[/li][/ul]
to…
[ul]
[li]abdomenLower spine1
[/li][li]abdomenUpper spine2
[/li][li]chestLower spine3
[/li][li]chestUpper spine4
[/li][/ul]
Just a guess, I haven’t used this command before.

Edit: Oops, ignore this. My mistake, I misread your comment.