Skip to content

Instantly share code, notes, and snippets.

@Onefabis
Created November 8, 2016 13:26
Show Gist options
  • Save Onefabis/7aa7e6ac3febe735580368942916ac6e to your computer and use it in GitHub Desktop.
Save Onefabis/7aa7e6ac3febe735580368942916ac6e to your computer and use it in GitHub Desktop.
selectActiveCurve.py
name = mc.keyframe( q=1, n=1, sl=1 )
objs = mc.ls( sl=1, l=1 )
global glAnCurves
try:
glAnCurves
except:
glAnCurves = []
if len( glAnCurves ) >0 :
mc.selectionConnection( 'graphEditor1FromOutliner', e=1, clr=1 )
allCh = [ g.rsplit( '.', 1 )[0] for g in glAnCurves ]
allObjs = set(allCh)
chann = []
for a in allObjs:
chann.extend( mc.keyframe( a, q=1 ,n=1 ) )
if len( chann ) == len( glAnCurves ):
for a in allObjs:
mc.selectionConnection( 'graphEditor1FromOutliner', e=1, select=a )
else:
for g in glAnCurves:
mc.selectionConnection( 'graphEditor1FromOutliner', e=1, select=g )
glAnCurves = []
else:
glAnCurves = mc.selectionConnection ( 'graphEditor1FromOutliner', q=1, object=1 )
if name:
mc.selectionConnection( 'graphEditor1FromOutliner', e=1, clr=1 )
for s in name:
splN = s.rsplit( '_', 1 )
mc.selectionConnection( 'graphEditor1FromOutliner', e=1, select='.'.join(splN) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment