def __register_scnexpl_startup():
from textwrap import dedent
cmds.evalDeferred(dedent(
"""
import scnexpl.startup as s
s.execute()
"""
))
python类evalDeferred()的实例源码
def __register_sishelf_startup():
from textwrap import dedent
cmds.evalDeferred(dedent(
"""
import sishelf.startup as s
s.execute()
"""
))
def channelbox_command_animCurve(box, menuItem, key, *args):
with sysCmd.Undo(0):
mel.eval("GraphEditor;")
cmds.selectionConnection("graphEditor1FromOutliner", e=1, clear=1)
# in case graph editor is open already, clear selection
sel_attrs = channelBox_SelectedPlugs(box)
if sel_attrs:
for i in sel_attrs:
cmds.evalDeferred(
"cmds.selectionConnection('graphEditor1FromOutliner', e = 1, select =\"" + i + "\")")
# evalDeferred allows occurring graph editor opens, else selection occurs before element exists
def deselectChannels():
'''
Deselect selected channels in the channelBox
by clearing selection and then re-selecting
'''
if not getSelectedChannels():
return
sel = mc.ls(sl=True)
mc.select(clear=True)
mc.evalDeferred(partial(mc.select,sel))