コード例 #1
0
ファイル: initTransferWindow.py プロジェクト: leandropim/Tapp
 def updateLayoutEnabled(self):
     '''
     updates UI enabled/disabled flag based on layer data availability
     '''
     enabled = self.dataModel.isEnabled()
     cmds.layout(self.cmdLayout.innerLayout,e=True,enable=enabled)
     cmds.layout(self.cmdLayout.buttonForm,e=True,enable=enabled)
コード例 #2
0
 def updateLayoutEnabled(self):
     '''
     updates UI enabled/disabled flag based on layer data availability
     '''
     enabled = LayerDataModel.getInstance().layerDataAvailable==True
     cmds.layout(self.cmdLayout.innerLayout,e=True,enable=enabled)
     cmds.layout(self.cmdLayout.buttonForm,e=True,enable=enabled)
コード例 #3
0
 def changePrefix(s, element, text):
     text = text.strip().title()
     if text and 2 < len(text) < 30 and "@" not in text:
         cmds.layout(element, e=True, bgc=(0.3,1,0.3))
         s.data["pref"] = text
         s.save()
     else:
         cmds.control(element, e=True, bgc=(1,0.4,0.4))
コード例 #4
0
 def closeTodo():  # Animate todo closed. Fancy.
     if cmds.layout(gui, ex=True):
         height = cmds.layout(gui, q=True, h=True)
         for i in range(20):
             i = (100 - i*5) / 100.0
             cmds.layout(gui, e=True, h=height * i)
             cmds.refresh()
             time.sleep(0.01)
     s._buidTodoTasks()
コード例 #5
0
ファイル: model.py プロジェクト: wildparky/spielenPipeline
    def __init__(self):      
        if mc.layout(self.layoutname, query=True, exists=True) == True:
            mc.deleteUI(self.layoutname, lay=True)
        if mc.layout(self.layoutname, query=True, exists=True) != True:
            self.windowName = mc.loadUI(f=self._UI_File)
            mc.showWindow(self.windowName)

            allowedAreas = ['right', 'left']
            self.layout=mc.dockControl(area='right', content=self.windowName, l='SP_2012', w=390, h=490, allowedArea=allowedAreas)
            self.layoutname=mc.dockControl(self.layout,q=1,fpn=1)
コード例 #6
0
    def createUI( self, win, index):
# min/max of the attr need to be set correcty, not yet
		win.cRange.append( mc.floatSliderGrp( label=self.niceName, fieldStep=.1, precision=3, field=True, min=0, fieldMinValue=-1000000, max=5, fieldMaxValue=1000000, cc='bt_randomizer.updateChannel( ' + str(index) + ', 1)', dc='bt_randomizer.updateChannel( ' + str(index) + ', 0)' ))
# Offset - then modify the stepping of the float field
		win.cOffset.append( mc.floatFieldGrp( label='Offset', precision=3, numberOfFields=1, value1=0, cc='bt_randomizer.updateChannel( ' + str(index) + ', 1)', dc='bt_randomizer.updateChannel( ' + str(index) + ', 0)' ))
		mc.floatField( (win.cOffset[-1] + '|' + mc.layout( win.cOffset[-1], q=1, ca=1)[1]), e=1, step=.1)
# Step - then modify the stepping of the float field
		win.cStep.append( mc.floatFieldGrp( label='Step', precision=3, numberOfFields=1, value1=0, cc='bt_randomizer.updateChannel( ' + str(index) + ', 1)', dc='bt_randomizer.updateChannel( ' + str(index) + ', 0)' ))
		mc.floatField( (win.cStep[-1] + '|' + mc.layout( win.cStep[-1], q=1, ca=1)[1]), e=1, step=.1)
		mc.separator( style="in", h=20)
コード例 #7
0
	def filterListByType(self, nodeType):
		if len(self.itemList) > 0:
			for item in self.itemList:
				classification = []
				classification.append(item.nodeType)
				classification.extend(cmds.getClassification(item.nodeType))
				clsStr = '|'.join(classification)
				if nodeType in clsStr:
					cmds.layout(item.listItemLayoutId, edit = 1, manage = 1)
				else:
					cmds.layout(item.listItemLayoutId, edit = 1, manage = 0)
コード例 #8
0
ファイル: Engine.py プロジェクト: DavideAlidosi/May9
 def show(cls, menu_type, menu_name, preferences, **kwargs):
     """create marking menu"""
     cls.hide(kwargs["b"])
     if not menu_name:
         return
     if menu_type == cls.MEL:
         cls._mel(menu_name, p=cmds.layout(cmds.getPanel(up=True), q=True, p=True), aob=True, mm=True, **kwargs)
     elif menu_type == cls.PYTHON:
         cls._python(menu_name, p=cmds.layout(cmds.getPanel(up=True), q=True, p=True), aob=True, mm=True, **kwargs)
     else:
         cls._preset(menu_name, preferences, p=cmds.layout(cmds.getPanel(up=True), q=True, p=True), aob=True,
                     mm=True, **kwargs)
コード例 #9
0
ファイル: todo.py プロジェクト: internetimagery/todo
 def _GUI_Delete(s):
     """
     Overriding deletion for a fancy removal animation.
     """
     if cmds.layout(s._root, ex=True):
         height = cmds.layout(s._root, q=True, h=True)
         for i in range(20):
             i = (100 - i*5) / 100.0
             cmds.layout(s._root, e=True, h=height * i)
             cmds.refresh()
             time.sleep(0.01)
         element.MayaElement._GUI_Delete(s)
コード例 #10
0
def sample(strYaya,*agre):
    cmds.deleteUI('layout_'+strYaya.split('saww')[1])
    
    main_column_num = cmds.layout('main_layout',q=True,numberOfChildren=True)
    for d in range(main_column_num):
        rowlayoutNum = cmds.rowLayout('sadw'+str(d),q=True,numberOfChildren=True)
        if rowlayoutNum<12 or rowlayoutNum>0:
            for i in range(12 - int(rowlayoutNum)):
                try:
                    layPos = cmds.layout('sadw'+str(int(d)+1),q=True,childArray=True)
                    cmds.columnLayout(layPos[0] ,e=True,parent='sadw'+str(d)) 
                except:
                    pass
コード例 #11
0
ファイル: tabPaint.py プロジェクト: leandropim/Tapp
    def updateToTool(self):
        '''
        update controls to current tool
        '''
        isPainting = self.isPainting()
        cmds.control(self.cmdLayout.innerLayout,e=True,enable=isPainting)
        cmds.button(self.cmdLayout.buttons[1],e=True,label="Flood" if isPainting else "Paint")

        if (isPainting):        
            self.controls.brushRadiusSlider.setValue(cmds.artUserPaintCtx(self.TOOL_PAINT,q=True,radius=True))
        self.controls.brushRadiusSlider.setEnabled(isPainting)
        
        layersAvailable = LayerDataModel.getInstance().layerDataAvailable
        cmds.layout(self.cmdLayout.buttonForm,e=True,enable=layersAvailable)
コード例 #12
0
ファイル: clips.py プロジェクト: internetimagery/clipStore
 def delete(s):
     # Delete itself
     with warn:
         ans = cmds.confirmDialog(
             t=s.i18n["clips.deleteClip"],
             m=s.i18n["clips.deleteConfirm"],
             button=[s.i18n["yes"], s.i18n["no"]],
             defaultButton=s.i18n["yes"],
             cancelButton=s.i18n["no"],
             dismissString=s.i18n["no"]
             )
         if ans == s.i18n["yes"]: # Are we ok to delete??
             s.char.removeClip(s.clip)
             cmds.layout(s.wrapper, e=True, m=False)
コード例 #13
0
 def updatePlaneMode(self, planeMode, unused):        
     if(self.currentPlaneMode == planeMode):
         return
     
     #hide advanced options UI
     if(self.currentPlaneMode is not None and self.currentPlaneMode.advancedSettingsUI is not None):
         cmds.layout(self.currentPlaneMode.advancedSettingsUI, edit=True, visible=False)
     
     self.currentPlaneMode = planeMode
     
     #show advanced options UI
     if(self.currentPlaneMode.advancedSettingsUI is not None):
         cmds.layout(self.currentPlaneMode.advancedSettingsUI, edit=True, visible=True)
         
     self.updatePreviewPlane()
コード例 #14
0
 def removeExportFolder(s, listElement, path):
     if cmds.layout(listElement, ex=True):
         cmds.deleteUI(listElement)
     if path in s.data["dirs"]:
         s.data["dirs"].remove(path)
         s.save()
     print "Removing Export Folder:", path
コード例 #15
0
 def removeExportSelection(s, listElement, item):
     if cmds.layout(listElement, ex=True):
         cmds.deleteUI(listElement)
     if item in s.data["objs"]:
         s.data["objs"].remove(item)
         s.save()
     print "Removing Export Object:", item
コード例 #16
0
def deleteChannelsUI( win):
    chnlUI = mkList( mc.layout( win.channelsParent, q=1, ca=1))
    if len(chnlUI): mc.deleteUI( chnlUI)
    win.cRange = []
    win.cOffset = []
    win.cStep = []
    mc.setParent( win.channelsParent)
コード例 #17
0
ファイル: mayaWranglerUI.py プロジェクト: ewerybody/melDrop
def startUp():
	print( '########## mayaWrangler >>>>>>>>>>>>>>>>>>>>>>>>' )
	# todo embedd in interface:
	wantSecondsCurrentTimeField = 1
	wantCurrentTimeFieldInt = 1
	wantCurrentTimeToMinMaxPopup = 1
	wantTweakGraphEditPopup = 1
	wantShelfSwitcherMM = 1

	if not m.layout( lyout, ex=1 ):
		raise IOError, 'timeSlider layout: ' + lyout + ' does not exist (yet)! :/'
	print ('check! layout: ' + str(lyout) + ' exists!')
	if not m.control( currTimeField, ex=1 ):
		raise IOError, 'currTimeField: ' + currTimeField + ' does not exist (yet)! :/'
	print ('check! currTimeField: ' + str(currTimeField) + ' exists!')

	if wantSecondsCurrentTimeField:
		createSecondsCurrentTimeField()
	if wantCurrentTimeFieldInt:
		makeCurrentTimeFieldInt()
	if wantCurrentTimeToMinMaxPopup:
		addCurrentTimeToMinMaxPopup()
	if wantTweakGraphEditPopup:
		createTweakGraphEditPopup()
	if wantShelfSwitcherMM:
		import shelfSwitcher
		shelfSwitcher.build()
	print( '########## mayaWrangler <<<<<<<<<<<<<<<<<<<<<<<<<' )
コード例 #18
0
 def cleanUP_editDishTAB(self,anchor):
     mc.textField( self.currentEditedDish ,e=True,tx='' )
     chldList = mc.layout(anchor,q=True,ca=True)
     
     if chldList is not None and len(chldList)>0:
         for chld in chldList:
             mc.deleteUI(chld)
コード例 #19
0
 def _clear(s):
     """
     Clear the layout ready to be refreshed
     """
     if cmds.layout(s.wrapper, ex=True):
         cmds.deleteUI(s.wrapper)
     s.wrapper = cmds.columnLayout(adj=True, p=s.container)
コード例 #20
0
ファイル: ml_utilities.py プロジェクト: Bumpybox/Tapp
 def readUI(self):
     '''
     This reads the UI elements and turns them into arguments saved in a kwargs style member variable
     '''
     
     if self.uiArgDict:
         #this is some fanciness to read the values of UI elements and generate or run the resulting command
         #keys represent the argument names, the values are UI elements
         
         for k in self.uiArgDict.keys():
             
             uiType = mc.objectTypeUI(self.uiArgDict[k])
             value = None
             if uiType == 'rowGroupLayout':
                 controls = mc.layout(self.uiArgDict[k], query=True, childArray=True)
                 if 'check1' in controls:
                     value = mc.checkBoxGrp(self.uiArgDict[k], query=True, value1=True)
                 elif 'radio1' in controls:
                     buttonNumber = mc.radioButtonGrp(self.uiArgDict[k], query=True, select=True)
                     #there should be a control for the label and each the buttons..I hope
                     labels = mc.radioButtonGrp(self.uiArgDict[k], query=True, **{'labelArray'+str(len(controls)-1):True})
                     value = labels[buttonNumber-1]
             else:
                 OpenMaya.MGlobal.displayWarning('Cannot read '+uiType+' UI element: '+self.uiArgDict[k])
                 continue
             
             self.kwargs[k] = value
コード例 #21
0
ファイル: syncScriptEditor.py プロジェクト: oglops/ogTools
def add_script_editor_toolbar():
    # this is the last contorl on script editor tool bar
    goto_btn = mc.iconTextButton(
        'scriptEditorToolbarGotoLineButton', q=1, fullPathName=1)
    flow_layout = re.search('.*(?=\|)', goto_btn).group()

    for x in reversed(mc.layout(flow_layout, q=1, ca=1)):
        if x == 'scriptEditorToolbarGotoLineButton':
            break
        else:
            mc.deleteUI(x)

    mc.setParent(flow_layout)

    iconSize = 23
    mc.separator(height=iconSize, horizontal=0, style='single')

    mc.iconTextButton(
        width=iconSize, height=iconSize,
        annotation='save tabs',
        image="save.png",
        c=lambda *x: save_tabs()
    )

    mc.iconTextButton(
        width=iconSize, height=iconSize,
        annotation='load tabs',
        image="refresh.png",
        c=lambda *x: load_tabs()
    )
コード例 #22
0
    def switch_module(self,dishName,dishFile,*args):
        archive = zipfile.ZipFile(dishFile, 'r')
        jsonFile = archive.read('dish.ini')
        jsondata = json.loads(jsonFile)  
        archive.close()

        #Clear chld
        chldrn = mc.layout( self.InfosTab, query=True, childArray=True )
        for chld in chldrn:
            mc.deleteUI(chld)
        #-------------------------------------------------------------------
        mc.columnLayout( adjustableColumn=True ,p=self.InfosTab ,rs=5)        
        header = """<html>
            <body>
            <h1>%s</h1></body>
            </html>
        """%(dishName )
        
        self.dishType  = dishName
        mc.text( self.module,e=True,l=header,font='boldLabelFont')        
        mc.scrollField( editable=False, wordWrap=True, text=jsondata['moduleInfos'] ,h=140)
        mc.separator()   
        mc.text( l='name bank') 
        mc.columnLayout( adjustableColumn=True)
        LimbMenu = mc.optionMenu( label='',w=224  )
        mc.menuItem( label='NONE')
        mc.setParent('..')
        mc.button(l='Open name composer',h=28)
        mc.optionMenu( LimbMenu ,e=True,changeCommand=partial(self.composePrfX,LimbMenu))

        self.dishPrfx       =  mc.textField()
        mc.button(l='Import', h=42,c=self.validate_dish_before_merge )        
コード例 #23
0
    def __init__(self):
        MPx.MPxCommand.__init__( self )

        #add env variable for maya scripts path
        CSIDL_PERSONAL = 5       # My Documents
        SHGFP_TYPE_CURRENT = 1   # Get current, not default value

        docs = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
        ctypes.windll.shell32.SHGetFolderPathW(None, CSIDL_PERSONAL, None, SHGFP_TYPE_CURRENT, docs)

        mayaENVfile = docs.value + "/maya/2016/Maya.env"

        os.chmod( mayaENVfile, 0o664 )
        mayaEnv = open( mayaENVfile, 'a' )
        mayaEnvR = open( mayaENVfile, 'r' )

        readEnv = mayaEnvR.readlines()
        lineSet = set(readEnv)

        newline = "MAYA_MODULE_PATH= C:\Program Files\Autodesk\Maya2016\plugin-ins\CGassetManager"
        newlineSpaces = "\n\nMAYA_MODULE_PATH= C:\Program Files\Autodesk\Maya2016\plugin-ins\CGassetManager"

        if not newline in lineSet:
            mayaEnv.writelines(newlineSpaces)

        mayaEnv.close()
        mayaEnvR.close()

        #rehash the maya script cache
        mel.eval( "rehash;" )

        if cmds.layout( "PM_plugins", exists=True ):
            pass
        else:
            mel.eval( "loadNewShelf \"shelf_PM_plugins\";" )
コード例 #24
0
ファイル: retarget.py プロジェクト: internetimagery/clipStore
 def clear(s, elem):
     ch = cmds.layout(elem, ca=True)
     if ch:
         for c in ch:
             try:
                 cmds.deleteUI(c)
             except RuntimeError:
                 pass
コード例 #25
0
 def clearElement(s, element):
     existing = cmds.layout(element, q=True, ca=True)
     if existing:
         for layout in existing:
             try:
                 cmds.deleteUI(existing)
             except RuntimeError:
                 pass
コード例 #26
0
 def removeAnimation(s, listElement, anim):
     if cmds.layout(listElement, ex=True):
         cmds.deleteUI(listElement)
     if anim in s.animationData:
         s.animationData.remove(anim)
         s.data["anim"] = s.extractAnimationData(s.animationData)
         s.save()
     print "Removing Animation:", anim.data["name"]
コード例 #27
0
 def replaceVectorVariables(self, nodeAttr):
    parent = cmds.setParent(query=1)
    children = cmds.layout(parent, query=1, childArray=1)
    
    form = parent + "|" + children[0]
    children = cmds.layout(form, query=1, childArray=1)
    
    rowlayout = form + "|" + children[0]
    varslayout = form + "|" + children[1]
    
    children = cmds.layout(rowlayout, query=1, childArray=1)
    
    addbtn = rowlayout + "|" + children[0]
    rembtn = rowlayout + "|" + children[1]
    
    cmds.button(addbtn, edit=1, command=lambda *args: self.addVectorVariable(nodeAttr, varslayout))
    cmds.button(rembtn, edit=1, command=lambda *args: self.removeAllVariables(nodeAttr, varslayout))
    
    # Update content
    nameAttr = nodeAttr
    valueAttr = nodeAttr.replace("vparam_name", "vparam_value")
    
    # Sync name/value arrays
    count = self.syncNameValueArrays(nameAttr, valueAttr, vectorValues=True)
    
    # Build UI
    children = cmds.columnLayout(varslayout, query=1, childArray=1)
    if children is None:
       children = []
    uicount = len(children)
    
    # Remove extra variables
    while uicount > count:
       cmds.deleteUI(children[-1])
       uicount -= 1
    
    # Sync existing values
    for i in xrange(uicount):
       self.syncVectorVariable(nameAttr, valueAttr, i, children[i])
    
    # Add missing variables
    while uicount < count:
       self.addVectorVariable(nodeAttr, varslayout,
                             name=cmds.getAttr("%s[%d]" % (nameAttr, uicount)),
                             value=cmds.getAttr("%s[%d]" % (valueAttr, uicount)))
       uicount += 1
コード例 #28
0
 def get_text_edit(self):
     'get current qtextedit from script editor'
     tabIdx = mc.tabLayout(gCommandExecuterTabs, q=1, st=1)
     _logger.debug('current tab: %s', tabIdx)
     cmd_executer = mc.layout(tabIdx,q=1,ca=1)[0]
     ptr=apiUI.MQtUtil.findControl(cmd_executer)
     
     self.textedit=sip.wrapinstance(long(ptr),QObject)
コード例 #29
0
 def _clearFrame(s):  # Clear the UI
     """
     Clear UI for next build
     """
     s.GUI["wrapper"] = s.GUI.get("wrapper", "")
     if cmds.layout(s.GUI["wrapper"], ex=True):
         cmds.deleteUI(s.GUI["wrapper"])
     s.GUI["wrapper"] = cmds.columnLayout(adjustableColumn=True, p=s.GUI["window"])
コード例 #30
0
def _getTimelineWinSize():
    '''Dimensione finestra timeline a seconda se sono su qt o no.'''

    mayaVersion = cmds.about(version=True).split()[0]
    if _isQt:
        return (cmds.layout('MainTimeSliderLayout|formLayout9|frameLayout2', q=True, w=True)-17, 38)
    else:
        return ((cmds.control('MayaWindow|mayaMainWindowForm', q=True, w=True)-311), 70)
コード例 #31
0
 def updateEnabled(self):
     cmds.layout(self.destinationRow,
                 e=True,
                 enable=not self.chkSelfReference.getValue())
     self.chkBidirectional.setEnabled(not self.chkSelfReference.getValue())
コード例 #32
0
 def children(self):
     """ :return: children of this layout """
     childnames = mutil.noneToList(cmds.layout(self, q=1, ca=1))
     # assure we have long names to ensure uniqueness
     return uibase.wrapUI(["%s|%s" % (self, c) for c in childnames])
コード例 #33
0
def installToolboxWindow():
    installForm = cmds.formLayout()
    textLabel = cmds.text(label='Shelf')
    nameText = cmds.textField('nameText', width=200, tx='Custom')
    scriptsMenu = cmds.optionMenu('scriptsMenu')
    jsonPathText = cmds.textField('jsonPathText', ed=False, pht='path to json')
    jsonPathBtn = cmds.button('jsonPathBtn',
                              width=50,
                              label='...',
                              c='browseForFile()')
    separator = ';' if cmds.about(nt=True) else ':'
    scriptsPaths = os.getenv('MAYA_SCRIPT_PATH')
    allparts = scriptsPaths.split(separator)
    for i, part in enumerate(allparts):
        if (i == 0):
            cmds.menuItem(label='Manually install scripts')
        if (i < 7):
            isSystemPath = FilterOutSystemPaths(part)
            if (isSystemPath == 0):
                cmds.menuItem(label=part)

    iconsMenu = cmds.optionMenu('iconsMenu')
    iconsPaths = os.getenv('XBMLANGPATH')
    iconsParts = iconsPaths.split(separator)

    for i, part in enumerate(iconsParts):
        if (i < 6):
            isSystemPath = FilterOutSystemPaths(part)
            if (isSystemPath == 0):
                cmds.menuItem(label=part)

    progressControl = cmds.progressBar('progressControl',
                                       maxValue=10,
                                       vis=False,
                                       width=250)

    btn1 = cmds.button(height=50, label='Install', c='CheckText()')
    btn2 = cmds.button(height=50,
                       label='Close',
                       c='cmds.deleteUI(\'Install Toolbox\')')

    listLayout = cmds.columnLayout('listLayout', adjustableColumn=True)

    try:
        dirname = os.path.dirname(__file__)
    except:
        print 'running in test environment'
        dirname = 'C:/Users/Admin/Documents/Toolbox'

    JSONPath = dirname + '/toolboxShelf.json'

    try:
        data = json.load(open(JSONPath), object_pairs_hook=OrderedDict)
        cmds.textField('jsonPathText', e=True, text=JSONPath)
        for k in data:
            cb = cmds.checkBox(h=20, label=k, v=1)
            try:
                if data[k]["checkStatus"] == 0:
                    cmds.checkBox(cb, e=True, v=0)
                if data[k]["checkStatus"] == 2:
                    cmds.checkBox(cb, e=True, v=1, ed=0)
            except:
                pass
    except:
        pass

    cmds.formLayout(installForm,
                    edit=True,
                    attachForm=[(textLabel, 'top', 15),
                                (textLabel, 'left', 10), (nameText, 'top', 10),
                                (nameText, 'right', 10),
                                (scriptsMenu, 'right', 10),
                                (iconsMenu, 'right', 10),
                                (jsonPathBtn, 'right', 10),
                                (progressControl, 'left', 10),
                                (progressControl, 'right', 10),
                                (btn1, 'bottom', 0), (btn1, 'left', 0),
                                (btn2, 'bottom', 0), (btn2, 'right', 0)],
                    attachControl=[(nameText, 'left', 10, textLabel),
                                   (scriptsMenu, 'top', 10, textLabel),
                                   (scriptsMenu, 'left', 10, textLabel),
                                   (iconsMenu, 'top', 10, scriptsMenu),
                                   (iconsMenu, 'left', 10, textLabel),
                                   (jsonPathText, 'top', 10, iconsMenu),
                                   (jsonPathBtn, 'top', 10, iconsMenu),
                                   (jsonPathText, 'left', 10, textLabel),
                                   (jsonPathText, 'right', 10, jsonPathBtn),
                                   (progressControl, 'top', 20, jsonPathText),
                                   (progressControl, 'left', 10, textLabel),
                                   (listLayout, 'top', 20, jsonPathText),
                                   (listLayout, 'left', 10, textLabel),
                                   (btn2, 'left', 0, btn1)],
                    attachPosition=[(btn1, 'right', 0, 50)])

    shelfName = ''
    #get current tab
    names = cmds.layout('ShelfLayout', q=True, ca=True)
    shelfIndex = cmds.shelfTabLayout('ShelfLayout',
                                     query=True,
                                     selectTabIndex=True)

    #set text
    selectionString = (names[shelfIndex - 1])
    cmds.textField(nameText, edit=True, tx=selectionString)
コード例 #34
0
 def get_exec_type(self):
     gCommandExecuterTabs = get_mel_global('$gCommandExecuterTabs')
     tabIdx = mc.tabLayout(gCommandExecuterTabs, q=1, st=1)
     cmd_executer = mc.layout(tabIdx, q=1, ca=1)[0]
     return mc.cmdScrollFieldExecuter(cmd_executer, q=1, st=1)
コード例 #35
0
    def __init__( self):
        self.cRange = []
        self.cOffset = []
        self.cStep = []
        window, columnLayout, closeButton, seedButton, selectButton, undoButton = standardWindow( "randomizerWin", "Randomizer", ( "Close", "New Seed", "Reload Sel", "Reset"))
        mc.setParent( columnLayout)
        mc.text( 'Select objects, channels or components\nand click on \"Reload Sel\"')
        mc.separator( style='none', h=10)


        mc.frameLayout( label='Objects', borderStyle='etchedIn', cll=1, cl=0)
        mc.columnLayout( adj=1)

        # Transform Objects
        self.tRange = mc.floatSliderGrp( label='Translate Range', fieldStep=.1, precision=3, field=True, min=0, fieldMinValue=0, max=50, fieldMaxValue=10000, cc='bt_randomizer.updateTranslate(1)', dc='bt_randomizer.updateTranslate(0)' )
        self.tScale = mc.floatFieldGrp( label='Multiply Axis', precision=3, numberOfFields=3, value1=1, value2=1, value3=1, cc='bt_randomizer.updateTranslate(1)', dc='bt_randomizer.updateTranslate(0)' )
        for c in mc.layout( self.tScale, q=1, ca=1)[1:]: mc.floatField( (self.tScale + '|' + c), e=1, step=.1)
        mc.separator( style='in', h=20)

        # Rotate Objects
        self.rRange = mc.floatSliderGrp( label='Rotate Range', fieldStep=.1, precision=3, field=True, min=0, fieldMinValue=0, max=360, fieldMaxValue=10000, cc='bt_randomizer.updateRotate(1)', dc='bt_randomizer.updateRotate(0)' )
        self.rScale = mc.floatFieldGrp( label='Multiply Axis', precision=3, numberOfFields=3, value1=1, value2=1, value3=1, cc='bt_randomizer.updateRotate(1)', dc='bt_randomizer.updateRotate(0)' )
        for c in mc.layout( self.rScale, q=1, ca=1)[1:]: mc.floatField( (self.rScale + '|' + c), e=1, step=.1)
        mc.separator( style='in', h=20)

        # Scale Objects
        self.sRange = mc.floatSliderGrp( label='Scale Range', fieldStep=.1, precision=3, field=True, min=0, fieldMinValue=0, max=5, fieldMaxValue=10000, cc='bt_randomizer.updateScale(1)', dc='bt_randomizer.updateScale(0)' )
        self.sScale = mc.floatFieldGrp( label='Multiply Axis', precision=3, numberOfFields=3, value1=1, value2=1, value3=1, cc='bt_randomizer.updateScale(1)', dc='bt_randomizer.updateScale(0)' )
        for c in mc.layout( self.sScale, q=1, ca=1)[1:]: mc.floatField( (self.sScale + '|' + c), e=1, step=.1)
        self.uniformScale = mc.checkBoxGrp( label='Uniform Scale', l1='', ncb=1, v1=0, cc='bt_randomizer.win.dimScaleFields()\nbt_randomizer.updateScale(1)')

        # Channels
        mc.setParent( columnLayout)
        mc.frameLayout( label='Channels', borderStyle='etchedIn', cll=1, cl=1)
        self.channelsParent = mc.columnLayout( adj=1)
        createChannelsUI( self)

        # Components
        mc.setParent( columnLayout)
        mc.frameLayout( label='Components', borderStyle='etchedIn', cll=1, cl=1)
        mc.columnLayout( adj=1)
        self.tCmpRange = mc.floatSliderGrp( label='Translate Range', fieldStep=.01, precision=3, field=True, min=0, fieldMinValue=0, max=1, fieldMaxValue=10000, cc='bt_randomizer.updateComponents(1)', dc='bt_randomizer.updateComponents(0)' )
        self.tCmpScale = mc.floatFieldGrp( label='Multiply Axis', precision=3, numberOfFields=3, value1=1, value2=1, value3=1, cc='bt_randomizer.updateComponents(1)', dc='bt_randomizer.updateComponents(0)' )
        for c in mc.layout( self.tCmpScale, q=1, ca=1)[1:]: mc.floatField( (self.tCmpScale + '|' + c), e=1, step=.1)

# move along normal is not yet working, the checkBox is disabled
        self.cmpAlongNormal = mc.checkBoxGrp( label='Along Normal', en=1, l1='', ncb=1, v1=0, cc='bt_randomizer.win.dimScaleFields()\nbt_randomizer.updateComponents(1)')
        mc.separator( h=10, style='none');

        self.cmpUseDnoise = mc.checkBoxGrp( label='Use Dnoise', l1='', ncb=1, v1=0, cc='bt_randomizer.win.dimScaleFields()\nbt_randomizer.updateComponents(1)')
        self.cmpDnoiseScale = mc.floatFieldGrp( label='Multiply Dnoise', precision=3, numberOfFields=3, value1=1, value2=1, value3=1, en=0, cc='bt_randomizer.genDnoiseAll()\nbt_randomizer.updateComponents(1)', dc='bt_randomizer.genDnoiseAll()\nbt_randomizer.updateComponents(0)' )
        for c in mc.layout( self.cmpDnoiseScale, q=1, ca=1)[1:]: mc.floatField( (self.cmpDnoiseScale + '|' + c), e=1, step=.1)

        # Selection
        mc.setParent( columnLayout)
        mc.frameLayout( label='Selection', borderStyle='etchedIn', cll=1, cl=1)
        mc.columnLayout( adj=1)
        self.selection = mc.floatSliderGrp( label='Selection Ratio', fieldStep=.1, precision=3, field=True, min=0, max=1, value=1, cc='bt_randomizer.updateSelection(1)', dc='bt_randomizer.updateSelection(0)' )

        mc.button( closeButton, edit=1, command='import maya.cmds\nmaya.cmds.deleteUI( \"' + window + '\")')
        mc.button( seedButton, edit=1, command='[o.generate() for o in bt_randomizer.sel]\n[o.generate() for o in bt_randomizer.selCmp]\n[o.generate() for o in bt_randomizer.selChnl]\nbt_randomizer.updateAll()')
        mc.button( selectButton, edit=1, command='bt_randomizer.start()')
        mc.button( undoButton, edit=1, command='bt_randomizer.win.resetUI()')
コード例 #36
0
 def clearInfo(self):
     chdn = cmds.layout(self.infoUI, q=1, ca=1)
     if not chdn == None:
         for chd in chdn:
             cmds.deleteUI(chd)
コード例 #37
0
    def _refresh(self, node):
        #print('InputButtons._refresh: ' + node)
        try:
            lastParentLayout = cmds.setParent(q=True)
            cmds.setParent(self.path)

            with UITemplate('DefaultTemplate'):
                node_i = node + '.i'
                attrs = cmds.listAttr(node_i, m=True) or []

                conn = cmds.listConnections(
                    node_i, s=True, d=False, c=True, p=True) or []
                conn = dict(zip(conn[::2], conn[1::2]))

                lyt_ = self.path + '|'
                children = [
                    (lyt_ + x)
                    for x in (cmds.layout(self.path, q=True, ca=True) or [])
                ]
                nChildren = len(children)

                i = 0
                node_ = node + '.'
                for attr in attrs:
                    if i < nChildren:
                        row = children[i]
                        cmds.text(row + '|name', e=True, l=attr)
                        upstream = row + '|upstream'
                        trash = row + '|trash'
                    else:
                        row = cmds.rowLayout(nc=3, h=20, cw=[(2, 30), (3, 30)])
                        cmds.text('name', l=attr)
                        upstream = cmds.symbolButton('upstream',
                                                     i='hsUpStreamCon.png',
                                                     h=20)
                        trash = cmds.symbolButton('trash',
                                                  i='smallTrash.png',
                                                  h=20)
                        cmds.setParent('..')

                    plug = node_ + attr
                    src = conn.get(plug)
                    if src:
                        cmds.symbolButton(upstream,
                                          e=True,
                                          en=True,
                                          c=_partial(_showUpstream, plug))
                    else:
                        cmds.symbolButton(upstream, e=True, en=False)
                    cmds.symbolButton(trash,
                                      e=True,
                                      c=_callback(
                                          cmds.evalEcho,
                                          'removeMultiInstance -b 1 ' + plug))

                    i += 1

                for i in range(i, nChildren):
                    cmds.deleteUI(children[i])

        finally:
            if lastParentLayout:
                cmds.setParent(lastParentLayout)
コード例 #38
0
 def layersAvailableHandler(self):
     cmds.layout(self.baseLayout,
                 e=True,
                 enable=LayerDataModel.getInstance().layerDataAvailable)
コード例 #39
0
 def cleanup(self, root):  # ( No need to change )
     chdn = cmds.layout(root, q=1, ca=1)
     if not chdn == None:
         for chd in chdn:
             cmds.deleteUI(chd)  #, layout=1
コード例 #40
0
 def updateListBGC(self, *args):
     chdn = cmds.layout(self.list, q=1, ca=1)
     colors = checkingBoxCmd(0).colors
     cmds.scrollLayout(self.listScr, e=1, bgc=colors[1 - len(chdn) % 2])
コード例 #41
0
 def cleanup(self):
     chd = cmds.layout(self.root, q=1, ca=1)
     if not chd == None:
         for item in chd:
             cmds.deleteUI(item)
コード例 #42
0
ファイル: uiWrappers.py プロジェクト: lazerdaze/lancer
 def setVisible(layout, visible):
     cmds.layout(layout, e=True, visible=visible)
コード例 #43
0
ファイル: uiWrappers.py プロジェクト: lazerdaze/lancer
 def setEnabled(layout, enabled):
     cmds.layout(layout, e=True, enable=enabled)
コード例 #44
0
 def clear(s, element):
     ch = cmds.layout(element, q=True, ca=True)
     if ch:
         for c in ch:
             try: cmds.deleteUI(c)
             except RuntimeError: pass
コード例 #45
0
ファイル: tabSkinRelax.py プロジェクト: lazerdaze/lancer
 def updateUIEnabled(self):
     useVolumeSearch = self.controls.useVolumeAssociation.getValue()
     cmds.layout(self.controls.volumeSearchRow, e=True, enable=useVolumeSearch)
コード例 #46
0
 def __init__(self, uiFile=None, **info):
     try: cmds.deleteUI(self.__UI[self.__class__].window)
     except: pass
     
     try: self.__UI[self.__class__].window.close()
     except: pass
     
     if self.__class__ in self.__messages:
         for msg in self.__messages[self.__class__]:
             try: om.MMessage.removeCallback(msg)
             except: pass
         self.__messages.update({self.__class__:[]})
         
     self.__UI.update({self.__class__:self})
     
     if uiFile:
         self.window = cmds.loadUI(f=config.getPath(config.kUI, "%s.ui"%uiFile))
         width = cmds.window(self.window, q=True, width=True)
         height = cmds.window(self.window, q=True, height=True)
         left = (1920 - width) / 2
         top = (1080 - height) / 2
         cmds.windowPref(self.window, topLeftCorner=[top, left], width=width, height=height)
         
         detector = {"button"         : cmds.button,
                     "checkBox"       : cmds.checkBox,
                     "intSlider"      : cmds.intSlider,
                     "optionMenu"     : cmds.optionMenu,
                     "progressBar"    : cmds.progressBar,
                     "radioButton"    : cmds.radioButton,
                     "text"           : cmds.text,
                     "textField"      : cmds.textField,
                     "textScrollList" : cmds.textScrollList}
         
         for item in info:
             found = False
             for target in detector:
                 if detector[target](info[item], exists=True):
                     found = True
                     pathList = detector[target](info[item], q=True, fpn=True).split('|')
                     self.__setattr__(item, "%s|%s"%(self.window, '|'.join(pathList[1:])))
                     break
             
             if not found:
                 if cmds.layout(info[item], exists=True):
                     parentList = cmds.layout(info[item], q=True, parent=True).split('|')
                     self.__setattr__(item, "%s|%s|%s"%(self.window, '|'.join(parentList[1:]), info[item]))
                     children = cmds.layout(self.__getattribute__(item), q=True, fpn=True, ca=True)
                     for child in children:
                         cmds.deleteUI(child)
                 else:
                     try: 
                         widget = '|'.join(cmds.control(info[item], q=True, fpn=True).split("|")[1:])
                         self.__setattr__(item, "%s|%s"%(self.window, widget))
                     except: cmds.confirmDialog(message=u'未找到控件:'+info[item], icon='warning', title=u'PuTao')
                     
         self.uiMessage = omui.MUiMessage.addUiDeletedCallback(self.window, self.close)
         cmds.showWindow(self.window)
         self.setupUi()
     
     else:
         self.uiMessage = None
         self.window = QMayaWindow()
         self.window.closed.connect(lambda *_: self.__UI.update({self.__class__:None}))
         self.setupUi(self.window)
コード例 #47
0
def runAutoPro(self):
    
    
    statusUpdate(self, 'Starting AutoPro')
    #reset textField values to default for error detection reasons
    resetValue(self)
    mel.progressBar('autoProProgress', edit = 1, visible=1)
    statusUpdate(self, 'Optimizing Scene')
    import maya.mel as mm
    mm.eval('source cleanupScene.mel')
    mm.eval('performCleanUpSceneForEverything')
    statusUpdate(self, 'Finished Optimizing Scene')
    addProgress()
    
    #collect display layers
    display_Layers = ap.find_layers()
    #collect the state of display layers
    display_layers_state = ap.collect_layer_state(display_Layers)
    #hide layers
    ap.hide_all_layers(display_Layers)
    
    #progressWindow()
    #Check to see if a file is loaded
    statusUpdate(self, 'Query Scene Load')
    if not (mel.file(query=1, sceneName=1)):
        mel.progressBar('autoProProgress', edit = 1, visible=0)
        statusUpdate(self, 'No file loaded. Please load a file.')
        mel.error("No file loaded. Please load a file")
    #update name variables
    updateNameVars()
    addProgress()
    statusUpdate(self, 'Name Variables Verified')
    
    statusUpdate(self, 'Checking File Name')
    #check the name and edit the GUI accordingly.
    nameCheck = ap.nameCheck(yearMonth, projNum)
    mel.textField("studentFileNameTextField", edit = True, text = nameCheck[1])
    if(nameCheck[0]):
        mel.textField("fileNamedTextField", edit=True, text = "Yes", backgroundColor = ap.bgColor(0))
    else:
        mel.textField("fileNamedTextField", edit = True, text = "No", backgroundColor = ap.bgColor(100))
    addProgress()
    statusUpdate(self, 'Name Check Complete')
    
    statusUpdate(self, 'Gathering Nodes')
    #Load the assemblie nodes minus cameras  
    masterNodes = ap.masterGroup()
    #sort to capture all children nodes as well as main assembly nodes
    allNodes = ap.nodeCollect(masterNodes)
    nodes= []
    addProgress()
    statusUpdate(self, 'Nodes Collected')
    
    statusUpdate(self, 'PolySurfaceShape Work Around')
    #this is a bit of a hack to get around the polySurfaceShape node that is created when an object has history
    for tempNode in allNodes:
        if 'polySurfaceShape' not in tempNode:
            nodes.append(tempNode)
    addProgress()
    statusUpdate(self, 'Work Around Complete')
    
    statusUpdate(self, 'Calculating Node Quantities')
    #calculate total nodes and place in GUI
    totalNodes = len(nodes)
    transformNodes = ap.listCollect(nodes, 'transform')    
    visiNodes = ap.listCollect(nodes, 'mesh')
    totalShape = len(visiNodes)
    totalTrans = len(transformNodes)
    mel.textField("totalObjectsTextField", edit=1, text=totalTrans)
    mel.textField("totalShapeObjectsTextField", edit=1, text = totalShape)
    addProgress()
    statusUpdate(self, 'Node Quantities Complete')
    
    statusUpdate(self, 'Comparing Default Names')
    #compare geometry names to defualt name list and calculate and populate GUI fields
    global defaultNames
    defaultNames = ap.defaultCompare(transformNodes)
    mel.textField("notNamedTextField", edit=1, text=len(defaultNames))
    notNamedPercent = int((float(len(defaultNames))/float(totalTrans))*100.0)
    percentDefaultNames = (str(notNamedPercent) + "%")
    notNamedColor = ap.bgColor(notNamedPercent)
    mel.textField("notNamedPercentTextField", edit=1, text=percentDefaultNames, backgroundColor = notNamedColor)
    addProgress()
    statusUpdate(self, 'Default Names Compared')
    
    statusUpdate(self, 'Checking Master Group')
    #Check to master Group node and subGroups
    subGroups = ap.subGroups(masterNodes)
    if ((len(masterNodes)) ==1) and subGroups != False:
        mel.textField("groupedTextField", edit=True, text = "Yes", backgroundColor = (0.0, 0.8, 0.0))
    else:
        mel.textField("groupedTextField", edit = True, text = "No", backgroundColor = (0.8, 0.0, 0.0))
    mel.textField("masterNodeTextField", edit = True, text = str(masterNodes))
    mel.textField("subGroupTextField", edit=True, text = str(subGroups))
    #checks to see if there are subGroups
    
    addProgress()
    statusUpdate(self, 'Master Group and SubGroups Checked')
    
    statusUpdate(self, 'Checking Display Layers')
    #Checks for geometry to be in display layer and updates GUI
    displayLayers = mel.layout('LayerEditorDisplayLayerLayout', query = 1, childArray =1)
    visibleLayer = []
    if displayLayers != None:
        for dLayer in displayLayers:
            if mel.objExists(dLayer):
                if(mel.getAttr('%s.visibility' % dLayer)):
                    visibleLayer.append(dLayer)
    for layer in visibleLayer:
        mel.setAttr('%s.visibility' % layer, 0)
    global notLayered
    notLayeredLocal = []
    for node in visiNodes:
        if (ap.visibleTest(node)):
            notLayeredLocal.append(node)
    if displayLayers != None:       
        for layer2 in visibleLayer:
            mel.setAttr('%s.visibility' % layer2, 1)
    notLayered = notLayeredLocal
    mel.textField("notLayeredTextField", edit = 1, text = len(notLayered))
    notLayerPercent = int((float(len(notLayered))/float(len(visiNodes)))*100.0)
    percentNotLayer = (str(notLayerPercent) + "%")
    notLayeredColor = ap.bgColor(notLayerPercent)
    mel.textField("notLayeredPercentTextField", edit=1, text=percentNotLayer, backgroundColor = notLayeredColor)
    addProgress()
    statusUpdate(self, 'Display Layers Checked')
    
    statusUpdate(self, 'Checking Transforms')
    #Checks for frozen transforms.
    global notFroze
    notFroze = ap.spreadSheet(ap.listCollect(nodes, 'transform'))
    mel.textField("notFrozenTextField", edit= 1, text=len(notFroze))
    notFrozePercent = int((float(len(notFroze))/float(totalTrans))*100.00)
    percentNotFroze = (str(notFrozePercent) + "%")
    notFrozeColor = ap.bgColor(notFrozePercent)
    mel.textField("notFrozenPercentTextField", edit =1, text = percentNotFroze, backgroundColor = notFrozeColor)
    addProgress()
    statusUpdate(self, 'Transforms Checked')
    
    statusUpdate(self, 'Checking for History')
    #check for History
    global withHistory
    withHistory = ap.historyFinder(ap.listCollect(nodes, 'mesh'))
    mel.textField("withHistoryTextField", edit = 1, text = len(withHistory))
    withHistoryPercent = int((float(len(withHistory))/float(len(visiNodes)))*100.0)
    percentWithHistory = (str(withHistoryPercent) + "%")
    withHistoryColor = ap.bgColor(withHistoryPercent)
    mel.textField("withHistoryPercentTextField", edit=1, text=percentWithHistory, backgroundColor = withHistoryColor)
    addProgress()
    statusUpdate(self, 'History Checked')
    
    statusUpdate(self, 'Checking Pivots')
    #Check for pivots
    global notCentered
    notCentered = ap.centerPivot(ap.listCollect(nodes, 'transform'))
    mel.textField("notCenteredTextField", edit=1, text = len(notCentered))
    notCenteredPercent = int((float(len(notCentered))/float(totalTrans))*100.0)
    percentNotCentered = (str(notCenteredPercent) + "%")
    notCenteredColor = ap.bgColor(notCenteredPercent)
    mel.textField("notCenteredPercentTextField", edit = 1, text = percentNotCentered, backgroundColor = notCenteredColor)
    addProgress()
    statusUpdate(self, 'Pivots Checked')
    
    statusUpdate(self, 'Testing N-gons')
    #Test N-gons
    global nGonList
    nGonList = ap.nGonFinder(allNodes)
    nGonPercent = int((float(len(nGonList[0]))/float(len(visiNodes)))*100.0)
    percentNGons = (str(nGonPercent) + "%")
    nGonColor = ap.bgColor(nGonPercent)
    mel.textField("totalNgonObjectsTextField", edit =1, text = len(nGonList[0]))
    mel.textField("ngonPercentTextField", edit = 1, text = percentNGons , backgroundColor = nGonColor)
    mel.textField("totalNgonsTextField", edit =1, text = len(nGonList[1]))
    addProgress()
    statusUpdate(self, 'N-gons Complete')
    
    statusUpdate(self, 'Testing Lamina Faces')
    #test Lamina faces
    global laminaList
    laminaList = ap.laminaFinder(allNodes)
    laminaPercent = int((float(len(laminaList[0]))/float(len(visiNodes)))*100.0)
    percentLamina = (str(laminaPercent) + "%")
    laminaColor = ap.bgColor(laminaPercent)
    mel.textField("totalLaminaObjectsTextField", edit =1, text = len(laminaList[0]))
    mel.textField("laminaPercentTextField", edit = 1, text = percentLamina , backgroundColor = laminaColor)
    if laminaList[1]==None:
        laminaListLen =0
    else:
        laminaListLen = len(laminaList[1])
    mel.textField("totalLaminaTextField", edit =1, text = laminaListLen)
    addProgress()
    statusUpdate(self, 'Laminas Complete')
    
    statusUpdate(self, 'Tool Completed')
    mel.rowLayout( 'progressRowLayout', edit = 1, visible = 0)
    mel.rowLayout('autoProStatusRowLayout', edit =1, visible = 0)

    statusUpdate(self, 'Testing Tri Faces')
    #test Lamina faces
    global triList
    triList = ap.triFinder(allNodes)
    triPercent = int((float(len(triList[0]))/float(len(visiNodes)))*100.0)
    percentTri = (str(triPercent) + "%")
    triColor = ap.bgColor(triPercent)
    mel.textField("totalTriObjectsTextField", edit =1, text = len(triList[0]))
    mel.textField("triPercentTextField", edit = 1, text = percentTri , backgroundColor = triColor)
    if triList[1]==None:
        triListLen =0
    else:
        triListLen = len(triList[1])
    mel.textField("totalTriTextField", edit =1, text = triListLen)
    addProgress()
    statusUpdate(self, 'Tris Complete')
    
    statusUpdate(self, 'Tool Completed')
    mel.rowLayout( 'progressRowLayout', edit = 1, visible = 0)
    mel.rowLayout('autoProStatusRowLayout', edit =1, visible = 0)
    
    ap.set_layers_visibility(display_Layers, display_layers_state)
    
    #push grades auto
    pushGrades('self')
コード例 #48
0
ファイル: spaces.py プロジェクト: fsanges/glTools-1
    def ui_embed(self, parentLayout, char=''):
        '''
		@param parentLayout: Parent UI layout to parent spaces UI to.
		@type parentLayout: str
		@param char: Character namespace to create UI for
		@type char: str
		'''
        # Get Character Prefix
        if char: char += ':'

        # List all spaces with given prefix
        spaceNodeList = mc.ls(char + '*_spn', r=True, et='transform')
        spaceNodeList = [
            i for i in spaceNodeList if not i.endswith('_con_spn')
        ]

        # Generate target list with default elements
        targetList = ['SuperMover', 'Default']

        # Build Spaces List from eNum attributes
        for node in spaceNodeList:
            if mc.objExists(node + '.spaces'):
                enumList = mc.addAttr(node + '.spaces', q=True,
                                      en=True).split(':')
                [
                    targetList.append(i) for i in enumList
                    if not targetList.count(i)
                ]

        # Begin UI Build
        if not mc.layout(parentLayout, q=True, ex=True):
            raise UserInputError(
                'Parent layout ' + parentLayout +
                ' does not exists! Unable to embed Spaces UI!')

        mc.setParent(parentLayout)
        # Clear Layout
        childArray = mc.layout(parentLayout, q=True, ca=True)
        if type(childArray) == list: mc.deleteUI(childArray)

        # Add Spaces control layout
        mc.rowColumnLayout(self.uiRCL,
                           numberOfColumns=5,
                           columnWidth=[(1, 160), (2, 160), (3, 80), (4, 80),
                                        (5, 80)])

        # Add KeyFrame CheckBoxs
        mc.checkBoxGrp(self.uiKeyPreviousCBG,
                       numberOfCheckBoxes=1,
                       label="Key Before Switch",
                       v1=0)
        mc.checkBoxGrp(self.uiKeyCBG,
                       numberOfCheckBoxes=1,
                       label="Key After Switch",
                       v1=0)

        for i in range(3):
            mc.separator(h=20, style='none')

        mc.checkBoxGrp(self.uiMaintainPosCBG,
                       numberOfCheckBoxes=1,
                       label="Maintain Position",
                       v1=1)

        for i in range(4):
            mc.separator(h=20, style='none')
        for i in range(5):
            mc.separator(h=20, style='single')

        # ALL OptionMenu
        mc.text(label='ALL')
        mc.optionMenuGrp(self.uiAllOMG,
                         cw=(1, 1),
                         cal=(1, 'center'),
                         label='',
                         cc='glTools.tools.spaces.Spaces().switchAllFromUI()')
        for item in targetList:
            mc.menuItem(label=item)

        mc.button(w=80,
                  l='Reset',
                  c='glTools.tools.spaces.Spaces().resetAllFromUI("' + char +
                  '")')
        mc.button(w=80, l='Select', c='mc.select(mc.ls("' + char + '*_spn"))')
        mc.button(w=80,
                  l='Key',
                  c='glTools.tools.spaces.Spaces().keyAllFromUI("' + char +
                  '")')

        for i in range(5):
            mc.separator(h=20, style='single')

        # Create attrEnumOptionMenu controls to accurately represent attribute values at all times.
        # ie - Update on frame change
        for spacesNode in spaceNodeList:
            tag = mc.getAttr(spacesNode + '.nameTag')
            mc.text(label=tag)
            mc.attrEnumOptionMenu(
                tag + '_switchAEO',
                w=160,
                label='',
                attribute=spacesNode + '.spaces',
                dtg=spacesNode + '.spaces',
                cc='glTools.tools.spaces.Spaces().switchFromUI("' +
                spacesNode + '")')
            mc.button(w=80,
                      l='Reset',
                      c='glTools.tools.spaces.Spaces().resetFromUI("' +
                      spacesNode + '")')
            mc.button(w=80, l='Select', c='mc.select("' + spacesNode + '")')
            mc.button(w=80,
                      l='Key',
                      c='glTools.tools.spaces.Spaces().key("' + spacesNode +
                      '")')
コード例 #49
0
    def replace(self, plug):
        """
        Called if an attribute editor already exists and another node of the
        same type is now to be edited.
        """
        self.setNodeName(plug.split('.')[0])

        # All the attributes of the current node.
        listAttr = cmds.listAttr(self.nodeName)

        # Get the current widget Maya name.
        currentWidgetName = cmds.setParent(query=True)
        # Convert it to C++ ptr.
        ptr = OpenMayaUI.MQtUtil.findLayout(currentWidgetName)
        # Convert it to PySide object.
        currentWidget = shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
        # Get the Layout.
        currentLayout = currentWidget.parent().parent().parent()
        # Get a button
        button = currentLayout.findChild(QtWidgets.QPushButton, PLUS_BUTTON_NAME)
        # Reconnect the button. We need it to be sure the button is connected
        # with proper object. Sometimes pymel creates several AETemplate
        # objects, in this way we need to be sure that the button is connected
        # with proper object.
        button.clicked.disconnect()
        button.clicked.connect(self.createContextMenu)

        # The "Walter" layout that contains everything.
        mainLayout = cmds.layout(currentWidgetName, query=True, parent=True)
        # Iterate all the children of the layout.
        for layout in cmds.layout(mainLayout, query=True, childArray=True):
            fullName = '|'.join([mainLayout, layout])

            # Check if current item is a frameLayout
            if not cmds.frameLayout(fullName, query=True, exists=True):
                continue

            group = cmds.frameLayout(fullName, query=True, label=True)

            # Check if we need to display this group
            visible = False

            # TODO: It's not a perfect way to iterate the attributes this way.
            # But we have a few of them, so for now it's OK.
            for attr in ATTRIBUTES:
                if attr.get('group') == group and attr['name'] in listAttr:
                    visible = True
                    continue

            # Hide/show
            cmds.frameLayout(fullName, edit=True, visible=visible)

        # Delete all old UIs of custom attributes
        customPath = cmds.layout(
            "walterCustomLayout", query=True, fullPathName=True)
        childLayouts = cmds.layout(
            "walterCustomLayout", query=True, childArray=True)
        for layout in childLayouts or []:
            fullName = '|'.join([customPath, layout])
            cmds.deleteUI(fullName)

        # Switch to the layout with custom attributes
        cmds.setParent(customPath)

        # List of predefined attributes
        known = [attr['name'] for attr in ATTRIBUTES]
        # Find attributes that will be exported but they wasn't defined.
        customAttrs = [
            a for a in listAttr if a[:PREFIX_SIZE] == PREFIX and a not in known]
        for a in customAttrs:
            currentPlug = '.'.join([self.nodeName, a])

            if cmds.addAttr(currentPlug, query=True, parent=True) != a:
                # We are here because the current attribute is a child of some
                # another attribute. We need to skip it.
                continue

            cmds.rowLayout(
                numberOfColumns=4,
                columnWidth4=(
                    BUTTON_POSITION * 6 / 14,
                    BUTTON_POSITION * 2 / 14,
                    BUTTON_POSITION * 6 / 14 - BUTTON_SIZE,
                    BUTTON_SIZE))

            nameLayout = a + "NameLayout"
            attrLayout = a + "Layout"
            buttonLayout = a + "Button"

            # Text field with the attribute name.
            text = a[PREFIX_SIZE:]
            if text[0] == '_':
                text = text[1:]

            cmds.textField(
                nameLayout,
                text=text,
                changeCommand=
                    lambda
                        text,
                        n=self.nodeName,
                        a=a,
                        nl=nameLayout,
                        al=attrLayout,
                        bl=buttonLayout:
                    self.renameAttr(n, a, PREFIX + '_' + text, nl, al, bl))

            # The group that repesents an attribute.
            control = self.getControllerGroup(currentPlug, custom=True)
            control(attrLayout, attribute=currentPlug, label="")
            # Remove the text label from the group. We already have a text field
            children = cmds.layout(attrLayout, query=True, childArray=True)
            path = cmds.layout(attrLayout, query=True, fullPathName=True)
            if children and len(children) > 1:
                # Remove the first. It's a text label.
                cmds.deleteUI(children.pop(0))
                # Hide all except the second item. We can't remove them because
                # Maya use them when it changes the current attribute of the
                # group.
                children.pop(0)
                for item in children:
                    fullItem = '|'.join([path, item])

                    if cmds.layout(fullItem, query=True, exists=True):
                        cmds.layout(fullItem, edit=True, visible=False)

                    if cmds.control(fullItem, query=True, exists=True):
                        cmds.control(fullItem, edit=True, visible=False)

            # Empty space for filling
            cmds.rowLayout(numberOfColumns=1)
            cmds.setParent('..')

            # The button to remove the attribute.
            cmds.button(
                buttonLayout,
                label="-",
                width=BUTTON_SIZE,
                height=BUTTON_SIZE,
                command=lambda c, a=a: self.deleteAttr(a))

            cmds.setParent("..")

        # Return the parent.
        cmds.setParent(currentWidgetName)
コード例 #50
0
def getRegion(rrStart_x, rrStart_y, rrLast_x, rrLast_y):

    values = [rrStart_x, rrStart_y, rrLast_x, rrLast_y]

    camOverscan = cmds.camera(camera0, q=1, ovr=1)

    if LockedAttr() == 'locked':
        cmds.warning('Unlock you camera\'s main attributtes')
        return False

    if cmds.window("vpRenderWindow", exists=1) == False:
        getRvStatus()
        getPaneLayoutStatus()

    if values[3] < 0:
        values[3] = 0

    if values[2] > formX:
        values[2] = formX

    if values[2] - values[0] < 20 or values[1] - values[3] < 20:
        cmds.warning('Region is too small')
    else:
        leftW = marLeft + values[0]
        topW = marTop + (formY - values[1])
        resoX = values[2] - values[0]
        resoY = values[1] - values[3]

        main(values)

        if "Viewport_RenderShape" not in cmds.ls(ca=1):
            setToolBegin()
        else:
            cmds.setAttr('defaultResolution.width', resoX)
            cmds.setAttr('defaultResolution.height', resoY)

            aspRatio = float(cmds.getAttr('defaultResolution.width')) / float(
                cmds.getAttr('defaultResolution.height'))

            cmds.setAttr('defaultResolution.deviceAspectRatio', aspRatio)

        ScaleToCrop = float(formX) / resoX
        ScaleToCrop2 = float(formY) / resoY

        cmds.setAttr(camera0 + '.preScale', float(ScaleToCrop) / camOverscan)

        if 'OverScanExpression' not in cmds.ls(et='expression'):
            cmds.expression(name='OverScanExpression',
                            s=camera0 +
                            '.overscan = Viewport_RenderShape.overscan',
                            o=camera0,
                            ae=1)

        # Pixel Offset
        pixoffX = (float(formX) / 2) - (values[0] + float(resoX) / 2)
        pixoffY = (float(formY) / 2) - (formY - values[1]) - (float(resoY) / 2)

        # Film Translate
        FxOff = float(pixoffX) / (formX / 2)
        FxOff = FxOff * ScaleToCrop

        if FxOff > 0:
            FxOff = FxOff * -1
        else:
            FxOff = -FxOff

        cmds.setAttr(camera0 + '.filmTranslateH', FxOff)

        unitY = float(formY) / 2 * float(formX) / formY
        FyOff = float(pixoffY) / unitY
        FyOff = FyOff * ScaleToCrop

        cmds.setAttr(camera0 + '.filmTranslateV', FyOff)

        cmds.setAttr('defaultResolution.width', resoX)
        cmds.setAttr('defaultResolution.height', resoY)

        aspRatio = float(cmds.getAttr('defaultResolution.width')) / float(
            cmds.getAttr('defaultResolution.height'))
        cmds.setAttr('defaultResolution.deviceAspectRatio', aspRatio)

        cmds.layout('scrollBarForm', e=1, vis=0)

        cmds.renderWindowEditor(renderViews,
                                e=True,
                                snp=(currentPanel, resoX, resoY))
        cmds.renderWindowEditor(renderViews, e=True, rs=True, cap=0, pca=0)
        cmds.renderWindowEditor(renderViews, e=1, cl=(resoX, resoY, 0, 0, 0))

        if currentRender == 'arnold':
            cmds.arnoldRender(cam=camera1)

        elif currentRender == 'vray':

            if cmds.getAttr("vraySettings.vfbOn") == 1:
                cmds.setAttr("vraySettings.vfbOn", 0)

            cmds.setAttr('vraySettings.width', resoX)
            cmds.setAttr('vraySettings.height', resoY)
            mel.eval('vraySetPixelDeviceAspect();')

            vrendCommand = 'vrend -camera %s' % (camera0)
            mel.eval(vrendCommand)

        elif currentRender == 'mentalRay':

            cmds.Mayatomr(pv=True, cam=camera0)

        else:
            cmds.warning(
                'Render engine not supported. Rendering using Maya Software renderer.'
            )
            cmds.render(camera1, x=resoX, y=resoY)

        reRenderVals.append(resoX)
        reRenderVals.append(resoY)
コード例 #51
0
def refreshUI(args):
    if cmds.layout(win + 'RootLayout', q=True, ex=True):
        cmds.deleteUI(win + 'RootLayout')
    createBodyUI()
コード例 #52
0
ファイル: vrac.py プロジェクト: 3d-kmax/kTools
        #nc = item.split("|")
        print item
        for axe in ["X", "Y", "Z"]:
            mc.setAttr(item + ".translate" + axe, lock=True)
                       
import maya.cmds as cmds

print(cmds.objectTypeUI( 'viewPanes' ))
import sys
for c,e in enumerate(cmds.objectTypeUI(listAll=True)):
    c += 1
    sys.stdout.write(e + " ")
    if c % 3 == 0:
        sys.stdout.write('\n')

channelWindow = mc.layout('MayaWindow|MainChannelsLayersLayout', parent=True, q=1)
mc.window(channelWindow, active=True, q=1)

## probleme bounding box infini
mc.exactWorldBoundingBox(mc.ls(sl=True))

listBad = []
selectionList = mc.ls(sl=1)
if selectionList:
    for item in selectionList:
        values = mc.exactWorldBoundingBox(item)
        if values[0] < -1e+10 or values[0] > 1e+10 :
            listBad.append(item)
            print ">> " + item + " : " + str(values)
        else:
            print ">> : " + item + " IS OK"
コード例 #53
0
    def populateMaterials(self):

        print("ML Log: populateMaterials")
        # Remove any existing materials.
        if (cmds.layout("RPRMaterialsFlow", exists=True)):
            cmds.deleteUI("RPRMaterialsFlow", layout=True)

        # Ensure that the material container is the current parent.
        cmds.setParent(self.materialsContainer)

        # Create the new flow layout.
        cmds.flowLayout("RPRMaterialsFlow", columnSpacing=0, wrap=True)

        # Add materials for the selected category.
        for material in self.materials:
            fileName = material["fileName"]
            imageFileName = self.libraryPath + "/" + fileName + "/" + fileName + ".jpg"

            materialName = material["name"]

            # Horizontal layout for small icons.
            if (self.iconSize < 64):
                iconWidth = self.iconSize + 5
                cmds.rowLayout(width=self.cellWidth,
                               height=self.cellHeight,
                               numberOfColumns=2,
                               columnWidth2=(self.iconSize,
                                             self.cellWidth - iconWidth - 5))

                cmds.iconTextButton(style='iconOnly',
                                    image=imageFileName,
                                    width=self.iconSize,
                                    height=self.iconSize,
                                    command=partial(self.selectMaterial,
                                                    material),
                                    doubleClickCommand=partial(
                                        self.importMaterial, material))

                cmds.iconTextButton(style='textOnly',
                                    height=self.iconSize,
                                    label=self.getTruncatedText(
                                        materialName,
                                        self.cellWidth - iconWidth - 5),
                                    align="left",
                                    command=partial(self.selectMaterial,
                                                    material),
                                    doubleClickCommand=partial(
                                        self.importMaterial, material))

            # Vertical layout for large icons.
            else:
                cmds.columnLayout(width=self.cellWidth, height=self.cellHeight)
                cmds.iconTextButton(style='iconOnly',
                                    image=imageFileName,
                                    width=self.iconSize,
                                    height=self.iconSize,
                                    command=partial(self.selectMaterial,
                                                    material),
                                    doubleClickCommand=partial(
                                        self.importMaterial, material))

                cmds.text(label=self.getTruncatedText(materialName,
                                                      self.iconSize),
                          align="center",
                          width=self.iconSize)

            cmds.setParent('..')

        # Perform an initial layout update.
        self.updateMaterialsLayout()
コード例 #54
0
 def _separatorMoved():
     h = cmds.layout(form1, q=True, h=True) + h2
     ExprespyEditor.setOpt('height', h)
     #print(h)
     cmds.paneLayout(pane, e=True, h=h, ps=(1, 100, 99))
コード例 #55
0
 def captureMode(s):
     s.live = True
     cmds.layout(s.previewLayout, e=True, m=False)
     cmds.layout(s.camLayout, e=True, m=True)
     cmds.iconTextButton(s.thumb, e=True, l=s.i18n["captureBtn"])
コード例 #56
0
 def update():
     cmds.layout(self.cmdLayout.outerLayout.layout,
                 e=True,
                 enable=selectionState.getLayersAvailable())
コード例 #57
0
ファイル: mzColorSetEditor.py プロジェクト: aratakawa/pop
	def refreshUI(self, args) :
		if cmds.layout(self.window+'BodyLayout', ex=True) :
			cmds.deleteUI(self.window+'BodyLayout')
		self.createBody()
		self.refreshObjectList()
		self.refreshDisplay()
コード例 #58
0
    def __init__(self, name):
        with UITemplate('Exprespy'):

            def _separatorMoved():
                h = cmds.layout(form1, q=True, h=True) + h2
                ExprespyEditor.setOpt('height', h)
                #print(h)
                cmds.paneLayout(pane, e=True, h=h, ps=(1, 100, 99))

            pane = cmds.paneLayout(name,
                                   cn='horizontal2',
                                   ps=(1, 100, 99),
                                   st=5,
                                   smc=_separatorMoved,
                                   h=self.getOpt('height'))

            form1 = cmds.formLayout('form1')

            super(ExprespyEditor, self).__init__(path=pane)

            cmds.formLayout(
                form1,
                e=True,
                af=[
                    (self.editor, 'top', 0),
                    (self.editor, 'left', 0),
                    (self.editor, 'right', 0),
                    (self.editor, 'bottom', 0),
                ],
            )

            cmds.setParent(pane)

            form2 = cmds.formLayout('form2')
            rawl = cmds.rowLayout('rawl', nc=3)
            if self.isRichEditor():
                sln = self.getBoolOpt('lineNumber')
                self.widget().syncSettings(sln=sln)
                cmds.checkBox('lineNumber',
                              l='Line Number',
                              v=sln,
                              cc=ExprespyEditor._lineNumber_changed)
            else:
                cmds.text(l=' ')
            cmds.checkBox('rawMode',
                          l='Raw Mode',
                          v=self.getBoolOpt('rawMode'),
                          cc=ExprespyEditor._rawMode_changed)
            cmds.checkBox('shortName',
                          l='Short Name',
                          v=self.getBoolOpt('shortName'),
                          cc=ExprespyEditor._shortName_changed)
            h2 = cmds.layout(rawl, q=True, h=True)
            cmds.setParent('..')
            self._inputsAPI1 = cmds.checkBox('inputsAPI1',
                                             l='Inputs API 1.0 MObject')
            cmds.formLayout(
                form2,
                e=True,
                af=[
                    (rawl, 'top', 0),
                    (rawl, 'left', 0),
                    (self._inputsAPI1, 'top', 0),
                    (self._inputsAPI1, 'right', 0),
                ],
            )

        # これによって UINodeTracker が UI と共に死ぬまで生きる。
        self._trackerPath = _decideTrackerUIPath(self.path)
        (UINodeTracker.getInstance(self._trackerPath)
         or UINodeTracker(self._trackerPath)).registerCallback(self._refresh)
コード例 #59
0
 def setEnabled(self, enabled):
     cmds.layout(self.mainLayout, e=True, enable=enabled)
コード例 #60
0
ファイル: legacy.py プロジェクト: lazerdaze/lancer
    def ui(self):

        # Main Layout ===================================================================================================

        if cmds.layout('animToolsChannelBoxUI', exists=True):
            cmds.deleteUI('animToolsChannelBoxUI')

        cmds.formLayout('animToolsChannelBoxUI', p=self.channelPane)

        scrollUI = cmds.scrollLayout(cr=True)

        cmds.separator(st='none', h=5)

        # Menu ===================================================================================================

        cmds.menuBarLayout()

        cmds.menu(l='UI', hm=True)
        cmds.menuItem(l='Close', c=self.removeUI)

        cmds.menu(l='Playblast')
        cmds.menuItem(l='Playblast - Temp',
                      c=lambda *_: cmds.playblast(format='image',
                                                  sequenceTime=0,
                                                  clearCache=1,
                                                  viewer=1,
                                                  showOrnaments=1,
                                                  offScreen=True,
                                                  fp=4,
                                                  percent=100,
                                                  compression='jpg',
                                                  quality=100))
        cmds.menuItem(divider=True)
        # cmds.menuItem(l='Playblast - Allison UI', c=allison.playblastWrapper)
        '''
		cmds.menu(l='Camera')
		cmds.menuItem(l='Set Saved Layout', c=self.savedLayout)
		cmds.menuItem(d=True)
		cmds.menuItem(l='Toggle Display', c=bboy.toggleViewport)
		'''

        cmds.menu(l='Anim')
        self.prefsRadioMenu(pref='evaluation', )
        self.prefsRadioMenu(pref='default tangent', )
        cmds.menuItem(l='', divider=True)
        cmds.menuItem(l='Weighted tangents',
                      checkBox=(cmds.keyTangent(q=True, g=True, wt=True)),
                      c=lambda x: cmds.keyTangent(e=True, g=True, wt=x))

        cmds.menu(l='Time')
        self.prefsRadioMenu(pref='playback speed', )
        self.prefsRadioMenu(pref='frames per second', )
        cmds.menuItem(l='', divider=True)
        self.keepFrames = cmds.menuItem(l='Keep keys at current frames',
                                        checkBox=False)

        cmds.menu(l='World')
        self.prefsRadioMenu(pref='up axis', )
        # self.prefsRadioMenu(pref='working units',)

        cmds.setParent('..')  # endMenu

        # Main Layout ===================================================================================================

        tab = cmds.tabLayout()

        self.keysUI()
        self.motionTrailUI()
        self.noteUI()

        # End UI ===================================================================================================

        cmds.setParent('..')  # end tab
        cmds.setParent('..')  # end scroll
        cmds.setParent('..')  # end form

        cmds.formLayout(
            'animToolsChannelBoxUI',
            e=True,
            attachForm=[
                (scrollUI, 'left', 0),
                (scrollUI, 'top', 0),
                (scrollUI, 'bottom', 0),
                (scrollUI, 'right', 0),
            ],
        )