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


Python cmds.button方法代码示例

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


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

示例1: donateWin

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def donateWin(self, *args):
        """ Simple window with links to donate in order to support this free and openSource code via PayPal.
        """
        # declaring variables:
        self.donate_title       = 'dpAutoRig - v'+DPAR_VERSION+' - '+self.langDic[self.langName]['i167_donate']
        self.donate_description = self.langDic[self.langName]['i168_donateDesc']
        self.donate_winWidth    = 305
        self.donate_winHeight   = 300
        self.donate_align       = "center"
        # creating Donate Window:
        if cmds.window('dpDonateWindow', query=True, exists=True):
            cmds.deleteUI('dpDonateWindow', window=True)
        dpDonateWin = cmds.window('dpDonateWindow', title=self.donate_title, iconName='dpInfo', widthHeight=(self.donate_winWidth, self.donate_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False)
        # creating text layout:
        donateColumnLayout = cmds.columnLayout('donateColumnLayout', adjustableColumn=True, columnOffset=['both', 20], rowSpacing=5, parent=dpDonateWin)
        cmds.separator(style='none', height=10, parent=donateColumnLayout)
        infoDesc = cmds.text(self.donate_description, align=self.donate_align, parent=donateColumnLayout)
        cmds.separator(style='none', height=10, parent=donateColumnLayout)
        brPaypalButton = cmds.button('brlPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - R$ - Real", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"BRL"), parent=donateColumnLayout)
        #usdPaypalButton = cmds.button('usdPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - USD - Dollar", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"USD"), parent=donateColumnLayout)
        # call Donate Window:
        cmds.showWindow(dpDonateWin) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:24,代码来源:dpAutoRig.py

示例2: dpIkFkSnapUI

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def dpIkFkSnapUI(self, *args):
        """ Show a little window with buttons to change from Ik to Fk or from Fk to Ik snapping.
        """
        # creating ikFkSnap Window:
        if cmds.window('dpIkFkSnapWindow', query=True, exists=True):
            cmds.deleteUI('dpIkFkSnapWindow', window=True)
        ikFkSnap_winWidth  = 205
        ikFkSnap_winHeight = 50
        dpIkFkSnapWin = cmds.window('dpIkFkSnapWindow', title='IkFkSnap '+DPIKFK_VERSION, iconName='dpIkFkSnap', widthHeight=(ikFkSnap_winWidth, ikFkSnap_winHeight), menuBar=False, sizeable=True, minimizeButton=True, maximizeButton=False, menuBarVisible=False, titleBar=True)
        # creating layout:
        ikFkSnapLayout = cmds.columnLayout('ikFkSnapLayout', adjustableColumn=True, parent=dpIkFkSnapWin)
        # creating buttons:
        cmds.button('ikToFkSnap_BT', label="Ik --> Fk", backgroundColor=(0.8, 0.8, 1.0), command=self.IkToFkSnap, parent=ikFkSnapLayout)
        cmds.button('fkToIkSnap_BT', label="Fk --> Ik", backgroundColor=(1.0, 0.8, 0.8), command=self.FkToIkSnap, parent=ikFkSnapLayout)
        # call colorIndex Window:
        cmds.showWindow(dpIkFkSnapWin) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:18,代码来源:dpIkFkSnap.py

示例3: colorizeModuleUI

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def colorizeModuleUI(self, colorIndex, *args):
        """ Show a little window to choose the color of the button and the override the guide.
        """
        # verify integrity of the guideModule:
        if self.verifyGuideModuleIntegrity():
            # creating colorIndex Window:
            if cmds.window('dpColorIndexWindow', query=True, exists=True):
                cmds.deleteUI('dpColorIndexWindow', window=True)
            colorIndex_winWidth  = 160
            colorIndex_winHeight = 80
            self.dpColorIndexWin = cmds.window('dpColorIndexWindow', title='Color Index', iconName='dpColorIndex', widthHeight=(colorIndex_winWidth, colorIndex_winHeight), menuBar=False, sizeable=False, minimizeButton=False, maximizeButton=False, menuBarVisible=False, titleBar=True)
            # creating layout:
            colorIndexLayout = cmds.gridLayout('colorIndexLayout', numberOfColumns=8, cellWidthHeight=(20,20))
            # creating buttons:
            for colorIndex, colorValues in enumerate(self.colorList):
                cmds.button('indexColor_'+str(colorIndex)+'_BT', label=str(colorIndex), backgroundColor=(colorValues[0], colorValues[1], colorValues[2]), command=partial(self.setColorModule, colorIndex), parent=colorIndexLayout)
            # call colorIndex Window:
            cmds.showWindow(self.dpColorIndexWin) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:20,代码来源:dpLayoutClass.py

示例4: createSpiralWin

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def createSpiralWin():
    window = cmds.window( title="Create Spiral", widthHeight=(200, 300) )
    cmds.columnLayout( columnAttach=('both', 5), rowSpacing=5, adjustableColumn=True )
    
    amp = cmds.floatFieldGrp( numberOfFields=1, label='Amp', value1=1.0)
    spin = cmds.floatFieldGrp( numberOfFields=1, label='Spin', value1=30)
    count = cmds.intFieldGrp( numberOfFields=1, label='Count', value1=20)
    width = cmds.floatFieldGrp( numberOfFields=1, label='Width', value1=3)

    def click(value):
        doCreateSpiral(amp, spin, count, width)
        
    cmds.button( label='Create Spiral!', command=click )
    
    closeCmd = 'cmds.deleteUI("%s", window=True)' % window
    cmds.button( label='Close', command=closeCmd )
    
    cmds.showWindow( window ) 
开发者ID:justinfx,项目名称:tutorials,代码行数:20,代码来源:createSpiralWin.py

示例5: __init__

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [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

示例6: colorControlLayout

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def colorControlLayout(self, label=''):
        mc.rowLayout( numberOfColumns=4,
                      columnWidth4=(150, 200, 90, 80),
                      adjustableColumn=2,
                      columnAlign=(1, 'right'),
                      columnAttach=[(1, 'both', 0),
                                    (2, 'both', 0),
                                    (3, 'both', 0),
                                    (4, 'both', 0)] )
        mc.text(label=label)
        colorSlider = mc.colorSliderGrp( label='', adj=2, columnWidth=((1,1),(3,1)))
        mc.button(label='From Selected',
                  ann='Get the color of the selected object.',
                  command=partial(self.setFromSelected, colorSlider))
        mc.button(label='Randomize',
                  ann='Set a random color.',
                  command=partial(self.randomizeColors, colorSlider))
        controls = mc.layout(colorSlider, query=True, childArray=True)

        mc.setParent('..')

        return colorSlider 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:24,代码来源:ml_colorControl.py

示例7: ui

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def ui():
    '''
    User interface for convert rotation order
    '''

    with utl.MlUi('ml_convertRotationOrder', 'Convert Rotation Order', width=400, height=140, info='''Select objects to convert and press button for desired rotation order.
Use the "Get Tips" button to see suggestions for a single object on the current frame.''') as win:


        mc.button(label='Get tips for selection', command=loadTips, annotation='')
        mc.scrollField('ml_convertRotationOrder_nodeInfo_scrollField', editable=False, wordWrap=True, height=60)

        mc.rowColumnLayout(numberOfColumns=2, columnWidth=[(1,100), (2,400)], columnAttach=[2,'both',1])
        for each in ROTATE_ORDERS:
            _BUTTON[each] = win.buttonWithPopup(label=each, command=globals()[each], annotation='Convert selected object rotate order to '+each+'.', shelfLabel=each)
            mc.textField('ml_convertRotationOrder_'+each+'_textField', editable=False)

    resetTips() 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:20,代码来源:ml_convertRotationOrder.py

示例8: quickBreakDownUI

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def quickBreakDownUI():
    winName = 'ml_quickBreakdownWin'
    if mc.window(winName, exists=True):
        mc.deleteUI(winName)

    mc.window(winName, title='ml :: QBD', iconName='Quick Breakdown', width=100, height=500)

    mc.columnLayout(adj=True)

    mc.paneLayout(configuration='vertical2', separatorThickness=1)
    mc.text('<<')
    mc.text('>>')
    mc.setParent('..')

    for v in (10,20,50,80,90,100,110,120,150):
        mc.paneLayout(configuration='vertical2',separatorThickness=1)

        mc.button(label=str(v)+' %', command=partial(weightPrevious,v/100.0))
        mc.button(label=str(v)+' %', command=partial(weightNext,v/100.0))
        mc.setParent('..')

    mc.showWindow(winName)

    mc.window(winName, edit=True, width=100, height=250) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:26,代码来源:ml_breakdown.py

示例9: upToDateCheck

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def upToDateCheck(revision, prompt=True):
    '''
    This is a check that can be run by scripts that import ml_utilities to make sure they
    have the correct version.
    '''

    if not '__revision__' in locals():
        return

    if revision > __revision__:
        if prompt and mc.optionVar(query='ml_utilities_revision') < revision:
            result = mc.confirmDialog( title='Module Out of Date',
                                       message='Your version of ml_utilities may be out of date for this tool. Without the latest file you may encounter errors.',
                                       button=['Download Latest Revision','Ignore', "Don't Ask Again"],
                                       defaultButton='Download Latest Revision', cancelButton='Ignore', dismissString='Ignore' )

            if result == 'Download Latest Revision':
                mc.showHelp(GITHUB_ROOT_URL+'ml_utilities.py', absolute=True)
            elif result == "Don't Ask Again":
                mc.optionVar(intValue=('ml_utilities_revision', revision))
        return False
    return True 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:24,代码来源:ml_utilities.py

示例10: about

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def about(self, *args):
        '''
        This pops up a window which shows the revision number of the current script.
        '''

        text='by Morgan Loomis\n\n'
        try:
            __import__(self.module)
            module = sys.modules[self.module]
            text = text+'Revision: '+str(module.__revision__)+'\n'
        except StandardError:
            pass
        try:
            text = text+'ml_utilities Rev: '+str(__revision__)+'\n'
        except StandardError:
            pass

        mc.confirmDialog(title=self.name, message=text, button='Close') 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:20,代码来源:ml_utilities.py

示例11: buttonWithPopup

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def buttonWithPopup(self, label=None, command=None, annotation='', shelfLabel='', shelfIcon='render_useBackground', readUI_toArgs={}):
        '''
        Create a button and attach a popup menu to a control with options to create a shelf button or a hotkey.
        The argCommand should return a kwargs dictionary that can be used as args for the main command.
        '''

        if self.icon:
            shelfIcon = self.icon

        if annotation and not annotation.endswith('.'):
            annotation+='.'

        button = mc.button(label=label, command=command, annotation=annotation+' Or right click for more options.')

        mc.popupMenu()
        self.shelfMenuItem(command=command, annotation=annotation, shelfLabel=shelfLabel, shelfIcon=shelfIcon)
        self.hotkeyMenuItem(command=command, annotation=annotation)
        return button 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:20,代码来源:ml_utilities.py

示例12: __init__

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

示例13: mini

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def mini():
    name = 'ml_arcTracer_win_mini'
    w = 100
    h = 50
    if mc.window(name, exists=True):
        mc.deleteUI(name)
    win = mc.window(name, width=w, height=h, title='arcs', iconName='arc')
    form = mc.formLayout()

    a1 = mc.button(label='camera', command=traceCamera)
    a2 = mc.button(label='world', command=traceWorld)
    b1 = mc.button(label='retrace', command=retraceArc)
    b2 = mc.button(label='clear', command=clearArcs)

    utl.formLayoutGrid(form, [[a1,a2],[b1,b2]], )

    mc.showWindow(win)
    mc.window(win, edit=True, width=w, height=h) 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:20,代码来源:ml_arcTracer.py

示例14: ui

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def ui():
    '''
    User interface for stopwatch
    '''

    with utl.MlUi('ml_stopwatch', 'Stopwatch', width=400, height=175, info='''Press the start button to start recording.
Continue pressing to set marks.
When finished, press the stop button and the report will pop up.''') as win:

        mc.checkBoxGrp('ml_stopwatch_round_checkBox',label='Round to nearest frame', value1=True, annotation='Only whole number frames')

        mc.text('ml_stopwatch_countdown_text', label='Ready...')

        mc.button('ml_stopwatch_main_button', label='Start', height=80)
        _setButtonStart()
        mc.button(label='Stop', command=_stopButton, annotation='Stop the recording.') 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:18,代码来源:ml_stopwatch.py

示例15: __init__

# 需要导入模块: from maya import cmds [as 别名]
# 或者: from maya.cmds import button [as 别名]
def __init__(self):

        super(CopySkinUI, self).__init__('ml_copySkin', 'Copy SkinClusters', width=400, height=180,
                                         info='''Select a skinned mesh to add to the Source Mesh field below.
Select a destination mesh, or vertices to copy the skin to.
Press the button to copy the skin weights.''')

        self.buildWindow()

        self.srcMeshField = self.selectionField(label='Source Mesh',
                                                annotation='Select the mesh to be used as the source skin.',
                                                channel=False,
                                                text='')

        mc.button(label='Copy Skin', command=self.copySkin, annotation='Copy the Source Skin to selection.')

        self.finish() 
开发者ID:morganloomis,项目名称:ml_tools,代码行数:19,代码来源:ml_copySkin.py


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