Skip to content

Instantly share code, notes, and snippets.

@splinecraft
Created September 7, 2016 18:42
Show Gist options
  • Save splinecraft/21e8676e4a6352a8106e2f138c251919 to your computer and use it in GitHub Desktop.
Save splinecraft/21e8676e4a6352a8106e2f138c251919 to your computer and use it in GitHub Desktop.
select all animated nodes
"""
Select Animated Nodes
Here’s a quick script I threw together today that will take your selection, check if any of the nodes have animation curves attached to them, and then deselect all the nodes that aren’t animated. Leaving you only with the nodes that are animated. I say nodes because it will keep any node in Maya you have intially selected whether it’d be a transform, a shape, or a nParticle node. So, be careful with your initial selection and you won’t have to worry about what you get out in the end.
"""
objs = mc.ls(sl=True,dag=True)
print objs
animated = []
for obj in objs:
findAnimCurves = mc.listConnections(obj,source=True,type="animCurve")
if findAnimCurves:
animated.append(obj)
mc.select(animated,replace=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment