当前位置: 首页>>代码示例>>Python>>正文


Python cmds.menuItem方法代码示例

本文整理汇总了Python中maya.cmds.menuItem方法的典型用法代码示例。如果您正苦于以下问题:Python cmds.menuItem方法的具体用法?Python cmds.menuItem怎么用?Python cmds.menuItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在maya.cmds的用法示例。


在下文中一共展示了cmds.menuItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __mirror_flip_pose_callback

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def __mirror_flip_pose_callback(*args):
    """Wrapper function to call mGears mirroPose function

    Args:
        list: callback from menuItem
    """

    # cast controls into pymel object nodes
    controls = [pm.PyNode(x) for x in args[0]]

    # triggers mirror
    # we handle the mirror/flip each control individually even if the function
    # accepts several controls. Flipping on proxy attributes like blend
    # attributes cause an issue to rather than trying the complete list we do
    # one control to avoid the mirror to stop
    for ctl in controls:
        mirrorPose(flip=args[1], nodes=[ctl]) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:19,代码来源:dagmenu.py

示例2: __reset_attributes_callback

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def __reset_attributes_callback(*args):
    """ Wrapper function to call mGears resetTransform function

    Args:
        list: callback from menuItem
    """

    attribute = args[1]

    for node in args[0]:
        control = pm.PyNode(node)

        if attribute == "translate":
            resetTransform(control, t=True, r=False, s=False)
        if attribute == "rotate":
            resetTransform(control, t=False, r=True, s=False)
        if attribute == "scale":
            resetTransform(control, t=False, r=False, s=True) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:20,代码来源:dagmenu.py

示例3: __init__

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def __init__(self, title, help_url=None):
        layout = mel.eval("getOptionBox")
        cmds.setParent(layout)
        mel.eval('setOptionBoxTitle("{}");'.format(title))
        self.create_ui()

        apply_close_button = mel.eval("getOptionBoxApplyAndCloseBtn;")
        cmds.button(apply_close_button, e=True, command=self._apply_and_close)
        apply_button = mel.eval("getOptionBoxApplyBtn;")
        cmds.button(apply_button, e=True, command=self._on_apply)
        close_button = mel.eval("getOptionBoxCloseBtn;")
        cmds.button(close_button, e=True, command=self._close)

        if help_url:
            help_item = mel.eval("getOptionBoxHelpItem;")
            cmds.menuItem(
                help_item,
                e=True,
                label="Help on {}".format(title),
                command='import webbrowser; webbrowser.open("{}")'.format(help_url),
            ) 
开发者ID:chadmv,项目名称:cmt,代码行数:23,代码来源:optionbox.py

示例4: markingMenu

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
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) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:25,代码来源:ml_graphEditorMask.py

示例5: attributeMenuItem

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
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)) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:23,代码来源:ml_puppet.py

示例6: markingMenu

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
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='N', label='Trace Camera', command=traceCamera, **menuKwargs)
    mc.menuItem(radialPosition='E', label='Trace World', command=traceWorld, **menuKwargs)
    mc.menuItem(radialPosition='W', label='Re-Trace', command=retraceArc, **menuKwargs)
    mc.menuItem(radialPosition='S', label='Clear', command=clearArcs, **menuKwargs)

    mc.menuItem(label='Arc Tracer UI', command=ui, **menuKwargs) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:19,代码来源:ml_arcTracer.py

示例7: getItem

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def getItem(item, name, parents):
    """
    Get data from item and store it into COMMANDS variable.
    
    :param QWidgetAction item:
    :param str name: 
    :param list parents: List f all parents, used for hierarchy
    """

    # get name
    text = item.text().encode("utf-8")
    if not name or item.isSeparator() or item.menu():  
        return
    
    # add last parent
    parents.append(text)
        
    # get icon
    icon = cmds.menuItem(utils.qtToMaya(item), query=True, image=True)
      
    # store commands      
    COMMANDS[name] = dict( )
    COMMANDS[name]["name"] = text
    COMMANDS[name]["pin"] = False
    COMMANDS[name]["cmd"] = item 
    COMMANDS[name]["icon"] = utils.QIcon( ":/{0}".format(icon))
    COMMANDS[name]["group"] = parents[0]
    COMMANDS[name]["search"] = "".join([p.lower() for p in parents]) 
    COMMANDS[name]["hierarchy"] = " > ".join(parents) 
开发者ID:robertjoosten,项目名称:maya-command-search,代码行数:31,代码来源:commands.py

示例8: _update_menu_task_label

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def _update_menu_task_label():
    """Update the task label in Avalon menu to current session"""

    if IS_HEADLESS:
        return

    object_name = "{}|currentContext".format(self._menu)
    if not cmds.menuItem(object_name, query=True, exists=True):
        logger.warning("Can't find menuItem: {}".format(object_name))
        return

    label = "{}, {}".format(api.Session["AVALON_ASSET"],
                            api.Session["AVALON_TASK"])
    cmds.menuItem(object_name, edit=True, label=label) 
开发者ID:getavalon,项目名称:core,代码行数:16,代码来源:pipeline.py

示例9: getCurrentMenuValue

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def getCurrentMenuValue(self, itemList, *args):
        for item in itemList:
            if cmds.menuItem( item+"_MI", query=True, radioButton=True ):
                return item 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:6,代码来源:dpAutoRig.py

示例10: reCreateEditSelectedModuleLayout

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def reCreateEditSelectedModuleLayout(self, bSelect=False, *args):
        Layout.LayoutClass.reCreateEditSelectedModuleLayout(self, bSelect)
        # style layout:
        self.styleLayout = cmds.rowLayout(numberOfColumns=4, columnWidth4=(100, 50, 50, 70), columnAlign=[(1, 'right'), (2, 'left'), (3, 'right')], adjustableColumn=4, columnAttach=[(1, 'both', 2), (2, 'left', 2), (3, 'left', 2), (3, 'both', 10)], parent="selectedColumn")
        cmds.text(label=self.langDic[self.langName]['m041_style'], visible=True, parent=self.styleLayout)
        self.styleMenu = cmds.optionMenu("styleMenu", label='', changeCommand=self.changeStyle, parent=self.styleLayout)
        styleMenuItemList = [self.langDic[self.langName]['m042_default'], self.langDic[self.langName]['m026_biped']]
        for item in styleMenuItemList:
            cmds.menuItem(label=item, parent=self.styleMenu)
        # read from guide attribute the current value to style:
        currentStyle = cmds.getAttr(self.moduleGrp+".style")
        cmds.optionMenu(self.styleMenu, edit=True, select=int(currentStyle+1)) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:14,代码来源:dpSpine.py

示例11: __change_rotate_order_callback

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def __change_rotate_order_callback(*args):
    """Wrapper function to call mGears change rotate order function

    Args:
        list: callback from menuItem
    """

    # triggers rotate order change
    change_rotate_order(args[0], args[1]) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:11,代码来源:dagmenu.py

示例12: __keyframe_nodes_callback

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def __keyframe_nodes_callback(*args):
    """Wrapper function to call Maya's setKeyframe command on given controls

    Args:
        list: callback from menuItem
    """

    cmds.setKeyframe(args[0]) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:10,代码来源:dagmenu.py

示例13: __select_nodes_callback

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def __select_nodes_callback(*args):
    """ Wrapper function to call Maya select command

    Args:
        list: callback from menuItem
    """

    cmds.select(args[0], add=True) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:10,代码来源:dagmenu.py

示例14: install

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def install():
    """ Installs dag menu option
    """

    # get state
    state = get_option_var_state()

    cmds.setParent(mgear.menu_id, menu=True)
    cmds.menuItem("mgear_dagmenu_menuitem", label="mGear Viewport Menu ",
                  command=run, checkBox=state)
    cmds.menuItem(divider=True)

    run(state) 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:15,代码来源:dagmenu.py

示例15: makeMenu

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import menuItem [as 别名]
def makeMenu(menuName=kPluginCmdName):
    """make menu when plugin load"""
    removeMenu(menuName)
    topMenu = cmds.menu(menuName, label=menuName, parent=u'MayaWindow', tearOff=True)
    cmds.menuItem(label=kPluginCmdName, parent=topMenu, command=kPluginCmdName, sourceType='mel')


# Plugin class
# ---------------------------------------------------------------------- 
开发者ID:WendyAndAndy,项目名称:MayaDev,代码行数:11,代码来源:pyMyPlugin.py


注:本文中的maya.cmds.menuItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。