Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save patwooky/9c956e8ab051551aae29494285b07bc8 to your computer and use it in GitHub Desktop.
Save patwooky/9c956e8ab051551aae29494285b07bc8 to your computer and use it in GitHub Desktop.
An example of a working nested list comprehension
from pymel.core import *
# an example of a working nested list comprehension
# this example is 2 levels deep
'''
-- Explanation --
for each selected object, list all the connections of type 'animCurve'
for each of the connected animCurve nodes, shortlist those with 'rotateX' in their names
put those shortlisted nodes in a list
select those shortlisted nodes
'''
select([x for y in ls(sl=True) for x in listConnections(y, type='animCurve') if 'rotateX' in x.name()])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment