Created
April 11, 2019 09:13
-
-
Save patwooky/9c956e8ab051551aae29494285b07bc8 to your computer and use it in GitHub Desktop.
An example of a working nested list comprehension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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