Zero

Download zero.py

python, pyfuncs, maya

This function will create n group above the target, so you can add several control layers in your rig, for instance

The naming convention I'm using is quite simple and allows 26 layers, using the alphabet, like
G_A_* → G_B_* → G_C_* and so on

A simple use could be

1
zero(itr=4)  # will create 4 groups above the selection

Here is full function

select
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from string import ascii_uppercase as abc

def zero(target=None, itr=1):
    """
    zero selected nodes with n group depending of iter,
    named by alphabet like 'G_A_object'
    :param       target: where to put zeros, if none, zero selection
    :param         itr: how many group depth
    :return: list of zeros
    """
    # loop through objects/selection
    target = ([target] if target else cmds.ls(sl=True)) if not isinstance(target, list) else target
    ret = []
    for t in target:
        ro = cmds.getAttr('%s.ro' % t)
        # loop through iterations
        for it in range(itr):
            obj_parent = cmds.listRelatives(t, p=True, f=True)
            null = cmds.group(em=True, n='_'.join(('G', abc[it], t)))
            cmds.setAttr('%s.ro' % null, ro)
            # if node has parent, reparent the empty group
            if obj_parent:
                cmds.parent(null, obj_parent)
            # grab object's transforms
            tsfm = [cmds.getAttr('%s.%s' % (t, b)) for b in 'tsr']
            cmds.parent(t, null)
            # loop through transforms
            for i, b in enumerate('tsr'):
                cmds.setAttr('%s.%s' % (null, b), *tsfm[i][0], type='double3')
                reset = (0, 0, 0) if i != 1 else (1, 1, 1)
                cmds.setAttr('%s.%s' % (t, b), *reset, type='double3')
            ret.append(null)
    return ret

If you have any questions... =)