HumanIK to Joints Script

For humanoid rigs, I have started to use Maya’s built in HumanIK system. I do this even if I am not going to be using a HumanIK based rig, as it quickly places joints in the correct places, giving me a headstart in rigging. I wrote a small script to automatically create a clean, non-HumanIK joint setup, using the quickrig as a template. Doing this means not having to fix joint orientation, and skipping the first step of building your rig, which saves time

Maya 2018 came with more of a focus on the HumanIK feature for quickly building humanoid rigs. I instantly hated it.

It has a confusing UI, it creates rigs that are hard to analyse and customise and at first it seems like you have very limited control over the way the rig ends up.

I have since learned more about the system and it doesn’t seem so bad. For example, it is great for retargeting and mocap, as you can quickly create homogeneous rigs for many characters, even with different proportions and body types. The automatic tools are great (if used correctly). Nevertheless it is still not appropriate for every pipeline.

That doesn’t mean it is useless for those pipelines. I might even go so far as to say that every humanoid character should be created with HumanIK in part of the development. This is because of the Quick Rig tool.

The Quick Rig tool can automatically build a humanoid result armature in a single click (or a few more clicks if you want to perfect it). This analyses the shape of your model and intelligently places the joints. This results in correctly oriented and positioned joints for your character model. It doesn’t create small joints like fingers, jaws, toes, eyes etc, but it saves a lot of time on positioning and orienting your spine, head, arms and legs.

HumanIK Quick Rig results (ignore the broken left arm, we won’t use it anyway since we will be mirroring them.)


Now this is great and all if you are using a HumanIK pipeline, but what if you aren’t? How can this benefit you?

Well this is where a script I wrote as a small side project comes in. It takes a selection of HumanIK joints, and uses them as a template to create regular old Maya joints, preserving default positions, orients etc. for super quick joint setup.

Here is the code, feel free to copy it and use it yourself:

convert_humanik (chik)
@author: Michael Stickler

select all of the joints in a humanIK rig, 
such as those created by the Quick Rig tool, 
then run the following code:

import pymel.core as pm
import convert_humanik as chik

import pymel.core as pm
def convert(selection):
    parents = {}
    copies = {}
    for joint in selection:
        name = joint.nodeName()
        parents[joint] = pm.listRelatives(joint, parent=True)[0]
        newjnt = pm.joint()
        pm.rename(newjnt, name)
        copies[joint] = newjnt

        snap_to(newjnt, joint)

    originals = {c: o for o, c in copies.iteritems()}
    for newjnt in originals:
            joint = originals[newjnt]
            pjoint = parents[joint]
            newparent = copies[pjoint]
            pm.parent(newjnt, newparent)
            print("{} has not got a parent in selection".format(joint.nodeName()))
            pm.makeIdentity(newjnt, apply=True)
def snap_to(obj, target, **kwargs):
    snap the first object to the target, can specify to limit to just translate or rotate
    translate = kwargs.setdefault("translate", True)
    rotate = kwargs.setdefault("rotate", True)

    if translate:
        point = pm.pointConstraint(target, obj)

    if rotate:
        orient = pm.orientConstraint(target, obj)

Leave a Reply

Your email address will not be published. Required fields are marked *