def LocateAllModoIblNodes(): nodes = [] for node in cmds.ls(type="modoEnvironment"): linkedNode = cmds.defaultNavigation(destination=node + ".environmentColor", defaultTraversal=True) #check if there's a file node plugged in and create one if there's not if linkedNode == []: fileNode = cmds.shadingNode('file', asTexture=True) linkedNode = cmds.defaultNavigation(connectToExisting=True, source=fileNode, destination="%s.environmentColor" % node, force=True) if(linkedNode == None): continue #break out of the array the first entry linkedNode = linkedNode[0] if(cmds.nodeType(linkedNode) != "file"): continue #we have a texture, but check to see that it's lat/long mapped. if(cmds.attributeQuery("format", node=str(node), exists=True)): mappingType = cmds.getAttr(node+".format") if(mappingType != 2): cmds.scrollField("rendererErrorText", edit=True, text="Selected modo Environment node is mapped to use non-spherical mapping.") continue #everything look valid strAttribute = str(linkedNode) + ".fileTextureName" #craft an entry for the node list entry = strAttribute, node, linkedNode nodes.append(entry) return nodes
def validateRenderer(): strPlugin = getPluginName() if(len(strPlugin) == 0): return False # Most renderers are in plugins, so by locating that we indentify that the renderer is valid. pluginLoaded = cmds.pluginInfo(strPlugin, q=True, l=True) # Modo is not a plugin, so check separatly for that if we failed above. if(pluginLoaded == False): if cmds.getAttr('defaultRenderGlobals.ren') == 'modoRender': pluginLoaded = True if(pluginLoaded == False): # Craft the error string (watching for modo special case). if strPlugin == "ModoRender": strError = strPlugin + " is not selected or registered - cannot support this renderer at this time" else: strError = strPlugin + ".mll plugin is not loaded - cannot support this renderer at this time" cmds.scrollField("rendererErrorText", edit=True, text=strError) return False cmds.scrollField("rendererErrorText", edit=True, text="Maya plugin for Host Renderer detected") return True
def populate(self,*args): #clear field cmds.picture('preview',e=True,image=rootPath+'/NA.png') cmds.textField('assetName',e=True,tx='') cmds.scrollField('assetDesc',e=True,tx='') cmds.textField('assetPath',e=True,tx='') #search string search=cmds.textField('assetSearch',q=True,tx=True) #asset type type=cmds.optionMenu('assetType',q=True,v=True) #populating asset content cmds.textScrollList('assetContent',e=True,ra=True) temp=[] write=[] for chk in veRegCore.listAssetTable(): if chk[2]==type:write.append(chk) if search!='': for chk in write: if chk[1].find(search)!=-1:temp.append(chk) write=temp #populate textscroll cmds.textScrollList('assetContent',e=True,ra=True) for chk in write: cmds.textScrollList('assetContent',e=True,a=str(chk[0])+'_'+chk[1]) return
def loadDisc(): ''' When a type of script job is selected in the textScrollList the discription of that event will be posted in the adjacent scrollField. ''' # Get RadioButton selectedRC = cmds.radioCollection(radioCol, q=True, sl=True) xmlDict = { "mecSJEvent":"Events", "mecSJAttr":"attributes", "mecSJCond":"Conditions", "mecSJNode":"nodeNameChanged", "mecSJConn":"connectionChange", "mecSJUI":"uiDeleted", "mecSJTime":"timeChange"} # get selected element from the textScrollList # Get which event was selected. Only the first item will be addressed. selectedTSL = cmds.textScrollList(tsl, q=True, si=True)[0] # Access proper tag from xml file elem = sjXML.getroot() sjType = xmlDict[selectedRC] curSel = elem.find(sjType) # find which type is selected. disc = "" for item in curSel: if( item.text == selectedTSL ): disc = item[0].text # apply disc name to the scrollField cmds.scrollField( sfDisc, edit=True, text=disc) sjModeSwitch()
def registerNewAssetUI(self,*args): if cmds.window('ramAssetRegisterNew', exists=True): cmds.deleteUI('ramAssetRegisterNew', window=True) cmds.window('ramAssetRegisterNew',t='Register New Asset', s=False,mxb=False,mnb=False) cmas=cmds.columnLayout(adj=True) cmds.rowColumnLayout(nc=2,cw=[(1,60),(2,220)]) cmds.text(l='Name : ',fn='boldLabelFont', al='left') cmds.textField('assetNewName',w=220) cmds.text(l='Keyword : ',fn='boldLabelFont', al='left') cmds.textField('assetNewKey',w=220) cmds.text(l='') cmds.text(l='note : separate keyword with comma',al='left',fn='smallObliqueLabelFont') cmds.text(l='Type : ',fn='boldLabelFont', al='left') cmds.optionMenu('assetNewOption',w=220) cmds.menuItem(l='') cmds.menuItem(l='CHAR') cmds.menuItem(l='PROP') cmds.menuItem(l='SETS') cmds.text(l='Stage : ',fn='boldLabelFont', al='left') cmds.optionMenu('assetNewStage',w=220) cmds.menuItem(l='') cmds.menuItem(l='model') cmds.menuItem(l='shader') cmds.menuItem(l='rig') cmds.text(l='Descript : ',fn='boldLabelFont', al='left') cmds.scrollField('newAssetScrollField',wordWrap=True,h=100) cmds.separator(p=cmas) cmds.button(l='REGISTER AND UPLOAD',p=cmas,c=self.registerNewAssetRecord) cmds.showWindow() return
def makePass_cmd(self, *args): try: cmd = self._pass.make() cmds.scrollField(self.outCmdField, edit=True, text=cmd) melPrint('// %s' % cmd) except PassMakerError, err: mel.eval('warning "%s";' % err)
def mainModule(self): cmds.rowColumnLayout(nc=2,cw =[(1,130),(2,285)]) #etchedOut rowlumnLayout.str# cmds.frameLayout(label=self.moduleLabel,mw =1 ,mh =3,bs="etchedOut",cl= 0,cll=0 ,h=self.hgt) cmds.symbolButton(h= 80,image= 'sphere.png' ) #cmds.rowColumnLayout( numberOfRows=1 ) #Side rowlumnLayout.str# #cmds.setParent('..') #Side rowlumnLayout.end# cmds.setParent('..') #etchedOut rowlumnLayout.end# cmds.frameLayout(label='options:',mw =1 ,mh =3,bs="etchedOut",cl= 0,cll=0 ,h= self.hgt) #optionsForm = cmds.formLayout() cmds.rowColumnLayout(nc=5,cw =[(1,50),(2,50),(3,50),(4,50),(5,50)]) cmds.text(l='joint:') cmds.text(l='fingers:') cmds.text(l='no:') cmds.text(l='segment:') cmds.text(l='symmetry:') cmds.textField() cmds.checkBox(l ="" ) cmds.textField() cmds.textField() cmds.checkBox(l ="" ) #cmds.formLayout(optionsForm ,e=1,) cmds.setParent('..') cmds.rowColumnLayout( numberOfRows=1 )#Side: .str cmds.text(l=' Side: ') cmds.radioButtonGrp(nrb=2 ,la2=["L","R"] ,cw2=[30 ,30],sl =1) cmds.scrollField(wordWrap =1,text ="creates arm skeleton template setup. ideal use: any arm Humans, Insects.." ,editable= 0,h=80,w=180) cmds.setParent('..')##Side: .end cmds.setParent('..') cmds.setParent('..') cmds.separator(height =3 ,style= "none" )
def gui(): ''' GUI for Image convert script. ''' win = "mecCVTWin" winWidth = 200 winHeight = 369 if( cmds.window(win, q=True, ex=True) ): cmds.deleteUI(win) cmds.window(win, title="Image Converter", w=winWidth, h=winHeight) cmds.columnLayout("mecCVTMC") cmds.button(label="Get Directory", w=200, c="mecConvert.pickFolder()") cmds.scrollField( "mecCVTDir", w=winWidth, editable=False, wordWrap=True, text='Choose Directory' ) # cmds.text("mecCVTDir", label="") cmds.textScrollList("mecCVTTSL", w=winWidth, h=200, allowMultiSelection=True) cmds.rowColumnLayout(nc=2, cw=[[1,100],[2,100]]) cmds.button(label="Remove ALL", c="mecConvert.cmds.textScrollList('mecCVTTSL', e=True, ra=True)") cmds.button(label="Remove Selected", c="mecConvert.tslRemSel()") cmds.setParent("..") cmds.button(label="Convert", w=200, c="mecConvert.convert()") cmds.picture(image="sbaLogo.xpm", w=210, h=20) cmds.showWindow(win)
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 )
def populateNotesField(self,*args): #get notes date and assetId selNotesDateVar=cmds.textScrollList('notesList',q=True,si=True) if selNotesDateVar==None: raise StandardError, 'error : no notes selected' selNotesDateVar=selNotesDateVar[0] selAssetVar=cmds.textScrollList('assetTextScroll', q=True, si=True) if selAssetVar==None: raise StandardError, 'error : no asset selected' selAssetVar=selAssetVar[0] #find asset ID assetIdVar='' for chk in veRegCore.listAssetTable(): if chk[1]==str(selAssetVar): assetIdVar=chk[0] if assetIdVar=='': cmds.confirmDialog(icn='warning', t='Error', m='Database anomaly no asset found.', button=['OK']) raise StandardError, 'error : database anomaly asset not found' for chk in veRegCore.listAssetNotes(): if chk[4]==selNotesDateVar and str(assetIdVar) == str(chk[1]): cmds.textField('notesTitleInfo',e=True,tx=str(chk[2])) cmds.textField('notesAuthorInfo',e=True,tx=str(chk[3])) cmds.textField('notesDateInfo',e=True,tx=str(chk[4])) cmds.scrollField('notesMessageInfo',e=True,tx=str(chk[5])) return
def SundayWarehouseBrowserUpdateInfo(file): asset = cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, annotation = True) f = open(file + '/' + asset + '.info', 'r') importNotes = eval(f.read()) printNotes = 'Asset Name : ' + asset printNotes = printNotes + '\n' printNotes = printNotes + 'Author : ' + str(importNotes['Author']) + ' | Version : ' + str(importNotes['Version']) + ' | Render : ' + str(importNotes['Render']) printNotes = printNotes + '\n' printNotes = printNotes + 'Notes : ' + str(importNotes['Notes']) printNotes = printNotes + '\n' sourceImages = file + '/' + 'sourceimages' + '/' texList = '' if os.path.isdir(sourceImages): for curTex in os.listdir(sourceImages): if curTex != '.DS_Store': texList = texList + '-' + curTex + ' ' continue printNotes = printNotes + 'Textures : ' + texList cmds.scrollField('whInfoTextBrowser', edit = True, text = printNotes) cmds.checkBox('whBrowseUseNameSpace', edit = True, label = 'Use Name Space (' + asset + ')') assetPath = os.path.dirname(cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, label = True)) pythonFile = assetPath + '/' + os.path.basename(assetPath) + '.py' if os.path.exists(pythonFile): cmds.checkBox('whRunPostImportScript', edit = True, enable = True) else: cmds.checkBox('whRunPostImportScript', edit = True, enable = False)
def getDestin(): testDir = FileDirectory() cmds.scrollField(destField, e=1, text=testDir.getPath()) destinPath = cmds.scrollField( destField, q=True, text=True) destFiles = os.listdir(destinPath) tslDestin.remAllItems() tslDestin.appendAll(destFiles)
def gui(): ''' Generates the interface for the file sequencer. ''' if( cmds.window(win, ex=True) ): cmds.deleteUI(win) if( cmds.windowPref(win, ex=True) ): cmds.windowPref(win, r=True) cmds.window(win, h=500, w=400) mainCol = cmds.columnLayout() cmds.rowColumnLayout(nc=2, cw=[[1,200],[2,200]]) global targField, destField, tslTarget, tslDestin targField = cmds.scrollField( w=200, h=50, editable=False, wordWrap=True, text='Non editable with word wrap' ) destField = cmds.scrollField( w=200, h=50, editable=False, wordWrap=True, text='Non editable with word wrap' ) cmds.button(label="Load Target", c=Callback(getTarget)) cmds.button(label="Load Destination", c=Callback(getDestin)) cmds.text(label = "Target Files") cmds.text(label = "Destination Files") tslTarget = TextScrollList(200, 200) tslDestin = TextScrollList(200, 200) cmds.setParent(mainCol) # Inputs fieldsGUI(mainCol) cmds.showWindow(win) print("Interface executed.")
def copy(): skin_cluster = None mesh_name = None selection = cmds.ls(sl=True) if selection: mesh_name = selection[0] shape = cmds.listRelatives(selection[0]) skin_clusters = cmds.listConnections(shape[0], type='skinCluster') if skin_clusters: skin_cluster = skin_clusters[0] else: cmds.error('No skin cluster present') else: cmds.error('No valid selection') bones = cmds.skinCluster(skin_cluster, q=True, inf=True) num_verts = cmds.polyEvaluate(mesh_name, v=True) data = dict() for bone in bones: data[bone] = [] for id in range(num_verts): data[bone].append(cmds.skinPercent(skin_cluster, '{0}.vtx[{1}]'.format(mesh_name, id), q=True, t=bone)) pickled_list = pickle.dumps(data) cmds.scrollField('jt_copy_skin_values_field', e=True, tx=pickled_list) cmds.skinCluster(mesh_name, e=True, ub=True)
def remoteMayaUI(*args): if MC.window("remoteMayaUI_WIN", ex=1): MC.deleteUI("remoteMayaUI_WIN") MC.window("remoteMayaUI_WIN", t="REMOTE MAYA", tlb=1, s=0, mb=0) MC.columnLayout() MC.rowLayout("HOLDER", nc=4, enable=1) 0; MC.text(label=" Episode") 0; MC.optionMenu("EPISODES_OPTIONMENU", changeCommand=refreshShotList) 0; MC.text("SHOT_TEXT", label=" Shot", enable=0) 0; MC.optionMenu("SHOTS_OPTIONMENU", changeCommand="pass", enable=0) MC.menuItem(label="", p="SHOTS_OPTIONMENU", enable=0) episodePath = "Y:/01_SAISON_4/09_EPISODES/03_Fabrication_2D/" episodeList = [x for x in os.listdir(episodePath) if len(x) >= 3 and x[:3] == "YKR"] 0; MC.setParent("..") MC.menuItem("VOID", label="...", p="EPISODES_OPTIONMENU") for episode in episodeList: MC.menuItem(label=episode, p="EPISODES_OPTIONMENU") MC.rowLayout(nc=2) 0; MC.text(l="", w=68) 0; QtButton(handle="INSPECT", label="INSPECT", action=inspectShot, lineColor=(100,240,100), background=(60,120,60), borderRadius=14, paddingTBLR=(0,0,0,0), margin=0, w=120, h=30, fontFamily="Arial", fontSize=16, fontWeight="bold") MC.setParent("..") MC.textField("COMMAND_TEXTFIELD", text = "", changeCommand=mayaClient.manualCommand) MC.scrollField("PNG_UNIVERSAL_LOG", h=430, font="plainLabelFont", editable=False, wordWrap=True, text="Ready...\n", bgc=(.2,.2,.2)) MC.progressBar("PNG_PROGRESS_BAR", h=16, w=260, manage=0) MC.showWindow("remoteMayaUI_WIN") MC.window("remoteMayaUI_WIN", edit=True, w=600, h=300)
def loadHotkeys(self, defaults=False): allHotkeys = hotkeys.getHotkeys() hotkeysDict = [] for n, loopHotkey in enumerate(allHotkeys): for loopItem in loopHotkey: hotkeysDict.append(loopItem) for loopIndex, loopCommand in enumerate(hotkeysDict): command = loopCommand["command"] name = loopCommand["name"] key = loopCommand["hotkey"] alt = loopCommand["alt"] ctl = loopCommand["ctl"] toolTip = loopCommand["toolTip"] if not defaults: hotkeyData = aToolsMod.loadInfoWithUser("hotkeys", name) if hotkeyData != None: key = hotkeyData[0] alt = hotkeyData[1] ctl = hotkeyData[2] cmds.checkBox('ctl%s'%name, edit=True, value=ctl) cmds.checkBox('alt%s'%name, edit=True, value=alt) cmds.scrollField('key%s'%name, edit=True, text=key) self.updateHotkeyCheck(name)
def reloadInfo(): ''' ''' # Get UI Data blendShape = mc.textScrollList('bsMan_blendShapeTSL',q=True,si=True) if not blendShape: blendShape = [''] base = mc.textScrollList('bsMan_baseGeomTSL',q=True,si=True) if not base: base = [''] target = mc.textScrollList('bsMan_targetsTSL',q=True,si=True) if not target: target = [''] # Get Derived Data baseIndex = '' targetGeo = '' targetIndex = '' if base[0]: baseIndex = glTools.utils.blendShape.getBaseIndex(blendShape[0],base[0]) if target[0]: targetGeo = glTools.utils.blendShape.getTargetGeo(blendShape[0],target[0],base[0]) if target[0]: targetIndex = glTools.utils.blendShape.getTargetIndex(blendShape[0],target[0]) infoTxt = 'BlendShape: '+blendShape[0]+'\n' infoTxt += 'Base Geometry: '+base[0]+'\n' infoTxt += 'Base Index: '+str(baseIndex)+'\n' infoTxt += 'Target Name: '+target[0]+'\n' infoTxt += 'Target Geometry: '+targetGeo+'\n' infoTxt += 'Target Index: '+str(targetIndex) mc.scrollField('bsMan_infoSF',e=True,text=infoTxt)
def createNoticeWin(self): """提示文件窗口""" noticeWindow = cmds.window(title = "Notice", iconName = "notice") cmds.columnLayout() noticeText = getNoticeText(noticeTextPath) cmds.scrollField(width = 600, height = 300, editable = False, wordWrap = True, text = noticeText) cmds.showWindow(noticeWindow)
def continueOutputFunction(): gradeOutputTotal=cmds.intFieldGrp( "gradeIntField", q=1, value1=1) lateGradeOutputTotal=cmds.intFieldGrp( "lateGradeIntField", q=1, value1=1) totalGradeOutputTotal=cmds.intFieldGrp( "totalGradeIntField", q=1, value1=1) # Queries the Grade comments for output aanqTSListOutput=cmds.scrollField("aanqTSList", q=1, tx=1) cflTSListOutput=cmds.scrollField("cflTSList", q=1, tx=1) lightTSTSListOutput=cmds.scrollField("lightTSList", q=1, tx=1) proTSListOutput=cmds.scrollField("proTSList", q=1, tx=1) # Formats the comments for output sceneFileOutput=open(selectedFileName+".txt", 'w') sceneFileOutput.write("Grading for: "+sceneFileName+"\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Lighting Comments: "+lightTSTSListOutput+"\r\n") sceneFileOutput.write("Lighting Grade: "+str(lightGradeTotal)+"\r\n") sceneFileOutput.write("\r\n") sceneFileOutput.write("Grade Total: "+str(gradeOutputTotal)+"\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Deduction Comments:\r\n") sceneFileOutput.write("Composition & Focal Length Comments: "+cflTSListOutput+"\r\n") sceneFileOutput.write("Antialiasing & Noise Quality Comments: "+aanqTSListOutput+"\r\n") sceneFileOutput.write("Professionalism Comments: "+proTSListOutput+"\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Comp/Focal Len Deductions (15%): -"+str(cflDisplayGradeTotal)+"\r\n") sceneFileOutput.write("Alias/Noise Deductions (15%): -"+str(aanqDisplayGradeTotal)+"\r\n") sceneFileOutput.write("Prof Deductions (10%): -"+str(proDisplayGradeTotal)+"\r\n") sceneFileOutput.write("Late Deductions: -"+str(lateGradeOutputTotal)+"\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Overall Grade Total: "+str(totalGradeOutputTotal)+"\r\n") sceneFileOutput.close()
def update_sF_expString( ): global g_tSL_expNode global g_sF_expString strlSel = mc.textScrollList(g_tSL_expNode, q=True, si=True ) expString = mc.expression( strlSel[0], q=True, string=True) mc.scrollField( g_sF_expString, edit=True, text=expString )
def ui(): """ User interface for convert rotation order """ with utl.MlUi( "ml_convertRotationOrder", "Convert Rotation Order", width=400, height=140, info="""Select objects to convert and press button for desired rotation order. Use the "Get Tips" button to see suggestions for a single object on the current frame.""", ) as win: mc.button(label="Get tips for selection", command=loadTips, annotation="") mc.scrollField("ml_convertRotationOrder_nodeInfo_scrollField", editable=False, wordWrap=True, height=60) mc.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 100), (2, 400)], columnAttach=[2, "both", 1]) for each in ROTATE_ORDERS: _BUTTON[each] = win.buttonWithPopup( label=each, command=globals()[each], annotation="Convert selected object rotate order to " + each + ".", shelfLabel=each, ) mc.textField("ml_convertRotationOrder_" + each + "_textField", editable=False) resetTips()
def makeAppFolders( tabLayout, title, cmdType, folderPath ): childArr = cmds.tabLayout( tabLayout, q=1, ca=1 ) tabLabels = cmds.tabLayout( tabLayout, q=1, tabLabel=1 ) appFolder = folderPath+'/'+ title deletePath( appFolder ) if cmdType == 'python': initPath = appFolder+'/__init__.py' makeFile( initPath ) for i in range( len( childArr ) ): childUi = childArr[i] tabLabel = tabLabels[i].replace( ' ', '_' ) srcFile = appFolder+'/'+tabLabel+'.py' makeFile( srcFile ) f = open( srcFile, 'w' ) f.write( cmds.scrollField( childUi, q=1, tx=1 ) ) f.close() elif cmdType == 'mel': for i in range( len( childArr ) ): childUi = childArr[i] tabLabel = tabLabels[i].replace( ' ', '_' ) srcFile = appFolder+'/'+tabLabel+'.mel' makeFile( srcFile ) f = open( srcFile, 'w' ) f.write( cmds.scrollField( childUi, q=1, tx=1 ) ) f.close()
def update(self, *args ): self.repairString = '' cmds.scrollField( self.scrollField, e=1, text='' ) checkUIs = [] checkUIs.append( cmds.rowColumnLayout( self.assetCheck, q=1, ca=1 ) ) checkUIs.append( cmds.rowColumnLayout( self.layoutCheck, q=1, ca=1 ) ) checkUIs.append( cmds.rowColumnLayout( self.productionCheck, q=1, ca=1 ) ) for cuCheckUIs in checkUIs: repairTitle = cmds.frameLayout( cmds.rowColumnLayout( cmds.checkBox( cuCheckUIs[0], q=1, p=1 ), q=1, p=1 ), q=1, l=1 ) onCheckBoxEx = False for checkBox in cuCheckUIs: if not checkBox in self.checkBoxs: continue if cmds.checkBox( checkBox, q=1, v=1 ): if not onCheckBoxEx: self.repairString += repairTitle+' : ' onCheckBoxEx = True self.addRepairString( cmds.checkBox( checkBox, q=1, l=1 ) ) if onCheckBoxEx: self.repairString += u' 수정\n' self.editFieldString()
def textEdit(self): textNewFiles = self.textFile() textNewFiles.reverse() stringPaths = '' for item in textNewFiles: stringPaths = item + '\n' + stringPaths mc.scrollField( self.txtField, e=1, tx=stringPaths )
def addNewComment(self,*args): self.SceneReviewer.pushCommentToHistory() cmds.textFieldGrp('author',e=True, text=getpass.getuser()) cmds.textFieldGrp('date', e=True, text=time.ctime()) cmds.textFieldGrp('sceneName',e=True, text=self.getSceneName()) cmds.scrollField('comment',e=True, ed=True, text='') cmds.scrollField('history',e=True, text=self.SceneReviewer.storedDataDict['history']) self.updateInternalDict()
def updateInternalDict(self,*args): if cmds.scrollField('comment',q=True, ed=True): self.SceneReviewer.storedDataDict['author'] = cmds.textFieldGrp('author',q=True, text=True) self.SceneReviewer.storedDataDict['date'] = cmds.textFieldGrp('date', q=True, text=True) self.SceneReviewer.storedDataDict['sceneName']= cmds.textFieldGrp('sceneName',q=True, text=True) self.SceneReviewer.storedDataDict['comment']= cmds.scrollField('comment',q=True, text=True) print self.SceneReviewer.storedDataDict self.SceneReviewer.storeReportData()
def post_summery(self, *args): ''' Posts comments to the summery tab ''' self.query_comments = cmds.scrollField(self.mainScroll, q=True, tx=True) cmds.scrollField(summery_scroll, e=True, it=self.query_comments + '\n') print self.query_comments
def _showUI(self): reportData=self.SceneReviewer.getReportData() allowEdit=False sceneName=None date=reportData['date'] if reportData.has_key('sceneName'): sceneName=reportData['sceneName'] author=None if not reportData['author']: #new sceneReport author=getpass.getuser() allowEdit=True elif reportData['author']==getpass.getuser(): #current author of comment == you author=getpass.getuser() allowEdit=True date=time.ctime() else: #current author != you author=reportData['author'] if not date: date=time.ctime() if not sceneName: sceneName=self.getSceneName() if cmds.window(self.win, exists=True): cmds.deleteUI(self.win, window=True) window = cmds.window(self.win, title=self.win, s=True, widthHeight=(260,300)) cmds.scrollLayout('reviewScrollLayout',rc=lambda *args:self.resizeTextScrollers()) cmds.columnLayout(adjustableColumn=True,columnAttach=('both',5)) cmds.textFieldGrp('author',label='Author', ed=False, text=author)#, tcc=partial(self.updateInternalDict)) cmds.textFieldGrp('date', label='Date', ed=False, text=date)#, tcc=partial(self.updateInternalDict)) cmds.textFieldGrp('sceneName', label='SceneName', ed=False, text=sceneName) cmds.separator(h=15,style='none') cmds.text(label='Comment') cmds.scrollField('comment', text=reportData['comment'], ed=allowEdit, h=200, wordWrap=False, kpc=partial(self.updateInternalDict), cc=partial(self.updateInternalDict)) cmds.button(label='New Comment',bgc=r9Setup.red9ButtonBGC(1),c=partial(self.addNewComment)) cmds.separator(h=15,style='none') cmds.text(label='History') cmds.scrollField('history', editable=False, en=True, wordWrap=False, h=200,text=reportData['history']) cmds.separator(h=15,style='none') cmds.rowColumnLayout('SceneNodeActivatorRC',numberOfColumns=2,columnWidth=[(1,200),(2,200)]) cmds.button('setReviewActive',label='Activate Live Review',bgc=r9Setup.red9ButtonBGC(1),c=lambda x:self._setReviewStatus('active')) cmds.button('setReviewInActive',label='Disable Live Review',bgc=r9Setup.red9ButtonBGC(1),c=lambda x:self._setReviewStatus('inactive')) cmds.setParent('..') cmds.separator(h=15,style='none') cmds.iconTextButton( style='iconOnly', bgc=(0.7,0,0),image1='Rocket9_buttonStrap2.bmp', c=lambda *args:(r9Setup.red9ContactInfo()),h=22,w=200 ) cmds.showWindow(window) if self.SceneReviewer.exists(): self._setReviewStatus('active') else: self._setReviewStatus('inactive')
def post_summery(self, *args): """ Posts comments to the summery tab """ self.query_comments = cmds.scrollField(self.mainScroll, q=True, tx=True) cmds.scrollField(summery_scroll, e=True, it=self.query_comments + "\n") print self.query_comments
def SelectionError(*args): WindowCheck = cmds.window(title = 'ERROR', widthHeight = (400, 100)) CHECK = cmds.ls( selection=True ) if len(CHECK) == 0: #cmds.error( "### Please Select CHAR_HULL_BASE ###" ) cmds.paneLayout() cmds.scrollField(wordWrap=True, text=' ### Please Select CHAR_HULL_GEO ###') cmds.showWindow(WindowCheck) cmds.showSelectionInTitle(WindowCheck)
def populateInformation(self, *args): #asset selection id assetName = cmds.textScrollList('assetContent', q=True, si=True)[0] assetType = cmds.optionMenu('assetType', q=True, v=True) assetPath = ASSET_ROOT + PRJ_NAME + '/' + assetType + '/' + assetName #populating asset information cmds.textField('assetName', e=True, tx=assetName) cmds.scrollField('assetDesc', e=True, tx='N/A') cmds.textField('assetPath', e=True, tx=assetPath) #populate image if os.path.isfile(assetPath + '/preview.png'): cmds.picture('preview', e=True, image=assetPath + '/preview.png') else: cmds.picture('preview', e=True, image=SCRIPT_ROOT + '/NA.png') return
def dpTranslatorSame(self, *args): """ Get the text from source scrollField in order to use it as a translated text. """ # get info from source scrollField: if self.langIndex <= self.keyLen: self.newLangList[self.langIndex] = cmds.scrollField( self.sourceTextSF, query=True, text=True) self.dpTranslatorForward()
def showNomenclatures(*args): from functools import partial nomenclaturesWindow = "Nomenclatures" if cmds.window(nomenclaturesWindow, ex=True): cmds.deleteUI(nomenclaturesWindow) cmds.window(nomenclaturesWindow) cmds.columnLayout(adjustableColumn=True) file = open( '//Merlin/3d4/skid/09_dev/toolScripts/publish/_nomenclatures.txt', 'r') nomenclaturesText = str(file.read()) cmds.scrollField(tx=nomenclaturesText, ed=False, wordWrap=True, h=500, w=700) cmds.setParent("..") cmds.showWindow()
def continueOutputFunction(): gradeOutputTotal = cmds.intFieldGrp("gradeIntField", q=1, value1=1) lateGradeOutputTotal = cmds.intFieldGrp("lateGradeIntField", q=1, value1=1) totalGradeOutputTotal = cmds.intFieldGrp("totalGradeIntField", q=1, value1=1) # Queries the Grade comments for output aanqTSListOutput = cmds.scrollField("aanqTSList", q=1, tx=1) cflTSListOutput = cmds.scrollField("cflTSList", q=1, tx=1) lightTSTSListOutput = cmds.scrollField("lightTSList", q=1, tx=1) mateTextTSListOutput = cmds.scrollField("mateTextTSList", q=1, tx=1) proTSListOutput = cmds.scrollField("proTSList", q=1, tx=1) # Formats the comments for output sceneFileOutput = open(selectedFileName + ".txt", 'w') sceneFileOutput.write("Grading for: " + sceneFileName + "\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Lighting Comments: " + lightTSTSListOutput + "\r\n") sceneFileOutput.write("Lighting Grade: " + str(lightGradeTotal) + "\r\n") sceneFileOutput.write("\r\n") sceneFileOutput.write("Materials and Textures Comments: " + mateTextTSListOutput + "\r\n") sceneFileOutput.write("Materials and Textures Grade: " + str(mateTextGradeTotal) + "\r\n") sceneFileOutput.write("\r\n") sceneFileOutput.write("Grade Total: " + str(gradeOutputTotal) + "\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Deduction Comments:\r\n") sceneFileOutput.write("Composition & Focal Length Comments: " + cflTSListOutput + "\r\n") sceneFileOutput.write("Antialiasing & Noise Quality Comments: " + aanqTSListOutput + "\r\n") sceneFileOutput.write("Professionalism Comments: " + proTSListOutput + "\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Comp/Focal Len Deductions (10%): -" + str(cflDisplayGradeTotal) + "\r\n") sceneFileOutput.write("Alias/Noise Deductions (10%): -" + str(aanqDisplayGradeTotal) + "\r\n") sceneFileOutput.write("Prof Deductions (10%): -" + str(proDisplayGradeTotal) + "\r\n") sceneFileOutput.write("Late Deductions: -" + str(lateGradeOutputTotal) + "\r\n") sceneFileOutput.write("-----------------------------------\r\n") sceneFileOutput.write("Overall Grade Total: " + str(totalGradeOutputTotal) + "\r\n") sceneFileOutput.close()
def loadTSL(): ''' Upon choosing a different radioButton the textScrollList will be updated along with the default scrollField message. ''' # Get RadioButton selectedRC = cmds.radioCollection(radioCol, q=True, sl=True) xmlDict = { "mecSJEvent": "Events", "mecSJAttr": "attributes", "mecSJCond": "Conditions", "mecSJNode": "nodeNameChanged", "mecSJConn": "connectionChange", "mecSJUI": "uiDeleted", "mecSJTime": "timeChange" } # Access proper tag from xml file elem = sjXML.getroot() sjType = xmlDict[selectedRC] curSel = elem.find(sjType) # Lets print out the tag and the content. ''' print("TSL Enabled: %s" %(curSel.get('en'))) print("TSL Enabled: %s" %(curSel.get('type'))) for items in curSel: print("Event: %s" %(items.text)) print("Event: %s" %(items[0].text)) ''' # Some radioButton option will clear and disable the textScrollList if (not int(curSel.get('en'))): # print("Disable textScroll List") cmds.textScrollList(tsl, e=True, ra=True) cmds.textScrollList(tsl, e=True, append=curSel.get('type')) cmds.textScrollList(tsl, e=True, en=False) cmds.scrollField(sfDisc, e=True, text=curSel[0][0].text) else: # Load the textScrollList will information # print("Enable textScroll List") cmds.textScrollList(tsl, e=True, ra=True) cmds.textScrollList(tsl, e=True, en=True) cmds.scrollField(sfDisc, e=True, text='Select event for discription.') for item in curSel: cmds.textScrollList(tsl, edit=True, append=item.text) sjModeSwitch()
def _copyToClipboardButton(self, *args): """ Copy the text in the macro scroll field to the the clipboard. """ textToClipBoard = cmds.scrollField(self.macroScrollField, q=True, text=True) QtWidgets.QApplication.clipboard().setText(textToClipBoard)
def _editButton(self, *args): """ Enable editing of the scroll field window and toggle editing UI elements on/off. """ # Enable Editing cmds.scrollField(self.macroScrollField, e=True, editable=True, backgroundColor=self.scrollFieldActiveBGColor) # Toggle UI for editing cmds.button(self.macroEditButton, e=True, en=False) cmds.button(self.macroSaveEditButton, e=True, en=True) cmds.button(self.macroCancelEditButton, e=True, en=True) self._toggleActiveUI(enable=False, includeStopButton=False, includeCreateUI=True)
def dismissUI(self, *args): self.dict["note"] = cmds.scrollField(self.txt, q=True, tx=True) self.dict["cam"] = cmds.checkBoxGrp(self.cam, q=True, v1=True) self.dict["shd"] = cmds.checkBoxGrp(self.shd, q=True, v1=True) self.dict["rig"] = cmds.checkBoxGrp(self.rig, q=True, v1=True) self.dict["light"] = cmds.checkBoxGrp(self.light, q=True, v1=True) self.dict["freeze"] = cmds.checkBoxGrp(self.freeze, q=True, v1=True) cmds.layoutDialog(dismiss="got it")
def raise_warn_dlg(result_list): print '@@@ raise_warn_dlg: ', result_list if cmds.window('check_win', exists=True) == True: cmds.deleteUI('check_win') result_str = ''.join([i + '\n' for i in result_list]) check_win = cmds.window('check_win') cmds.paneLayout(configuration='single') cmds.scrollField(editable=False, wordWrap=True, text=result_str) cmds.showWindow() res = cmds.confirmDialog(title='Confirm', message='Are you sure?', button=['Yes', 'No'], defaultButton='Yes', cancelButton='No', dismissString='No', parent=check_win) return res
def process(): print("Processing") # Get the items from the target tsl. fileNames = tslTarget.getSelItems() startNum = cmds.intField(counter, q=True, value=True) newName = cmds.textField(mainName, q=True, text=True) padVal = cmds.intField(pad, q=True, value=True) targetPath = cmds.scrollField(targField, q=True, text=True) destinPath = cmds.scrollField(destField, q=True, text=True) # Loop through one by one copying it over then renaming it. # newNames = [] # "%s.%s.%s" %(newName, "%04d", "iff") for i in range(len(fileNames)): tempName = eval('"%s.%0' + str(padVal) + 'd.%s" %(newName, startNum, "iff")') # tempName = "%s.%03d.iff" %(newName, startNum) print("Test: " + tempName) # Copy over fullTarget = os.path.join(targetPath, fileNames[i]) fullDestin = os.path.join(destinPath, fileNames[i]) # Renaming # fullDestin = os.path.join( destinPath, fileNames[i] ) if (os.path.isfile(fullTarget)): shutil.copy(fullTarget, fullDestin) # Rename tempPath = os.path.join(destinPath, fileNames[i]) newPath = os.path.join(destinPath, tempName) if (os.path.exists(tempPath)): os.rename(tempPath, newPath) # add to the list. # tslDestin.appendAll(tempName) print(newName) startNum += 1 destFiles = os.listdir(destinPath) tslDestin.remAllItems() tslDestin.appendAll(destFiles) # Research question??? # Does copying the file or getting the listdir on the file, # return a string or an instance to a file name? cmds.intField(counter, e=1, value=startNum)
def __init__(self): if cmds.window('veShotBuilder', exists=True): cmds.deleteUI('veShotBuilder', wnd=True) win = cmds.window(t='Shot Builder - [' + PRJ_NAME + ']', s=False) cmds.renameUI(win, 'veShotBuilder') cmas = cmds.rowColumnLayout(nc=2) left = cmds.columnLayout(adj=True, p=cmas) f1 = cmds.frameLayout(l='Asset Open', p=left) cmds.columnLayout(adj=True) cmds.optionMenu('assetType', w=150, cc=self.populate) cmds.menuItem(l='') for chk in ASSET_TYPES: cmds.menuItem(l=chk['tag']) cmds.text(l='Search Asset :', fn='boldLabelFont', al='left') cmds.textField('assetSearch', cc=self.populate) f2 = cmds.frameLayout(l='Asset Content', p=left) cmds.columnLayout(adj=True) cmds.textScrollList('assetContent', w=150, h=150, sc=self.populateInformation) right = cmds.columnLayout(adj=True, p=cmas) f3 = cmds.frameLayout(l='Asset Information', p=right) pf3 = cmds.columnLayout(adj=True) f3split = cmds.rowColumnLayout(nc=2, p=pf3) cmds.columnLayout(adj=True, p=f3split) cmds.picture('preview', image=SCRIPT_ROOT + '/NA.png', w=150, h=150) cmds.columnLayout(adj=True, p=f3split) cmds.text(l='Asset Name :', fn='boldLabelFont', al='left') cmds.textField('assetName', en=False) cmds.text(l='Asset Description :', fn='boldLabelFont', al='left') cmds.scrollField('assetDesc', h=70, en=False, ww=True) cmds.text(l='Asset Path :', fn='boldLabelFont', al='left') cmds.textField('assetPath', en=False) cmds.separator(p=pf3) cmds.button(l='REFERENCE ASSET TO CURRENT SCENE FILE', p=pf3, h=70, bgc=[1.0, 0.730158729907, 0.0], \ c=self.referenceAsset) cmds.showWindow() return
def _showUI(self): self.close() window = cmds.window(self.win, title=self.win, s=True, widthHeight=(450, 700)) cmds.menuBarLayout() cmds.menu(l=LANGUAGE_MAP._Generic_.tools) cmds.menuItem(l=LANGUAGE_MAP._Generic_.vimeo_help, c="import Red9.core.Red9_General as r9General;r9General.os_OpenFile('https://vimeo.com/459389038')") cmds.menuItem(divider=True) cmds.menuItem(l='Delete SceneNode Data', c=self.delete) cmds.scrollLayout('reviewScrollLayout', rc=lambda *args: self._resizeTextScrollers(), cr=True) cmds.columnLayout(adjustableColumn=True, columnAttach=('both', 5)) cmds.textFieldGrp('author', l=LANGUAGE_MAP._SceneReviewerUI_.author, ed=False, text='') cmds.textFieldGrp('date', l=LANGUAGE_MAP._SceneReviewerUI_.date, ed=False, text='') cmds.textFieldGrp('sceneName', l=LANGUAGE_MAP._SceneReviewerUI_.scene_name, ed=False, text='') cmds.separator(h=15, style='none') cmds.text(l=LANGUAGE_MAP._SceneReviewerUI_.comment) cmds.scrollField('comment', text='', ed=True, h=200, wordWrap=False, kpc=partial(self.updateInternalDict), cc=partial(self.updateInternalDict)) cmds.button(l=LANGUAGE_MAP._SceneReviewerUI_.new_comment, bgc=r9Setup.red9ButtonBGC(1), c=partial(self.addNewComment)) cmds.separator(h=15, style='none') cmds.text(l=LANGUAGE_MAP._SceneReviewerUI_.history) cmds.scrollField('history', editable=False, en=True, wordWrap=False, h=200, text='') cmds.separator(h=15, style='none') cmds.rowColumnLayout('SceneNodeActivatorRC', numberOfColumns=3, columnWidth=[(1, 200), (2, 200)]) cmds.button('setReviewActive', l=LANGUAGE_MAP._SceneReviewerUI_.activate_live_review, bgc=r9Setup.red9ButtonBGC(1), c=lambda x: self._setReviewStatus('active')) cmds.button('setReviewInActive', l=LANGUAGE_MAP._SceneReviewerUI_.disable_live_review, bgc=r9Setup.red9ButtonBGC(1), c=lambda x: self._setReviewStatus('inactive')) cmds.setParent('..') cmds.separator(h=15, style='none') cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp', c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200) cmds.showWindow(window) self._refresh() if self.SceneReviewer.exists(): self._setReviewStatus('active') else: self._setReviewStatus('inactive')
def add_comment(self, *args): self.new_comment = cmds.scrollField(self.new_comment_field, q=True, tx=True) print self.comments self.comments.append(self.new_comment) cmds.deleteUI('comment_win') print self.comments gui()
def createModuleInstallButton(self, module): mod = __import__("Blueprint."+module, {}, {}, [module]) reload(mod) title = mod.TITLE description = mod.DESCRIPTION icon = mod.ICON #Create UI buttonSize = 64 row = cmds.rowLayout(numberOfColumns=2, columnWidth=([1,buttonSize]), adjustableColumn=2, columnAttach=([1, "both", 0],[2, "both", 5]) ) self.UIElements["module_button_"+module] = cmds.symbolButton(width=buttonSize, height=buttonSize, image=icon, command=partial(self.installModule, module)) textColumn = cmds.columnLayout(columnAlign="center") cmds.text(align="center", width=300, label=title) cmds.scrollField(text=description, editable=False, width=300, height=50, wordWrap=True)
def animHelpWindow(self, *args): if cmds.window('animHelpWindowUI', exists=1): cmds.deleteUI('animHelpWindowUI') self.animHelpWindowUI = cmds.window('animHelpWindowUI', s=1, width=500, height=500, menuBar=1, title='Help on Animation Export') cmds.paneLayout(configuration='horizontal4') cmds.scrollField( editable=0, wordWrap=1, text= "Animation Export: \nAnimation export assumes single-level referencing with proper namesapce.\n\nActors: \nAll referenced characters with a origin joint tagged with the origin attribute will be listed in the Actor's field by their namespace. Please see the modeling help window for how to tage a character's origin with the origin attribute.\n\nExport Nodes:\nThe Export Nodes panel will fill in with export nodes connected to the origin of the selected actor from the Actor's field. Clicking on the New Export Node will create a new node. Each export node represents a seperate animation.\n\nExport:\nThe Export flag means the current export ndoe will be available for export. All nodes wihtout this checked will not be exported.\n\nMove to origin:\nNot yet supported\n\nSub Range:\nTurn this on to enable the sub-range option for the selected node. This will enable the Start Frame and End Frame fields where you can set the range for the specified animation. Otherwise, the animation will use the frame range of the file.\n\nExport File Name:\nClick on the Browse button to browse to where you want the file to go. The path will be project relative.\n\nExport Selected Animation:\nClick this button to export the animation selected in Export Nodes\n\nExport All Animations For Selected Character:\nClick this button to export all animations for the selected actor in the Actors filed. This flag will ignore what is selected in Export Nodes and export from all found nodes for the character\n\nExport All Animations:\nClick this button to export all animations for all characters. All selections will be ignored" ) cmds.showWindow('animHelpWindowUI')
def modelHelpWindow(self, *args): if cmds.window('modelHelpWindowUI', exists=1): cmds.deleteUI('modelHelpWindowUI') self.modelHelpWindowUI = cmds.window('modelHelpWindowUI', s=1, width=500, height=500, menuBar=1, title='Help on Model Export') cmds.paneLayout(configuration='horizontal4') cmds.scrollField( editable=0, wordWrap=1, text= "Model Export: \nModel exporter assumes one skeleton for export. Referencing for model export is not supported\n\nRoot Joints: \nPanel will list all the joints tagged with the \"origin\" attribute. If no joint is tagged with the attribute, it will list all joints in the scene and turn red. Select the root joint and click the Tag as Origin button.\n\nExport Nodes:\nThe Export Nodes panel will fill in with export nodes connected to the origin of the selected actor from the Actor's field. Clicking on the New Export Node will create a new node. Each export node represents a seperate character export (for example, seperate LOD's).\n\nMeshes:\nThe Meshes panel shows all the geometry associated with the selected export node. This can be used if you have mesh variations skinned to the same rig or LOD's.\n\nExport File Name:\nClick on the Browse button to browse to where you want the file to go. The path will be project relative.\n\nExport Selected Character:\nClick this button to export the character selected in Export Nodes\n\nExport All Characters:\nClick this button to export all character definitions for the skeleton. All selections will be ignored" ) cmds.showWindow(self.modelHelpWindowUI)
def ui(): ''' User interface for convert rotation order ''' with utl.MlUi('ml_convertRotationOrder', 'Convert Rotation Order', width=400, height=140, info='''Select objects to convert and press button for desired rotation order. Use the "Get Tips" button to see suggestions for a single object on the current frame.''') as win: mc.button(label='Get tips for selection', command=loadTips, annotation='') mc.scrollField('ml_convertRotationOrder_nodeInfo_scrollField', editable=False, wordWrap=True, height=60) mc.rowColumnLayout(numberOfColumns=2, columnWidth=[(1,100), (2,400)], columnAttach=[2,'both',1]) for each in ROTATE_ORDERS: _BUTTON[each] = win.buttonWithPopup(label=each, command=globals()[each], annotation='Convert selected object rotate order to '+each+'.', shelfLabel=each) mc.textField('ml_convertRotationOrder_'+each+'_textField', editable=False) resetTips()
def rayTracing(): global rayTraceSeparator rayTraceGroup1 = cmds.radioButtonGrp( "rayTraceButGrp1", numberOfRadioButtons=3, label='Raytracing (33%)', labelArray3=['A+ -A', 'B+ -B', 'C+ -C'], onCommand=rayTraceButton1) rayTraceGroup2 = cmds.radioButtonGrp("rayTraceButGrp2", numberOfRadioButtons=2, shareCollection=rayTraceGroup1, label='', labelArray2=['D', 'F'], onCommand=rayTraceButton2) cmds.formLayout( gradeFrm, edit=1, attachForm=[rayTraceGroup1, "left", 5], attachControl=[rayTraceGroup1, "top", 5, mateTextSeparator]) cmds.formLayout(gradeFrm, edit=1, attachForm=[ rayTraceGroup2, "left", 5, ], attachControl=[rayTraceGroup2, "top", 5, rayTraceGroup1]) rayTraceShapeField = cmds.intFieldGrp("rayTraceIntField", numberOfFields=1, label='Grade', changeCommand=updateGradeTotal) rayTraceTextScrollList = cmds.scrollField("rayTraceTSList", w=200, h=150, wordWrap=1) rayTraceCommentsLabel = cmds.text(label='Comments') cmds.formLayout( gradeFrm, edit=1, attachForm=[rayTraceShapeField, "top", 5], attachControl=[rayTraceShapeField, "top", 10, rayTraceGroup2]) cmds.formLayout( gradeFrm, edit=1, attachForm=[rayTraceTextScrollList, "left", 140], attachControl=[rayTraceTextScrollList, "top", 10, rayTraceShapeField]) cmds.formLayout( gradeFrm, edit=1, attachForm=[rayTraceCommentsLabel, "left", 60], attachControl=[rayTraceCommentsLabel, "top", 10, rayTraceShapeField]) rayTraceSeparator = cmds.separator(height=15, width=460, style='in') cmds.formLayout( gradeFrm, edit=1, attachForm=[rayTraceSeparator, "left", 5], attachControl=[rayTraceSeparator, "top", 5, rayTraceTextScrollList])
def updateTextField(self): self.m2011 = (cmds.about(version=1) == "2011 x64") if (self.m2011 and cmds.dockControl( 'DiagnosticUIManager', exists=1)) or cmds.window( 'DiagnosticUIManager', q=True, ex=True): # if in Maya 2011+ and dockable, textFieldString = '---window objects---\n\n' for obj in self.window: if cmds.window(obj, q=True, ex=True): textFieldString += obj + '\n' textFieldString += '\n---dockable objects---\n\n' for obj in self.dockControl: if cmds.dockControl(obj, q=1, exists=1): textFieldString += obj + '\n' cmds.scrollField('diagnosticUI_UIObjects_scrollField', edit=1, text=textFieldString)
def folderPathFinder(self): multipleFilters = "Python (*.py);;Maya mel (*.mel)" filePath = cmds.fileDialog2(fileMode=True, fileFilter=multipleFilters, caption='Find your code') if not filePath == '': try: tmpName = filePath[0].split('/') except: sys.exit() name = tmpName[-1] file = open(filePath[0], 'r').read() try: cmds.scrollField('copyText', text=file, edit=True) except UnicodeDecodeError: cmds.scrollField('copyText', text=file, edit=True) cmds.textField('codeName', text=name, edit=True)
def main(): sf = mc.scrollField(w=440) mc.paneLayout(cn="vertical2", st=1, shp=1) mc.button(l="save", c=partial(save, sf)) mc.button(l="reload", c=partial(update, sf)) mc.setParent("..") update(sf)
def helpWindow(*args): helpWindow = 'helpExporter_window' if cmds.window(helpWindow, exists=1): cmds.deleteUI(helpWindow, window=True) if cmds.windowPref(helpWindow, exists=1): cmds.windowPref(helpWindow, remove=True) helpWindow = cmds.window(helpWindow, title="Exporter help", s=1, widthHeight=(700, 400)) layout = cmds.columnLayout(adjustableColumn=1) text = "This tools exports animated or static polygonal geometry and Particles to houdini.\n For geometry it uses OBJ or MDD format\n For particles --> Houdini's ascii GEO format.\n\nOBJ EXPORT: \n 1. Select single or multiple meshes in maya\n 2.Set frame range, increment, choose OBJ in choice selector, specify path for export similar to Example.\n 3. Click \"Export\".\n\nMDD EXPORT: \n 1. Select single or multiple meshes in maya\n 2.Set frame range, choose MDD in choice selector, specify path for export similar to Example.\n 3. Click \"Export\"\nNote that increment doesn't work .\n\nPARTICLE EXPORT:\n 1. Select your particles \n 2.Set frame range, increment, choose \"Particle\" in choice selector, specify path for export similar to Example.\n 3. Expand \"Particle Custom Variable\" rollout and here you can specifiy two custom vector PP variables and two float as well(or leave them blank). \n to do it just input their names like they appear in expression editor without particleShape name.EXAMPLE: \"myCustomVecPP\"\n 4. Click \"Export\"\nNote that increment doesn't work for particle export.\n\n\n" cmds.scrollField(editable=False, parent=layout, h=300, wordWrap=True, text=text) cmds.showWindow(helpWindow)
def checkBadObjects(strict = 0): def check(connections, *cases): result = False sources = connections[::2] destinations = connections[1::2] for case in cases: if [x for x in sources if case in x]: result = True break elif [x for x in destinations if case in x]: result = True break return result global BadObjects BadObjects = [] objects = cmds.ls(s = 1) amount = 0 count = 0 num = len(objects) cmds.progressWindow(t = u'检测中...', pr = amount, ii = 1) cmds.scrollField('ScrollText', e = 1, cl = 1) mytext = u'检测结果'.center(57, '-') + '\n' cmds.scrollField('ScrollText', e = 1, it = mytext, ip = 0) cmds.editRenderLayerGlobals(crl = 'defaultRenderLayer') feedBackCaseA, feedBackCaseB = [], [] for object in objects: if cmds.nodeType(object) in ('mesh', 'nurbsSurface'): connections = cmds.listConnections(object, c = 1, t = 'shadingEngine') if not connections: connections = cmds.listConnections(object, c = 1) if (connections and not check(connections, 'groupParts', 'outMesh', 'worldMesh', 'worldSpace')) or strict: if not cmds.ls(object, io = 1): BadObjects.append(object) addText = u'>>> %s 没有和SG节点连接\n' % object feedBackCaseA.append(addText) elif check(connections, 'compInstObjGroups'): BadObjects.append(object) addText = u'>>> %s 与SG节点之间可能存在异常连接\n' % object feedBackCaseB.append(addText) count += 1 if count*50 % num == 0: amount += 2 cmds.progressWindow(e = 1, pr = amount) elif count == num: amount = 100 cmds.progressWindow(e = 1, pr = amount) if cmds.progressWindow(q = 1, ic = 1): break if cmds.progressWindow(q = 1, pr = 1) >= 100: break cmds.scrollField('ScrollText', e = 1, it = ''.join(feedBackCaseA), ip = 0) cmds.scrollField('ScrollText', e = 1, it = ''.join(feedBackCaseB), ip = 0) cmds.progressWindow(ep = 1)
def resizeTextScrollers(self): width = cmds.scrollLayout('reviewScrollLayout', q=True, w=True) - 20 height = cmds.scrollLayout('reviewScrollLayout', q=True, h=True) cmds.scrollField('comment', e=True, h=(height / 2) - 120) cmds.scrollField('comment', e=True, w=width) cmds.scrollField('history', e=True, h=(height / 2) - 120) cmds.scrollField('history', e=True, w=width) cmds.rowColumnLayout('SceneNodeActivatorRC', e=True, columnWidth=[(1, (width / 2) - 1), (2, (width / 2) - 1)])
def mateTextures(): global mateTextSeparator mateTextGroup1 = cmds.radioButtonGrp( "mateTextButGrp1", numberOfRadioButtons=3, label='Materials & Textures (50%)', labelArray3=['A+ -A', 'B+ -B', 'C+ -C'], onCommand=mateTextButton1) mateTextGroup2 = cmds.radioButtonGrp("mateTextButGrp2", numberOfRadioButtons=2, shareCollection=mateTextGroup1, label='', labelArray2=['D', 'F'], onCommand=mateTextButton2) cmds.formLayout(gradeFrm, edit=1, attachForm=[mateTextGroup1, "left", 5], attachControl=[mateTextGroup1, "top", 5, lightSeparator]) cmds.formLayout(gradeFrm, edit=1, attachForm=[ mateTextGroup2, "left", 5, ], attachControl=[mateTextGroup2, "top", 5, mateTextGroup1]) mateTextShapeField = cmds.intFieldGrp("mateTextIntField", numberOfFields=1, label='Grade', changeCommand=updateGradeTotal) mateTextTextScrollList = cmds.scrollField("mateTextTSList", w=200, h=150, wordWrap=1) mateTextCommentsLabel = cmds.text(label='Comments') cmds.formLayout( gradeFrm, edit=1, attachForm=[mateTextShapeField, "top", 5], attachControl=[mateTextShapeField, "top", 10, mateTextGroup2]) cmds.formLayout( gradeFrm, edit=1, attachForm=[mateTextTextScrollList, "left", 140], attachControl=[mateTextTextScrollList, "top", 10, mateTextShapeField]) cmds.formLayout( gradeFrm, edit=1, attachForm=[mateTextCommentsLabel, "left", 60], attachControl=[mateTextCommentsLabel, "top", 10, mateTextShapeField]) mateTextSeparator = cmds.separator(height=15, width=460, style='in') cmds.formLayout( gradeFrm, edit=1, attachForm=[mateTextSeparator, "left", 5], attachControl=[mateTextSeparator, "top", 5, mateTextTextScrollList])
def delayedUpdateHotkeyCheck(self, name): command = cmds.button("command%s"%name, query=True, label=True) key = cmds.scrollField("key%s"%name, query=True, text=True) ctl = cmds.checkBox("ctl%s"%name, query=True, value=True) alt = cmds.checkBox("alt%s"%name, query=True, value=True) if len(key) > 1 and key not in KEYSLIST: key = key[0] cmds.scrollField("key%s"%name, edit=True, text=key) label = self.hotkeyCheck(key, ctl, alt) if label == None: label = "" cmds.text("query%s"%name, edit=True, label=label, font="plainLabelFont") if utilMod.toTitle(label) != command: cmds.text("query%s"%name, edit=True, font="boldLabelFont")
def tslLoader(fileName, fileType): ''' This function is loaded from the fileBrowserDialog. - The fileBrowserDialog passes two values to this function automaticly fileName --> file name and path of selected directory/file fileType --> What type of file is selected. ''' # Remove everything in the textScrollList cmds.textScrollList("mecCVTTSL", e=True, ra=True) # Update the scrollField with the selected path. cmds.scrollField("mecCVTDir", e=True, text=fileName) # Return the files in the chosen directory files = os.listdir(fileName) # Apply those files to the textScrollList cmds.textScrollList("mecCVTTSL", e=True, append=files) # return 1 means the dialog prompt worked correctly. # Only integers values are reconized during this return. return 1
def selectBadObjects(): try: selectedText = cmds.scrollField('ScrollText', q = 1, sl = 1) if selectedText and '-' not in selectedText: splitedText = [x for x in selectedText.split() if '\\' not in repr(x) and '>' not in x] cmds.select(splitedText, r = 1) elif not selectedText: cmds.select(BadObjects, r = 1) except: pass
def masterShotWindow(self): form = cmds.setParent(q=True) cmds.formLayout(form, e=True, w=300, h=200) t1 = cmds.text(l="Mastering Options:") self.cam = cmds.checkBoxGrp( l="Delete user cameras not named 'renderCam'?", ncb=1, cal=[(1, "left"), (2, "left")], cw=[(1, 200), (2, 100)], v1=True) #delete unused cameras? self.shd = cmds.checkBoxGrp( l="Delete unused shaders/textures?", ncb=1, cal=[(1, "left"), (2, "left")], cw=[(1, 200), (2, 100)], v1=True) #delete unused shaders and textures t2 = cmds.text(l="Note:") self.txt = cmds.scrollField(h=40, tx="note field", w=300, ww=True) #pum = cmds.popupMenu(b=3, p=widgets["noteSF"]) #cmds.menuItem("yo", p=pum) self.but = cmds.button(l="Master Shot!", bgc=(.5, .7, .4), w=300, h=50, c=self.dismissUI) self.cancel = cmds.button(l="Cancel", bgc=(.7, .4, .4), w=300, h=30, c=self.cancelUI) cmds.formLayout( form, e=True, attachForm=[ (t1, "top", 0), (t1, "left", 5), (self.cam, "top", 25), (self.cam, "left", 5), (self.shd, "top", 45), (self.shd, "left", 5), #(self.rig, "top", 65), (self.rig, "left", 5), (t2, "top", 85), (t2, "left", 5), (self.txt, "top", 105), (self.txt, "left", 5), (self.but, "top", 155), (self.but, "left", 5), (self.cancel, "top", 215), (self.cancel, "left", 5), ]) cmds.formLayout(form, e=True, h=200)
def gui(): ''' Generates the interface for the file sequencer. ''' if (cmds.window(win, ex=True)): cmds.deleteUI(win) if (cmds.windowPref(win, ex=True)): cmds.windowPref(win, r=True) cmds.window(win, h=500, w=400) mainCol = cmds.columnLayout() cmds.rowColumnLayout(nc=2, cw=[[1, 200], [2, 200]]) global targField, destField, tslTarget, tslDestin targField = cmds.scrollField(w=200, h=50, editable=False, wordWrap=True, text='Non editable with word wrap') destField = cmds.scrollField(w=200, h=50, editable=False, wordWrap=True, text='Non editable with word wrap') cmds.button(label="Load Target", c=Callback(getTarget)) cmds.button(label="Load Destination", c=Callback(getDestin)) cmds.text(label="Target Files") cmds.text(label="Destination Files") tslTarget = TextScrollList(200, 200) tslDestin = TextScrollList(200, 200) cmds.setParent(mainCol) # Inputs fieldsGUI(mainCol) cmds.showWindow(win) print("Interface executed.")