def isolate(option):
sel = mc.ls(sl=True)
if not sel:
return
graphVis = mc.selectionConnection('graphEditor1FromOutliner', query=True, obj=True)
channels = list()
wildCard = str()
alreadyIsolated = True
if graphVis:
for c in graphVis:
if not '.' in c and mc.objExists(c):
attrs = mc.listAttr(c, keyable=True, unlocked=True)
if attrs:
channels.extend([c+'.'+a for a in attrs])
else:
attr = c.split('.')[-1]
if attr.startswith(option):
channels.append(c)
if not wildCard:
wildCard = option+'*'
elif attr.endswith(option):
channels.append(c)
if not wildCard:
wildCard = '*'+option
elif attr == option:
channels.append(c)
if not wildCard:
wildCard = option
else:
#found a curve that is outside our search parameters
alreadyIsolated = False
if channels and alreadyIsolated:
#if the option is already the only thing being displayed, then show everything that matches the option
for obj in sel:
attrs = mc.listAttr(obj, keyable=True, unlocked=True, string=wildCard)
if attrs:
channels.extend([obj+'.'+a for a in attrs])
if not channels:
for obj in sel:
attrs = mc.listAttr(obj, keyable=True, unlocked=True)
for a in attrs:
if a==option or a.startswith(option) or a.endswith(option):
channels.append(obj+'.'+a)
clear()
for c in channels:
mc.selectionConnection('graphEditor1FromOutliner', edit=True, select=c)
评论列表
文章目录