def manipCreator_changeShapeFormButton(self, index): self.shapeChoice = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] activeNames = ['Off', 'On'] icoShapeDossier = 'tools/autoManip/icon/shape/' icoShapePath = self.toolBoxPath + icoShapeDossier nbrShapes = len(self.manipShapeNames) self.shapeChoice[index] = 1 self.shapeName = self.manipShapeNames[index] #_UI for i in range(0, nbrShapes): mc.iconTextRadioButton( ('AM_' + self.manipShapeNames[i] + '_ITRB'), e=True, i=(icoShapePath + 'manip' + self.manipShapeNames[i] + activeNames[self.shapeChoice[i]] + '.jpg')) #_SCENE selection = mc.ls(sl=True) for elem in selection: try: manip = manipsClass.manip(elem) manip.setShapeForm(self.shapeName) except: pass mc.select(selection)
def getSmoothLvl(*args): if mc.iconTextRadioButton(smstUI_smoothLvl0, select=True, q=True): return 0 if mc.iconTextRadioButton(smstUI_smoothLvl1, select=True, q=True): return 1 if mc.iconTextRadioButton(smstUI_smoothLvl2, select=True, q=True): return 2
def refreshPropsListLocal(self): #delete old layoutList = cmds.scrollLayout('mainScrollLayout', childArray=True, q=True) if layoutList == None: pass else: for item in layoutList: cmds.deleteUI(item) #build new hugePropsName = cmds.textField('Huge_Props_Name',text=True,q=True) if hugePropsName == '': ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids,label=True,q=True) allFileList = os.listdir(self.LocalRootPath+hugePropsName) fileName = sorted(allFileList)[-1] LocalRootPath = self.LocalRootPath+hugePropsName+'/'+fileName try: file = open(LocalRootPath, 'rb') informationMapList = json.load(file) file.close() except: informationMapList = [] cmds.columnLayout(parent='mainScrollLayout',adjustableColumn=True) cmds.iconTextRadioCollection('keyIconTextRadioCollection') for i in range(len(informationMapList)): text=informationMapList[i]['name']+' ---> '+informationMapList[i]['parent'] cmds.iconTextRadioButton('%s:%s'%(informationMapList[i]['name'],informationMapList[i]['ctrlCircle']),collection='keyIconTextRadioCollection', style='iconAndTextHorizontal',l='%s'%text, width=340, height=25,onCommand=lambda *arg:self.selectObjects()) cmds.setParent('..')
def UI_manipCreator_shapeChoice(self, name, parent): # w = 238 icoShapeDossier = 'tools/autoManip/icon/shape/' icoShapePath = self.toolBoxPath + icoShapeDossier sizeIcone = 34 nbrShape = len(self.manipShapeNames) mc.rowColumnLayout(name, numberOfRows=2, rowHeight=([1, sizeIcone], [2, sizeIcone]), p=parent) mc.iconTextRadioCollection(name + 'rc') for i in range(0, nbrShape): activeName = 'Off' if (self.shapeChoice[i] == 1): activeName = 'On' mc.iconTextRadioButton(('AM_' + self.manipShapeNames[i] + '_ITRB'), w=sizeIcone, h=sizeIcone, cl=(name + 'rc')) mc.iconTextRadioButton( ('AM_' + self.manipShapeNames[i] + '_ITRB'), e=True, onc=(self.variableNameInGlobal + '.manipCreator_changeShapeFormButton(%r)' % (i)), i=(icoShapePath + 'manip' + self.manipShapeNames[i] + activeName + '.jpg'))
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 SundayWarehouseBrowserRenameAsset(): try: renameAssetPath = os.path.dirname(cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, label = True)) renameAssetName = cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, annotation = True) except: SundayDialogPy.SundayDialogConfirm('Delete Error ', 'No Asset Selected!', 'OK') return None newName = SundayDialogPy.SundayDialogPromptVariable('Asset Rename', 'Rename ', renameAssetName) if newName == None: return None assetFiles = os.listdir(renameAssetPath) renameAsset = renameAssetPath + '/' + renameAssetName if os.path.exists(renameAsset + '.mb'): os.renames(renameAsset + '.mb', renameAssetPath + '/' + newName + '.mb') if os.path.exists(renameAsset + '.ma'): os.renames(renameAsset + '.ma', renameAssetPath + '/' + newName + '.ma') if os.path.exists(renameAsset + '.py'): os.renames(renameAsset + '.py', renameAssetPath + '/' + newName + '.py') if os.path.exists(renameAsset + '.info'): os.renames(renameAsset + '.info', renameAssetPath + '/' + newName + '.info') if os.path.exists(renameAsset + '.png'): os.renames(renameAsset + '.png', renameAssetPath + '/' + newName + '.png') if os.path.exists(renameAsset + '.dae'): os.renames(renameAsset + '.dae', renameAssetPath + '/' + newName + '.dae') assetTypePath = cmds.optionVar(query = 'SundayWarehousePath') + '/' + cmds.optionMenu('whCategoryComboBox', query = True, value = True) + '/' + cmds.optionMenu('whTypeComboBox', query = True, value = True) os.renames(renameAssetPath, assetTypePath + '/' + newName) SundayWarehouseBrowserUpdateAssets()
def refresh(self): #delete old propsList layoutList = cmds.scrollLayout('mainScrollLayout', childArray=True, q=True) if layoutList == None: pass else: for item in layoutList: cmds.deleteUI(item) #delete old hugePropsList layoutList = cmds.scrollLayout('hugePropsScrollLayout', childArray=True, q=True) if layoutList == None: pass else: for item in layoutList: cmds.deleteUI(item) #bulid new hugePropsList = os.listdir(self.ServerRootPath) cmds.columnLayout(parent='hugePropsScrollLayout',adjustableColumn=True) cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection') self.id = -1 for i in range(len(hugePropsList)): self.id += 1 cmds.iconTextRadioButton('id%s_hugePropsIconTextRadioButton'%i,collection='hugePropsIconTextRadioCollection', style='iconAndTextHorizontal',l='%s'%hugePropsList[i], width=190, height=25, onCommand=lambda *arg:self.refreshPropsListPlus()) cmds.setParent('..')
def checkParent(self): ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids, label=True, q=True) jsonFileList = os.listdir(self.ServerRootPath + hugePropsName) jsonFile = sorted(jsonFileList)[-1] openJsonFile = self.ServerRootPath + hugePropsName + '/' + jsonFile file = open(openJsonFile, 'rb') informationMapList = json.load(file) file.close() for propInfo in informationMapList: #print propInfo['parent'] try: #~ 试着选择有命名空间的parent物体 namespace = self.getNamespace() cmds.select(namespace + propInfo['parent']) except ValueError: try: #~ 试着选择没有命名空间的问题 cmds.select(propInfo['parent']) except ValueError: #~ 如果这两个物体都没有,说明这个物体不存在 cmds.iconTextRadioButton( '%s:%s' % (propInfo['name'], propInfo['ctrlCircle']), backgroundColor=[0.8, 0, 0], e=True) cmds.select(None)
def SLiBBrowserImport(type): selected = cmds.ls(selection = True) if cmds.iconTextRadioCollection('slAssetCollection', query = True, select = True) == 'NONE': SLiBDialogConfirm('Error while ' + type + ' ', 'Please select the Shader you want to Import!', 'OK') return None assetPath = os.path.dirname(cmds.iconTextRadioButton(cmds.iconTextRadioCollection('slAssetCollection', query = True, select = True), query = True, label = True)) importFile = cmds.iconTextRadioButton(cmds.iconTextRadioCollection('slAssetCollection', query = True, select = True), query = True, label = True) fileType = 'mayaAscii' aas = cmds.checkBox('SLiBAutoAssign', query = True, value = True) before = cmds.ls(materials=1) cmds.file(importFile, i = True, type = fileType, usingNamespaces = False, returnNewNodes = True, ignoreVersion = True) after = cmds.ls(materials=1) imported = list(set(after)-set(before)) cmds.scrollField('SLiB_TEXTFIELD_Info', edit = True, text = 'Import %s Successful !!!' % imported[0]) cmds.select(selected) if aas: #cmds.sets(selected, e=1, forceElement=shader) cmds.hyperShade( a=imported[0]) atf = cmds.checkBox('SLiBAutoTextureFix', query = True, value = True) if atf: import SLiBFixTexturePathSilentPy reload(SLiBFixTexturePathSilentPy) SLiBFixTexturePathSilentPy.SLiBFiXiTs() try: cmds.select(selected) except: cmds.iconTextRadioCollection('slAssetCollection', query = True, select = True) == 'NONE' cmds.select(clear = True)
def selectionStyleSwitch(self, *args): if mc.selectPref(query=True, paintSelect=True): mc.selectPref(paintSelect=False) mc.iconTextRadioButton(self.bt_marqueeSelStyle, edit=True, select=True) #self.bt_selectionStyle.setText("Marquee") print ">> Selection mode is MARQUEE." if mc.selectPref(query=True, useDepth=True): mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True) #self.bt_camSwitch.setChecked(True) #self.buttonOn(self.bt_camSwitch) else: mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False) #self.bt_camSwitch.setChecked(False) #self.buttonOff(self.bt_camSwitch) else: mc.selectPref(paintSelect=True) mc.iconTextRadioButton(self.bt_dragSelStyle, edit=True, select=True) #self.bt_selectionStyle.setText("Drag") print ">> Selection mode is DRAG." if mc.selectPref(query=True, paintSelectWithDepth=True): mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True) #self.bt_camSwitch.setChecked(True) #self.buttonOn(self.bt_camSwitch) else: mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
def backUpAllFileGui(self): projectList = self.jobList2[0] moduleList = self.jobList2[1] projectOption = cmds.optionMenu('optionProject2', q=True, select=True) moduleOption = cmds.optionMenu('optionModule2', q=True, select=True) project = projectList[int(projectOption) - 1] module = moduleList[int(moduleOption) - 1] ServerRoot = Path.Path().GetServerPath() ServerRootPath = '%s/%s/ProjectConfig/workNodeScripts/%s/backup/' % ( ServerRoot, project, module) if os.path.isdir(ServerRootPath): pass else: lsrunas.lsrunas().CreateDir_1(ServerRootPath) listAllDir = os.listdir(ServerRootPath) listAllDir.sort() if cmds.window('backUpAllFileWindow', q=1, exists=1): cmds.deleteUI('backUpAllFileWindow') backUpAllFileWindow = cmds.window('backUpAllFileWindow', title='Backup', widthHeight=(300, 300), sizeable=False) cmds.rowColumnLayout('backUpAllLayout', numberOfColumns=1, columnWidth=[(1, 300)]) cmds.text('History All Code Backuper', height=30, backgroundColor=[0.5, 0.6, 0.6]) cmds.separator(style='out') cmds.text(' ') cmds.text(' ') cmds.separator(style='out') cmds.text(label='All Code`s History:', align='left') cmds.text(' ') cmds.scrollLayout('historyAllScrollLayout', parent='backUpAllLayout', width=300, height=400) cmds.iconTextRadioCollection('historyAllCodeList') for i in range(len(listAllDir)): cmds.iconTextRadioButton(listAllDir[i], collection='historyAllCodeList', st='iconAndTextHorizontal', visible=True, l=listAllDir[i], width=270, height=25) cmds.separator(style='out') cmds.setParent('..') cmds.text(' ') cmds.button(label='BackUp', height=30, command=lambda *arg: self.backUpAllFunc()) cmds.text(' ') cmds.showWindow(backUpAllFileWindow)
def initSelectStyle(self): if mc.selectPref(q=True, paintSelect=True): mc.iconTextRadioButton(self.bt_dragSelStyle, edit=True, select=True) if mc.selectPref(q=True, paintSelectWithDepth=True): mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True) else: mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False) else: mc.iconTextRadioButton(self.bt_marqueeSelStyle, edit=True, select=True) if mc.selectPref(q=True, useDepth=True): mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=True) else: mc.iconTextCheckBox(self.bt_camSwitch, edit=True, value=False)
def HugePropsListPlus(self): try: hugePropsList = os.listdir(self.ServerRootPath) except WindowsError: hugePropsList = [] cmds.columnLayout(parent='hugePropsScrollLayout',adjustableColumn=True) cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection') self.id = -1 for i in range(len(hugePropsList)): self.id += 1 cmds.iconTextRadioButton('id%s_hugePropsIconTextRadioButton'%i,collection='hugePropsIconTextRadioCollection', style='iconAndTextHorizontal',l='%s'%hugePropsList[i], width=190, height=25, onCommand=lambda *arg:self.refreshPropsListPlus()) cmds.setParent('..')
def actuToolSettings(self): ctx = mc.currentCtx() ctxType = mc.contextInfo(ctx, c=True) # if self.wg_moveSettings.isVisible() or self.wg_rotateSettings.isVisible() or self.wg_scaleSettings.isVisible() or self.wg_nullSettings.isVisible(): if ctxType == "manipMove": self.setIconTool("manipMove") mc.frameLayout(self.fl_tool, edit=True, label="Move Settings") mc.iconTextRadioButton(self.bt_tweakSelStyle, edit=True, enable=True) # self.wg_rotateSettings.setVisible(False) # self.wg_scaleSettings.setVisible(False) # self.wg_nullSettings.setVisible(False) # self.wg_moveSettings.setVisible(True) # self.initMoveSettings() if ctxType == "manipRotate": self.setIconTool("manipRotate") mc.frameLayout(self.fl_tool, edit=True, label="Rotate Settings") mc.iconTextRadioButton(self.bt_tweakSelStyle, edit=True, enable=True) # self.wg_moveSettings.setVisible(False) # self.wg_scaleSettings.setVisible(False) # self.wg_nullSettings.setVisible(False) # self.wg_rotateSettings.setVisible(True) # self.initRotateSettings() if ctxType == "manipScale": self.setIconTool("manipScale") mc.frameLayout(self.fl_tool, edit=True, label="Scale Settings") mc.iconTextRadioButton(self.bt_tweakSelStyle, edit=True, enable=True) # self.wg_moveSettings.setVisible(False) # self.wg_rotateSettings.setVisible(False) # self.wg_nullSettings.setVisible(False) # self.wg_scaleSettings.setVisible(True) # self.initScaleSettings() if ctxType == "selectTool": self.setIconTool("selectTool") mc.frameLayout(self.fl_tool, edit=True, label="Tool Settings") mc.iconTextRadioButton(self.bt_tweakSelStyle, edit=True, enable=False)
def showControlWindow(): if mc.window("ControlColors", ex=True):mc.deleteUI("ControlColors", wnd=True) if mc.windowPref("ControlColors", ex=True):mc.windowPref("ControlColors", r=True) mc.window("ControlColors", t="Control Colors", w=320, h=45, menuBar=True) ColorRGBIndeX = ((0.000, 0.000, 0.000),(0.000, 0.000, 0.000),(0.251, 0.251, 0.251),(0.500, 0.500, 0.500),(0.608, 0.000, 0.157),(0.000, 0.016, 0.376),(0.000, 0.000, 1.000),(0.000, 0.275, 0.098),(0.149, 0.000, 0.263),(0.784, 0.000, 0.784),(0.541, 0.282, 0.200),(0.247, 0.137, 0.122),(0.600, 0.149, 0.000),(1.000, 0.000, 0.000),(0.000, 1.000, 0.000),(0.000, 0.255, 0.600),(1.000, 1.000, 1.000),(1.000, 1.000, 0.000),(0.392, 0.863, 1.000),(0.263, 1.000, 0.639),(1.000, 0.690, 0.690),(0.894, 0.675, 0.475),(1.000, 1.000, 0.388),(0.000, 0.600, 0.329),(0.631, 0.412, 0.188),(0.624, 0.631, 0.188),(0.408, 0.631, 0.188),(0.188, 0.631, 0.365),(0.188, 0.631, 0.631),(0.188, 0.404, 0.631),(0.435, 0.188, 0.631),(0.631, 0.188, 0.412)) mc.rowColumnLayout(w=320, nc=16, cw=[(i, 20) for i in range(1,17)]) mc.iconTextRadioCollection("UI_ColorCollide") for i in range(32): if i == 0: mc.iconTextRadioButton('UI_ColorRadioBtn%d'%i, h=20, i='fpe_brokenPaths.png', onc=partial(SetDisplayColor)) else: mc.iconTextRadioButton('UI_ColorRadioBtn%d'%i, h=20, bgc=ColorRGBIndeX[i], onc=partial(SetDisplayColor)) mc.showWindow("ControlColors")
def runDmpY(self, camh, camv, dmpx, dmpy, cam): mode = cmds.iconTextRadioButton('hb', q = True, sl = True) hap = float(cmds.textField(camh, q = True, tx = True)) vap = float(cmds.textField(camv, q = True, tx = True)) dmpX = float(cmds.textField(dmpx, q = True, tx = True)) dmpY = float(cmds.textField(dmpy, q = True, tx = True)) camRatio = hap/vap dmpRatio = dmpX/dmpY if mode == 0: newvap = hap/(float(dmpX)/float(dmpY)) cmds.textField(camv, e = True, tx = newvap) cmds.setAttr(cam+'.horizontalFilmAperture', hap) cmds.setAttr(cam+'.verticalFilmAperture', newvap) if mode == 1: newdmpx = ApertureTool().intRound(dmpY*camRatio) cmds.textField(dmpx, e = True, tx = newdmpx) cmds.setAttr(cam+'.horizontalFilmAperture', hap) cmds.setAttr(cam+'.verticalFilmAperture', vap)
def selectObjects(self): ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids, label=True, q=True) allFileList = os.listdir(self.ServerRootPath + hugePropsName) fileName = sorted(allFileList)[-1] ServerRootPath = self.ServerRootPath + hugePropsName + '/' + fileName try: file = open(ServerRootPath, 'rb') informationMapList = json.load(file) file.close() except: informationMapList = [] ctrlCircleParts = cmds.iconTextRadioCollection( 'keyIconTextRadioCollection', select=True, q=True).split(':') ctrlCircle = ctrlCircleParts[1] + ':' + ctrlCircleParts[2] for item in informationMapList: if item['ctrlCircle'] == ctrlCircle: try: namespace = self.getNamespace() cmds.select(item['ctrlCircle'], namespace + item['parent']) except ValueError: cmds.select(None) pass
def changeCheckBoxMark(self): testMap = {} self.changeBoxMap = {} projectList = self.jobList2[0] moduleList = self.jobList2[1] projectOption = cmds.optionMenu('optionProject2', q=True, select=True) moduleOption = cmds.optionMenu('optionModule2', q=True, select=True) project = projectList[int(projectOption) - 1] module = moduleList[int(moduleOption) - 1] pythonCodeFilePath = '//hnas01/data/Projects/%s/ProjectConfig/workNodeScripts/%s/' % ( project, module) tmp_listDir = os.listdir(pythonCodeFilePath) listDir = [] for item in tmp_listDir: tmp = item.split('.') if tmp[-1] == 'py': listDir.append(item) else: pass for i in range(self.id + 1): key = cmds.iconTextRadioButton('id%s' % i, l=True, q=True) value = cmds.checkBox('id%s' % i, value=True, q=True) testMap[key] = value print testMap for item in list(testMap.keys()): if not self.oldActiveMap[item] == None and not self.oldActiveMap[ item] == testMap[item]: self.changeBoxMap[item] = testMap[item] else: pass
def browseCode(self): projectList = self.jobList2[0] moduleList = self.jobList2[1] projectOption = cmds.optionMenu('optionProject2', q=True, select=True) moduleOption = cmds.optionMenu('optionModule2', q=True, select=True) project = projectList[int(projectOption) - 1] module = moduleList[int(moduleOption) - 1] ids = cmds.iconTextRadioCollection('pythonCodeList', select=True, q=True) try: codeName = cmds.iconTextRadioButton(ids, label=True, q=True) except RuntimeError: sys.exit() except IOError: sys.exit() textFilePath = '//hnas01/data/Projects/%s/ProjectConfig/workNodeScripts/%s/%s' % ( project, module, codeName) self.textOldFilePath = textFilePath self.textOldFileName = codeName file = open(textFilePath, 'r').read() cmds.textField('showTextName', enable=self.flag[4], text=codeName, edit=True) try: cmds.scrollField('showText', enable=self.flag[3], text=file.decode('utf-8'), edit=True) except UnicodeDecodeError: cmds.confirmDialog(title='Erro', message='Your code is not UTF-8 unicode!', button='Gotcha')
def deleteCode(self): projectList = self.jobList2[0] moduleList = self.jobList2[1] projectOption = cmds.optionMenu('optionProject2', q=True, select=True) moduleOption = cmds.optionMenu('optionModule2', q=True, select=True) project = projectList[int(projectOption) - 1] module = moduleList[int(moduleOption) - 1] ServerRoot = Path.Path().GetServerPath() ServerRootPath = '%s/%s/ProjectConfig/workNodeScripts/%s/' % ( ServerRoot, project, module) ids = cmds.iconTextRadioCollection('pythonCodeList', select=True, q=True) try: codeName = cmds.iconTextRadioButton(ids, label=True, q=True) except RuntimeError: sys.exit() except IOError: sys.exit() yourChoice = cmds.confirmDialog( title='CLOSED', message='You sure you want to delete the code?', button=['Yes', 'No'], defaultButton='Yes', cancelButton='No', dismissString='No') if yourChoice == 'Yes': lsrunas.lsrunas().deleteFile(ServerRootPath + codeName) cmds.textField('showTextName', text='', e=True) cmds.scrollField('showText', text='', e=True) else: print 'Wise choise' time.sleep(2) self.scrollMenuReflesh()
def SLiBBrowserUpdateInfo(): asset = cmds.iconTextRadioButton(cmds.iconTextRadioCollection('slAssetCollection', query = True, select = True), query = True, annotation = True) print asset printNotes = 'Shader Name : ' + asset printNotes = printNotes + '\n' printNotes = printNotes + 'Selected!' #printNotes = printNotes + 'Author : ' + str(importNotes['Author']) + ' | Version : ' + str(importNotes['Version']) + ' | Render : ' + str(importNotes['Render']) cmds.scrollField('SLiB_TEXTFIELD_Info', edit = True, text = printNotes)
def showMateralsWindows(self): if cmds.window('MaterialsReload', q=1, exists=1): cmds.deleteUI('MaterialsReload') if cmds.window('CheckOutWindows', q=1, exists=1): cmds.deleteUI('CheckOutWindows') Mytool = cmds.window('CheckOutWindows', title='CheckOutWindows', width=550, sizeable=False) cmds.columnLayout(adjustableColumn=True) cmds.text(label='Check The Materials', height=30, backgroundColor=[0.5, 0.5, 0.6]) cmds.separator(style='out') cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 350)]) cmds.columnLayout(adjustableColumn=True) cmds.text('Shaders', align='center', backgroundColor=[0.5, 0.6, 0.5]) cmds.scrollLayout(height=250) cmds.iconTextRadioCollection('ShadersRadioCollection') shaderslist = list(self.alLayerShadersInformation.keys()) #shaderslist=['test1_sadksdknmaskfncdvsd_sasjkcnioasdjncjisdncasmcsd', # 'test2_skcasdojcskdmnvsjsdfn_ajscnsdjkncjksdnfcvnskjdvnsj', # 'test3_zxmcdnmjcvnsdij_zxcjknsdjincinsdkvjndfjv'] for shader in shaderslist: cmds.iconTextRadioButton( '%s' % shader, collection='ShadersRadioCollection', style='iconAndTextHorizontal', l='%s' % shader, height=25, onCommand=lambda *args: self.showInformation()) cmds.setParent('..') cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.text('Information', align='center', backgroundColor=[0.5, 0.6, 0.5]) cmds.scrollLayout('mainScrollLayout', height=250) cmds.setParent('..') cmds.setParent('..') cmds.showWindow(Mytool)
def activeCode(self): projectList = self.jobList2[0] moduleList = self.jobList2[1] projectOption = cmds.optionMenu('optionProject2', q=True, select=True) moduleOption = cmds.optionMenu('optionModule2', q=True, select=True) project = projectList[int(projectOption) - 1] module = moduleList[int(moduleOption) - 1] LocalRoot = Path.Path().GetLocalPath() ServerRoot = Path.Path().GetServerPath() LocalRootPath = '%s/%s/ProjectConfig/workNodeScripts/%s/' % ( LocalRoot, project, module) ServerRootPath = '%s/%s/ProjectConfig/workNodeScripts/%s/' % ( ServerRoot, project, module) uploadTime = time.time() if os.path.isdir(ServerRootPath): pass else: lsrunas.lsrunas().CreateDir_1(ServerRootPath) if os.path.isdir(LocalRootPath): pass else: os.makedirs(LocalRootPath) #do active code,read and write the map if os.path.isfile(ServerRootPath + 'activeMap.txt'): file = open(ServerRootPath + 'activeMap.txt', 'rb') activeMap = json.load(file) file.close() else: activeMap = {} self.changeCheckBoxMark() for key in list(self.changeBoxMap.keys()): value = self.changeBoxMap[key] activeMap[key] = [value] print(activeMap) file = open(LocalRootPath + 'activeMap.txt', 'wb') json.dump(activeMap, file) file.close() lsrunas.lsrunas(uploadTime).UploadFile(LocalRootPath + 'activeMap.txt', ServerRootPath + 'activeMap.txt', DeleteSource=False) cmds.confirmDialog(title='Good Job', message='Active completed!', button='Gotcha') #refresh oldActiveMap`s values file = open(ServerRootPath + 'activeMap.txt', 'rb') activeMap = json.load(file) file.close() for i in range(self.id + 1): key = cmds.iconTextRadioButton('id%s' % i, l=True, q=True) mapValue = activeMap[key][0] self.oldActiveMap[key] = mapValue
def remove(self): tmp1_current_time = str(datetime.datetime.now()) tmp2_current_time = tmp1_current_time.replace(' ', '_') tmp3_current_time = tmp2_current_time.split('.') tmp4_current_time = tmp3_current_time[0].split(':') current_time = tmp4_current_time[0] + '-' + tmp4_current_time[ 1] + '-' + tmp4_current_time[2] ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) try: hugePropsName = cmds.iconTextRadioButton(ids, label=True, q=True) except RuntimeError: return fileName = hugePropsName + '_' + current_time + '.json' LocalRootPath = self.LocalRootPath + hugePropsName + '/' + fileName ServerRootPath = self.ServerRootPath + hugePropsName + '/' + fileName try: file = open(ServerRootPath, 'rb') informationMapList = json.load(file) file.close() except IOError: allFileList = os.listdir(self.ServerRootPath + hugePropsName) fileName = sorted(allFileList)[-1] ServerRootPath = self.ServerRootPath + hugePropsName + '/' + fileName file = open(ServerRootPath, 'rb') informationMapList = json.load(file) file.close() try: parts = cmds.iconTextRadioCollection('keyIconTextRadioCollection', select=True, q=True).split(':') ctrlCircle = parts[1] + ':' + parts[2] except IndexError: return for info in informationMapList: if info['ctrlCircle'] == ctrlCircle: informationMapList.remove(info) for info in informationMapList: print info['name'] file = open(LocalRootPath, 'wb') json.dump(informationMapList, file) file.close() uploadTime = time.time() if not os.path.isdir( os.path.dirname(self.ServerRootPath + hugePropsName)): lsrunas.lsrunas().CreateDir_1( os.path.dirname(self.ServerRootPath + hugePropsName)) lsrunas.lsrunas(uploadTime).UploadFile(LocalRootPath, ServerRootPath, DeleteSource=False) self.refreshPropsList()
def SundayWarehouseBrowserDeleteAsset(): try: deleteFile = cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, label = True) except: SundayDialogPy.SundayDialogConfirm('Rename Error ', 'No Asset Selected!', 'OK') return None deleteResult = SundayDialogPy.SundayDialogPromptYesNo('Delete Asset:', os.path.splitext(os.path.basename(cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, label = True)))[0], 'OK', 'Cancel') if deleteResult == 'OK': shutil.rmtree(os.path.dirname(deleteFile)) SundayWarehouseBrowserUpdateAssets()
def refreshPropsList(self): #delete old layoutList = cmds.scrollLayout('mainScrollLayout', childArray=True, q=True) if layoutList == None: pass else: for item in layoutList: cmds.deleteUI(item) #build new try: hugePropsName = cmds.textField('Huge_Props_Name',text=True,q=True) if hugePropsName == '': ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids,label=True,q=True) except RuntimeError: ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids,label=True,q=True) allFileList = os.listdir(self.ServerRootPath+hugePropsName) fileName = sorted(allFileList)[-1] ServerRootPath = self.ServerRootPath+hugePropsName+'/'+fileName try: file = open(ServerRootPath, 'rb') informationMapList = json.load(file) file.close() except: informationMapList = [] cmds.columnLayout(parent='mainScrollLayout',adjustableColumn=True) cmds.iconTextRadioCollection('keyIconTextRadioCollection') for i in range(len(informationMapList)): text=informationMapList[i]['name']+' ---> '+informationMapList[i]['parent'] cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1,260),(2,40),(3,40)]) cmds.iconTextRadioButton('%s:%s'%(informationMapList[i]['name'],informationMapList[i]['ctrlCircle']),collection='keyIconTextRadioCollection', style='iconAndTextHorizontal',l='%s'%text, width=335, height=25,onCommand=lambda *arg:self.selectObjects()) cmds.text('active:',enable=False) cmds.checkBox('id_%s'%informationMapList[i]['ctrlCircle'], l='', height=25, visible=True, value=True) cmds.setParent('..') cmds.setParent('..') self.checkParent()
def Download(self): yourChoice = cmds.confirmDialog(title=u'文件类型', message=u'请选择要加载的文件类型', button=['Rig_high','Rig_low'], defaultButton='Rig_high') if yourChoice == 'Rig_low': fileType = '_rig_low.ma' else: fileType = '_rig_high.ma' ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids,label=True,q=True) jsonFileList = os.listdir(self.ServerRootPath+hugePropsName) jsonFile = sorted(jsonFileList)[-1] openJsonFile = self.ServerRootPath+hugePropsName +'/'+jsonFile file = open(openJsonFile, 'rb') informationMapList = json.load(file) file.close() ctrlCircleList = [] for hugePropsInfo in informationMapList: ctrlCircleList.append(hugePropsInfo['ctrlCircle']) keyCtrlCircleList = [] for ctrlCircle in ctrlCircleList: checkValue = cmds.checkBox('id_%s'%ctrlCircle,value=True,q=True) if checkValue == True: keyCtrlCircleList.append(ctrlCircle) for ctrlCircle in keyCtrlCircleList: for item in informationMapList: if item['ctrlCircle'] == ctrlCircle: name = item['name'] nameSpace =item['ctrlCircle'].split(':')[0] openPropsFile = self.ServerFilePath+name+'/p_'+name+fileType cmds.file(openPropsFile,reference=True, namespace=nameSpace,mergeNamespacesOnClash=False); for info in informationMapList: if info['ctrlCircle'] == ctrlCircle: cmds.setAttr(info['ctrlCircle']+'.tx',info['offset'][0]) cmds.setAttr(info['ctrlCircle']+'.ty',info['offset'][1]) cmds.setAttr(info['ctrlCircle']+'.tz',info['offset'][2]) cmds.setAttr(info['ctrlCircle']+'.rx',info['offset'][3]) cmds.setAttr(info['ctrlCircle']+'.ry',info['offset'][4]) cmds.setAttr(info['ctrlCircle']+'.rz',info['offset'][5]) cmds.setAttr(info['ctrlCircle']+'.sx',info['offset'][6]) cmds.setAttr(info['ctrlCircle']+'.sy',info['offset'][7]) cmds.setAttr(info['ctrlCircle']+'.sz',info['offset'][8]) try: parent = self.getNamespace() + info['parent'] parentPos = info['ctrlCircle'] ADPosGroup = cmds.group(empty=True,name=(parentPos+"_pos"),parent=parent) cmds.parentConstraint(ADPosGroup,info['ctrlCircle'],maintainOffset=True,name='%s_parentConstraint'%info['ctrlCircle']) except: cmds.confirmDialog( title='ERRO', message='This object %s is not exsit!'%item['parent'], button='Gotcha')
def Upload(self): hugePropsName = cmds.textField('Huge_Props_Name',text=True,q=True) if hugePropsName == '': ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids,label=True,q=True) allFileList = os.listdir(self.LocalRootPath+hugePropsName) fileName = sorted(allFileList)[-1] ServerRootPath = self.ServerRootPath+hugePropsName+'/'+fileName LocalRootPath = self.LocalRootPath+hugePropsName+'/'+fileName uploadTime = time.time() if not os.path.isdir(os.path.dirname(self.ServerRootPath+hugePropsName)): lsrunas.lsrunas().CreateDir_1(os.path.dirname(self.ServerRootPath+hugePropsName)) lsrunas.lsrunas(uploadTime).UploadFile(LocalRootPath, ServerRootPath, DeleteSource=False) flag = cmds.textField('Huge_Props_Name',text=True,q=True) if flag != '': self.refreshHugePropsListPlus() cmds.confirmDialog(title=u'完成', message=u'上传完成!', button=u'好的')
def backUpFunc(self): projectList = self.jobList2[0] moduleList = self.jobList2[1] projectOption = cmds.optionMenu('optionProject2', q=True, select=True) moduleOption = cmds.optionMenu('optionModule2', q=True, select=True) project = projectList[int(projectOption) - 1] module = moduleList[int(moduleOption) - 1] ServerRoot = Path.Path().GetServerPath() LocalRoot = Path.Path().GetLocalPath() ServerBackUpPath = '%s/%s/ProjectConfig/workNodeScripts/%s/backup/' % ( ServerRoot, project, module) ids = cmds.iconTextRadioCollection('historyCodeList', select=True, q=True) try: backup_codeName = cmds.iconTextRadioButton(ids, label=True, q=True) except RuntimeError: cmds.confirmDialog(title='Erro', message='Please select a file first!', button='Gotcha') sys.exit() pass codeName = backup_codeName.split('&')[-1] file = open(ServerBackUpPath + backup_codeName, 'r').read() cmds.textField('showTextName', enable=self.flag[4], text=codeName, edit=True) cmds.scrollField('showText', enable=self.flag[3], text=file.decode('utf-8'), edit=True) self.textOldFileName = codeName cmds.deleteUI('backUpWindow')
def apertureToolwindow(self, cam): if cmds.window("apertureToolWindow", exists = True): cmds.deleteUI("apertureToolWindow", window = True) #if cmds.windowPref("apertureToolWindow", exists = True): # cmds.windowPref("apertureToolWindow", remove = True) # window cmds.window("apertureToolWindow", t = "Ratio Calculator: "+cam[0], w = 300, h = 130) #cmds.columnLayout(adj = True) form = cmds.formLayout() separatorTop = cmds.separator() separatorBottom = cmds.separator() camtext = cmds.text(l = 'camera aperture', al = 'left') camHtextField = cmds.textField(text = self.getCameraAperture(cam)[0], w = 100) camVtextField = cmds.textField(text = self.getCameraAperture(cam)[1], w = 100) tmpDMPx = 4096 tmpDMPy = ApertureTool().intRound(4096.0/(self.getCameraAperture(cam)[0]/self.getCameraAperture(cam)[1])) dmptext = cmds.text(l = 'dmp resolution', al = 'left') dmpXtextField = cmds.textField(text = tmpDMPx, w = 100) dmpYtextField = cmds.textField(text = tmpDMPy, w = 100) vbuttons = cmds.iconTextRadioCollection('buttons') vbutton = cmds.iconTextRadioButton('vb', st = 'iconOnly', w = 20, onc = 'import maya.cmds as cmds;cmds.text("text", e = True, l = "locked for offset")') hbutton = cmds.iconTextRadioButton('hb', st = 'iconOnly', h = 20, onc = 'import maya.cmds as cmds;cmds.text("text", e = True, l = "locked for ratio")') cmds.iconTextRadioButton('vb', e = True, i = MAYA_PICTURES+'/ratioCalculator_v.tif') cmds.iconTextRadioButton('hb', e = True, i = MAYA_PICTURES+'/ratioCalculator_h.tif') txt = cmds.text('text', l = "locked for ratio", al ='right') cmds.iconTextRadioButton('hb', e = True, sl = True) cmds.textField(camHtextField, e = True, cc = 'ratioCalculator.ApertureTool().runCamH("'+camHtextField+'","'+camVtextField+'","'+dmpXtextField+'","'+dmpYtextField+'","'+cam[1]+'")') cmds.textField(camVtextField, e = True, cc = 'ratioCalculator.ApertureTool().runCamV("'+camHtextField+'","'+camVtextField+'","'+dmpXtextField+'","'+dmpYtextField+'","'+cam[1]+'")') cmds.textField(dmpXtextField, e = True, cc = 'ratioCalculator.ApertureTool().runDmpX("'+camHtextField+'","'+camVtextField+'","'+dmpXtextField+'","'+dmpYtextField+'","'+cam[1]+'")') cmds.textField(dmpYtextField, e = True, cc = 'ratioCalculator.ApertureTool().runDmpY("'+camHtextField+'","'+camVtextField+'","'+dmpXtextField+'","'+dmpYtextField+'","'+cam[1]+'")') cmds.formLayout(form, e = True, attachForm = [ (camtext, "left", 5), (camVtextField, "right", 35), (dmptext, "left", 5), (dmpYtextField, "right", 35), (separatorTop, "top", 5), (separatorTop, "right", 5), (separatorTop, "left", 5), (separatorBottom, "right", 5), (separatorBottom, "left", 5), (txt, "right", 5), (txt, "bottom", 5) ]) cmds.formLayout(form, e = True, attachControl = [ (camtext, "top", 5, separatorTop), (camHtextField, "top", 5, separatorTop), (camVtextField, "top", 5, separatorTop), (dmptext, "top", 10, camtext), (dmpXtextField, "top", 5, camHtextField), (dmpYtextField, "top", 5, camVtextField), (camHtextField, "right", 5, camVtextField), (dmpXtextField, "right", 5, dmpYtextField), (hbutton, "top", 2, dmpXtextField), (vbutton, "left", 2, camVtextField), (separatorBottom, "bottom", 2, txt) ]) cmds.formLayout(form, e = True, attachOppositeControl = [ (hbutton, "left", 0, dmpXtextField), (hbutton, "right", 0, camVtextField), (vbutton, "top", 0, camVtextField), (vbutton, "bottom", 0, dmpYtextField) ]) # show window cmds.showWindow("apertureToolWindow")
def buildUI(self): if mc.window(self.winName, query=True, exists=True): mc.deleteUI(self.winName) if mc.windowPref(self.winName, exists=1): mc.windowPref(self.winName, r=1) if mc.toolBar(self.toolBarName, query=True, exists=True): mc.deleteUI(self.toolBarName) ''' if mc.workspaceControl(wscName, query=True, exists=True): mc.deleteUI(wscName, control=True) ''' mc.window(self.winName, title='kTool', sizeable=False, widthHeight=(186, 1100)) mc.columnLayout('columnLayout1', height=1100, adjustableColumn=True) # build UI : Common Selection Options mc.frameLayout('selection_Layout', parent='columnLayout1', collapsable=True, label='Common Selection Options') mc.columnLayout('columnLayout2') mc.rowColumnLayout(numberOfColumns=2) self.lb_tool = mc.iconTextStaticLabel(width=44, visible=True, image=self.path + 'selectTool.png') mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]]) mc.iconTextRadioCollection() self.bt_selObj = mc.iconTextRadioButton(width=44, height=32, enableBackground=False, image=self.path + 'objectnex.png', select=True, onCommand=self.selObject) self.bt_selMulti = mc.iconTextRadioButton(width=44, height=32, enableBackground=False, label='Multi', style='textOnly', onCommand=self.selMulti) self.bt_selUv = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'uvnex.png', onCommand=self.selUv) self.bt_selVert = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'vertexnex.png', onCommand=self.selVertex) self.bt_selEdge = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'edgesnex.png', onCommand=self.selEdge) self.bt_selFace = mc.iconTextRadioButton(width=44, height=32, image=self.path + 'facesnex.png', onCommand=self.selFace) mc.rowColumnLayout(parent='columnLayout2', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.iconTextRadioCollection() self.bt_marqueeSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Marquee', style='textOnly', font='tinyBoldLabelFont', onCommand=self.selectionStyleSwitch) self.bt_dragSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Drag', style='textOnly', font='tinyBoldLabelFont', onCommand=self.selectionStyleSwitch) self.bt_tweakSelStyle = mc.iconTextRadioButton(width=44, height=22, label='Tweak', style='textOnly', font='tinyBoldLabelFont') self.bt_camSwitch = mc.iconTextCheckBox(width=44, height=22, label='Cam B', style='textOnly', font='tinyBoldLabelFont', changeCommand=self.camSwitch) mc.rowColumnLayout('rowColumnLayout4', parent='columnLayout2', numberOfColumns=2, columnWidth=[[1, 20], [2, 160]]) mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'transform.png') self.tf_transformName = mc.textField(enterCommand=self.renameTransform) mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'shape.png') self.tf_shapeName = mc.textField(editable=False) mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'constructionHistory.png') self.om_history = mc.optionMenu(changeCommand=self.openAttributEditor, alwaysCallChangeCommand=True, maxVisibleItems=10) mc.iconTextStaticLabel(width=20, height=20, image=self.path + 'quickRename.png') self.tf_selByName = mc.textField(placeholderText='select by name', enterCommand=self.selectByName) # build UI : Transform mc.frameLayout('transform_Layout', parent='columnLayout1', collapsable=True, label='Transform') mc.columnLayout('columnLayout3') mc.channelBox('channelBox1', width=180, height=192, # preventOverride=False, # attributeEditorMode=False, # containerAtToparent=False, precision=3, fixedAttrList=("translateX", "translateY", "translateZ", "rotateX", "rotateY", "rotateZ", "scaleX", "scaleY", "scaleZ", 'visibility')) mc.gridLayout(numberOfRows=5, numberOfColumns=4, cellWidth=45, cellHeight=44) mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'deleteHistory.png', command=self.deleteHistory) mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'centerPivot.png', command=self.centerPivot) mc.iconTextButton(width=44, height=44, enableBackground=False, label='//', style='textOnly', enable=False) self.bt_visibility = mc.iconTextCheckBox(width=44, height=44, image=self.path + 'visibility.png', changeCommand=self.visibility) mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'resetTransform.png', command=self.resetAllTransform) mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'matchTransform.png', command=self.matchAllTransforms) mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'freezeTransform.png', command=self.freezeAllTransform) mc.iconTextButton(width=44, height=44, enableBackground=False, image=self.path + 'unfreeze.png', command=self.unFreeze) mc.gridLayout(parent='columnLayout3', numberOfRows=4, numberOfColumns=4, cellWidth=45, cellHeight=22) mc.iconTextButton(width=44, height=22, label='R.T', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetTranslation) mc.iconTextButton(width=44, height=22, label='M.T', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchTranslate) mc.iconTextButton(width=44, height=22, label='F.T', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeTranslate) mc.iconTextButton(width=44, height=22, label='//', style='textOnly', enable=False) mc.iconTextButton(width=44, height=22, label='R.R', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetRotation) mc.iconTextButton(width=44, height=22, label='M.R', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchRotate) mc.iconTextButton(width=44, height=22, label='F.R', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeRotate) mc.iconTextCheckBox(width=44, height=22, image=self.path + 'snapToggle.png') mc.iconTextButton(width=44, height=22, label='R.S', style='textOnly', image=self.path + 'resetSmall.png', command=self.resetScaling) mc.iconTextButton(width=44, height=22, label='M.S', style='textOnly', image=self.path + 'matchSmall.png', command=self.matchScale) mc.iconTextButton(width=44, height=22, label='F.S', style='textOnly', image=self.path + 'freezeSmall.png', command=self.freezeScale) mc.iconTextButton(width=44, height=22, label='//', style='textOnly', enable=False) # build UI : Display mc.frameLayout('display_Layout', parent='columnLayout1', collapsable=True, label='Display') # build UI : Tool Settings self.fl_tool = mc.frameLayout('tool_Layout', parent='columnLayout1', collapsable=True, label='Tool Settings') mc.columnLayout('columnLayout6') mc.rowColumnLayout(numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Object', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='World', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Comp.', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Parent', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Normal', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Gimbal', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(enable=False, width=44, height=22, enableBackground=True, label='//', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Custom', style='textOnly', font='tinyBoldLabelFont') mc.separator(parent='columnLayout6', height=1, style='none') mc.rowColumnLayout(parent='columnLayout6', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Default', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Object', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Manip', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Selection', style='textOnly', font='tinyBoldLabelFont') mc.separator(parent='columnLayout6', height=1, style='none') mc.rowColumnLayout(parent='columnLayout6', enable=False, visible=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.text(width=44, height=22, label='Snap :', font='tinyBoldLabelFont') mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Relative', style='textOnly', font='tinyBoldLabelFont' , select=True) mc.iconTextRadioButton(width=44, height=22, enableBackground=True, label='Absolute', style='textOnly', font='tinyBoldLabelFont') mc.floatField(width=44, height=22, precision=3) mc.separator(parent='columnLayout6', height=1, style='none') mc.rowColumnLayout(parent='columnLayout6', numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Tweak', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Pr.UVs', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Pr.Child', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Free Rot.', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='No Neg.S', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Smt.Dup', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, enableBackground=True, label='Smt.Ext', style='textOnly', font='tinyBoldLabelFont') # build UI : Soft selection mc.frameLayout('soft_Layout', parent='columnLayout1', collapsable=True, label='Soft') mc.columnLayout('columnLayout5') mc.rowColumnLayout('rowColumnLayout9', height=46, numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]]) mc.iconTextCheckBox(width=44, height=44, image=self.path + 'offsetCurve.png', label='Soft', style='iconAndTextVertical', font='tinyBoldLabelFont') mc.gridLayout(numberOfRows=2, numberOfColumns=2, cellWidth=44, cellHeight=22) mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, label='Surface', style='textOnly', font='tinyBoldLabelFont' , select=True) mc.iconTextRadioButton(width=44, height=22, label='Volume', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, label='Object', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, label='Global', style='textOnly', font='tinyBoldLabelFont') mc.gridLayout(parent='rowColumnLayout9', numberOfColumns=1, cellWidth=44, cellHeight=22) mc.floatField(width=44, precision=3) mc.iconTextCheckBox(width=44, label='Color', style='textOnly', font='tinyBoldLabelFont') mc.rowColumnLayout(parent='columnLayout5', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetA.png', style='iconOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetB.png', style='iconOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, image=self.path + 'softPresetC.png', style='iconOnly', font='tinyBoldLabelFont') # build UI : Symmetry mc.frameLayout('sym_Layout', parent='columnLayout1', collapsable=True, label='Symmetry') mc.columnLayout('columnLayout4') mc.rowColumnLayout(height=46, numberOfColumns=2) mc.iconTextCheckBox(width=44, height=44, image=self.path + 'polyMirrorCut.png', label='Sym', style='iconAndTextVertical', font='tinyBoldLabelFont') mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]]) mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, label='Object', style='textOnly', font='tinyBoldLabelFont', select=True) mc.iconTextRadioButton(width=44, height=22, label='World', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, label='Topo', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, label='X', style='textOnly', font='tinyBoldLabelFont', select=True) mc.iconTextRadioButton(width=44, height=22, label='Y', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, label='Z', style='textOnly', font='tinyBoldLabelFont') mc.rowColumnLayout(parent='columnLayout4', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, label='P.Seam', style='textOnly', font='tinyBoldLabelFont') mc.iconTextCheckBox(width=44, height=22, label='Partial', style='textOnly', font='tinyBoldLabelFont') mc.floatField(width=44, height=22, precision=3) # build UI : Step Snap mc.frameLayout('step_Layout', parent='columnLayout1', collapsable=True, label='Step & Snap') mc.columnLayout('columnLayout7') mc.rowColumnLayout(height=46, numberOfColumns=2) mc.iconTextCheckBox(width=44, height=44, image=self.path + 'snapPixel.png', label='Snap', style='iconAndTextVertical', font='tinyBoldLabelFont') mc.rowColumnLayout(numberOfColumns=3, columnSpacing=[[2, 1], [3, 1]]) mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, label='Relative', style='textOnly', font='tinyBoldLabelFont' , select=True) mc.iconTextRadioButton(width=44, height=22, label='Absolute', style='textOnly', font='tinyBoldLabelFont') mc.floatField(width=44, precision=3) mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, label='Edge', style='textOnly', font='tinyBoldLabelFont' , select=True) mc.iconTextRadioButton(width=44, height=22, label='Surface', style='textOnly', font='tinyBoldLabelFont') mc.iconTextButton(width=44, height=22, label='Normals', style='textOnly', font='tinyBoldLabelFont') mc.rowColumnLayout(parent='columnLayout7', enable=True, numberOfColumns=4, columnSpacing=[[2, 1], [3, 1], [4, 1]]) mc.iconTextButton(width=44, height=22, enableBackground=True, label='Reset', style='textOnly', font='tinyBoldLabelFont') mc.iconTextRadioCollection() mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapGrid.png', style='iconOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapCurve.png', style='iconOnly', font='tinyBoldLabelFont') mc.iconTextRadioButton(width=44, height=22, image=self.path + 'snapPoint.png', style='iconOnly', font='tinyBoldLabelFont') # mc.showWindow(self.winName) # gMainWindow = pm.mel.eval('$tmpVar=$gMainWindow') allowedAreas = ['left', 'right'] mc.toolBar(self.toolBarName, area='right', content=self.winName, allowedArea=allowedAreas) # , parent=gMainWindow)
def actuTypeSelection(self): if mc.selectMode(q=True, object=True): mc.iconTextRadioButton(self.bt_selObj, edit=True, select=True) mc.iconTextRadioButton(self.bt_selVert, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selEdge, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selFace, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selUv, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selMulti, edit=True, enableBackground=False) else: if mc.selectType(q=True, vertex=True): mc.iconTextRadioButton(self.bt_selObj, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selVert, edit=True, select=True) mc.iconTextRadioButton(self.bt_selEdge, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selFace, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selUv, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selMulti, edit=True, enableBackground=False) if mc.selectType(q=True, edge=True): mc.iconTextRadioButton(self.bt_selObj, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selVert, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selEdge, edit=True, select=True) mc.iconTextRadioButton(self.bt_selFace, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selUv, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selMulti, edit=True, enableBackground=False) if mc.selectType(q=True, facet=True): mc.iconTextRadioButton(self.bt_selObj, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selVert, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selEdge, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selFace, edit=True, select=True) mc.iconTextRadioButton(self.bt_selUv, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selMulti, edit=True, enableBackground=False) if mc.selectType(q=True, meshComponents=True): mc.iconTextRadioButton(self.bt_selObj, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selVert, edit=True, backgroundColor=self.selectColor) mc.iconTextRadioButton(self.bt_selEdge, edit=True, backgroundColor=self.selectColor) mc.iconTextRadioButton(self.bt_selFace, edit=True, backgroundColor=self.selectColor) mc.iconTextRadioButton(self.bt_selUv, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selMulti, edit=True, select=True) if mc.selectType(q=True, polymeshUV=True): mc.iconTextRadioButton(self.bt_selObj, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selVert, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selEdge, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selFace, edit=True, enableBackground=False) mc.iconTextRadioButton(self.bt_selUv, edit=True, select=True) mc.iconTextRadioButton(self.bt_selMulti, edit=True, enableBackground=False)
def SundayControllerToolUI(): global sundayControllerToolUI SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(sundayControllerToolUI, exists = True): cmds.deleteUI(sundayControllerToolUI) sundayControllerToolUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayControllerTool.ui') except: sundayControllerToolUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayControllerTool.ui') cmds.setParent(sundayControllerToolUI) cmds.setParent(cmds.button('SundayControllerToolChooseColorDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) cmds.iconTextRadioCollection('ltColorCollection') cmds.rowColumnLayout(numberOfColumns = 8) cmds.text(label = 'Color : ') cmds.iconTextRadioButton('DarkBlue_5', image1 = SundayImage + 'SundayColorDarkBlue.png', height = 20, width = 20, select = True) cmds.iconTextRadioButton('DarkRed_4', image1 = SundayImage + 'SundayColorDarkRed.png', height = 20, width = 20) cmds.iconTextRadioButton('Purple_9', image1 = SundayImage + 'SundayColorPurple.png', height = 20, width = 20) cmds.iconTextRadioButton('Red_13', image1 = SundayImage + 'SundayColorRed.png', height = 20, width = 20) cmds.iconTextRadioButton('Green_14', image1 = SundayImage + 'SundayColorGreen.png', height = 20, width = 20) cmds.iconTextRadioButton('LightBlue_18', image1 = SundayImage + 'SundayColorLightBlue.png', height = 20, width = 20) cmds.iconTextRadioButton('Yellow_17', image1 = SundayImage + 'SundayColorYellow.png', height = 20, width = 20) cmds.setParent(sundayControllerToolUI) cmds.setParent(cmds.button('SundayControllerToolDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) cmds.scrollLayout(childResizable = True) cmds.rowColumnLayout(numberOfColumns = 8) SundayLocatorToolPy.SundayLocatorToolMakeLocatorButtonsInWidget('SundayControllerToolPy\nreload(SundayControllerToolPy)\nSundayControllerToolPy.SundayControllerToolApply') cmds.showWindow(sundayControllerToolUI) if platform.system() == 'Windows': cmds.window(sundayControllerToolUI, edit = True, topLeftCorner = [ 100, 100])
#smstUI_win_formL = mc.formLayout() #smstUI_slider_frameL = mc.frameLayout(labelVisible=0, borderVisible=False, p=smstUI_win_formL) mc.frameLayout(label="Smooth set :", labelVisible=0, borderVisible=0, marginHeight=2, marginWidth=2) #borderStyle="out", mc.columnLayout(rowSpacing=2) mc.rowLayout(numberOfColumns=3, columnWidth=[(1, 54), (2, 54), (3, 54)]) smstUI_smoothLvl_set = mc.iconTextRadioCollection("Smooth level") smstUI_smoothLvl0 = mc.iconTextRadioButton( l="0 ", style='iconAndTextHorizontal', image="E:/kTools/icons/polyCube2016.png", selectionImage="E:/kTools/icons/polyCube2016b.png") smstUI_smoothLvl1 = mc.iconTextRadioButton( l="1 ", style='iconAndTextHorizontal', image="E:/kTools/icons/kSphere32.png", selectionImage="E:/kTools/icons/kSphere32b.png") smstUI_smoothLvl2 = mc.iconTextRadioButton( l="2 ", style='iconAndTextHorizontal', image="E:/kTools/icons/polySphere2016.png", selectionImage="E:/kTools/icons/polySphere2016b.png") mc.setParent('..') mc.setParent('..') '''
def add(self): tmp1_current_time = str(datetime.datetime.now()) tmp2_current_time = tmp1_current_time.replace(' ', '_') tmp3_current_time = tmp2_current_time.split('.') tmp4_current_time = tmp3_current_time[0].split(':') current_time = tmp4_current_time[0]+'-'+tmp4_current_time[1]+'-'+tmp4_current_time[2] hugePropsName = cmds.textField('Huge_Props_Name',text=True,q=True) #如果hugePropsName有值得话,就上传hugePropsName的名字 if hugePropsName == '': try: ids = cmds.iconTextRadioCollection('hugePropsIconTextRadioCollection', select=True, q=True) hugePropsName = cmds.iconTextRadioButton(ids,label=True,q=True) except: cmds.confirmDialog( title=u'注意', message=u'请输入巨型道具名称', button=u'继续') sys.exit() fileName = hugePropsName +'_'+current_time+'.json' LocalRootPath = self.LocalRootPath+hugePropsName+'/'+fileName ServerRootPath = self.ServerRootPath+hugePropsName+'/'+fileName #试着打开本地上的文件 try: file = open(LocalRootPath, 'rb') informationMapList = json.load(file) file.close() except IOError: #本地上没有这个实时文件名的文件,就打开时期最近的文件 try: allFileList = os.listdir(self.LocalRootPath+hugePropsName) fileName = sorted(allFileList)[-1] LocalRootPath = self.LocalRootPath+hugePropsName+'/'+fileName file = open(LocalRootPath, 'rb') informationMapList = json.load(file) file.close() except WindowsError: try: allFileList = os.listdir(self.ServerRootPath+hugePropsName) fileName = sorted(allFileList)[-1] ServerRootPath = self.ServerRootPath+hugePropsName+'/'+fileName file = open(ServerRootPath, 'rb') informationMapList = json.load(file) file.close() except WindowsError: informationMapList = [] objects = cmds.ls(selection=True) self.selectObjectsCheck(objects) #get group_model_GRP name allTransformNodes = cmds.ls(type='transform') allRootGroups = [] for item in allTransformNodes: key = cmds.listRelatives(item,parent=True) if key == None: allRootGroups.append(item) keyMap = {} for i in range(len(objects)-1): for rootGroup in allRootGroups: allMembers = cmds.listRelatives(rootGroup,allDescendents=True) if objects[i] in allMembers: for member in allMembers: splitMember = member.split('_') if splitMember[-1] == 'GRP' and splitMember[-2] == 'model': keyMap[objects[i]] = member else: pass #get object information for i in range(len(objects)-1): ctrlCircle = objects[i] parent = objects[-1].split(':')[-1] tx = cmds.getAttr(objects[i]+'.tx') ty = cmds.getAttr(objects[i]+'.ty') tz = cmds.getAttr(objects[i]+'.tz') rx = cmds.getAttr(objects[i]+'.rx') ry = cmds.getAttr(objects[i]+'.ry') rz = cmds.getAttr(objects[i]+'.rz') sx = cmds.getAttr(objects[i]+'.sx') sy = cmds.getAttr(objects[i]+'.sy') sz = cmds.getAttr(objects[i]+'.sz') offset = [tx,ty,tz,rx,ry,rz,sx,sy,sz] name = cmds.getAttr(keyMap[objects[i]]+'.treeName') tmpMap = {'name':name,'ctrlCircle':ctrlCircle,'parent':parent,'offset':offset} flag = True if not informationMapList == []: for test in informationMapList: if test['ctrlCircle'] == ctrlCircle: flag = False if flag == True: informationMapList.append(tmpMap) else: informationMapList.append(tmpMap) if os.path.isdir(self.LocalRootPath+hugePropsName): pass else: os.makedirs(self.LocalRootPath+hugePropsName) file = open(LocalRootPath, 'wb') json.dump(informationMapList, file,indent=2) file.close() self.refreshPropsListLocal() ifNew = cmds.textField('Huge_Props_Name',text=True,q=True) if ifNew != '': self.Upload() self.refresh() cmds.textField('Huge_Props_Name',text='',e=True)
def SundayWarehouseBrowserImport(type): selected = cmds.ls(selection = True) if cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True) == 'NONE': SundayDialogPy.SundayDialogConfirm('Error while ' + type + ' ', 'No Asset Selected!', 'OK') return None assetPath = os.path.dirname(cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, label = True)) if cmds.checkBox('whBrowseIncludeTexturesCheckBox', query = True, value = True): sourceImagesPath = cmds.workspace(q = True, rootDirectory = True) + cmds.workspace(fileRuleEntry = 'sourceImages') + '/' texPath = assetPath + '/' + 'sourceimages' + '/' if os.path.isdir(texPath): Tex = os.listdir(texPath) textureExists = [] for curTex in Tex: assetTex = texPath + curTex if curTex != '.DS_Store': if os.path.exists(sourceImagesPath + curTex): print sourceImagesPath + curTex textureExists.append(curTex) os.path.exists(sourceImagesPath + curTex) if len(textureExists) > 0: overwrite = SundayDialogPy.SundayDialogPromptYesNo('Texture(s) already exists in Source Images. Overwrite All?', str(textureExists), 'YES', 'NO') if overwrite == 'YES': for curTex in Tex: if curTex != '.DS_Store': assetTex = texPath + curTex shutil.copyfile(assetTex, sourceImagesPath + curTex) continue cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True) == 'NONE' else: for curTex in Tex: if curTex != '.DS_Store': assetTex = texPath + curTex shutil.copyfile(assetTex, sourceImagesPath + curTex) continue cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True) == 'NONE' importFile = cmds.iconTextRadioButton(cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True), query = True, label = True) fileType = 'mayaBinary' if os.path.splitext(importFile)[1] == '.ma': fileType = 'mayaAscii' newNodes = [] iV = cmds.checkBox('whBrowseIgnoreVersion', query = True, value = True) if type == 'reference': newNodes = cmds.file(importFile, r = True, type = fileType, namespace = '', returnNewNodes = True, ignoreVersion = iV) elif cmds.checkBox('whBrowseUseNameSpace', query = True, value = True): newNodes = cmds.file(importFile, i = True, type = fileType, namespace = '', returnNewNodes = True, ignoreVersion = iV) else: newNodes = cmds.file(importFile, i = True, type = fileType, usingNamespaces = False, returnNewNodes = True, ignoreVersion = iV) if cmds.checkBox('whBrowseSetTexturePathCheckBox', query = True, value = True): import SundayRenderToolsPy as SundayRenderToolsPy reload(SundayRenderToolsPy) cmds.select(newNodes) SundayRenderToolsPy.SundayRenderSetTexturePathToProject('selected') if cmds.checkBox('whRunPostImportScript', query = True, value = True) & cmds.checkBox('whRunPostImportScript', query = True, enable = True): print 'Run Post Import Script' pythonFile = assetPath + '/' + os.path.basename(assetPath) + '.py' if os.path.exists(pythonFile): cmds.select(newNodes) imp.load_source('module.name', pythonFile) try: os.remove(pythonFile + 'c') except: pass try: cmds.select(selected) except: cmds.iconTextRadioCollection('whAssetCollection', query = True, select = True) == 'NONE' cmds.select(clear = True)
def SundayWarehouseBrowserUpdateAssets(): cmds.optionVar(stringValue = ('whIconViewComboBox', cmds.optionMenu('whIconViewComboBox', query = True, value = True))) cmds.setParent(warehouseBrowserUI) cmds.setParent(cmds.button('warehouseIconDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) if cmds.scrollLayout('whScrollLayout', query = True, exists = True): cmds.deleteUI('whScrollLayout', layout = True) iconLayout = cmds.optionMenu('whIconViewComboBox', query = True, value = True) iconSize = iconLayout.split('x') if len(iconSize) > 1: cmds.scrollLayout('whScrollLayout', childResizable = True) if iconLayout == '64x64': cmds.rowColumnLayout(numberOfColumns = 8) if iconLayout == '96x96': cmds.rowColumnLayout(numberOfColumns = 5) if iconLayout == '128x128': cmds.rowColumnLayout(numberOfColumns = 4) if iconLayout == '192x192': cmds.rowColumnLayout(numberOfColumns = 2) if iconLayout == '256x256': cmds.rowColumnLayout(numberOfColumns = 2) else: cmds.scrollLayout('whScrollLayout', childResizable = True) cmds.rowColumnLayout(numberOfColumns = 1) assetPath = cmds.optionVar(query = 'SundayWarehousePath') + '/' + cmds.optionMenu('whCategoryComboBox', query = True, value = True) + '/' + cmds.optionMenu('whTypeComboBox', query = True, value = True) assetDir = os.listdir(assetPath) cmds.optionVar(stringValue = ('whIconCaption', cmds.iconTextCheckBox('whIconCaption', query = True, value = True))) if len(assetDir) != 0: cmds.iconTextRadioCollection('whAssetCollection') for curAsset in assetDir: curAssetPath = assetPath + '/' + curAsset + '/' if curAsset != '.DS_Store': assetFile = os.listdir(curAssetPath) for curFile in assetFile: file = os.path.splitext(curFile)[0] fileEx = os.path.splitext(curFile)[1] if fileEx == '.mb' or fileEx == '.ma': image = curAssetPath + file + '.png' if len(iconSize) > 1: if cmds.optionVar(query = 'whIconCaption') == 'True': cmds.columnLayout(rowSpacing = 0, columnWidth = int(iconSize[0])) assetIcon = cmds.iconTextRadioButton(image1 = image, height = int(iconSize[0]), width = int(iconSize[0]), onCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateInfo("' + curAssetPath + '")', label = curAssetPath + curFile, annotation = file) cmds.popupMenu(button = 3, markingMenu = True) cmds.menuItem(label = 'View Icon', command = 'SundayWarehousePy.SundayWarehouseBrowserViewIcon("' + curAssetPath + file + '")') if os.path.exists(curAssetPath + file + '.dae'): cmds.menuItem(label = 'View Collada', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenInColladaViewer("' + curAssetPath + file + '")') else: cmds.menuItem(label = 'View Collada (No .DAE)', enable = False) cmds.menuItem(label = 'Reveal Asset', command = 'SundayWarehousePy.SundayWarehouseBrowserRevealAsset("' + curAssetPath + file + '")') cmds.menuItem(divider = True) cmds.menuItem(label = 'Open Original', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenFile("' + curAssetPath + file + fileEx + '")') if cmds.optionVar(query = 'whIconCaption') == 'True': cmds.text(label = file, width = int(iconSize[0]), align = 'left') cmds.setParent('..') else: cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [ (1, 64), (2, 8), (3, 435)]) assetIcon = cmds.iconTextRadioButton(image1 = image, height = 64, width = 64, onCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateInfo("' + curAssetPath + '")', label = curAssetPath + curFile, annotation = file) cmds.popupMenu(button = 3, markingMenu = True) cmds.menuItem(label = 'View Icon', command = 'SundayWarehousePy.SundayWarehouseBrowserViewIcon("' + curAssetPath + file + '")') if os.path.exists(curAssetPath + file + '.dae'): cmds.menuItem(label = 'View Collada', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenInColladaViewer("' + curAssetPath + file + '")') else: cmds.menuItem(label = 'View Collada (No .DAE)', enable = False) cmds.menuItem(label = 'Reveal Asset', command = 'SundayWarehousePy.SundayWarehouseBrowserRevealAsset("' + curAssetPath + file + '")') cmds.menuItem(divider = True) cmds.menuItem(label = 'Open Original', command = 'SundayWarehousePy.SundayWarehouseBrowserOpenFile("' + curAssetPath + file + '")') cmds.text(label = '') cmds.text(label = file, align = 'left') cmds.setParent('..') len(iconSize) > 1 cmds.optionVar(stringValue = ('whCategoryComboBox', cmds.optionMenu('whCategoryComboBox', query = True, value = True))) cmds.optionVar(stringValue = ('whTypeComboBox', cmds.optionMenu('whTypeComboBox', query = True, value = True)))
def uiCreate(self): self.onCloseClicked() self.window = m.window( WIN_NAME, title='Maya Window', maximizeButton=False ) uiLAY_mainForm = m.formLayout() self.uiLAY_mainScroll = m.scrollLayout(childResizable=True) mainColumn = m.columnLayout(adjustableColumn=True) # main column layout with frames # -------- self.uiLAY_frameCheckBoxes = self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1') self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2') m.setParent(mainColumn) # -------- self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiCHKGRP_test1 = m.checkBoxGrp( 'uiCHKGRP_test1', numberOfCheckBoxes=1, label='PMCheckBoxGrp1', label1='test1' ) self.uiCHKGRP_test2 = m.checkBoxGrp( 'uiCHKGRP_test2', numberOfCheckBoxes=2, label='PMCheckBoxGrp2', labelArray2=('test1', 'test2') ) self.uiCHKGRP_test3 = m.checkBoxGrp( 'uiCHKGRP_test3', numberOfCheckBoxes=3, label='PMCheckBoxGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiCHKGRP_test4 = m.checkBoxGrp( 'uiCHKGRP_test4', numberOfCheckBoxes=4, label='PMCheckBoxGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) m.setParent(mainColumn) # -------- self.uiLAY_frameColorSliders = self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiCLRGRP_test1 = m.colorSliderGrp( 'uiCLRGRP_test1', label='test1' ) self.uiCLRGRP_test2 = m.colorSliderGrp( 'uiCLRGRP_test2', label='test2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFields = self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiFLF_test1 = m.floatField('uiFLF_test1') self.uiFLF_test2 = m.floatField('uiFLF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiFLFGRP_test1 = m.floatFieldGrp( 'uiFLFGRP_test1', numberOfFields=1, label='PMFloatFieldGrp1' ) self.uiFLFGRP_test2 = m.floatFieldGrp( 'uiFLFGRP_test2', numberOfFields=2, label='PMFloatFieldGrp2' ) self.uiFLFGRP_test3 = m.floatFieldGrp( 'uiFLFGRP_test3', numberOfFields=3, label='PMFloatFieldGrp3' ) self.uiFLFGRP_test4 = m.floatFieldGrp( 'uiFLFGRP_test4', numberOfFields=4, label='PMFloatFieldGrp4' ) m.setParent(mainColumn) # -------- self.uiLAY_frameFloatScrollBars = self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1') self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliders = self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1') self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiFLSGRP_test1 = m.floatSliderGrp( 'uiFLSGRP_test1', label='test1', field=True ) self.uiFLSGRP_test2 = m.floatSliderGrp( 'uiFLSGRP_test2', label='test2', field=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITCHK_test1 = m.iconTextCheckBox( 'uiITCHK_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITCHK_test2 = m.iconTextCheckBox( 'uiITCHK_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.iconTextRadioCollection() self.uiITRAD_test1 = m.iconTextRadioButton( 'uiITRAD_test1', style='iconAndTextHorizontal', label='cube', image1='cube' ) self.uiITRAD_test2 = m.iconTextRadioButton( 'uiITRAD_test2', style='iconAndTextHorizontal', label='cone', image1='cone' ) self.uiITRAD_test3 = m.iconTextRadioButton( 'uiITRAD_test3', style='iconAndTextHorizontal', label='torus', image1='torus' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiITSLST_test1 = m.iconTextScrollList( 'uiITSLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiITSLST_test2 = m.iconTextScrollList( 'uiITSLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) m.setParent(mainColumn) # -------- self.uiLAY_frameIntFields = self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiINF_test1 = m.intField('uiINF_test1') self.uiINF_test2 = m.intField('uiINF_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntFieldGroups = self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiINFGRP_test1 = m.intFieldGrp( 'uiINFGRP_test1', numberOfFields=1, label='PMIntFieldGrp1' ) self.uiINFGRP_test2 = m.intFieldGrp( 'uiINFGRP_test2', numberOfFields=2, label='PMIntFieldGrp2' ) self.uiINFGRP_test3 = m.intFieldGrp( 'uiINFGRP_test3', numberOfFields=3, label='PMIntFieldGrp3' ) self.uiINFGRP_test4 = m.intFieldGrp( 'uiINFGRP_test4', numberOfFields=4, label='PMIntFieldGrp4' ) m.setParent(mainColumn) # -------- self.uiLAY_frameIntScrollBars = self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1') self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliders = self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') m.columnLayout(adjustableColumn=True) m.separator(style='none', height=2) self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1') self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameIntSliderGroups = self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiINSGRP_test1 = m.intSliderGrp( 'uiINSGRP_test1', label='test1', field=True ) self.uiINSGRP_test2 = m.intSliderGrp( 'uiINSGRP_test2', label='test2', field=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenus = self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=110, style='none') self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel') m.menuItem(label='one') m.menuItem(label='two') m.menuItem(label='three') self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel') m.menuItem(label='four') m.menuItem(label='five') m.menuItem(label='six') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtons = self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') m.columnLayout() m.rowLayout(numberOfColumns=4) m.separator(style='none', width=140) m.radioCollection() self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1') self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2') self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3') m.setParent(mainColumn) # -------- self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') m.columnLayout() m.separator(style='none', height=2) self.uiRADGRP_test1 = m.radioButtonGrp( 'uiRADGRP_test1', numberOfRadioButtons=1, label='PMRadioButtonGrp1', label1='test1' ) self.uiRADGRP_test2 = m.radioButtonGrp( 'uiRADGRP_test2', numberOfRadioButtons=2, label='PMRadioButtonGrp2', labelArray2=('test1', 'test2') ) self.uiRADGRP_test3 = m.radioButtonGrp( 'uiRADGRP_test3', numberOfRadioButtons=3, label='PMRadioButtonGrp3', labelArray3=('test1', 'test2', 'test3') ) self.uiRADGRP_test4 = m.radioButtonGrp( 'uiRADGRP_test4', numberOfRadioButtons=4, label='PMRadioButtonGrp4', labelArray4=('test1', 'test2', 'test3', 'test4') ) m.setParent(mainColumn) # -------- self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSYMCHK_test1 = m.symbolCheckBox( 'uiSYMCHK_test1', image='polyCube' ) self.uiSYMCHK_test2 = m.symbolCheckBox( 'uiSYMCHK_test2', image='polyCone' ) m.setParent(mainColumn) # -------- self.uiLAY_frameScriptTables = self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRTBL_test1 = m.scriptTable( 'uiSCRTBL_test1', selectionMode=3, rows=4, columns=2 ) self.uiSCRTBL_test2 = m.scriptTable( 'uiSCRTBL_test2', selectionMode=3, rows=4, columns=2 ) m.setParent(mainColumn) # -------- self.uiLAY_frameScrollField = self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiSCRFLD_test1 = m.scrollField( 'uiSCRFLD_test1', wordWrap=True ) self.uiSCRFLD_test2 = m.scrollField( 'uiSCRFLD_test2', wordWrap=True ) m.setParent(mainColumn) # -------- self.uiLAY_frameShelfTabLayout = self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') m.columnLayout(adjustableColumn=True) self.uiSHLTAB_test1 = m.shelfTabLayout() m.shelfLayout('test1') m.setParent('..') m.shelfLayout('test2') m.setParent('..') m.shelfLayout('test3') m.setParent('..') m.setParent('..') self.uiSHLTAB_test2 = m.shelfTabLayout() m.shelfLayout('test4') m.setParent('..') m.shelfLayout('test5') m.setParent('..') m.shelfLayout('test6') m.setParent('..') m.setParent(mainColumn) # -------- self.uiLAY_frameTabLayout = self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') m.columnLayout(adjustableColumn=True) self.uiTAB_test1 = m.tabLayout() uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout( self.uiTAB_test1, edit=True, tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),) ) self.uiTAB_test2 = m.tabLayout() uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1) m.setParent('..') uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1) m.setParent('..') m.setParent('..') m.tabLayout( self.uiTAB_test2, edit=True, tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),) ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFields = self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') m.columnLayout() m.separator(style='none', height=2) m.rowLayout(numberOfColumns=3) m.separator(width=140, style='none') self.uiTXT_test1 = m.textField('uiTXT_test1') self.uiTXT_test2 = m.textField('uiTXT_test2') m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXBTGR_test1 = m.textFieldButtonGrp( 'uiTXBTGR_test1', label='test1', buttonLabel='button1' ) self.uiTXBTGR_test2 = m.textFieldButtonGrp( 'uiTXBTGR_test2', label='test2', buttonLabel='button2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextFieldGroups = self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') m.columnLayout() m.separator(style='none', height=2) self.uiTXTGRP_test1 = m.textFieldGrp( 'uiTXTGRP_test1', label='test1' ) self.uiTXTGRP_test2 = m.textFieldGrp( 'uiTXTGRP_test2', label='test2' ) m.setParent(mainColumn) # -------- self.uiLAY_frameTextScrollLists = self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') m.columnLayout() m.rowLayout(numberOfColumns=3) m.separator(style='none', width=140) self.uiTXTLST_test1 = m.textScrollList( 'uiTXTLST_test1', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) self.uiTXTLST_test2 = m.textScrollList( 'uiTXTLST_test2', allowMultiSelection=True, append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten') ) # -------- m.setParent(uiLAY_mainForm) self.uiBTN_savePrefs = m.button( label='Save Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onSavePrefsClicked ) self.uiBTN_loadPrefs = m.button( label='Load Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onLoadPrefsClicked ) self.uiBTN_resetPrefs = m.button( label='Reset Prefs', height=MAIN_BUTTONS_HEIGHT, command=self.onResetPrefsClicked ) m.setParent('..') # -> window m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'top', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachControl=[(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_savePrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'left', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_loadPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_resetPrefs, 'top')]) m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'right', 2)]) m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)]) m.showWindow(self.window)
def SLiBBrowserUpdateShader(): cmds.optionVar(stringValue = ('SLiBThumbSizeComboBox', cmds.optionMenu('SLiBThumbSizeComboBox', query = True, value = True))) cmds.setParent(slBrowserUI) cmds.setParent(cmds.button('SLiBIconParenter', query = True, fullPathName = True, parent = True)) if cmds.scrollLayout('SLiBScrollLayout', query = True, exists = True): cmds.deleteUI('SLiBScrollLayout', layout = True) iconLayout = cmds.optionMenu('SLiBThumbSizeComboBox', query = True, value = True) iconSize = iconLayout.split('x') if len(iconSize) > 1: cmds.scrollLayout('SLiBScrollLayout', childResizable = True) if iconLayout == '64x64': cmds.rowColumnLayout(numberOfColumns = 12) if iconLayout == '128x128': cmds.rowColumnLayout(numberOfColumns = 6) if iconLayout == '256x256': cmds.rowColumnLayout(numberOfColumns = 3) else: cmds.scrollLayout('SLiBScrollLayout', childResizable = True) cmds.rowColumnLayout(numberOfColumns = 2, columnWidth=[(1, 250), (2, 250)]) assetPath = cmds.optionVar(query = 'SLiBLib') + '/' + cmds.optionMenu('SLiBCategoryComboBox', query = True, value = True) + '/' + cmds.optionMenu('SLiBTypeComboBox', query = True, value = True) assetDir = os.listdir(assetPath) cmds.optionVar(stringValue = ('SLiBIconCaption', cmds.iconTextCheckBox('SLiBIconCaption', query = True, value = True))) if len(assetDir) != 0: cmds.iconTextRadioCollection('slAssetCollection') for curAsset in assetDir: curAssetPath = assetPath + '/' + curAsset + '/' if curAsset != '.DS_Store': assetFile = os.listdir(curAssetPath) for curFile in assetFile: file = os.path.splitext(curFile)[0] fileEx = os.path.splitext(curFile)[1] if fileEx == '.mb' or fileEx == '.ma': image = curAssetPath + file + '.png' if not os.path.isfile(image): image = curAssetPath + file + '.ma.swatch' if not os.path.isfile(image): image = curAssetPath + file + '.mb.swatch' if len(iconSize) > 1: if cmds.optionVar(query = 'SLiBIconCaption') == 'True': cmds.columnLayout(rowSpacing = 6, columnWidth = int(iconSize[0])) assetIcon = cmds.iconTextRadioButton(image1 = image, height = int(iconSize[0]), width = int(iconSize[0]), onCommand = 'SLiBBrowserPy.SLiBBrowserUpdateInfo()', label = curAssetPath + curFile, annotation = file) if cmds.optionVar(query = 'SLiBIconCaption') == 'True': cmds.text(label = file, width = int(iconSize[0]), align = 'left') cmds.setParent('..') else: cmds.rowColumnLayout(numberOfColumns = 3, columnWidth = [ (1, 64), (2, 8), (3, 435)]) #assetIcon = cmds.iconTextRadioButton(image1 = image, height = 64, width = 32, label = curAssetPath + curFile, annotation = file) assetIcon = cmds.iconTextRadioButton(image1 = image, height = 64, width = 32, onCommand = 'SLiBBrowserPy.SLiBBrowserUpdateInfo()', label = curAssetPath + curFile, annotation = file) cmds.text(label = '') cmds.text(label = file, align = 'left') cmds.setParent('..') len(iconSize) > 1 cmds.optionVar(stringValue = ('SLiBCategoryComboBox', cmds.optionMenu('SLiBCategoryComboBox', query = True, value = True))) cmds.optionVar(stringValue = ('SLiBTypeComboBox', cmds.optionMenu('SLiBTypeComboBox', query = True, value = True)))