Skip to content

Instantly share code, notes, and snippets.

@splinecraft
Created February 1, 2020 06:24
Show Gist options
  • Save splinecraft/14e233f689ee23960d86d12a778e2c5c to your computer and use it in GitHub Desktop.
Save splinecraft/14e233f689ee23960d86d12a778e2c5c to your computer and use it in GitHub Desktop.
import maya.cmds as cmds
import collections
def getAllLayers():
rootLayer = cmds.animLayer(q=True, r=True)
if rootLayer:
def search(layer, depth=0):
children = cmds.animLayer(layer, q=True, c=True)
if children:
for child in children:
layers[child] = {"depth": depth}
search(child, depth + 1)
layers = collections.OrderedDict()
search(rootLayer)
if layers:
for layer in layers:
mute = cmds.animLayer(layer, q=True, m=True)
solo = cmds.animLayer(layer, q=True, s=True)
layers[layer]["mute"] = mute
layers[layer]["solo"] = solo
return layers
return {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment