• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.shelfButton函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: selToShelf

def selToShelf():
    """
	Saves all the selected textScrollList attributes to the shelf to be keyframed.
	"""
    results = cmds.promptDialog(
        title="Creating a shelf button.",
        message="Enter Shelf Button Name:",
        button=["OK", "Cancel"],
        defaultButton="OK",
        cancelButton="Cancel",
        dismissString="Cancel",
    )

    fileName = cmds.promptDialog(query=True, text=True)

    # if( results ):

    # Get the current shelf
    currentShelf = mel.eval(
        "global string $gShelfTopLevel;\rstring $shelves = `tabLayout -q -selectTab $gShelfTopLevel`;"
    )

    # Compile the info from the textScrollList
    # Get all the attrs from the textScrollList
    selectedTSL = cmds.textScrollList("sbaKeyTSL", q=True, si=True)

    # Calling my function to complies the attribute to be keyframed correctly.
    keyFrameLines = compileKeyframes(selectedTSL)

    # Create the shelfButton
    cmds.shelfButton(l=fileName, iol=fileName, c=keyFrameLines, image="setKey.xpm", parent=currentShelf)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:31,代码来源:mclavan_fp_extra.py


示例2: mayaUIContent

def mayaUIContent(parent):
    """ Contents by Maya standard UI widgets """

    layout = cmds.columnLayout(adjustableColumn=True, parent=parent)

    cmds.frameLayout("Sample Frame 1", collapsable=True)
    cmds.columnLayout(adjustableColumn=True, rowSpacing=2)
    cmds.button("maya button 1")
    cmds.button("maya button 2")
    cmds.button("maya button 3")
    cmds.setParent('..')
    cmds.setParent('..')

    cmds.frameLayout("Sample Frame 2", collapsable=True)
    cmds.gridLayout(numberOfColumns=6, cellWidthHeight=(35, 35))
    cmds.shelfButton(image1="polySphere.png", rpt=True, c=cmds.polySphere)
    cmds.shelfButton(image1="sphere.png", rpt=True, c=cmds.sphere)
    cmds.setParent('..')
    cmds.setParent('..')

    cmds.setParent('..')  # columnLayout

    ptr = OpenMayaUI.MQtUtil.findLayout(layout)
    obj = shiboken2.wrapInstance(long(ptr), QtWidgets.QWidget)

    return obj
开发者ID:minoue,项目名称:miMayaUtils,代码行数:26,代码来源:sampleWindow2018.py


示例3: create_shelf

def create_shelf():
    """
    Create the OBB shelf

    Raises:
        None

    Returns:
        None
    """

    tab_layout = mel.eval('$pytmp=$gShelfTopLevel')
    shelf_exists = cmds.shelfLayout('OBB', exists=True)

    if shelf_exists:
        cmds.deleteUI('OBB', layout=True)

    shelf = cmds.shelfLayout('OBB', parent=tab_layout)

    for button, kwargs in buttons.items():

        img = QtGui.QImage(kwargs['image'])
        kwargs['width'] = img.width()
        kwargs['height'] = img.height()

        cmds.shelfButton(label=button, parent=shelf, **kwargs)

    # Fix object 0 error.
    shelves = cmds.shelfTabLayout(tab_layout, query=True, tabLabelIndex=True)

    for index, shelf in enumerate(shelves):
        cmds.optionVar(stringValue=("shelfName%d" % (index+1), str(shelf)))
开发者ID:matthewkapfhammer,项目名称:OBB,代码行数:32,代码来源:__init__.py


示例4: addPose

    def addPose(self,*args):
        cSel = cmds.ls(sl=True)
        
        if len(cSel)<1:
            cmds.warning('No objects selected..')
            sys.exit()
            
        valueDict={}
        
        sCommand = ""
        
        for i in cSel:
            attrList = cmds.listAttr(i, sa= True, k=True)
            
            for j in attrList:
                currAttr = i+'.'+j
                valueDict[currAttr] = cmds.getAttr(currAttr)
                       
        for objAttr, val in valueDict.iteritems():       
            sCommand = sCommand + "cmds.setAttr('"+objAttr+"',"+str(val)+");"
          
        
        gShelfTopLevel = mel.eval('$temp = $gShelfTopLevel')

        currentTab = cmds.tabLayout(gShelfTopLevel, query = True, st = True);
        cmds.shelfButton( annotation='User Pose', label = cSel[0], imageOverlayLabel = cSel[0], image1='commandButton.png', overlayLabelBackColor=(random.random(), random.random(), random.random(), .4), command=sCommand, parent = currentTab)
开发者ID:Kainev,项目名称:kToolset_OBSOLETE,代码行数:26,代码来源:kT_poseToShelf.py


示例5: refreshShelfLayout

 def refreshShelfLayout(self, *args):
     '''Delete and the shelf buttons and remake them
     '''
     
     shelfButtons = mc.shelfLayout(self.shelfLayout, query=True, childArray=True)
     if shelfButtons:
         for child in shelfButtons:
             mc.deleteUI(child)
     
     mc.setParent(self.shelfLayout)
     
     for each in os.listdir(REPOSITORY_PATH):
         if each.endswith('.ctrl'):
             name = os.path.splitext(each)[0]
             icon = None
             imageFile = os.path.join(REPOSITORY_PATH,name+'.png')
             if os.path.isfile(imageFile):
                 icon = imageFile
             filename = os.path.join(REPOSITORY_PATH,each)
             button = mc.shelfButton(command=partial(importControl, name),
                                     image=icon, 
                                     width=70,
                                     height=70,
                                     imageOverlayLabel=name.replace('_',' ').replace('  ',' '),
                                     annotation=name)
             
             menus = mc.shelfButton(button, query=True, popupMenuArray=True)
             if menus:
                 for menu in menus:
                     mc.deleteUI(menu)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:30,代码来源:ml_controlLibrary.py


示例6: updateLoadState

def updateLoadState( state ):
	existingWin = TriggeredWindow.Get()
	if existingWin:
		existingWin.updateLoadState()

	shelfButtons = getShelfButtonsWithTag( 'zooTriggered' )
	for button in shelfButtons:
		cmd.shelfButton( button, e=True, image1="zooTriggered_%d.xpm" % state )
开发者ID:GuidoPollini,项目名称:MuTools,代码行数:8,代码来源:triggeredUI.py


示例7: handPose_fromSelect_toShelf

def handPose_fromSelect_toShelf():
    _shelfName = 'pose_Hand'
    if not cmds.shelfLayout( _shelfName, q=True, exists=True):
         mel.eval('addNewShelfTab "%s";'%_shelfName)

         _cmd  ='\n'
         _cmd +='import maya.cmds as cmds\n'
         _cmd +='import sys\n'
         _cmd +='\n'
         _cmd +=u'# 파이썬 경로 추가\n'
         _cmd +='_newPath = \'//alfredstorage/Alfred_asset/Maya_Shared_Environment/scripts_Python/Alfred_AssetTools\'\n'
         _cmd +='if not _newPath in sys.path:\n'
         _cmd +='    sys.path.append(_newPath)\n'
         _cmd +='\n'
         _cmd +=u'# UI Load\n'
         _cmd +='import Alfred_AssetTools\n'
         _cmd +='reload(Alfred_AssetTools)\n'
         _cmd +=__name__+'.handPose_fromSelect_toShelf()\n'
         
         cmds.shelfButton(
            commandRepeatable = True ,
            image1            = 'pythonFamily.png' ,
            label             = 'getHandPose',
            annotation        = 'getHandPose from Selection',
            sourceType        = 'python',
            command           = _cmd ,
            imageOverlayLabel = 'getHandPose',
            parent            = _shelfName,
            )

    _cmd = getData_from_selection()
    if not _cmd:
        return
    
    _result = cmds.promptDialog(
        title='name',
        message='pose name:',
        button=['OK', 'Cancel'],
        defaultButton='OK',
        cancelButton='Cancel',
        dismissString='Cancel'
        )
    if _result != 'OK':
        print _cmd
        return

    _label = cmds.promptDialog(query=True, text=True)
    
    cmds.shelfButton(
        commandRepeatable =True ,
        image1            ='commandButton.png' ,
        label             ='handPose_'+_label ,
        annotation        ='handPose_'+_label ,
        sourceType        ='mel',
        command           = _cmd ,
        imageOverlayLabel =_label,
        parent            =_shelfName,
    )
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:58,代码来源:Gun_Tools.py


示例8: createShelfBtn

def createShelfBtn():
    currentShelf = cmds.tabLayout("ShelfLayout",selectTab=True,query=True)
    cmds.shelfButton( annotation='Delta Mush To Skin Cluster',
                      command='import dm2sc.convert as convert\nconvert.main()',
                      label='DM2SC',
                      sourceType='python',
                      image1='pythonFamily.png',
                      imageOverlayLabel='DM2SC',
                      parent=currentShelf)
开发者ID:jeanim,项目名称:deltaMushToSkinCluster,代码行数:9,代码来源:dm2scSetup.py


示例9: _update_buttons

def _update_buttons(status):
    image = {
        None: 'publishes/check_deps_unknown.png',
        True: 'publishes/check_deps_ok.png',
        False: 'publishes/check_deps_bad.png'
    }[status]
    # print '# Setting button image to', image
    for button in mayatools.shelf.buttons_from_uuid('sgpublish.mayatools.update_references:run'):
        cmds.shelfButton(button['name'], edit=True, image=image)
开发者ID:hasielhassan,项目名称:sgpublish,代码行数:9,代码来源:maya.py


示例10: openTool

def openTool():
    window = cmds.window('Copymation Toolset', tb=False, s=False)

    #cmds.windowPref('Copymation_Toolset', ra=True)
    shelf = cmds.shelfLayout()

    button = cmds.shelfButton(annotation='Clone animation', image1='animCopymationClone.png', command='animCopymation.clone()', imageOverlayLabel='clone')

    cmds.shelfButton(annotation="Open advanced copy tool",
        image1="redo.png", command="", imageOverlayLabel="copy",
        overlayLabelColor=(1, 1, .25), overlayLabelBackColor=(.15, .9, .1, .4))

    cmds.shelfButton(annotation="Open animation cycler tool",
        image1="undo.png", command="", imageOverlayLabel="cycler",
        overlayLabelColor=(1, .25, .25))

    cmds.shelfButton(annotation="Close Copymation toolset",
        image1="close.png", command='maya.utils.executeDeferred("cmds.deleteUI(\'Copymation_Toolset\')")' , imageOverlayLabel="close",
        overlayLabelColor=(1, .25, .25))

    #resize toolset
    buttonH = cmds.shelfButton(button, q=True, h=True)
    buttonW = cmds.shelfButton(button, q=True, w=True)
    cmds.window(window, edit=True, widthHeight=(buttonW*4+10, buttonH+10))

    #show UI
    showUI()
开发者ID:studiocoop,项目名称:maya-coop,代码行数:27,代码来源:animCopymation.py


示例11: build

 def build(self):
     if cmds.window( 'speedWin', ex=1 ): cmds.deleteUI( 'speedWin' )
     if cmds.windowPref( 'speedWin', ex=1 ): cmds.windowPref( 'speedWin', remove=1 )
     cmds.window( 'speedWin', t='SpeedTool', wh=(350, 260))
     cmds.shelfTabLayout( 'mainShelfTab', image='smallTrash.png', imageVisible=True )
     self.shelf = cmds.shelfLayout( 'Tools', cwh=(35, 35) )
     cmds.shelfButton('save',imageOverlayLabel="save", i1='menuIconWindow.png', c=self.writeShelf)
     self.updateShelf()
     cmds.setParent( '..' )
     cmds.setParent( '..' )
     cmds.showWindow()
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:11,代码来源:speedTools.py


示例12: changeToolTip

	def changeToolTip(self, toolTip, buttonText):
		###Change the tooltip from code to user friendly
		#####WARNING: Method looks at button label, not icon label, which may be different
		activeShelf = self.currentShelf()
		buttons = cmds.shelfLayout(activeShelf, query=True, childArray=True)
		# print dir(buttons[0])
		for button in buttons:
			buttonPath = activeShelf + "|" + button
			buttonLabel = cmds.shelfButton(buttonPath, query = True, label = True)
			if buttonLabel == buttonText:
				cmds.shelfButton(buttonPath, edit = True, annotation = toolTip)
开发者ID:AndresMWeber,项目名称:aw,代码行数:11,代码来源:Ik_Fk_Matcher.py


示例13: shelfButtonHuman

 def shelfButtonHuman(self):
     children = mc.shelfLayout('Human', q=1, ca=1)
     if children == None:
         pass
     else:
         for name in children:
             oldLabel = mc.shelfButton(name, q=1, l=1)
             if oldLabel in self.flowerFacial:
                 mc.deleteUI(name, ctl=1)
     for item in self.humanFacial:
         mc.shelfButton('%s_bt'%item, l=item, w=188, h=196, image1='%s/%s.jpg'%(self.iconPath, item), annotation=item, dcc='facialPanel.update(\"' + item + '\")')
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:11,代码来源:facialPanel.py


示例14: _removeFromShelf

 def _removeFromShelf(s, name, code):
     allShelf = cmds.tabLayout(s.shelf, ca=True, q=True)
     for s in allShelf:
         buttons = cmds.shelfLayout(s, q=True, ca=True)
         if buttons:
             for b in buttons:
                 label = cmds.shelfButton(b, q=True, l=True)
                 command = cmds.shelfButton(b, q=True, c=True)
                 if label == name and command == code:
                     Say().it("Removing shelf button: %s." % b)
                     cmds.deleteUI(b, ctl=True)
开发者ID:internetimagery,项目名称:maya_autoinstaller,代码行数:11,代码来源:__init__.py


示例15: add_toolbox_menu

def add_toolbox_menu():
	gridLayout= 'hj_gridLayout'
	if mc.gridLayout(gridLayout,q=1,ex=1):
		mc.deleteUI(gridLayout)

	mc.setParent('flowLayout2')
	mc.gridLayout(gridLayout,nc=1,cwh=[32,32])
	mc.setParent(gridLayout)

	global_vars = inspect.getouterframes(inspect.currentframe())[-1][0].f_globals
	# global_vars = globals()
	mc.shelfButton(i='tools.png',c=lambda *x: __import__("pyshell").main(global_vars))
开发者ID:anubhab91,项目名称:pyshell,代码行数:12,代码来源:utils.py


示例16: shelfFromFile

def shelfFromFile():
    """
	Creates a shelf button to keyframe the attributes straight from a previously saved file.
	"""
    # Get information from file
    # Starting at the maya folder and limiting to extension .sba
    mayaFolder = cmds.internalVar(userAppDir=True)
    # File Dialog
    # sba will be the file extension.
    filePath = cmds.fileDialog(mode=0, directoryMask=mayaFolder + "*.sba")

    print("Choosen file: " + filePath)

    # Open File
    attrFile = open(filePath, "r")  # Will overwrite the file if it allready exists!

    attrs = attrFile.readlines()

    # Close File
    attrFile.close()

    attrToShelf = []
    # loop through file content adding to the attrToShelf variable.
    for attr in attrs:
        attrToShelf.append(attr.rstrip())

    print(attrToShelf)

    results = cmds.promptDialog(
        title="Creating a shelf button.",
        message="Enter Shelf Button Name:",
        button=["OK", "Cancel"],
        defaultButton="OK",
        cancelButton="Cancel",
        dismissString="Cancel",
    )

    fileName = cmds.promptDialog(query=True, text=True)

    # if( results ):

    # Get the current shelf
    currentShelf = mel.eval(
        "global string $gShelfTopLevel;\rstring $shelves = `tabLayout -q -selectTab $gShelfTopLevel`;"
    )

    # Calling my function to complies the attribute to be keyframed correctly.
    keyFrameLines = compileKeyframes(attrToShelf)

    print(keyFrameLines)
    # Create the shelfButton
    cmds.shelfButton(l=fileName, iol=fileName, c=keyFrameLines, image="setKey.xpm", parent=currentShelf)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:52,代码来源:mclavan_fp_extra.py


示例17: toggleIcon

def toggleIcon(off=False):
    p = Get()
    # List shelf buttons
    buttons = cmds.lsUI(type='shelfButton')
    # interate through buttons to find one using appropriate images
    for btn in buttons:
        img = cmds.shelfButton(btn, q=1, image=1)
        # toggle icon
        if img in p.iconOff or img in p.iconOn:
            if not off:
                cmds.shelfButton(btn, edit=True, image=p.iconOff)
            else:
                cmds.shelfButton(btn, edit=True, image=p.iconOn)
开发者ID:boochos,项目名称:work,代码行数:13,代码来源:pairSelect.py


示例18: add_toolbox_menu

def add_toolbox_menu():
    gridLayout = "hj_gridLayout"
    if mc.gridLayout(gridLayout, q=1, ex=1):
        mc.deleteUI(gridLayout)

    mc.setParent("flowLayout2")
    size = 36
    mc.gridLayout(gridLayout, nc=1, cwh=[size, size])
    mc.setParent(gridLayout)

    global_vars = inspect.getouterframes(inspect.currentframe())[-1][0].f_globals
    # global_vars = globals()
    mc.shelfButton(i="play.png", c=lambda *x: __import__("pyshell").main(global_vars), w=40)
开发者ID:oglops,项目名称:pyshell,代码行数:13,代码来源:utils.py


示例19: add_button

    def add_button(self, **kwargs):

        import sys

        # intercept/adjust some of the arguments
        for (key, val) in kwargs.iteritems():

            # get full image path
            if key.startswith("image") and IconFactory.is_icon_path(val):
                kwargs[key] = self.icon_factory.disk_path(val)

        cmds.setParent("|".join([self.layout, self.name]))
        cmds.shelfButton(**kwargs)
开发者ID:chippey,项目名称:dpa-pipe,代码行数:13,代码来源:shelf.py


示例20: shelf

def shelf() :
    
    ''' Creates a peelMocapTools shelf '''

    import maya.cmds as m
    import maya.mel as mel

    shelfTabName = "peelMocapTools"
    if not m.shelfLayout(shelfTabName, exists=True) :
       shelfTab = mel.eval("addNewShelfTab(\"%s\")" % shelfTabName)
        
    topShelf = mel.eval("global string $gShelfTopLevel; string $x = $gShelfTopLevel")
    try :
       toolShelf = m.shelfLayout("%s|%s" % (topShelf, shelfTabName), q=True, ca=True)
       if toolShelf is not None :
          if len(toolShelf) > 0 : m.deleteUI(toolShelf)
    except RuntimeError :
       x = 0

    kt = 'import mocapCleanup.keyTools as kt;kt.'
    mx = 'import mocapCleanup.mocap as mx;mx.'
    ms = 'import mocapCleanup.markerset as mz;mz.'
    la = 'import mocapCleanup.labeler as la;la.'
    ld = 'import mocapCleanup.loader as ld;ld.'
    ca = 'import mocapCleanup.camera as ca;ca.'
    
    buttons = [
      [ "Load c3d",             mx + "loadc3d()",            "mocap_loadc3d.bmp" ],
      [ "Data",                 ld + "show()",                "mocap_data.bmp"    ],
      [ "Gui",                  la + "show()",               "mocap_gui.bmp"     ],
      [ "Fill",                 kt + "fill()",               "mocap_fill.bmp"    ],
      [ "Split Parts",          kt + "splitParts()",         "mocap_splitParts.bmp" ],
      [ "Swap Selected",        kt + "swap()",               "mocap_swapSelected.bmp" ],
      [ "Swap All",             kt + "swapAll()",            "mocap_swapAll.bmp" ],
      [ "Extract Before",       kt + "extractBefore()",      "mocap_extractBefore.bmp" ],
      [ "Extract After",        kt + "extractAfter()",       "mocap_extractAfter.bmp" ],
      [ "Extract After Sel",    kt + "extractSelected()",    "mocap_extractSelected.bmp" ],
      [ "Set Current",          kt + "setCurrent('1')",      "mocap_setX.bmp" ],
      [ "Move to Current",      kt + "moveToCurrent('1')",   "mocap_moveToX.bmp" ],
      [ "Move 1 to 2",          kt + "moveFirstToSecond()",  "mocap_moveFirstToSecond.bmp" ],
      [ "Key Current to match", kt + "keyCurrentToMatch()",  "mocap_keyCurrentToMatch.bmp" ],
      [ "Go to next gap",       kt + "goToNextGap()",        "mocap_goToNextGap.bmp" ],
      [ "Toggle Active",        kt + "toggleConnectVis()",   "mocap_eye.bmp" ],
      [ "Camera On",            ca + "rigidbodyCam()",       "mocap_cam_on.bmp" ],
      [ "Camera Off",           ca + "clear()",              "mocap_cam_off.bmp" ],
    ]
    #  [ "Load web data",   "import loader\nx=loader.Loader()\nx.show()", "mocap_c3d.bmp" ],
    #  [ "Import Cameras",  "import camera\ncamera.importCameras()\n", "mocap_cam.bmp" ],
      
    for i in buttons :
      m.shelfButton(l=i[0], stp="python", c=i[1], i1=i[2], p=shelfTabName)
开发者ID:mocap-ca,项目名称:cleanup,代码行数:51,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.shelfLayout函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.shadingNode函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap