我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用maya.cmds.menuItem()。
def initialize_plugin(): cmds.setParent("MayaWindow") cmds.menu("surume", l=u"surume", to=True) cmds.menuItem(l=u"Check Layout", c=CheckLayoutWindow.main) cmds.menuItem(l=u"Convert Color Code", c=ConvertColorCode.show_ui) cmds.setParent("..")
def _create_ui(self): u"""UI???""" safe_delete_window(self._WINDOW_NAME) win = cmds.window(self._WINDOW_NAME, t="Convert Color Code", mb=True, w=480, h=128) cmds.menu(l="Option") cmds.menuItem(l="ColorEditor", c=self.get_color_from_editor) cmds.columnLayout(adj=True, rs=2) self.color_code_field = cmds.textFieldButtonGrp(l="Color code", bl="Convert", bc=self._convert) self.decimal_point_field = cmds.intFieldGrp(l="Decimal point", nf=1, v1=2) self.result_field = cmds.textFieldGrp(l="Result") cmds.setParent("..") cmds.columnLayout(adj=True) self.color_preview = cmds.text(l="", h=24) cmds.setParent("..") cmds.showWindow(win)
def channelbox_command_expression(box, menuItem, key, *args): with sysCmd.Undo(0): main_obj_list = cmds.channelBox(box.channelbox, q=1, mainObjectList=1) main_attr_list = cmds.channelBox(box.channelbox, q=1, selectedMainAttributes=1) shape_obj_list = cmds.channelBox(box.channelbox, q=1, shapeObjectList=1) shape_attr_list = cmds.channelBox(box.channelbox, q=1, selectedShapeAttributes=1) history_obj_list = cmds.channelBox(box.channelbox, q=1, historyObjectList=1) history_attr_list = cmds.channelBox(box.channelbox, q=1, selectedHistoryAttributes=1) output_obj_list = cmds.channelBox(box.channelbox, q=1, outputObjectList=1) output_attr_list = cmds.channelBox(box.channelbox, q=1, selectedOutputAttributes=1) if main_obj_list and main_attr_list: mel.eval("expressionEditor \"EE\" " + main_obj_list[0] + " " + main_attr_list[0] + ";") elif shape_obj_list and shape_attr_list: mel.eval("expressionEditor \"EE\" " + shape_obj_list[0] + " " + shape_attr_list[0] + ";") elif history_obj_list and history_attr_list: mel.eval("expressionEditor \"EE\" " + history_obj_list[0] + " " + history_attr_list[0] + ";") elif output_obj_list and output_attr_list: mel.eval("expressionEditor \"EE\" " + output_obj_list[0] + " " + output_attr_list[0] + ";")
def channelbox_command_setSpeed(box, menuItem, key, *args): # Sets the incremental size for attributes when modifying with middle mouse, # eg 'medium' appends +1/-1, 'fast' is +10/-10 with sysCmd.Undo(0): state = 1 if key == "speedSlow" else 2 if key == "speedMedium" else 3 if state == 1: cmds.channelBox(box.channelbox, e=1, speed=0.1) elif state == 2: cmds.channelBox(box.channelbox, e=1, speed=1) else: cmds.channelBox(box.channelbox, e=1, speed=10) box.saved_states["speedState"][0] = state if box.saved_states["showIcons"][0]: channelbox_command_Symbol_update(box, "speedState") sysCmd.channelbox_save_state(box)
def channelbox_command_setManip(box, menuItem, key, *args): # Set manipulator display/update type based on selected attr in channel box with sysCmd.Undo(0): state = 1 if key == "noManips" else 2 if key == "invisibleManips" else 3 if state == 1: cmds.channelBox(box.channelbox, e=1, useManips="none") elif state == 2: cmds.channelBox(box.channelbox, e=1, useManips="invisible") else: cmds.channelBox(box.channelbox, e=1, useManips="standard") box.saved_states["manipsState"][0] = state if box.saved_states["showIcons"][0]: channelbox_command_Symbol_update(box, "manipsState") sysCmd.channelbox_save_state(box)
def channelbox_command_precision(box, menuItem, key, *args): # floating point value displayed in channel box, eg. value of 5 will # display 5 decimal places with sysCmd.Undo(0): old_precision = box.saved_states[key][0] new_precision = mel.eval("precisionPrompt (\"\", " + str(old_precision) + ", 15);") if new_precision > 0: # Change widths of the fields depending on the precision if new_precision <= 3: new_width = 65 elif new_precision <= 6: new_width = 95 elif new_precision <= 9: new_width = 115 elif new_precision <= 12: new_width = 130 else: new_width = 155 cmds.channelBox(box.channelbox, e=1, pre=new_precision, fieldWidth=new_width) box.saved_states[key][0] = new_precision box.saved_states["fieldWidth"][0] = new_width sysCmd.channelbox_save_state(box)
def channelbox_command_setChannelName(box, menuItem, key, *args): # set display type for the names in the channel box and adjust the width of the columns displaying the label with sysCmd.Undo(0): state = 1 if key == "nameNice" else 2 if key == "nameLong" else 3 if state == 1: width = 180 cmds.channelBox(box.channelbox, e=1, lw=width, ln=1, nn=1) elif state == 2: width = 180 cmds.channelBox(box.channelbox, e=1, lw=width, ln=1, nn=0) else: width = 140 cmds.channelBox(box.channelbox, e=1, lw=width, ln=0, nn=0) box.saved_states["namesState"][0] = state box.saved_states["channelWidth"][0] = width sysCmd.channelbox_save_state(box) # ----------------------------------------- # --------------- SHOW MENU --------------- # -----------------------------------------
def channelbox_command_cboxReset(box, menuItem, key, *args): with sysCmd.Undo(0): confirm = cmds.confirmDialog(t="Reset to Default", m="Delete all saved data and modified settings associated with this Channel Box?", icon="critical", button=["Reset", "Cancel"]) if confirm == "Reset": default_states = box.menu_default_states for k, v in default_states.iteritems(): # compare keys containing a default state with items that exist in the edit menu or others # specified and restore them box.saved_states[k] = v sysCmd.channelbox_pickle_delete_state(box) # box.re_init(box) # re-initialize to update our changes in the display cmds.warning("Please close the ChannelBox UI and re-open it for changes to take effect")
def attributeMenuItem(node, attr): plug = node+'.'+attr niceName = mc.attributeName(plug, nice=True) #get attribute type attrType = mc.getAttr(plug, type=True) if attrType == 'enum': listEnum = mc.attributeQuery(attr, node=node, listEnum=True)[0] if not ':' in listEnum: return listEnum = listEnum.split(':') mc.menuItem(label=niceName, subMenu=True) for value, label in enumerate(listEnum): mc.menuItem(label=label, command=partial(mc.setAttr, plug, value)) mc.setParent('..', menu=True) elif attrType == 'bool': value = mc.getAttr(plug) label = 'Toggle '+ niceName mc.menuItem(label=label, command=partial(mc.setAttr, plug, not value))
def __init__(self, label=None, name=None, command=None, annotation='', shelfLabel='', shelfIcon='render_useBackground', readUI_toArgs={}, **kwargs): ''' The fancy part of this object is the readUI_toArgs argument. ''' self.uiArgDict = readUI_toArgs self.name = name self.command = command self.kwargs = kwargs self.annotation = annotation self.shelfLabel = shelfLabel self.shelfIcon = shelfIcon if annotation and not annotation.endswith('.'): annotation+='.' button = mc.button(label=label, command=self.runCommand, annotation=annotation+' Or right click for more options.') mc.popupMenu() mc.menuItem(label='Create Shelf Button', command=self.createShelfButton, image=shelfIcon) mc.menuItem(label='Create Hotkey', command=self.createHotkey, image='commandButton')
def markingMenu(): ''' Example of how a marking menu could be set up. ''' menuKwargs = {'enable':True, 'subMenu':False, 'enableCommandRepeat':True, 'optionBox':False, 'boldFont':True} mc.menuItem(radialPosition='NW', label='Trans', command=translate, **menuKwargs) mc.menuItem(radialPosition='N', label='Rot', command=rotate, **menuKwargs) mc.menuItem(radialPosition='NE', label='Scale', command=scale, **menuKwargs) mc.menuItem(radialPosition='SW', label='X', command=x, **menuKwargs) mc.menuItem(radialPosition='S', label='Y', command=y, **menuKwargs) mc.menuItem(radialPosition='SE', label='Z', command=z, **menuKwargs) mc.menuItem(radialPosition='W', label='ChanBox', command=channelBox, **menuKwargs) mc.menuItem(radialPosition='E', label='Sel', command=selected, **menuKwargs) mc.menuItem(label='All', command=showAll, **menuKwargs)
def menu_setup(): cmd = ''' buildViewMenu MayaWindow|mainWindowMenu; setParent -menu "MayaWindow|mainWindowMenu"; ''' mel.eval(cmd) cmds.menuItem(divider=True) cmds.menuItem( 'scnexpl_folder', label='SceneExplorer', subMenu=True, tearOff=True ) cmds.menuItem( 'scnexpl_open', label=jpn('open SceneExplorer'), annotation="open SceneExplorer", parent='scnexpl_folder', echoCommand=True, command=dedent( ''' import scnexpl.explorer scnexpl.explorer.main() ''') )
def createMenu(): cmds.setParent(mel.eval("$temp1=$gMainWindow")) if cmds.control('NR_ImportMenu', exists=True): cmds.deleteUI('NR_ImportMenu', menu=True) menu = cmds.menu('NR_ImportMenu', label='Ninja Ripper', tearOff=True) cmds.menuItem( label='Import RIP v4', c="cmds.showWindow('NR_ImportWindow')" ) cmds.menuItem( label="Reload Script", c="reload(NinjaRipperMayaImportTools)" )
def create(self, parent=None): from maya import cmds uiData = self.command.uiData() self.item = cmds.menuItem(l=uiData["uiData"], bld=uiData.get("bold", False), parent=parent, itl=uiData.get("italicized", False), c=partial(self.triggered.emit, self.command.id))
def CreateMenu(): # Set the diplay's parent cmds.setParent(mel.eval("$temp1=$gMainWindow")) # Purge old one DeleteMenu() # Make new menu menu = cmds.menu(MENU_DATA['menu'][0], label=MENU_DATA["menu"][1], tearOff=True) # Recreate the base # Add children cmds.menuItem(label="Import <- SEAnim", command=lambda x:ImportSEAnim(), annotation="Imports a SEAnim, resetting the scene first") cmds.menuItem(label="Import and Blend <- SEAnim", command=lambda x:ImportMergeSEAnim(), annotation="Imports a SEAnim without resetting the scene (Blending the animations together)") cmds.menuItem(divider=True) cmds.menuItem(label="Export -> SEAnim", command=lambda x:ExportEntireSceneAnim(), annotation="Exports all joints, or all selected joints to a SEAnim file") cmds.menuItem(divider=True) cmds.menuItem(label="Clean Namespaces", command=lambda x:NamespaceClean(), annotation="Removes all namespaces from the scene") cmds.menuItem(label="Place Notetrack", command=lambda x:PlaceNote(), annotation="Places a notetrack at the current scene time") cmds.menuItem(label="Select All Joints", command=lambda x:SelectAllJoints(), annotation="Selects all joints") cmds.menuItem(label="Select Keyed Joints", command=lambda x:SelectKeyframes(), annotation="Selects keyed joints, this feature does not work with conversion rigs") cmds.menuItem(divider=True) cmds.menuItem(label="Reset Scene", command=lambda x:ResetSceneAnim(), annotation="Manually reset the scene to bind position") cmds.menuItem(label="Clear Curves", command=lambda x:PurgeAllKeyframes(), annotation="Manually delete all cached keyframe curves in the scene") cmds.menuItem(divider=True) game_menu = cmds.menuItem(label="Game Specific Tools", subMenu=True) # Make game specific submenu cmds.menuItem(label="Call of Duty", subMenu=True) cmds.menuItem(label="Attach Weapon to Rig", command=lambda x:WeaponBinder(), annotation="Attatches the weapon to the viewhands, does not work properly with conversion rigs") cmds.setParent(game_menu, menu=True) # Close out menu (Call of Duty) cmds.setParent(menu, menu=True) # Close out menu (Game tools) cmds.menuItem(divider=True) cmds.menuItem(label="Reload Plugin", command=lambda x:ReloadMayaPlugin(), annotation="Attempts to reload the plugin") cmds.menuItem(label="About", command=lambda x:AboutWindow()) # Reloads a maya plugin
def view_menu_callback(*args): '''Callback for global mel proc postModelEditorViewMenuCmd''' menu_path = args[0] model_panel = args[1] menu_item_path = model_panel + 'burnin' burnin_enabled = False viewport_burnin = get_viewport_burnin() if viewport_burnin: burnin_enabled = cmds.getAttr(viewport_burnin + '.v') cmds.setParent(menu_path, m=True) if not cmds.menuItem(menu_item_path, exists=True): cmds.menuItem(d=True) cmds.menuItem( menu_item_path, label='Burn In', checkBox=burnin_enabled, command=toggle_burnin ) else: cmds.menuItem( menu_item_path, edit=True, checkBox=burnin_enabled )
def _install_menu(): from pyblish_starter.tools import creator, loader _uninstall_menu() def deferred(): cmds.menu(self.menu, label="Pyblish Starter", tearOff=True, parent="MayaWindow") cmds.menuItem("Show Creator", command=creator.show) cmds.menuItem("Show Loader", command=loader.show) # Allow time for uninstallation to finish. QtCore.QTimer.singleShot(100, deferred)
def addMenuDivider(self, label): try: cmds.menuItem(divider=True, label=label) except RuntimeError as e: print 'Maya error while trying to create divider:', print e
def addMenuLabel(self, label): try: cmds.menuItem(label=label, en=False) except RuntimeError as e: print 'Maya error while trying to add menu entry:', print e
def addMenuSubmenu(self, label, icon, entries): try: cmds.menuItem(subMenu=True, tearOff=False, label=label, image=icon) except RuntimeError as e: print 'Maya error while trying to create submenu:', print e self.fillMenu(entries) try: cmds.setParent('..', menu=True ) except RuntimeError as e: print 'Maya error while trying to change menu parent:', print e
def addMenuCommand(self, label, icon, command): try: cmds.menuItem( label=label, image=icon, command=command ) except RuntimeError as e: print 'Maya error while trying to change menu parent:', print e
def menus(self): ######### modify for inheritence ########### #self.widgets["testMenu"] = cmds.menu(l="test") self.widgets["menu"] = cmds.menuBarLayout() self.widgets["menuFile"] = cmds.menu(label="file") cmds.menuItem(l='reset values', c=self.resetValues) cmds.menuItem(l="save values", c=self.saveValues) cmds.menuItem(l="load values", c=self.loadValues) self.widgets["menuHelp"] = cmds.menu(l="help") cmds.menuItem(l="print help", c=self.printHelp)
def populateMenuItems(*args): cmds.popupMenu(widgets["searchPUM"], e=True, deleteAllItems=True) # clear popup menu t = getTypeText() matches = [] if t: matches = returnMatches(t, typeList) if matches: for item in matches: cmds.menuItem(p=widgets["searchPUM"], l=item, c=partial(fillMenuText, item))
def menuset_sel(box_ui, key, m_item, menu, *args): state = cmds.menuItem(m_item, q=1, isOptionBox=1) if state: # option box used, edit menu set menuset_edit(box_ui, key, menu) else: # changing menu set data = data_load() channelbox_make(box_ui, data[key]) menulabel_update(key, menu) currentset_set(key)
def channelbox_menu_states(box, item_key, *args): # -----------------------------------------------------------------------------------# # MENU STATES : For enabling or disabling menu items based on conditions # This will determine if our menuItem is enabled or not, if you want to add a # custom menu item with different conditions for being enabled you can do it # here by returning prior to the 'return result' on the final line # # For this to function the "_hasEnableConditions" must be set to true/1 # -----------------------------------------------------------------------------------# # ---------------- MANUALLY ADDED CONDITIONS ----------------# # Put your enabled/disabled state overrides here, example: # if item_key == "keyForManualOverride": # return 0 to disable or return 1 to enable # -----------------------------------------------------------# if item_key == "invertShown": return 1 if len(box.filter_attrs) >= 1 or len(box.filter_items) >= 1 else 0 if item_key == "createFilterSet": if len(box.filter_attrs) >= 1 or len(box.filter_items) >= 1: return 1 else: return 0 if item_key == "selectFilterSet": if "savedFilters" in box.saved_states and len(box.saved_states["savedFilters"][0]) >= 1: return 1 else: return 0 return channelbox_menu_selected_channels(box) # ----------------------------------------------------------------------------------- # # ----------------------------------------------------------------------------------- # # CUSTOM MENU TYPES : Anything set as a "custom" type in the menu can have it's # behaviour set here by checking for it's unique key # ----------------------------------------------------------------------------------- #
def channelbox_menu_custom(box, item_key, item_type, label, command, parent, enabled): if item_key == "selectFilterSet": m_item = cmds.menuItem(l=label, en=enabled, subMenu=1, p=parent) for f in box.saved_states["savedFilters"][0]: item = cmds.menuItem(l=f, p=m_item) item_ob = cmds.menuItem(l=f, ob=1, p=m_item) cmds.menuItem(item, e=1, c=sysCmd.rpartial(command, box, item, item_key)) cmds.menuItem(item_ob, e=1, c=sysCmd.rpartial(command, box, item_ob, item_key)) # ----------------------------------------------------------------------------------- # # ----------------------------------------------------------------------------------- # # CUSTOM MENU "Objects" : Use this also as an example for implementing a custom menu # ----------------------------------------------------------------------------------- #
def channelbox_command_objectmenu(box, menu, menu_item, m_item, *args): state = cmds.menuItem(menu_item, q=1, isOptionBox=1) item = cmds.menuItem(menu_item if not state else m_item, q=1, l=1) cmds.select(item, deselect=1) cmds.select(item, add=1) if state: mel.eval("editSelected")
def channelbox_menu_object(box, menu, *args): cmds.menu(menu, e=1, deleteAllItems=1) sel = cmds.ls(os=1) if not sel: cmds.menuItem(l="Nothing selected", p=menu) return sel.reverse() first = 1 for i in sel: m_item = cmds.menuItem(l=i, p=menu) m_item_box = cmds.menuItem(m_item, optionBox=1, p=menu) cmds.menuItem(m_item, e=1, c=sysCmd.rpartial(channelbox_command_objectmenu, box, menu, m_item, "select " + i)) cmds.menuItem(m_item_box, e=1, c=sysCmd.rpartial(channelbox_command_objectmenu, box, menu, m_item_box, m_item, "select " + i + " [ ]")) if first: cmds.menuItem(divider=1, p=menu) first = 0 # -----------------------------------------------------------------------------------# # -----------------------------------------------------------------------------------# # This is where the menu icons are setup # You probably don't need to modify this, unless you have your own icons to add # -----------------------------------------------------------------------------------#
def channelbox_command_keyAll(box, menuItem, key, *args): with sysCmd.Undo(): cmds.channelBox(box.channelbox, e=1, exe=("if( `getAttr -k \"#P.#A\"` ) setKeyframe \"#P.#A\";", 0))
def channelbox_command_breakdown(box, menuItem, key, *args): with sysCmd.Undo(): cmds.channelBox(box.channelbox, e=1, exe=("setKeyframe -breakdown true \"#P.#A\";", 1))
def channelbox_command_breakdownAll(box, menuItem, key, *args): with sysCmd.Undo(): cmds.channelBox(box.channelbox, e=1, exe=("setKeyframe -breakdown true \"#P.#A\";", 0))
def channelbox_command_mute(box, menuItem, key, *args): with sysCmd.Undo(): cmds.channelBox(box.channelbox, e=1, exe=("mute \"#P.#A\";", 1))
def channelbox_command_muteAll(box, menuItem, key, *args): with sysCmd.Undo(): cmds.channelBox(box.channelbox, e=1, exe=("mute \"#P.#A\";", 0))
def channelbox_command_unmuteAll(box, menuItem, key, *args): with sysCmd.Undo(): cmds.channelBox(box.channelbox, e=1, exe=("mute -disable -force \"#P.#A\";", 0))
def channelbox_command_syncGraph(box, menuItem, key, *args): with sysCmd.Undo(0): state = channelBox_Checkbox_Update(box, key, menuItem) if not state and box.menu_jobs[key] > 0: # if user disabled the option, and ScriptJob is running, kill the ScriptJob cmds.scriptJob(k=box.menu_jobs[key]) box.menu_jobs[key] = -1 if state: mel.eval("GraphEditor;") # open graph editor cmds.channelBox(box.channelbox, e=1, exe=(channelbox_command_animCurve(box, menuItem, key), 0)) if box.menu_jobs[key] < 0: # if ScriptJob is not running, start it box.menu_jobs[key] = cmds.scriptJob( event=("ChannelBoxLabelSelected", partial(channelbox_command_syncGraph_scriptJob, box)), parent=box.channelbox)
def channelbox_command_syncTimeline(box, menuItem, key, *args): with sysCmd.Undo(0): state = channelBox_Checkbox_Update(box, key, menuItem) playback_slider = mel.eval("$tmpVar=$gPlayBackSlider") # gets timeslider name if state: cmds.timeControl(playback_slider, e=1, showKeys=box.channelbox) cmds.timeControl(playback_slider, e=1, showKeysCombined=1) else: cmds.timeControl(playback_slider, e=1, showKeysCombined=0) cmds.timeControl(playback_slider, e=1, showKeys="active") # --
def channelbox_command_cut(box, menuItem, key, *args): with sysCmd.Undo(): cmd = "" okay = 0 def loop(which, _cmd, _okay): obj_list = cmds.channelBox(box.channelbox, q=1, mainObjectList=which[0], shapeObjectList=which[1], historyObjectList=which[2], outputObjectList=which[3]) attr_list = cmds.channelBox(box.channelbox, q=1, selectedMainAttributes=which[0], selectedShapeAttributes=which[1], selectedHistoryAttributes=which[2], selectedOutputAttributes=which[3]) if obj_list and attr_list: _cmd += "cutKey -t \":\" -f \":" for channel in attr_list: _cmd += "\" -at \"" + channel for obj in obj_list: _cmd += "\" " + obj _cmd += ";" _okay = 1 return _cmd, _okay cmd, okay = loop([1, 0, 0, 0], cmd, okay) cmd, okay = loop([0, 1, 0, 0], cmd, okay) cmd, okay = loop([0, 0, 1, 0], cmd, okay) cmd, okay = loop([0, 0, 0, 1], cmd, okay) if okay == 1: print cmd print "// Result: " + str(mel.eval(cmd)) + " //"
def channelbox_command_copy(box, menuItem, key, *args): with sysCmd.Undo(): cmd = "" okay = 0 def loop(which, _cmd, _okay): obj_list = cmds.channelBox(box.channelbox, q=1, mainObjectList=which[0], shapeObjectList=which[1], historyObjectList=which[2], outputObjectList=which[3]) attr_list = cmds.channelBox(box.channelbox, q=1, selectedMainAttributes=which[0], selectedShapeAttributes=which[1], selectedHistoryAttributes=which[2], selectedOutputAttributes=which[3]) if obj_list and attr_list: _cmd += "copyKey -t \":\" -f \":" for channel in attr_list: _cmd += "\" -at \"" + channel for obj in obj_list: _cmd += "\" " + obj _cmd += ";" _okay = 1 return _cmd, _okay cmd, okay = loop([1, 0, 0, 0], cmd, okay) cmd, okay = loop([0, 1, 0, 0], cmd, okay) cmd, okay = loop([0, 0, 1, 0], cmd, okay) cmd, okay = loop([0, 0, 0, 1], cmd, okay) if okay == 1: print cmd print "// Result: " + str(mel.eval(cmd)) + " //"
def channelbox_command_delete(box, menuItem, key, *args): with sysCmd.Undo(): cmd = "" okay = 0 def loop(which, _cmd, _okay): obj_list = cmds.channelBox(box.channelbox, q=1, mainObjectList=which[0], shapeObjectList=which[1], historyObjectList=which[2], outputObjectList=which[3]) attr_list = cmds.channelBox(box.channelbox, q=1, selectedMainAttributes=which[0], selectedShapeAttributes=which[1], selectedHistoryAttributes=which[2], selectedOutputAttributes=which[3]) if obj_list and attr_list: _cmd += "cutKey -cl -t \":\" -f \":" for channel in attr_list: _cmd += "\" -at \"" + channel for obj in obj_list: _cmd += "\" " + obj _cmd += ";" _okay = 1 return _cmd, _okay cmd, okay = loop([1, 0, 0, 0], cmd, okay) cmd, okay = loop([0, 1, 0, 0], cmd, okay) cmd, okay = loop([0, 0, 1, 0], cmd, okay) cmd, okay = loop([0, 0, 0, 1], cmd, okay) if okay == 1: print cmd print "// Result: " + str(mel.eval(cmd)) + " //" # --
def channelbox_command_duplicateAttrValues(box, menuItem, key, *args): mel.eval("copyAttrValues")
def channelbox_command_freezeTranslate(box, menuItem, key, *args): with sysCmd.Undo(): if cmds.ls(sl=1): cmds.makeIdentity(t=1, r=0, s=0, n=0, a=1)
def channelbox_command_freezeRotate(box, menuItem, key, *args): with sysCmd.Undo(): if cmds.ls(sl=1): cmds.makeIdentity(t=0, r=1, s=0, n=0, a=1)
def channelbox_command_freezeScale(box, menuItem, key, *args): with sysCmd.Undo(): if cmds.ls(sl=1): cmds.makeIdentity(t=0, r=0, s=1, n=0, a=1)
def channelbox_command_freezeTranslateScale(box, menuItem, key, *args): with sysCmd.Undo(): if cmds.ls(sl=1): cmds.makeIdentity(t=1, r=0, s=1, n=0, a=1)
def channelbox_command_freezeRotateScale(box, menuItem, key, *args): with sysCmd.Undo(): if cmds.ls(sl=1): cmds.makeIdentity(t=0, r=1, s=1, n=0, a=1)
def channelbox_command_freezeJointOrient(box, menuItem, key, *args): with sysCmd.Undo(): if cmds.ls(sl=1): cmds.makeIdentity(t=0, r=0, s=0, n=0, jo=1, a=1)
def channelbox_command_freezeAll(box, menuItem, key, *args): with sysCmd.Undo(): state = cmds.menuItem(menuItem, q=1, isOptionBox=1) if not state: if cmds.ls(sl=1): cmds.makeIdentity(t=1, r=1, s=1, n=0, a=1) else: channelbox_command_freezeUI()