Smart Null-Attribute Script

Here’s a quick script that I wrote during my last rigging project. For every object in the selection, it gets the keyable attributes and their defaults and sets those attributes to their defaults.

It works on default and user-defined attributes. I have it mapped to a hotkey (ctrl+0) and it really speeds things up!


import maya.cmds as cmds

# bm_nullAttr
# sets channel box values to default for every object in selection. Works on default and custom attributes.

# get the selection
def nullAttr():
    sel =
    for obj in sel:
        # list the keyable attributes on that object
        keyable = cmds.listAttr(obj, k=1)
        for attr in keyable:
            # find each attribute's default value and set it
            default = cmds.attributeQuery(attr, node=obj, listDefault=1)
            cmds.setAttr(obj + "." + attr, default[0])


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s