Zero Joint

Download zeroJoints.py

python, pyfuncs, maya

Some times you need to zero with a joint instead of a group to maintain your joint's chain, here is zeroJoint :-) !

Simple use could be

1
2
zeroJoint(itr=3)             # will create 3 joints above the selected one
zeroJoints('joint1', itr=2)  # will create 2 joints above joint1

Here is code ;

select
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from string import ascii_uppercase as abc

def zero_jt(target, itr=1):
    """
    create n joints above the targets to zero the transforms, named like
    G_A_joint -> G_B_joint and so on
    :param target: joints target
    :param    itr: number of iteration
    :return      : the zeros created
    """
    target = target if isinstance(target, list) else [target]
    gs = []
    for t in target:
        for i in itr:
            gs.append(cmds.duplicate(t, po=True, name='G_%s_%s' % (abc[i], t)))
            cmds.parent(t, gs[-1])
    return gs

If you have any questions... =)