def get_selected_channel(tfbg, *args):
"""
gets the selected channel of the selected objects
tfbg = the key of the widget for the ui (from widgets dict). string
"""
obj = ""
channel = ""
cBox = mel.eval('$temp=$gChannelBoxName')
sel = cmds.ls(sl=True, l=True)
if sel:
if not len(sel) == 1:
cmds.warning("You have to select ONE node!")
else:
obj = sel[0]
else:
cmds.warning("You have to select ONE node!")
if sel:
channels = cmds.channelBox(cBox, q=True, sma=True, ssa=True, sha=True, soa=True)
if channels:
if not len(channels) == 1:
cmds.warning("You have to select ONE channel!")
else:
channel = channels[0]
else:
cmds.warning("You have to select ONE channel!")
if obj and channel:
full = "%s.%s" % (obj, channel)
cmds.textFieldButtonGrp(widgets[tfbg], e=True, tx=full)
评论列表
文章目录