示例#1
0
    def toggleToolbar(self, forceOff=None):
        visible = True

        if cmds.toolBar(self.toolbar, query=True, exists=True):
            visible = (False if forceOff else not cmds.toolBar(
                self.toolbar, query=True, visible=True))
            cmds.toolBar(self.toolbar, edit=True, visible=visible)
            if visible: self.adjustButtonsWidth()
        else:
            self.createWin()

        if visible and len(self.aToolsSets) == 0:
            self.turnOnCreateNewSetField()

        if cmds.iconTextButton("selectSetsBtn", query=True, exists=True):
            if visible:
                cmds.iconTextButton("selectSetsBtn",
                                    edit=True,
                                    image=uiMod.getImagePath(
                                        "specialTools_select_sets_active"),
                                    highlightImage=uiMod.getImagePath(
                                        "specialTools_select_sets_active"))
            else:
                cmds.iconTextButton(
                    "selectSetsBtn",
                    edit=True,
                    image=uiMod.getImagePath("specialTools_select_sets"),
                    highlightImage=uiMod.getImagePath(
                        "specialTools_select_sets copy"))
示例#2
0
    def createWin(self):

        self.aToolsSets = self.getaToolsSets()
        self.mainWin = cmds.window(sizeable=True)

        cmds.frameLayout(labelVisible=False, borderVisible=False, w=10)
        cmds.rowLayout(numberOfColumns=2,
                       adjustableColumn=1,
                       columnAttach=([2, 'right', self.barOffset]))
        cmds.text(label="")
        self.mainLayout = cmds.rowLayout(numberOfColumns=5)
        self.limboLayout = cmds.rowLayout(parent=self.mainLayout, w=1)

        self.populateSelSetsButtons()
        cmds.toolBar(self.toolbar,
                     area='bottom',
                     content=self.mainWin,
                     allowedArea=['bottom'],
                     height=self.height)

        self.allWin.extend([self.mainWin, self.mainLayout])
        self.highlightSelectedButtons()
        G.deferredManager.sendToQueue(self.toggleSelSetsButtonColor, 1, "SS")
        G.deferredManager.sendToQueue(self.adjustButtonsWidth, 1, "SS")
        self.addScriptJobs()
示例#3
0
    def createWin(self):

        # Creates window
        self.mainWin = cmds.window(self.winName, sizeable=True)

        # Main frame
        cmds.frameLayout(
            "mainFrameLayout",
            labelVisible=False,
            borderVisible=False,
            w=10,
            marginHeight=0,
            marginWidth=0,
            labelIndent=0,
            collapsable=False,
        )
        cmds.rowLayout(numberOfColumns=2, adjustableColumn=1, columnAttach=([2, "right", self.barOffset]), h=37)
        cmds.text(label="")
        self.subUIsLayout = cmds.rowLayout("mainLayout", numberOfColumns=len(SUB_UI_MODS) + 2)

        # subUIs
        self.uiList = [eval("%s.%s%s_Gui" % (loopUi, loopUi[0].upper(), loopUi[1:])) for loopUi in SUB_UI_MODS]
        # append general tools ui
        self.uiList.append(generalToolsUI.GeneralTools_Gui)
        # define subUis
        self.subUIs = [loopUi(self.subUIsLayout, self.buttonSize) for loopUi in self.uiList]

        self.addSubUIs()

        # shows toolbar
        cmds.toolBar(self.toolbarName, area="bottom", content=self.mainWin, allowedArea=["bottom"])
示例#4
0
 def refreshToolBar(self, *args):
     
     if not cmds.toolBar(self.toolbar, query=True, exists=True): return
     
     self.saveSelectSetsDict()
     G.deferredManager.sendToQueue(self.delWindows, 1, "SS")        
     if cmds.toolBar(self.toolbar, query=True, visible=True): G.deferredManager.sendToQueue(self.createWin, 1, "SS")
示例#5
0
    def refreshToolBar(self, *args):

        if not cmds.toolBar(self.toolbar, query=True, exists=True): return

        self.saveSelectSetsDict()
        G.deferredManager.sendToQueue(self.delWindows, 1, "SS")
        if cmds.toolBar(self.toolbar, query=True, visible=True):
            G.deferredManager.sendToQueue(self.createWin, 1, "SS")
示例#6
0
 def loadInMaya(self, *args):
     """
     """
     if not cmds.toolBar('WarriorToolbar', exists = True):  
         allowedAreas = ['top', 'bottom']
         cmds.toolBar('WarriorToolbar', area='bottom', content=self.win, allowedArea=allowedAreas )
     else:
         self.close()
示例#7
0
 def loadInMaya(self, *args):
     """
     """
     if not cmds.toolBar('sgToolbar', exists = True):  
         allowedAreas = ['top', 'bottom']
         sgToolBar = cmds.toolBar('sgToolbar', area='bottom', content=self.win, allowedArea=allowedAreas )
         self.buildButton()
     else:
         self.close()
示例#8
0
 def toggleToolbar(self, forceOff=None):
     visible = True
     
     if cmds.toolBar(self.toolbar, query=True, exists=True):
         visible = (False if forceOff else not cmds.toolBar(self.toolbar, query=True, visible=True))
         cmds.toolBar(self.toolbar, edit=True, visible=visible)
         if visible: self.adjustButtonsWidth()
     else:
         self.createWin()
         
     if visible and len(self.aToolsSets) == 0: self.turnOnCreateNewSetField() 
     
     if cmds.iconTextButton("selectSetsBtn", query=True, exists=True):
         if visible: cmds.iconTextButton("selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets_active"), highlightImage= uiMod.getImagePath("specialTools_select_sets_active"))
         else:       cmds.iconTextButton("selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets"), highlightImage= uiMod.getImagePath("specialTools_select_sets copy"))
示例#9
0
def modifyMayaUI():
    mayaHotKeys.disableAllHotKeys()
    mayaUI.simplifyUI()
    mayaUI.setViewportQuality()

    myWindow = cmds.window()
    myForm = cmds.formLayout(parent=myWindow)
    global gCadNanoToolbar
    gCadNanoToolbar = cmds.toolBar(
                                "cadnanoBox",
                                area='top',
                                allowedArea='top',
                                content=myWindow)

    global gIconPath
    closeCadNanoCmd = 'import maya.cmds;maya.cmds.closeCadNano()'
    myButton = cmds.iconTextButton(
                               label='Quit cadnano',
                               annotation='Quit cadnano interface',
                               image1=gIconPath,
                               parent=myForm,
                               command=closeCadNanoCmd)
    cmds.formLayout(
                myForm,
                edit=True,
                attachForm=[(myButton, 'right', 10)])
示例#10
0
def restoreMayaUI():
    mayaHotKeys.restoreAllHotKeys()
    mayaUI.restoreUI()
    mayaUI.restoreViewportQuality()

    if gCadNanoToolbar:
        if cmds.toolBar(gCadNanoToolbar, exists=True):
            cmds.deleteUI(gCadNanoToolbar)
示例#11
0
文件: spCadNano.py 项目: vdt/cadnano2
def restoreMayaUI():
    mayaHotKeys.restoreAllHotKeys()
    mayaUI.restoreUI()
    mayaUI.restoreViewportQuality()

    if gCadNanoToolbar:
        if cmds.toolBar(gCadNanoToolbar, exists=True):
            cmds.deleteUI(gCadNanoToolbar)
示例#12
0
 def loadInMaya(self, *args):
     """
     """
     #cmds.showWindow(self.win)
     allowedAreas = ['top', 'bottom']
     sgToolBar = cmds.toolBar('daToolbar',
                              area='bottom',
                              content=self.win,
                              allowedArea=allowedAreas)
示例#13
0
 def createWin(self):     
     
     self.aToolsSets     = self.getaToolsSets() 
     self.mainWin        = cmds.window(sizeable=True)
 
     cmds.frameLayout(labelVisible=False, borderVisible=False, w=10)
     cmds.rowLayout(numberOfColumns=2, adjustableColumn=1, columnAttach=([2, 'right', self.barOffset]))
     cmds.text(label="")
     self.mainLayout     = cmds.rowLayout(numberOfColumns=5)
     self.limboLayout    = cmds.rowLayout(parent=self.mainLayout, w=1)
     
     self.populateSelSetsButtons()
     cmds.toolBar(self.toolbar, area='bottom', content=self.mainWin, allowedArea=['bottom'], height=self.height)
     
     self.allWin.extend([self.mainWin, self.mainLayout])
     self.highlightSelectedButtons()
     G.deferredManager.sendToQueue(self.toggleSelSetsButtonColor, 1, "SS")
     G.deferredManager.sendToQueue(self.adjustButtonsWidth, 1, "SS")
     self.addScriptJobs()   
示例#14
0
    def createWin(self):

        # Creates window
        self.mainWin = cmds.window(self.winName, sizeable=True)

        # Main frame
        cmds.frameLayout("mainFrameLayout",
                         labelVisible=False,
                         borderVisible=False,
                         w=10,
                         marginHeight=0,
                         marginWidth=0,
                         labelIndent=0,
                         collapsable=False)
        cmds.rowLayout(numberOfColumns=2,
                       adjustableColumn=1,
                       columnAttach=([2, 'right', self.barOffset]),
                       h=37)
        cmds.text(label="")
        self.subUIsLayout = cmds.rowLayout("mainLayout",
                                           numberOfColumns=len(SUB_UI_MODS) +
                                           2)

        # subUIs
        self.uiList = [
            eval("%s.%s%s_Gui" % (loopUi, loopUi[0].upper(), loopUi[1:]))
            for loopUi in SUB_UI_MODS
        ]
        # append general tools ui
        self.uiList.append(generalToolsUI.GeneralTools_Gui)
        # define subUis
        self.subUIs = [
            loopUi(self.subUIsLayout, self.buttonSize)
            for loopUi in self.uiList
        ]

        self.addSubUIs()

        # shows toolbar
        cmds.toolBar(self.toolbarName,
                     area='bottom',
                     content=self.mainWin,
                     allowedArea=['bottom'])
	def dockTo(self, location = None, arg = None):
		self.toolbarWidth = 280
		if location == 'window':
			mel.eval('panelTearOff(\"scriptedPanel", \"bpj_shaderAndTextureListerScriptedPanel\")')
		else:
			# is the lister docked in the viewpanes?
			panels = []
			panels.extend(cmds.paneLayout('viewPanes', q = 1, childArray = 1))
			if len(panels) > 1:
				for panel in panels:
					if panel == 'bpj_shaderAndTextureListerScriptedPanel' and cmds.layout(self.mainLayout, q = 1, isObscured = 1) == 0:
						mel.eval('panelTearOff(\"scriptedPanel", \"bpj_shaderAndTextureListerScriptedPanel\")')
						cmds.window('bpj_shaderAndTextureListerScriptedPanelWindow', e = 1, toolbox = 1, resizeToFitChildren = 0, sizeable = 1)
						# curPanel = cmds.getPanel(withFocus = 1)
						# if curPanel != "":
							# cmds.scriptedPanel("bpj_shaderAndTextureListerScriptedPanel", edit = 1, rp = 'modelPanel1')
					# if panel == 'bpj_shaderAndTextureListerScriptedPanel' and cmds.layout(self.mainLayout, q = 1, isObscured = 1) == 1:

			# is the lister tornOff in a window?
			# fullUiPath = cmds.layout(self.mainLayout, q = 1, fullPathName = 1)
			# fullUiPathList = fullUiPath.split('|')

			# now creating the dockable toolbar
			# mel.eval('panelTearOff(\"scriptedPanel", \"bpj_shaderAndTextureListerScriptedPanel\")')
			# cmds.scriptedPanel( 'bpj_shaderAndTextureListerScriptedPanel', e = 1, unParent = 1)

			# toolbarWindow = self.createToolbarWindow()

			cmds.window('bpj_shaderAndTextureListerScriptedPanelWindow', edit = True, resizeToFitChildren = True)
			allowedAreas = ['left', 'right', 'top', 'bottom']
			if cmds.toolBar(self.toolbarId, q = 1, exists = 1):
				cmds.deleteUI(self.toolbarId, layout = 1)
			cmds.toolBar( self.toolbarId, area=location, content = 'bpj_shaderAndTextureListerScriptedPanelWindow', allowedArea = allowedAreas, label = 'Shader/Texture Lister' )


			# cmds.scriptedPanel( 'bpj_shaderAndTextureListerScriptedPanel', e = 1, unParent = 1)
			# cmds.scriptedPanel( 'bpj_shaderAndTextureListerScriptedPanel', e = 1, parent = 'toolbarWindow')

			# if fullUiPathList[0] == 'bpj_shaderAndTextureListerScriptedPanelWindow':
				# cmds.deleteUI('bpj_shaderAndTextureListerScriptedPanelWindow', window = 1)

		self.updateUiOnSelectionChange(self.listLayoutId)
	def panelAddCallback(self):
		self.toolbarWidth = 68
		cmds.formLayout( self.mainLayout, e = 1, width = self.toolbarWidth)

		if cmds.toolBar(self.toolbarId, q = 1, exists = 1):
			cmds.deleteUI(self.toolbarId, layout = 1)

		if cmds.window(self.windowId, q = 1, exists = 1):
			cmds.deleteUI(self.windowId, window = 1)

		print self.mainLayout
示例#17
0
    def delWindows(self):
        
        if cmds.iconTextButton("selectSetsBtn", query=True, exists=True):
            cmds.iconTextButton("selectSetsBtn", edit=True, image=uiMod.getImagePath("specialTools_select_sets"), highlightImage= uiMod.getImagePath("specialTools_select_sets copy"))

        for loopWin in self.allWin:
            if cmds.rowLayout(loopWin, query=True, exists=True): cmds.deleteUI(loopWin)
            if cmds.window(loopWin, query=True, exists=True):  cmds.deleteUI(loopWin)
            if cmds.toolBar(loopWin, query=True, exists=True): cmds.deleteUI(loopWin)
    
        self.clearScriptJobs()    
	def createToolbarWindow(self):
		if cmds.toolBar(self.toolbarId, q = 1, exists = 1):
			cmds.deleteUI(self.toolbarId, layout = 1)

		if cmds.window(self.windowId, q = 1, exists = 1):
			cmds.deleteUI(self.windowId, window = 1)

		# cmds.scriptedPanel( 'bpj_shaderAndTextureListerScriptedPanel', e = 1, unParent = 1)
		# cmds.scriptedPanel( 'bpj_shaderAndTextureListerScriptedPanel', e = 1, parent = self.windowId)
		# cmds.paneLayout(configuration = 'vertical2')

		cmds.window(self.windowId, title = 'Shader/texture list', toolbox = 1, resizeToFitChildren = 0, sizeable = 1, menuBar = 1, retain = 1)
		return cmds.columnLayout()
示例#19
0
    def delWindows(self):

        if cmds.iconTextButton("selectSetsBtn", query=True, exists=True):
            cmds.iconTextButton(
                "selectSetsBtn",
                edit=True,
                image=uiMod.getImagePath("specialTools_select_sets"),
                highlightImage=uiMod.getImagePath(
                    "specialTools_select_sets copy"))

        for loopWin in self.allWin:
            if cmds.rowLayout(loopWin, query=True, exists=True):
                cmds.deleteUI(loopWin)
            if cmds.window(loopWin, query=True, exists=True):
                cmds.deleteUI(loopWin)
            if cmds.toolBar(loopWin, query=True, exists=True):
                cmds.deleteUI(loopWin)

        self.clearScriptJobs()
示例#20
0
文件: spCadNano.py 项目: vdt/cadnano2
def modifyMayaUI():
    mayaHotKeys.disableAllHotKeys()
    mayaUI.simplifyUI()
    mayaUI.setViewportQuality()

    myWindow = cmds.window()
    myForm = cmds.formLayout(parent=myWindow)
    global gCadNanoToolbar
    gCadNanoToolbar = cmds.toolBar("cadnanoBox",
                                   area='top',
                                   allowedArea='top',
                                   content=myWindow)

    global gIconPath
    closeCadNanoCmd = 'import maya.cmds;maya.cmds.closeCadNano()'
    myButton = cmds.iconTextButton(label='Quit cadnano',
                                   annotation='Quit cadnano interface',
                                   image1=gIconPath,
                                   parent=myForm,
                                   command=closeCadNanoCmd)
    cmds.formLayout(myForm, edit=True, attachForm=[(myButton, 'right', 10)])
示例#21
0
def show(mode="show"):

    G.aToolsBar = G.aToolsBar or AnimationBar_Gui()

    if mode == False: mode = "show"
    if mode == True: mode = "toggle"

    if mode == "launch":
        lastState = aToolsMod.loadInfoWithUser("userPrefs",
                                               "animationBarLastState")
        if lastState: show()
        return

    if mode == "show" or mode == "hide":
        if cmds.toolBar("aTools_Animation_Bar", query=True, exists=True):
            visible = (mode == "show")
            cmds.toolBar("aTools_Animation_Bar", edit=True, visible=visible)
            G.aToolsBar.saveLastState(visible)
            return
        elif mode == "show":
            G.aToolsBar.start()
            G.aToolsBar.saveLastState()
            return

    if mode == "toggle":
        if cmds.toolBar("aTools_Animation_Bar", query=True, exists=True):
            state = cmds.toolBar("aTools_Animation_Bar",
                                 query=True,
                                 visible=True)
            visible = (not state)
            G.aToolsBar.toggleToolbars(visible)
            cmds.toolBar("aTools_Animation_Bar", edit=True, visible=visible)
            G.aToolsBar.saveLastState(visible)
            return
        else:
            show()
            return

    if mode == "refresh":
        G.aToolsBar = AnimationBar_Gui()
        G.aToolsBar.start()
        G.aToolsBar.saveLastState()
示例#22
0
def show(mode="show"):

    G.aToolsBar = G.aToolsBar or AnimationBar_Gui()

    if mode == False:
        mode = "show"
    if mode == True:
        mode = "toggle"

    if mode == "launch":
        lastState = aToolsMod.loadInfoWithUser("userPrefs", "animationBarLastState")
        if lastState:
            show()
        return

    if mode == "show" or mode == "hide":
        if cmds.toolBar("aTools_Animation_Bar", query=True, exists=True):
            visible = mode == "show"
            cmds.toolBar("aTools_Animation_Bar", edit=True, visible=visible)
            G.aToolsBar.saveLastState(visible)
            return
        elif mode == "show":
            G.aToolsBar.start()
            G.aToolsBar.saveLastState()
            return

    if mode == "toggle":
        if cmds.toolBar("aTools_Animation_Bar", query=True, exists=True):
            state = cmds.toolBar("aTools_Animation_Bar", query=True, visible=True)
            visible = not state
            G.aToolsBar.toggleToolbars(visible)
            cmds.toolBar("aTools_Animation_Bar", edit=True, visible=visible)
            G.aToolsBar.saveLastState(visible)
            return
        else:
            show()
            return

    if mode == "refresh":
        G.aToolsBar = AnimationBar_Gui()
        G.aToolsBar.start()
        G.aToolsBar.saveLastState()
示例#23
0
 def set_ui_mode(self, mode=None):
     """
     Set the UI's current state (window, dock, toolbar, HUD)
     """
     oldmode = SETTINGS["ui_mode"]
     # If user is in Maya 2013, force window mode until a fix can be found
     # for toolbar mode
     if "2013" in MAYA_VERSION:
         mode = None
         oldmode = "window"
     # Update the UI appropriately if we're changing modes
     if mode != oldmode:
         if mode is None:
             mode = oldmode
         SETTINGS["ui_mode"] = mode
         # Delete the popup menu variable so that a new one can be made
         if hasattr(self, "popup_menu"):
             del (self.popup_menu)
         # Show the proper UI
         window = self.window
         if self.window is None:
             window = find_ui("window")
         toolbar = find_ui("toolBar")
         dock = find_ui("dockControl")
         self._make_window()
         deleteold = None
         hasmenu = True
         if mode == "window":
             if oldmode == "toolbar" and toolbar:
                 deleteold = toolbar
                 SETTINGS["show_menu_bar"] = True
             if oldmode == "dock" and dock:
                 deleteold = dock
             mc.showWindow(self.window)
         elif mode == "toolbar":
             if toolbar:
                 deleteold = toolbar
             if oldmode == "window" and window:
                 deleteold = window
             if oldmode == "dock" and dock:
                 deleteold = dock
             if not mc.toolBar("tweenMachineToolbar", q=True, exists=True):
                 mc.toolBar("tweenMachineToolbar",
                            height=20,
                            docTag="tweenMachine",
                            content=self.window,
                            area="left",
                            label="tweenMachine")
                 mc.windowPref(
                     restoreMainWindowState="startupMainWindowState")
             else:
                 mc.windowPref(saveMainWindowState="startupMainWindowState")
         elif mode == "dock":
             pass
         elif mode == "hud":
             hasmenu = False
         if hasmenu:
             self._make_menus()
         # If we're deleting an old item, set a deferred command to do so
         if deleteold is not None:
             defer_delete(deleteold)
示例#24
0
文件: kTool.py 项目: 3d-kmax/kTools
    def buildUI(self):
        if mc.window(self.winName, query=True, exists=True):
            mc.deleteUI(self.winName)
        if mc.windowPref(self.winName, exists=1):
            mc.windowPref(self.winName, r=1)
        if mc.toolBar(self.toolBarName, query=True, exists=True):
            mc.deleteUI(self.toolBarName)
        '''
        if mc.workspaceControl(wscName, query=True, exists=True):
            mc.deleteUI(wscName, control=True)
        '''

        mc.window(self.winName, title='kTool', sizeable=False, widthHeight=(186, 1100))
        mc.columnLayout('columnLayout1', height=1100, adjustableColumn=True)


        # build UI : Common Selection Options

        mc.frameLayout('selection_Layout', parent='columnLayout1', collapsable=True, label='Common Selection Options')
        mc.columnLayout('columnLayout2')
        mc.rowColumnLayout(numberOfColumns=2)
        self.lb_tool = mc.iconTextStaticLabel(width=44, visible=True, image=self.path + 'selectTool.png')
        mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextRadioCollection()
        self.bt_selObj = mc.iconTextRadioButton(width=44, height=32, enableBackground=False, image=self.path + 'objectnex.png', select=True, onCommand=self.selObject)
        self.bt_selMulti = mc.iconTextRadioButton(width=44, height=32, enableBackground=False, label='Multi',  style='textOnly', onCommand=self.selMulti)
        self.bt_selUv = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'uvnex.png', onCommand=self.selUv)
        self.bt_selVert = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'vertexnex.png', onCommand=self.selVertex)
        self.bt_selEdge = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'edgesnex.png', onCommand=self.selEdge)
        self.bt_selFace = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'facesnex.png', onCommand=self.selFace)
        mc.rowColumnLayout(parent='columnLayout2', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextRadioCollection()
        self.bt_marqueeSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Marquee',  style='textOnly', font='tinyBoldLabelFont', onCommand=self.selectionStyleSwitch)
        self.bt_dragSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Drag',  style='textOnly', font='tinyBoldLabelFont', onCommand=self.selectionStyleSwitch)
        self.bt_tweakSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Tweak',  style='textOnly', font='tinyBoldLabelFont')
        self.bt_camSwitch = mc.iconTextCheckBox(width=44, height=22, label='Cam B',  style='textOnly', font='tinyBoldLabelFont', changeCommand=self.camSwitch)
        mc.rowColumnLayout('rowColumnLayout4', parent='columnLayout2', numberOfColumns=2, columnWidth=[[1, 20], [2, 160]])
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'transform.png')
        self.tf_transformName = mc.textField(enterCommand=self.renameTransform)
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'shape.png')
        self.tf_shapeName = mc.textField(editable=False)
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'constructionHistory.png')
        self.om_history = mc.optionMenu(changeCommand=self.openAttributEditor, alwaysCallChangeCommand=True, maxVisibleItems=10)
        mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'quickRename.png')
        self.tf_selByName = mc.textField(placeholderText='select by name', enterCommand=self.selectByName)


        # build UI : Transform

        mc.frameLayout('transform_Layout', parent='columnLayout1', collapsable=True, label='Transform')
        mc.columnLayout('columnLayout3')
        mc.channelBox('channelBox1', width=180, height=192, # preventOverride=False,
                                    # attributeEditorMode=False,
                                    # containerAtToparent=False,
                                    precision=3,
                                    fixedAttrList=("translateX", "translateY", "translateZ", "rotateX", "rotateY",
                                                   "rotateZ", "scaleX", "scaleY", "scaleZ", 'visibility'))
        mc.gridLayout(numberOfRows=5, numberOfColumns=4, cellWidth=45, cellHeight=44)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'deleteHistory.png', command=self.deleteHistory)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'centerPivot.png', command=self.centerPivot)
        mc.iconTextButton(width=44, height=44, enableBackground=False, label='//',  style='textOnly', enable=False)
        self.bt_visibility = mc.iconTextCheckBox(width=44, height=44, image=self.path + 'visibility.png', changeCommand=self.visibility)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'resetTransform.png', command=self.resetAllTransform)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'matchTransform.png', command=self.matchAllTransforms)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'freezeTransform.png', command=self.freezeAllTransform)
        mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'unfreeze.png', command=self.unFreeze)
        mc.gridLayout(parent='columnLayout3', numberOfRows=4, numberOfColumns=4, cellWidth=45, cellHeight=22)
        mc.iconTextButton(width=44, height=22, label='R.T', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetTranslation)
        mc.iconTextButton(width=44, height=22, label='M.T', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchTranslate)
        mc.iconTextButton(width=44, height=22, label='F.T', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeTranslate)
        mc.iconTextButton(width=44, height=22, label='//',  style='textOnly', enable=False)
        mc.iconTextButton(width=44, height=22, label='R.R', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetRotation)
        mc.iconTextButton(width=44, height=22, label='M.R', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchRotate)
        mc.iconTextButton(width=44, height=22, label='F.R', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeRotate)
        mc.iconTextCheckBox(width=44, height=22, image=self.path + 'snapToggle.png')
        mc.iconTextButton(width=44, height=22, label='R.S', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetScaling)
        mc.iconTextButton(width=44, height=22, label='M.S', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchScale)
        mc.iconTextButton(width=44, height=22, label='F.S', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeScale)
        mc.iconTextButton(width=44, height=22, label='//',  style='textOnly', enable=False)


        # build UI : Display

        mc.frameLayout('display_Layout', parent='columnLayout1', collapsable=True, label='Display')


        # build UI : Tool Settings

        self.fl_tool = mc.frameLayout('tool_Layout', parent='columnLayout1', collapsable=True, label='Tool Settings')
        mc.columnLayout('columnLayout6')
        mc.rowColumnLayout(numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Object',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='World',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Comp.',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Parent',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Normal',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Gimbal',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(enable=False, width=44, height=22, enableBackground=True, label='//',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Custom',  style='textOnly', font='tinyBoldLabelFont')
        mc.separator(parent='columnLayout6', height=1,  style='none')
        mc.rowColumnLayout(parent='columnLayout6', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Default',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Object',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Manip',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Selection',  style='textOnly', font='tinyBoldLabelFont')
        mc.separator(parent='columnLayout6', height=1,  style='none')
        mc.rowColumnLayout(parent='columnLayout6', enable=False, visible=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.text(width=44, height=22, label='Snap :', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Relative',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Absolute',  style='textOnly', font='tinyBoldLabelFont')
        mc.floatField(width=44, height=22, precision=3)
        mc.separator(parent='columnLayout6', height=1,  style='none')
        mc.rowColumnLayout(parent='columnLayout6', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Tweak',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Pr.UVs',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Pr.Child',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Free Rot.',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='No Neg.S',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Smt.Dup',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Smt.Ext',  style='textOnly', font='tinyBoldLabelFont')


        # build UI : Soft selection

        mc.frameLayout('soft_Layout', parent='columnLayout1', collapsable=True, label='Soft')
        mc.columnLayout('columnLayout5')
        mc.rowColumnLayout('rowColumnLayout9', height=46, numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextCheckBox(width=44, height=44, image=self.path + 'offsetCurve.png', label='Soft',  style='iconAndTextVertical', font='tinyBoldLabelFont')
        mc.gridLayout(numberOfRows=2, numberOfColumns=2, cellWidth=44, cellHeight=22)
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Surface',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Volume',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Object',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Global',  style='textOnly', font='tinyBoldLabelFont')
        mc.gridLayout(parent='rowColumnLayout9', numberOfColumns=1, cellWidth=44, cellHeight=22)
        mc.floatField(width=44, precision=3)
        mc.iconTextCheckBox(width=44, label='Color',  style='textOnly', font='tinyBoldLabelFont')
        mc.rowColumnLayout(parent='columnLayout5', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetA.png',  style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetB.png',  style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetC.png',  style='iconOnly', font='tinyBoldLabelFont')


        # build UI : Symmetry

        mc.frameLayout('sym_Layout', parent='columnLayout1', collapsable=True, label='Symmetry')
        mc.columnLayout('columnLayout4')
        mc.rowColumnLayout(height=46, numberOfColumns=2)
        mc.iconTextCheckBox(width=44, height=44, image=self.path + 'polyMirrorCut.png', label='Sym',  style='iconAndTextVertical', font='tinyBoldLabelFont')
        mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Object',  style='textOnly', font='tinyBoldLabelFont', select=True)
        mc.iconTextRadioButton(width=44, height=22, label='World',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Topo',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='X',  style='textOnly', font='tinyBoldLabelFont', select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Y',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, label='Z',  style='textOnly', font='tinyBoldLabelFont')
        mc.rowColumnLayout(parent='columnLayout4', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, label='P.Seam',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextCheckBox(width=44, height=22, label='Partial',  style='textOnly', font='tinyBoldLabelFont')
        mc.floatField(width=44, height=22, precision=3)


        # build UI : Step Snap

        mc.frameLayout('step_Layout', parent='columnLayout1', collapsable=True, label='Step & Snap')
        mc.columnLayout('columnLayout7')
        mc.rowColumnLayout(height=46, numberOfColumns=2)
        mc.iconTextCheckBox(width=44, height=44, image=self.path + 'snapPixel.png', label='Snap',  style='iconAndTextVertical', font='tinyBoldLabelFont')
        mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]])
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Relative',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Absolute',  style='textOnly', font='tinyBoldLabelFont')
        mc.floatField(width=44, precision=3)
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, label='Edge',  style='textOnly', font='tinyBoldLabelFont' , select=True)
        mc.iconTextRadioButton(width=44, height=22, label='Surface',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextButton(width=44, height=22, label='Normals',  style='textOnly', font='tinyBoldLabelFont')
        mc.rowColumnLayout(parent='columnLayout7', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]])
        mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset',  style='textOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioCollection()
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapGrid.png', style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapCurve.png', style='iconOnly', font='tinyBoldLabelFont')
        mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapPoint.png', style='iconOnly', font='tinyBoldLabelFont')

        # mc.showWindow(self.winName)
        # gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow')
        allowedAreas = ['left', 'right']
        mc.toolBar(self.toolBarName, area='right', content=self.winName, allowedArea=allowedAreas) # , parent=gMainWindow)
示例#25
0
    def __init__(self):
        path = "E:/kTools/icons/"
        iconSize = 28
        separatorSize = 12
        wscName = "kSh"

        self.initPath()

        windowName = "kShelf2Window"
        self.toolName = "kShelf2"

        if mc.window(windowName, q=True, exists=True):
            mc.deleteUI(windowName)

        if mc.toolBar(self.toolName, q=True, exists=True):
            mc.deleteUI(self.toolName)

        myWindow = mc.window(windowName)

        allButtons = [
            ("bt_kMaxToolBar", "kMaxTool32.png", "kMaxTool32b.png",
             "Launch kMaxTools", self.kMaxTool),
            #("bt_kMaxToolBar2", "kMaxTool32.png", "kMaxTool32b.png", "Launch kMaxTools", self.kMaxUi2),
            ("bt_separator_00", "separateHor.png", "separateHor.png", "", ""),
            ("bt_kMod", "kMaxMod32.png", "kMaxMod32.png",
             "Launch kMod Left bar", self.kMod),
            ("bt_kMaxShelfTop", "kMaxShelfTop32.png", "kMaxShelfTop32.png",
             "Launch kMaxShelfTop", self.kMaxShelfTop),
            ("bt_outlinerView", "outliner.png", "outliner.png",
             "Outliner/Persp", self.kmOutlinerView),
            ("bt_singlePerspView", "singlePerspLayout2016_32.png",
             "singlePerspLayout2016_32.png", "Single Perspective View",
             self.kmSinglePerspView),
            ("bt_fourView", "fourViewLayout2016_32.png",
             "fourViewLayout2016_32.png", "Four View", self.kmFourView),
            ("bt_separator_01", "separateHor.png", "separateHor.png", "", ""),
            ("bt_new", "new.png", "new.png", "Create a New Scene", self.kmNew),
            ("bt_classicOpen", "open.png", "open.png", "Open a Scene",
             self.kmClassicOpenScene),
            ("bt_classicSave", "save.png", "save.png",
             "Save the current Scene", self.kmClassicSave),
            ("bt_savePlus", "save+.png", "save+.png", "Incrementale Save",
             self.kmSavePlus),
            ("bt_classicSaveAs", "saveAs.png", "saveAs.png",
             "Save the current scene under a new name or export all",
             self.kmClassicSaveAs),
            ("bt_import", "import.png", "import.png", "Import file",
             self.kmImport),
            ("bt_export", "export.png", "export.png",
             "Export entire scene into one file", self.kmExport),
            ("bt_exportSel", "exportSel.png", "exportSel.png",
             "Export Selection...", self.kmExportSel),
            ("bt_referenceEditor", "reference.png", "reference.png",
             "Reference Editor", self.kmReferenceEditor),
            ("bt_separator_02", "separateHor.png", "separateHor.png", "", ""),
            ("bt_open", "teamtTo.png", "teamtTo.png", "Open a Scene",
             self.kmOpen),
            ("bt_save", "tt_save2_b.png", "tt_save2_b.png",
             "Save the current Scene", self.kmSave),
            ("bt_saveAs", "tt_saveAs2_b.png", "tt_saveAs2_b.png",
             "Save the current scene under a new name or export all",
             self.kmSaveAs),
            ("bt_exportProps", "exportSelb.png", "exportSelb.png",
             "Export Prop", self.kmExportProps),
            ("bt_separator_10", "separateHor.png", "separateHor.png", "", ""),
            ("bt_modelUpdater", "compareGeom.png", "compareGeom.png",
             "modelUpdater", self.kmCompareGeom),
            ("bt_cleanupGeo", "cleanupgeo.png", "cleanupgeo.png",
             "CleanUp Geo by Thomas G", self.cleanupGeo),
            ("bt_checkPublishable", "yes.png", "yes.png",
             "Check Publishability", self.kmCheckPublishable),
            ("bt_publish", "publish.png", "publish.png", "Send Publish",
             self.publish),
            ("bt_separator_09", "separateHor.png", "separateHor.png", "", ""),
            ("bt_hardwareShader", "hardwareShader.png", "hardwareShader.png",
             "Apply hardwareShader on pxr shader", self.kmHardwareShader),
            ("bt_buildPresScene", "buildPres.png", "buildPres.png",
             "build presentation scene", self.buildPresentationScene),
            ("bt_launchPresScene", "launchPres.png", "launchPres.png",
             "launch presentation scene", self.launchPresentationRender),
            #("bt_separator_03", "separateHor.png", "separateHor.png",  "", ""),
            ("bt_separator_04", "separateHor.png", "separateHor.png", "", ""),
            ("bt_outliner", "outliner32.png", "outliner32.png", "Outliner",
             self.kmOutliner),
            ("bt_nameSpaceEditor", "nameSpaceEditor.png",
             "nameSpaceEditor.png", "Namespace Editor",
             self.kmNameSpaceEditor),
            ("bt_nodeEditor", "nodeEditor.png", "nodeEditor.png",
             "Node Editor", self.kmNodeEditor),
            ("bt_hyperShade", "hyperShade.png", "hyperShade.png", "Hypershade",
             self.kmHyperShade),
            ("bt_textureEditor", "uvTextureEditor.png", "uvTextureEditor.png",
             "UV Texture Editor", self.kmUVTextureEditor),
            ("bt_uvSnapshot", "uvSnapshot.png", "uvSnapshot.png",
             "UV Snapshot", self.uvSnapshot),
            ("bt_relationshipEditor", "relation32.png", "relation32b.png",
             "Relation Ship Editor", self.kmRelationShipEditor),
            ("bt_separator_05", "separateHor.png", "separateHor.png", "", ""),
            ("bt_colorPicker", "colorPicker.png", "colorPicker.png",
             "Color Shader Picker", self.kmColorPicker),
            ("bt_randomizer", "kRandomizer32.png", "kRandomizer32.png",
             "Randomizer", self.kmRandomizer),
            ("bt_replacer", "kReplacer32.png", "kReplacer32.png", "kReplacer",
             self.kmReplacer),
            ("bt_frRenamer", "text-32.png", "text-32.png", "FrRenamer",
             self.frRenamer),
            ("bt_setSmooth", "smoothSetTool.png", "smoothSetTool.png",
             "Set smooth tool", self.kmSetSmoothGroupTool),
            ("bt_separator_06", "separateHor.png", "separateHor.png", "", ""),
            ("bt_switchDisplayPoly", "switchAllPoly32.png",
             "switchAllPoly32.png", "Switch display ALL/POLY",
             self.kmSwitchDisplayPoly),
            ("bt_switchLighting", "lighting.png", "lighting.png",
             "Switch Lighting", self.kmSwitchLighting),
            ("bt_switchBallPreview", "globe_2.png", "globe_2.png",
             "Switch renderThumbnailUpdate", self.kmSwitchBallPreview),
            ("bt_unlockAllAtt", "unlock.png", "unlock.png",
             "Unlock all attributs", self.kmUnlockAllAtt),
            ("bt_deleteUnAutorisedNodes", "delUnusedNode32.png",
             "delUnusedNode32.png", "Delete all unautorised nodes",
             self.delUnautorisedNodes),
            ("bt_cleanRmanRdrOptions", "cleanRmanRdrOpions.png",
             "cleanRmanRdrOpions.png", "clean renderman render options",
             self.cleanRdrmanRdrOptions),
            ("bt_clean", "kCleaner.png", "kCleaner.png", "Cleaner tool",
             self.kmCleanTool),
            ("bt_spacer", "empty.png", "empty.png", "", ""),
            ("bt_uiDesigner", "uid.png", "uid.png", "UI Designer",
             self.kmUiDesigner),
            ("bt_connectPC", "connectPC.png", "connectPC.png",
             "Connect Maya to PyCharm", self.kmConnectPC),
            ("bt_preferences", "settings.png", "settings.png", "Preferences",
             self.kmSetting),
            ("bt_hotkeys", "hotkey.png", "hotkey.png", "Hotkeys Editor",
             self.kmHotKey),
            ("bt_plugins", "plugin.png", "plugin.png", "Plug-ins Manager",
             self.kmPlugIn),
            ("bt_separator_07", "separateHor.png", "separateHor.png", "", ""),
            ("bt_attributeEditor", "attributes.png", "attributes.png",
             "Attribute Editor", self.kmAttributeEditor),
            ("bt_channelBox", "channelBox.png", "channelBox.png",
             "Channel Box", self.kmChannelBox),
            ("bt_modelingToolKit", "modelToolkit.png", "modelToolkit.png",
             "Modeling Tool Kit", self.kmModelingToolKit),
            ("bt_toolSettings", "toolSettings.png", "toolSettings.png",
             "Tool Settings", self.kmToolSettings),
            ("bt_layerEditor", "layerEditor.png", "layerEditor.png",
             "Layer Editor", self.kmLayerEditor),
            ("bt_separator_08", "separateHor.png", "separateHor.png", "", ""),
            # ("bt_clock", "clock32.png", "clock32b.png", "Actualise clock", self.kmClock),
            # ("bt_h01", "digit8.png", "digit8.png", "", ""),
            # ("bt_h02", "digit8.png", "digit8.png", "", ""),
            # ("bt_clockSeparator", "digitSeparator.png",  "digitSeparator.png", "", ""),
            # ("bt_m01", "digit8.png", "digit8.png", "", ""),
            # ("bt_m02", "digit8.png", "digit8.png", "", ""),
            # ("bt_separator", "separateHor.png", "separateHor.png", "", ""),
            ("bt_reduce", "minimize32.png", "minimize32.png", "Minimize Maya",
             self.kmMinimizeMaya),
            ("bt_toggleInterfaceLines", "toggleLines32.png",
             "toggleLines32.png", "Toggle interface Lines",
             self.kmToggleInterfaceLines),
            ("bt_toggleToolBars", "toggleInterface32.png",
             "toggleInterface32.png", "Toggle interface Tools Bars",
             self.kmToggleToolBars),
            ("bt_close", "close32.png", "close32.png", "Quit Maya",
             self.kmCloseMaya)
        ]

        mc.rowColumnLayout(numberOfRows=1, rowHeight=(1, iconSize))

        for btnName, imgFileName, imgHltFileName, btnAnnotation, btnCommand in allButtons:
            '''
            if btnName == "bt_h01":
                self.bt_h01 = mc.iconTextButton(image1=self.target + "digit8.png", width=22, enable=0)
            if btnName == "bt_h02":
                self.bt_h02 = mc.iconTextButton(image1=self.target + "digit8.png", width=22, enable=0)
            if btnName == "bt_m01":
                self.bt_m01 = mc.iconTextButton(image1=self.target + "digit8.png", width=22, enable=0)
            if btnName == "bt_m02":
                self.bt_m02 = mc.iconTextButton(image1=self.target + "digit8.png", width=22, enable=0)
            if imgFileName == "digitSeparator.png":
                mc.iconTextButton(btnName, edit=True,
                                            width=10,
                                            enable=0)
            '''

            if imgFileName != "digit8.png":
                btnName = mc.iconTextButton(image1=self.target + imgFileName,
                                            highlightImage=self.target +
                                            imgHltFileName,
                                            annotation=btnAnnotation,
                                            command=btnCommand,
                                            width=iconSize)

            if imgFileName == "separateHor.png":
                mc.iconTextButton(btnName,
                                  edit=True,
                                  width=separatorSize,
                                  enable=0)

            if imgFileName == "empty.png":
                mc.iconTextButton(btnName, edit=True, width=100, enable=0)

        allowedAreas = ['top', 'bottom']
        mc.toolBar(self.toolName,
                   area='top',
                   content=myWindow,
                   allowedArea=allowedAreas)
示例#26
0
 def delWindows(self, onOff=True, forceOff=False):
     for loopWin in self.allWin:
         if cmds.window(loopWin, query=True, exists=True):
             cmds.deleteUI(loopWin)
         if cmds.toolBar(loopWin, query=True, exists=True):
             cmds.deleteUI(loopWin)
示例#27
0
    def kmToggleToolBars(self):
        gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow')

        if mc.toolBar("MayaWindow|toolBar1", visible=True, q=True):

            mc.toolBar("MayaWindow|toolBar1", visible=False,
                       e=True)  # status line
            mc.toolBar("MayaWindow|toolBar2", visible=False, e=True)  # shelf
            # mc.toolBar("MayaWindow|toolBar3", visible=False, e=True) # help line
            # mc.toolBar("MayaWindow|toolBar4", visible=False, e=True) # command line
            mc.toolBar("MayaWindow|toolBar5", visible=False,
                       e=True)  # range slider
            mc.toolBar("MayaWindow|toolBar6", visible=False,
                       e=True)  # time slider
            mc.toolBar("MayaWindow|toolBar7", visible=False,
                       e=True)  # tool box
            mc.window(gMainWindow, titleBar=False, e=True)
            #self.kmToggleInterfaceLines()

        else:
            mc.toolBar("MayaWindow|toolBar1", visible=True, e=True)
            mc.toolBar("MayaWindow|toolBar2", visible=True, e=True)
            #mc.toolBar("MayaWindow|toolBar4", visible=True, e=True)
            mc.toolBar("MayaWindow|toolBar5", visible=True, e=True)
            mc.toolBar("MayaWindow|toolBar6", visible=True, e=True)
            mc.toolBar("MayaWindow|toolBar7", visible=True, e=True)
            mc.window(gMainWindow, titleBar=True, e=True)
示例#28
0
    def __init__(self):

        scaleIcon = 30
        scaleSeparator = 12
        #scaleColumn = scaleIcon+2

        self.initPath()

        #self.nPlane = 1

        window_name = "kWindow"
        dockName = "dockMod"
        toolName = "kMod"

        if mc.window(window_name, q=True, exists=True):
            mc.deleteUI(window_name)

        if mc.dockControl(dockName, q=True, exists=True):
            mc.deleteUI(dockName)

        if mc.toolBar(toolName, q=True, exists=True):
            mc.deleteUI(toolName)

        my_window = mc.window(window_name,
                              toolbox=True,
                              resizeToFitChildren=True,
                              titleBar=False)

        allButtons = [
            ("bt_plane", "polykPlane.png", "polykPlane.png", "Plane",
             "Create a polygonal plane on the grid", self.kmPlane,
             "pm.mel.CreatePolygonPlaneOptions()"),
            ("bt_planeDisk", "polykDisk.png", "polykDisk.png", "Plane",
             "Create a tuned polygonal plane on the grid", self.kmPlaneDisk,
             ""),
            ("bt_cube", "polyCube.png", "polyCube.png", "Cube",
             "Create a polygonal cube on the grid", self.kmPolycube,
             "pm.mel.CreatePolygonCubeOptions()"),
            ("bt_cubeSphere", "polykSphere.png", "polykSphere.png", "kSphere",
             "Create a tuned polygonal cube on the grid",
             self.kmPolycubeSphere, ""),
            ("bt_sphere", "polySphere.png", "polySphere.png", "Sphere",
             "Create a polygonal sphere on the grid", self.kmSphere,
             "pm.mel.CreatePolygonSphereOptions()"),
            ("bt_cylinder", "polyCylinder.png", "polyCylinder.png", "Cylinder",
             "Create a polygonal cylinder on the grid", self.kmCylinder,
             "pm.mel.CreatePolygonCylinderOptions()"),
            ("bt_torus", "polyTorus.png", "polyTorus.png", "Torus",
             "Create a polygonal torus on the grid", self.kmTorus,
             "pm.mel.CreatePolygonTorusOptions()"),
            ("bt_cone", "polyCone.png", "polyCone.png", "Cone",
             "Create a polygonal cone on the grid", self.kmCone,
             "pm.mel.CreatePolygonConeOptions()"),
            ("bt_separator_01", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_separator_02", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_locator", "locator.png", "locator.png", "Locator",
             "Create a Locator", self.kmLocator, ""),
            ("bt_lattice", "lattice.png", "lattice.png", "Lattice",
             "Create lattice",
             "mc.lattice(divisions=(2, 2, 2), objectCentered=True, ldv=(2, 2, 2))",
             ""),
            ("bt_separator_03", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_separator_04", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_extrude", "polyExtrudeFacet.png", "polyExtrudeFacet.png",
             "Extrude", "Extrude the selected component", self.kmExtrude,
             "pm.mel.performPolyExtrude(0)"),
            ("bt_duplicateFace", "polyDuplicateFacet.png",
             "polyDuplicateFacet.png", "DuplicateFace",
             "Duplicate the currently selected faces in a new shell",
             "pm.mel.performPolyChipOff(0,1)", ""),
            ("bt_extract", "polyChipOff.png", "polyChipOff.png", "Extract",
             "Extract the currently selected faces from their shell",
             "pm.mel.performPolyChipOff(0,0)", ""),
            ("bt_mirrorOption", "polyMirrorGeometry.png",
             "polyMirrorGeometry.png", "Poly Mirror Options",
             "Mirror Geometry", "pm.mel.MirrorPolygonGeometryOptions()", ""),
            ("bt_separate", "polySeparate.png", "polySeparate.png", "Separate",
             "Separate the selected polygon object shells or the shells of any selected faces from the object into distinct objects",
             "pm.mel.SeparatePolygon()", ""),
            ("bt_combine", "polyUnite.png", "polyUnite.png", "Combine",
             "Combine the selected polygon objects into one single object to allow operations such as merges or face trims",
             "pm.mel.polyUnite()", ""),
            ("bt_mergeVertexTool", "polyMergeVertex.png",
             "polyMergeVertex.png", "MergeVertexTool",
             "Interactively select and merge vertices",
             "pm.mel.MergeVertexTool()", "pm.mel.MergeVertexToolOptions()"),
            ("bt_mergeVertex", "polyMerge.png", "polyMerge.png", "MergeVertex",
             "Merge vertices / border edges based on selection",
             "pm.mel.performPolyMerge(0)", "pm.mel.PolyMergeOptions()"),
            ("bt_collapse", "polyCollapseEdge.png", "polyCollapseEdge.png",
             "Collapse", "Collapse the selected edges or faces",
             "pm.mel.performPolyCollapse(0)", ""),
            ("bt_deleteVertexEdges", "polyDelEdgeVertex.png",
             "polyDelEdgeVertex.png", "DeleteVertexEdges",
             "Delete the selected Vertices / Edges",
             "pm.mel.performPolyDeleteElements()", ""),
            ("bt_splitPolygon", "multicutnex.png", "multicutnex.png",
             "SplitFace", "Split polygon", self.multiCut,
             "pm.mel.InteractiveSplitTool()"),
            ("bt_connectComponents", "polyConnectComponents.png",
             "polyConnectComponents.png", "Connect", "Connect components",
             "pm.mel.ConnectComponents()", ""),
            ("bt_duplicateEdge", "splitEdge.png", "splitEdge.png",
             "DuplicateEdge", "Duplicate edges",
             "pm.modeling.polyDuplicateEdge(pm.ls(selection=True), of=0.5, aef=1.0)",
             ""),
            ("bt_insertEdgeLoop", "polySplitEdgeRing.png",
             "polySplitEdgeRing.png", "InsertEdge", "Insert edge loop",
             "pm.mel.SplitEdgeRingTool()", ""),
            ("bt_slideEdge", "slideEdgeTool.png", "slideEdgeTool.png",
             "SlideEdge", "Slide edge tool", "pm.mel.SlideEdgeTool()",
             "pm.mel.SlideEdgeToolOptions()"),
            ("bt_offsetEdgeLoop", "polyDuplicateEdgeLoop.png",
             "polyDuplicateEdgeLoop.png", "OffsetEdge", "Offset edge loop",
             "pm.mel.performPolyDuplicateEdge(0)",
             "pm.mel.DuplicateEdgesOptions()"),
            (
                "bt_bevel",
                "polyBevel.png",
                "polyBevel.png",
                "Bevel",
                "Bevel selected edges",
                "pm.mel.polyBevel(offset=0.5, offsetAsFraction=1, autoFit=1, segments=1, worldSpace=1, uvAssignment=1, fillNgons=1, mergeVertices=1, mergeVertexTolerance=0.0001, smoothingAngle=30, miteringAngle=180, angleTolerance=180)",
                "pm.mel.BevelPolygonOptions()",
            ),
            ("bt_empty_00", "", "", "", "", "", ""),
            ("bt_separator_05", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_separator_06", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_bridge", "polyBridge.png", "polyBridge.png", "Bridge",
             "Create a bridge between two sets of edges or faces",
             "mc.polyBridgeEdge(divisions=0)", "pm.mel.BridgeEdgeOptions()"),
            ("bt_appendPolygon", "polyAppendFacet.png", "polyAppendFacet.png",
             "Append",
             "Select border edges to append a face to the selected shell",
             "pm.mel.setToolTo('polyAppendFacetContext')", ""),
            ("bt_fillHole", "polyCloseBorder.png", "polyCloseBorder.png",
             "Fill",
             "Create a face filling the hole around the selected border edge(s)",
             "pm.mel.FillHole()", ""),
            ("bt_empty_00", "", "", "", "", "", ""),
            ("bt_separator_07", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_separator_08", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_smooth", "polySmooth.png", "polySmooth.png", "Smooth",
             "Smooth mesh", self.kmSmooth, "pm.mel.SmoothPolygonOptions()"),
            ("bt_reduce", "polyReduce.png", "polyReduce.png", "Reduce",
             "Reduce Polygon", self.kmReduce, "pm.mel.ReducePolygonOptions()"),
            (
                "bt_sculpt",
                "putty.png",
                "putty.png",
                "Sculpt",
                "Sculpt a geometry object",
                "pm.mel.SculptGeometryTool()",
                "pm.mel.SculptGeometryToolOptions()",
            ),
            ("bt_transform", "polyMoveVertex.png", "polyMoveVertex.png",
             "Transform",
             "Transform (Scale, Rotate, Translate...) the selected components (Vertices, Edges or Faces). UVs are moved in the UV Texture Editor",
             "pm.mel.performPolyMove('',0)", ""),
            ("bt_separator_09", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_separator_10", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_softEdge30", "polyNormalSetAngle.png",
             "polyNormalSetAngle.png", "NormalAngle",
             "Set the soft/hard threshold angles for edge normals",
             self.kmSoftEdge30, ""),
            ("bt_setToFace", "polyNormalSetToFace.png",
             "polyNormalSetToFace.png", "Set to face", "Set to face",
             self.kmSetToFace, ""),
            ("bt_softEdge180", "polySoftEdge.png", "polySoftEdge.png",
             "SoftEdge", "Set the soft/hard threshold angles for edge normals",
             self.kmSoftEdge180, ""),
            ("bt_kmSoftEdge0", "polyHardEdge.png", "polyHardEdge.png",
             "Set to face", "Set to face", self.kmSoftEdge0, ""),
            (
                "bt_reverse",
                "polyNormal.png",
                "polyNormal.png",
                "ReverseNormal",
                "Reverse the normals of the selected faces",
                self.kmReverseNormal,
                "pm.mel.ReversePolygonNormalsOptions()",
            ),
            ("bt_empty_00", "", "", "", "", "", ""),
            ("bt_separator_11", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_separator_12", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_instObj", "instanceToObject.png", "instanceToObject.png",
             "InstanceToObject", "Convert selected instance(s) to object(s)",
             "pm.mel.ConvertInstanceToObject()", ""),
            ("bt_edgeToCurve", "polyEdgeToCurve.png", "polyEdgeToCurve.png",
             "EdgeToCurve", "Convert selected edges to curve",
             "pm.mel.CreateCurveFromPoly()", ""),
            ("bt_separator_13", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
            ("bt_separator_14", "separateHorizontal.png",
             "separateHorizontal.png", "Separator", "", "", ""),
        ]

        modeling = mc.rowColumnLayout(numberOfColumns=2,
                                      columnWidth=[(1, scaleIcon),
                                                   (2, scaleIcon)])

        for btnName, imgFileName, imgHltFileName, btnLabel, btnAnnotation, btnCommand, btnDoubleClic in allButtons:

            if btnName == "bt_empty_00":
                mc.separator(style='none', height=scaleIcon)

            else:
                btnName = mc.iconTextButton(image1=self.target + imgFileName,
                                            highlightImage=self.target +
                                            imgHltFileName,
                                            label=btnLabel,
                                            annotation=btnAnnotation,
                                            command=btnCommand,
                                            doubleClickCommand=btnDoubleClic,
                                            height=scaleIcon)

            if imgFileName == "separateHorizontal.png":
                mc.iconTextButton(btnName,
                                  edit=True,
                                  height=scaleSeparator,
                                  enable=0)

        #my_dock = mc.dockControl(dockName, label="", area='left', content=my_window, allowedArea=['right', 'left'],
        #sizeable=False, width=2*scaleColumn+2) #label="kMod",

        allowedAreas = ['left', 'right']
        myTool = mc.toolBar(toolName,
                            area='left',
                            content=my_window,
                            allowedArea=allowedAreas)
示例#29
0
 def delWindows(self, onOff=True, forceOff=False):
     for loopWin in self.allWin:
         if cmds.window(loopWin, query=True, exists=True):
             cmds.deleteUI(loopWin)
         if cmds.toolBar(loopWin, query=True, exists=True):
             cmds.deleteUI(loopWin)