def SundayPlusSaveOptionsUI(): global plusSaveDialogUI if len(os.path.splitext(cmds.file(query = True, sceneName = True, shortName = True))[0].split('_')) > 2: SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(plusSaveDialogUI, exists = True): cmds.deleteUI(plusSaveDialogUI) plusSaveDialogUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayPlusSaveOption.ui') except: plusSaveDialogUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayPlusSaveOption.ui') cmds.textField('plusSaveAuthorLineEdit', edit = True, text = cmds.optionVar(query = 'SundayUserName')) cmds.textField('plusSaveNewSceneLineEdit', edit = True, text = os.path.splitext(cmds.file(query = True, sceneName = True, shortName = True))[0].split('_')[0]) cmds.textField('plusSaveFileVersionLineEdit', edit = True, text = int(os.path.splitext(cmds.file(query = True, sceneName = True, shortName = True))[0].split('_')[1]) + 1) curNameSplit = os.path.splitext(cmds.file(query = True, sceneName = True, shortName = True))[0].split('_') curCaption = '' for i in range(3, len(curNameSplit)): curCaption = curCaption + '_' + curNameSplit[i] cmds.textField('plusSaveNewCaptionLineEdit', edit = True, text = curCaption[1:]) cmds.textField('plusSaveHistoryCaptionLineEdit', edit = True, text = curCaption[1:]) cmds.optionMenu('plusSaveNewCaptionComboBox', edit = True, changeCommand = 'SundayPlusSavePy.SundayPlusSaveChangeNewCaption()') cmds.optionMenu('plusSaveHistoryCaptionComboBox', edit = True, changeCommand = 'SundayPlusSavePy.SundayPlusSaveChangeHistoryCaption()') cmds.showWindow(plusSaveDialogUI) if platform.system() == 'Windows': cmds.window(plusSaveDialogUI, edit = True, topLeftCorner = [ 100, 100]) else: SundayPlusSaveWrongFileConvention()
def SundayGeometryCacheImportUI(): global sundayGeometryCacheImportUI print 'SundayGeometryCacheImport' exportDir = cmds.workspace(q = True, rootDirectory = True) + 'data' cacheDir = os.listdir(exportDir) SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(sundayGeometryCacheImportUI, exists = True): cmds.deleteUI(sundayGeometryCacheImportUI) sundayGeometryCacheImportUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayGeometryCacheImport.ui') except: sundayGeometryCacheImportUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayGeometryCacheImport.ui') cmds.text('SundayGeometryCachePath', edit = True, label = exportDir) cmds.setParent(sundayGeometryCacheImportUI) cmds.setParent(cmds.button('SundayGeometryImportDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) scrollLayout = cmds.scrollLayout(childResizable = True) for curCacheDir in cacheDir: if curCacheDir.split('.')[0] != '': cmds.rowLayout(numberOfColumns = 2, adjustableColumn = 1) cmds.button(height = 26, label = curCacheDir, command = 'import SundayGeometryCachePy\nreload(SundayGeometryCachePy)\nSundayGeometryCachePy.SundayGeometryCacheImportFile("' + exportDir + os.sep + curCacheDir + '")') cmds.button(height = 26, label = 'Delete', command = 'import SundayGeometryCachePy\nreload(SundayGeometryCachePy)\nSundayGeometryCachePy.SundayGeometryCacheDelete("' + exportDir + os.sep + curCacheDir + '")') cmds.setParent('..') continue cmds.setParent(sundayGeometryCacheImportUI) cmds.setParent(cmds.button('SundayGeometryImportDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) cmds.text('sundayGeoCacheNodeLabel', edit = True, label = len(cmds.ls(type = 'cacheFile', long = True))) cmds.showWindow(sundayGeometryCacheImportUI) if platform.system() == 'Windows': cmds.window(sundayGeometryCacheImportUI, edit = True, topLeftCorner = [ 100, 100])
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])
def creat_cam(): cmds.loadUI('') #创建UI 尝试pyQT? scenesCameras=cmds.ls(cameras=1) #获取场景摄像机 隐藏默认摄像机? # 修改UI列表 显示cam if cmds.objExists('bakeCAM')!=1: cameraName=cmds.camera() cameraShape=cameraName[1] cmds.rename('cameraShape', 'bakeCAM') pass
def loadUsingCmdsAndReturnInfoDict(self, uiFile): ## Remember where stuff was printing before seFile = 'c:/users/joe/mmmmScriptEditorHistory.txt' oldStatusOfHistoryFilename = cmds.scriptEditorInfo( query=True, historyFilename=True) oldStatusOfWriteHistory = cmds.scriptEditorInfo(query=True, writeHistory=True) ## Redirect printing cmds.scriptEditorInfo(historyFilename=seFile) cmds.scriptEditorInfo(writeHistory=1) cmds.scriptEditorInfo(clearHistoryFile=True) design = cmds.loadUI(uiFile=uiFile, v=True) ## Restore remembered old print location cmds.scriptEditorInfo(historyFilename=oldStatusOfHistoryFilename) cmds.scriptEditorInfo(writeHistory=oldStatusOfWriteHistory) fh = open(seFile, 'r') printed = fh.read() fh.close() uiElements = self.splitUiPrintout(printed) result = {'design': design, 'elements': uiElements} return result
def load_ui(): current_script_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) if (cmds.window('jt_autorig', exists=True)): cmds.deleteUI('jt_autorig') window = cmds.loadUI(uiFile=os.path.join(current_script_path, 'jt_autorig.ui')) cmds.showWindow(window)
def loadUsingCmdsAndReturnInfoDict(self, uiFile): ## Remember where stuff was printing before seFile = 'c:/users/joe/mmmmScriptEditorHistory.txt' oldStatusOfHistoryFilename = cmds.scriptEditorInfo( query=True, historyFilename=True ) oldStatusOfWriteHistory = cmds.scriptEditorInfo( query=True, writeHistory=True ) ## Redirect printing cmds.scriptEditorInfo( historyFilename=seFile ) cmds.scriptEditorInfo( writeHistory=1 ) cmds.scriptEditorInfo(clearHistoryFile=True) design = cmds.loadUI( uiFile=uiFile, v=True ) ## Restore remembered old print location cmds.scriptEditorInfo( historyFilename=oldStatusOfHistoryFilename ) cmds.scriptEditorInfo( writeHistory=oldStatusOfWriteHistory ) fh = open(seFile,'r') printed = fh.read() fh.close() uiElements = self.splitUiPrintout( printed ) result = { 'design':design, 'elements':uiElements } return result
def loadUI(self, ui_file): """ Loads the UI and does an post-load commands """ # monkey patch the cmds module for use when the UI gets loaded cmds.submit_callb = partial(self.get_initial_value, self) cmds.do_submit_callb = partial(self.submit, self) if cmds.window('SubmitDialog', q=True, ex=True): cmds.deleteUI('SubmitDialog') name = cmds.loadUI(f=ui_file) cmds.textScrollList('layers', e=True, append=self.layers) # check for existing projects to determine how project selection should # be displayed num_existing_projs = cmds.optionMenu('existing_project_name', q=True, ni=True) if num_existing_projs == 0: cmds.radioButton('existing_project', e=True, en=False) else: cmds.radioButton('existing_project', e=True, en=True) # callbacks cmds.checkBox('upload_only', e=True, changeCommand=self.upload_only_toggle) cmds.checkBox('distributed', e=True, changeCommand=self.distributed_toggle) cmds.optionMenu('renderer', e=True, changeCommand=self.change_renderer) cmds.radioButton('new_project', e=True, onCommand=self.select_new_project) cmds.radioButton('existing_project', e=True, onCommand=self.select_existing_project) self.change_renderer( self.renderer ) self.select_new_project( True ) return name
def SubmitGolaemUI(): if (cmds.window('mkRenderGolaemUI', exists=True) == True): cmds.deleteUI('mkRenderGolaemUI') GolaemSubmitUI = cmds.loadUI( f='Q:/Tools/maya/2012/scripts/python/UI/mkRenderGolaemUI.ui') cmds.showWindow(GolaemSubmitUI) mkRefreshUI()
def vrayReUI(): if cmds.dockControl('vrayRendElem', exists=True): cmds.deleteUI('vrayRendElem', ctl=True) awVrayRETools = cmds.loadUI (f = 'Q:/Tools/maya/2012/scripts/python/UI/awRenderElem.ui') awVrayREPane = cmds.paneLayout (cn = 'single', parent = awVrayRETools) awVrayDock = cmds.dockControl ( 'vrayRendElem',allowedArea = ("right","left"), area = "right", floating = False ,con = awVrayRETools, label = 'Render Element tools') vrayUpdateUI()
def create(self, verbose=False): if cmds.window(self.window, exists=True): cmds.deleteUI(self.window) self.window = cmds.loadUI(uiFile=self.uiFile, verbose=verbose) cmds.showWindow(self.window)
def create(self): if cmds.window(self.window, exists=True): cmds.deleteUI(self.window); self.window = cmds.loadUI(uiFile=self.uiFile, verbose=False) cmds.showWindow(self.window); try: initPos = cmds.windowPref( self.window, query=True, topLeftCorner=True ) if initPos[0] < 0: initPos[0] = 0 if initPos[1] < 0: initPos[1] = 0 cmds.windowPref( self.window, edit=True, topLeftCorner=initPos ) except : pass ctrlPath = '|'.join([self.window, 'radioButton']); cmds.radioButton(ctrlPath, edit=True, select=True); ctrlPath = '|'.join([self.window, 'groupBox_4']); cmds.control(ctrlPath, edit=True, enable=False); ctrlPath = '|'.join([self.window, 'groupBox_2', 'pushButton_7']); cmds.button(ctrlPath, edit=True, enable=False); ctrlPath = '|'.join([self.window, 'groupBox_2', 'lineEdit']); cmds.textField(ctrlPath, edit=True, text="-u --oiio");
def build(self): if mc.window(self.ui, ex=1): mc.deleteUI(self.ui) self.ui = mc.loadUI(uiFile=self.uiFile) mc.button( 'pickFK', e=1, c=self.FKButton ) mc.button( 'pickIK', e=1, c=self.IKButton ) mc.button('switch_2', e=1, c='')
def awCreateMatteIDUI(): if (cmds.window('awAddMaterialMultiMattes', exists=True) == True): cmds.deleteUI('awAddMaterialMultiMattes') awAddMMUI = cmds.loadUI( f='Q:/Tools/maya/2012/scripts/python/UI/awAddMultiMatteUI_02.ui') cmds.showWindow(awAddMMUI) awPopulateIDUI()
def load_ui(): current_script_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) if cmds.window("jt_copy_ae_positions", exists=True): cmds.deleteUI("jt_copy_ae_positions") window = cmds.loadUI(uiFile=os.path.join(current_script_path, "jt_copy_ae_positions.ui")) cmds.showWindow(window)
def SundayWarehouseBrowserUI(): global warehouseBrowserUI if cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet': SundayDialogPy.SundayDialogConfirm('Error ', 'Warehouse path not set.\nOpen settings and set the path.', 'OK') return None SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(warehouseBrowserUI, query = True, exists = True): cmds.deleteUI(warehouseBrowserUI) warehouseBrowserUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayWarehouseBrowser.ui') except: cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet' warehouseBrowserUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayWarehouseBrowser.ui') if cmds.dockControl('sundayWarehouseBrowserDock', query = True, exists = True): cmds.deleteUI('sundayWarehouseBrowserDock') try: cmds.optionMenu('whIconViewComboBox', edit = True, value = cmds.optionVar(query = 'whIconViewComboBox')) except: cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet' cmds.setParent(cmds.button('whIconCaptionDummy', query = True, fullPathName = True, parent = True)) cmds.deleteUI('whIconCaptionDummy') cmds.iconTextCheckBox('whIconCaption', image1 = SundayImage + 'SundayImageCaption.png', changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateAssets()') cmds.setParent(warehouseBrowserUI) if cmds.optionVar(query = 'whIconCaption') == 'True': cmds.iconTextCheckBox('whIconCaption', edit = True, value = True) cmds.showWindow(warehouseBrowserUI) if platform.system() == 'Windows': cmds.window(warehouseBrowserUI, edit = True, topLeftCorner = [ 100, 100]) cmds.optionMenu('whIconViewComboBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateAssets()') cmds.optionMenu('whCategoryComboBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateType()') cmds.optionMenu('whTypeComboBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehouseBrowserUpdateAssets()') SundayWarehouseBrowserUpdate() try: cmds.deleteUI('sundayWarehouseBrowserDock') except: cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet'
def replaceCam(): main_win = 'replaceCamWin' if mc.window (main_win, exists = 1): mc.deleteUI (main_win) if mc.windowPref (main_win, exists = 1): mc.windowPref (main_win, remove = 1) win = mc.loadUI(f = '//192.168.3.250/scripts$/toonzPipe/mayaPipe/replaceCamWin.ui') mc.window(win, e = 1, tlc = [350,350]) mc.showWindow(win) mc.button('btn_importCam', e = 1, c = lambda event: importCam())
def create(self, verbose=False): if cmds.window(self.window, exists=True): cmds.deleteUI(self.window); self.window=cmds.loadUI( uiFile=self.uiFile, verbose=verbose ); cmds.showWindow(self.window);
def SundayBetweenToolUI(): global sundayControllerToolBetweenUI SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(sundayControllerToolBetweenUI, exists = True): cmds.deleteUI(sundayControllerToolBetweenUI) sundayControllerToolBetweenUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayBetweenTools.ui') except: sundayControllerToolBetweenUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayBetweenTools.ui') cmds.showWindow(sundayControllerToolBetweenUI) if platform.system() == 'Windows': cmds.window(sundayControllerToolBetweenUI, edit = True, topLeftCorner = [ 100, 100])
def build(self): uiFile = self.uiFile if mc.window(self.ui, ex=1): mc.deleteUI(self.ui) self.ui = mc.loadUI(uiFile=self.uiFile) mc.button('enter',e=1,c=self.doIt) mc.optionMenu('flowerBox',e=1,changeCommand=self.newMenuItem) mc.showWindow(self.ui)
def SLiBBrowserUI(): global slBrowserUI if cmds.optionVar(query = 'SLiBLib') == 'NoPath': SLiBDialogConfirm('Error', 'SLiB Library path not set.\nCheck Settings...', 'OK') return None SLiBGuiPath = mel.eval('getenv SLiBGui;') SLiBImage = mel.eval('getenv SLiBImage;') try: if cmds.window(slBrowserUI, query = True, exists = True): cmds.deleteUI(slBrowserUI) slBrowserUI = cmds.loadUI(uiFile = SLiBGuiPath + 'SLiBBrowser.ui') except: cmds.optionVar(query = 'SLiBLib') == 'NoPath' slBrowserUI = cmds.loadUI(uiFile = SLiBGuiPath + 'SLiBBrowser.ui') if cmds.dockControl('slBrowserDock', query = True, exists = True): cmds.deleteUI('slBrowserDock') try: cmds.optionMenu('SLiBThumbSizeComboBox', edit = True, value = cmds.optionVar(query = 'SLiBThumbSizeComboBox')) except: cmds.optionVar(query = 'SLiBLib') == 'NoPath' cmds.setParent(cmds.button('SLiB_BUTTON_Caption', query = True, fullPathName = True, parent = True)) cmds.deleteUI('SLiB_BUTTON_Caption') cmds.iconTextCheckBox('SLiBIconCaption', image = SLiBImage + 'SLiB_ic_off.png', selectionImage = SLiBImage + 'SLiB_ic_on.png', changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateShader()') cmds.setParent(slBrowserUI) if cmds.optionVar(query = 'SLiBIconCaption') == 'True': cmds.iconTextCheckBox('SLiBIconCaption', edit = True, value = True) cmds.showWindow(slBrowserUI) if platform.system() == 'Windows': cmds.window(slBrowserUI, edit = True, topEdge = True, maximizeButton = False) cmds.optionMenu('SLiBThumbSizeComboBox', edit = True, changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateShader()') cmds.optionMenu('SLiBCategoryComboBox', edit = True, changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateType()') cmds.optionMenu('SLiBTypeComboBox', edit = True, changeCommand = 'SLiBBrowserPy.SLiBBrowserUpdateShader()') SLiBBrowserUpdate() try: cmds.deleteUI('slBrowserDock') except: cmds.optionVar(query = 'SLiBLib') == 'NoPath'
def build(self, *args): if mc.window(self.ui, ex=1): mc.deleteUI(self.ui) self.ui = mc.loadUI(uiFile=self.uiFile) mc.button('killButton',e=1,c=self.initHUD) mc.button('shanButton',e=1,c=self.disableHUD) mc.button('sandiButton',e=1,c=self.sandicamera) mc.showWindow(self.ui)
def loadUI(self, ui_file): """ Loads the UI and does post-load commands. """ # # Create two new functions, cmds.submit_callb() and cmds.do_submit_callb(). # These functions are called by UI elements in resources/submit_dialog.ui. # Each UI element in that file uses these functions to query this Object # for its initial value. # # For example, the "frange" textbox calls cmds.submit_callb('frange'), # which causes its value to be set to whatever the value of self.frange # is currently set to. # # Initial values can also be function based. For example, the "renderer" dropdown # calls cmds.submit_callb('renderer'), which in turn triggers self.init_renderer(). # cmds.submit_callb = partial(self.get_initial_value, self) cmds.do_submit_callb = partial(self.submit, self) # # Delete the "SubmitDialog" window if it exists. # if cmds.window('SubmitDialog', q=True, ex=True): cmds.deleteUI('SubmitDialog') # # Load the UI file. See the init_* functions below for more info on # what each UI element does as it's loaded. # name = cmds.loadUI(f=ui_file) # # Callbacks - set up functions to be called as UI elements are modified. # cmds.radioButton('existing_project', e=True, onCommand=self.select_existing_project) cmds.radioButton('new_project', e=True, onCommand=self.select_new_project) cmds.checkBox('upload_only', e=True, changeCommand=self.upload_only_toggle) cmds.optionMenu('renderer', e=True, changeCommand=self.change_renderer) cmds.optionMenu('job_type', e=True, changeCommand=self.change_job_type) cmds.checkBox('distributed', e=True, changeCommand=self.distributed_toggle) cmds.textScrollList('layers', e=True, selectCommand=self.change_layers) # # Call a few of those callbacks now to set initial UI state. # self.change_renderer(self.renderer) self.select_new_project(True) return name
def SundayAssetExportOptionsUI(): global assetExportDialog SundayMayaGuiPath = mel.eval('getenv SundayGui;') assetExportDialog = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayAssetExportOption.ui') sceneName = cmds.file(query = True, shn = True, sn = True) assetName = sceneName.split('_') cmds.textField('assetExportNameLineEdit', edit = True, text = assetName[0]) cmds.radioButton('assetExportSelectedRadioButton', edit = True, changeCommand = 'SundayAssetExportPy.SundayAssetExportOptionsRigAndGeoCheckBoxToggle()') cmds.showWindow(assetExportDialog)
def load_ui(): current_script_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) if (cmds.window('jt_ctl_curve', exists=True)): cmds.deleteUI('jt_ctl_curve') window = cmds.loadUI(uiFile=os.path.join(current_script_path, 'jt_ctl_curve.ui')) for key in shapes.keys(): cmds.textScrollList('jt_ctl_curve_ui_list', e=True, append=key) cmds.showWindow(window)
def build(self, *args): uiFile = self.uiFile if mc.window(self.ui, ex=1): mc.deleteUI(self.ui) self.ui = mc.loadUI(uiFile=self.uiFile) mc.button('controlPick', e=1, c=self.editText) mc.button('enter',e=1,c=self.allCharacterName) mc.button('cancle', e=1, c=self.cancleWindow) mc.button('select', e=1, c=self.zeroSelect) mc.showWindow(self.ui)
def loadSandboxTabs(self, *args): self.activeTabs = [] generalTab = cmds.paneLayout('General', parent=self.saverTabLayout) generalWidget = cmds.loadUI(uiFile=data.Constants().toolPath() + '/core/handler/saver/general.ui') cmds.control(generalWidget, e=True, p=generalTab) self.setGeneralTabDefaults() self.activeTabs.append(generalTab) cmds.scrollField('saverGeneralComment_text', e=True, text=self.description)
def __init__(self): if mc.layout(self.layoutname, query=True, exists=True) == True: mc.deleteUI(self.layoutname, lay=True) if mc.layout(self.layoutname, query=True, exists=True) != True: self.windowName = mc.loadUI(f=self._UI_File) mc.showWindow(self.windowName) allowedAreas = ['right', 'left'] self.layout=mc.dockControl(area='right', content=self.windowName, l='SP_2012', w=390, h=490, allowedArea=allowedAreas) self.layoutname=mc.dockControl(self.layout,q=1,fpn=1)
def create(self, verbose=False): #verbose=True时,输出GUI中可用的小组件的信息 """Draw the window""" # delete the window if its handle exists #if cmds.window(self.window, exists=True): # cmds.deleteUI(self.window) #上面这两行可以不要,不同于windows命令,如果存在冲突,loadUI命令将自动 #递增所创建的窗口的名称,这非常类似于transform节点的命名 # initialize the window self.window = cmds.loadUI( #将.ui文件转换成maya可识别的控件 uiFile=self.uiFile, verbose=verbose) cmds.showWindow(self.window)
def FKIKRiggingWin(): ui='O:/hq_tool/Maya/hq_maya/scripts/adv5/AdvancedSkeleton5/AdvancedSkeleton5Files/icons/SkeletonRigUI.ui' if mc.window('SkeletonRigWindow',ex=1): mc.deleteUI('SkeletonRigWindow') mui=mc.loadUI(f=ui) mc.showWindow(mui) mc.button('shouldButton',e=True,c='FKIK_rigUI.ShouldButtonCommand()') mc.button('handButton',e=True,c='FKIK_rigUI.handButtonCommand()') mc.button('cleanSelLabelButton',e=True,c='FKIK_rigUI.cleanSelLabelButtonCommand()') mc.button('cleanAllLabelButton',e=True,c='FKIK_rigUI.cleanAllLabelButtonCommand()') mc.button('SekeletonRigButton',e=True,c='FKIK_rigUI.SekeletonRigButtonCommand()')
def SLiBSetupSettingsUI(): global SLiBSettingsUI SLiBGuiPath = mel.eval('getenv SLiBGui;') try: if cmds.window(SLiBSettingsUI, exists = True): cmds.deleteUI(SLiBSettingsUI) SLiBSettingsUI = cmds.loadUI(uiFile = SLiBGuiPath + 'SLiBSettings.ui') except: SLiBSettingsUI = cmds.loadUI(uiFile = SLiBGuiPath + 'SLiBSettings.ui') if platform.system() == 'Windows': cmds.textField('SLiBLibLineEdit', edit = True, text = cmds.optionVar(query = 'SLiBLib')) else: cmds.textField('SLiBLibLineEdit', edit = True, text = cmds.optionVar(query = 'SLiBLib')) cmds.showWindow(SLiBSettingsUI) if platform.system() == 'Windows': cmds.window(SLiBSettingsUI, edit = True, titleBar = True, topEdge = True)
def create(self, verbose=False): """Draw the window""" # delete the window if its handle exists if cmds.window(self.window, exists=True): cmds.deleteUI(self.window) # initialize the window self.window = cmds.loadUI( uiFile=self.uiFile, verbose=verbose ) cmds.showWindow(self.window)
def SundayGeometryCacheExportUI(): global sundayGeometryCacheExportUI SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(sundayGeometryCacheExportUI, exists = True): cmds.deleteUI(sundayGeometryCacheExportUI) sundayGeometryCacheExportUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayGeometryCacheExport.ui') except: sundayGeometryCacheExportUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayGeometryCacheExport.ui') cmds.setParent(sundayGeometryCacheExportUI) try: selected = cmds.ls(selection = True)[0].split('|') cmds.textField('geometryExportNameLineEdit', edit = True, text = selected[len(selected) - 1].replace(':', '-')) except: cmds.textField('geometryExportNameLineEdit', edit = True, text = 'CacheData') cmds.textField('geometryExportStartFrameEdit', edit = True, text = cmds.playbackOptions(query = True, min = True)) cmds.textField('geometryExportEndFrameEdit', edit = True, text = cmds.playbackOptions(query = True, max = True)) cmds.setParent(sundayGeometryCacheExportUI) cmds.setParent(cmds.button('SundayGeometryExportDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) scrollLayout = cmds.scrollLayout(childResizable = True) exportDir = cmds.workspace(q = True, rootDirectory = True) + 'data' cacheDir = os.listdir(exportDir) for curCacheDir in cacheDir: if curCacheDir.split('.')[0] != '': cmds.rowLayout(numberOfColumns = 2, adjustableColumn = 1) cmds.button(height = 26, label = curCacheDir, command = 'import SundayGeometryCachePy\nreload(SundayGeometryCachePy)\nSundayGeometryCachePy.SundayGeometryCacheExportSetCacheName("' + curCacheDir + '")') cmds.setParent('..') continue cmds.setParent(sundayGeometryCacheExportUI) cmds.setParent(cmds.button('SundayGeometryExportDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) cmds.showWindow(sundayGeometryCacheExportUI) if platform.system() == 'Windows': cmds.window(sundayGeometryCacheExportUI, edit = True, topLeftCorner = [ 100, 100])
def loadPublishTabs(self, *args): self.activeTabs = [] generalTab = cmds.paneLayout('General', parent=self.saverTabLayout) generalWidget = cmds.loadUI(uiFile=data.Constants().toolPath() + '/core/handler/saver/general.ui') cmds.control(generalWidget, e=True, p=generalTab) self.setGeneralTabDefaults() self.activeTabs.append(generalTab) # Place render publisher at the very end activeSets = cmds.ls(type='objectSet') if 'publishRender' in activeSets: activeSets = activeSets + [activeSets.pop(activeSets.index('publishRender'))] for activeSet in activeSets: if activeSet[:7] == 'publish': publisher = activeSet[7:] #if data.Constants().departments()[publisher.lower()] == __main__.activeType or data.Constants().departments()[publisher.lower()] == 'all': publisherTab = cmds.paneLayout(publisher, parent=self.saverTabLayout) uiLocation = '%s/core/handler/saver/%s.ui' %(data.Constants().toolPath(), publisher.lower()) publisherWidget = cmds.loadUI(uiFile=uiLocation) cmds.control(publisherWidget, e=True, p=publisherTab) self.activeTabs.append(publisherTab) # Load default settings if publisher.lower() == 'animation': animation.Animation().publishSettings() elif publisher.lower() == 'matchmove': matchmove.Matchmove().publishSettings() elif publisher.lower() == 'groomsim': groomSim.GroomSim().publishSettings() elif publisher.lower() == 'techanim': techAnim.TechAnim().publishSettings() elif publisher.lower() == 'render': render.Render().publishSettings() # Edit data cmds.deleteUI('saverSandboxFilename_label') cmds.deleteUI('saverSandboxFilename_lineEdit') cmds.scrollField('saverGeneralComment_text', e=True, text=self.description)
def __init__(self): self.interface = cmds.loadUI( uiFile= r'D:\Users\Justine\ATI\python\maya-python-castle\interface.ui') self.windows = cmds.showWindow(self.interface) cmds.button('buttonClose', edit=True, command=functools.partial(close_callback, self.interface)) self.slum = Slum() print(cmds.button('buttonSlum', query=True, exists=True)) cmds.button('buttonSlum', edit=True, c='scene.generateSlum()')
def SundayMayaToAEOptionsUI(): global mayaToAEOptionsUI SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(mayaToAEOptionsUI, exists = True): cmds.deleteUI(mayaToAEOptionsUI) mayaToAEOptionsUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayMayaToAEOption.ui') except: mayaToAEOptionsUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayMayaToAEOption.ui') cmds.textField('startFrameEdit', edit = True, text = cmds.playbackOptions(query = True, min = True)) cmds.textField('endFrameEdit', edit = True, text = cmds.playbackOptions(query = True, max = True)) cmds.textField('exportPathEdit', edit = True, text = os.path.dirname(cmds.file(query = True, sceneName = True)) + '/' + 'MayaToAE.ma') locatorScaleEdit = cmds.textField('locatorScaleEdit', edit = True, text = '0.001') cmds.showWindow(mayaToAEOptionsUI) if platform.system() == 'Windows': cmds.window(mayaToAEOptionsUI, edit = True, topLeftCorner = [ 100, 100])
def SundayWarehouseCreateUI(): global warehouseCreateUI if cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet': SundayDialogPy.SundayDialogConfirm('Error ', 'Warehouse path not set.\nOpen settings and set the path.', 'OK') return None SundayMayaGuiPath = mel.eval('getenv SundayGui;') try: if cmds.window(warehouseCreateUI, exists = True): cmds.deleteUI(warehouseCreateUI) warehouseCreateUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayWarehouseCreate.ui') except: cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet' warehouseCreateUI = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayWarehouseCreate.ui') cmds.setParent(warehouseCreateUI) cmds.setParent(cmds.button('warehouseIconDummyButtonToGrabParent', query = True, fullPathName = True, parent = True)) cmds.iconTextButton('iconImage', image = SundayImage + 'SundayLogoBlack_128x128.png', width = 128, height = 128) cmds.setParent(warehouseCreateUI) cmds.textField('whAuthorLineEdit', edit = True, text = cmds.optionVar(query = 'SundayUserName')) cmds.checkBox('whCreateExportColladaCheckBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehouseViewColladaCheckBoxToggle()') cmds.checkBox('whPostImportScriptCheckBox', edit = True, changeCommand = 'SundayWarehousePy.SundayWarehousePostImportPythonScriptToggle()') try: cmds.checkBox('whCreateIncludeTexturesCheckBox', edit = True, value = cmds.optionVar(query = 'SundayWarehouseIncludeTexture')) cmds.checkBox('whCreateExportColladaCheckBox', edit = True, value = cmds.optionVar(query = 'SundayWarehouseExportCollada')) cmds.checkBox('whCreateViewColladaCheckBox', edit = True, value = cmds.optionVar(query = 'SundayWarehouseViewCollada')) except: cmds.optionVar(query = 'SundayWarehousePath') == 'WarehousePathNotSet' SundayWarehouseViewColladaCheckBoxToggle() SundayWarehousePostImportPythonScriptToggle() cmds.showWindow(warehouseCreateUI) if platform.system() == 'Windows': cmds.window(warehouseCreateUI, edit = True, topLeftCorner = [ 100, 100]) SundayWarehouseCreateUpdate()
def createJntByVTX_showUI(): uipath='U:/RiggerAdderMenu/createJntByVTX/createJntByVtx.ui' if(cmds.window('weana_createJntByVtx_window',q=1,ex=1)):cmds.deleteUI('weana_createJntByVtx_window') ui = cmds.loadUI(f=uipath) cmds.showWindow(ui) # cmds.selectPref(trackSelectionOrder=True) # #cmds.button('refresh_button',e=True,command='selectRefresh()') cmds.button('createJntByVtx_button',e=True,command='createJntByVtx()') cmds.button('index_button',e=True,command='setIndex_field()') cmds.button('multCreate_button',e=True,command='multCtrateJnt()') cmds.textField('baseName_textField',e=True,text='base')
def __init__(self, *args): # first delete window if it already exists if (cmds.window('MainWindow', exists=True)): cmds.deleteUI('MainWindow') path = os.path.dirname(__file__) ui_file = path + '/ui/launcher.ui' self.ui = cmds.loadUI(f=ui_file) ## Create dock layout and tell it where it can go dockLayout = cmds.paneLayout(configuration='single', parent=self.ui) cmds.dockControl(allowedArea='all', area='right', floating=True, content=dockLayout, label='RenderBOX 1.0 Launcher') ## parent our window underneath the dock layout cmds.control(self.ui, e=True, parent=dockLayout) cmds.button( "send_PB", edit=True, command=self.sendJob )
def gui(): try: cmds.deleteUI( 'gui') except: pass try: cmds.windowPref( 'gui', remove = 1) except: pass w = cmds.loadUI( f = '/home/daniel/_ford/mayaScripts/ford_projectSelector/ford_projectSelectorGUI.ui') for k in get_shot_list(): cmds.menuItem( p = 'MayaWindow|gui|cw|vl|shotListCombo', label = k) cmds.showWindow( w)
def loadUI(self, ui_file): """ Loads the UI and does post-load commands. """ # # Create two new functions, cmds.submit_callb() and cmds.do_submit_callb(). # These functions are called by UI elements in resources/submit_dialog.ui. # Each UI element in that file uses these functions to query this Object # for its initial value. # # For example, the "frange" textbox calls cmds.submit_callb('frange'), # which causes its value to be set to whatever the value of self.frange # is currently set to. # # Initial values can also be function based. For example, the "renderer" dropdown # calls cmds.submit_callb('renderer'), which in turn triggers self.init_renderer(). # cmds.submit_callb = partial(self.get_initial_value, self) cmds.do_submit_callb = partial(self.submit, self) # # Delete the "SubmitDialog" window if it exists. # if cmds.window('SubmitDialog', q=True, ex=True): cmds.deleteUI('SubmitDialog') # # Load the UI file. See the init_* functions below for more info on # what each UI element does as it's loaded. # name = cmds.loadUI(f=ui_file) # # Callbacks - set up functions to be called as UI elements are modified. # cmds.radioButton('existing_project', e=True, onCommand=self.select_existing_project) cmds.radioButton('new_project', e=True, onCommand=self.select_new_project) cmds.checkBox('upload_only', e=True, changeCommand=self.upload_only_toggle) cmds.optionMenu('renderer', e=True, changeCommand=self.change_renderer) cmds.optionMenu('job_type', e=True, changeCommand=self.change_job_type) cmds.checkBox('distributed', e=True, changeCommand=self.distributed_toggle) cmds.textScrollList('layers', e=True, selectCommand=self.change_layers) # # Call a few of those callbacks now to set initial UI state. # self.change_renderer( self.renderer ) self.select_new_project( True ) return name
def __build__(self): while cmds.control("menuSetForm", exists=True): cmds.deleteUI("menuSetForm") widgets = cmds.layout(self.layout, q=True, ca=True) for widget in widgets: isShelfButton = cmds.shelfButton(widget, exists=True) if (not isShelfButton) and widget.find("itBtn") == -1: cmds.deleteUI(widget) try: cmds.loadUI(f=config.getPath(config.kUI, "%s.ui" % cmds.setMenuMode())) except: return cmds.shelfLayout(self.layout, e=True, position=(self.button, 1)) widgets = cmds.layout("menuSetLayout", q=True, ca=True) position = 2 for widget in widgets: width = cmds.control(widget, q=True, width=True) cmds.control(widget, e=True, parent=self.layout, width=width) cmds.shelfLayout(self.layout, e=True, position=(widget, position)) position += 1
def edo_createSoftDeformSecCtrlUI(): if cmds.window('edo_createSoftDeformSecCtrlUI', q=1, ex=1): cmds.deleteUI('edo_createSoftDeformSecCtrlUI') ui = cmds.loadUI(f=uipath) cmds.showWindow(ui) #create cmds.button('edo_createSoftDeformSecCtrl_BT01', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TF01')) cmds.button('edo_createSoftDeformSecCtrl_BT02', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TF02')) cmds.button('edo_createSoftDeformSecCtrl_BT03', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TF03')) cmds.button('edo_createSoftDeformSecCtrl_BT04', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TF04')) cmds.button('edo_createSoftDeformSecCtrl_BT05', e=1, c=partial(edo_createSoftDeformSecCtrlCmd)) #append cmds.button('edo_createSoftDeformSecCtrl_TBL01_BT01', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TBL01_TF01')) cmds.button('edo_createSoftDeformSecCtrl_TBL01_BT02', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TBL01_TF02')) cmds.button('edo_createSoftDeformSecCtrl_TBL01_BT03', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TBL01_TF03')) cmds.button('edo_createSoftDeformSecCtrl_TBL01_BT04', e=1, c=partial(edo_loadListToTF, 'edo_createSoftDeformSecCtrl_TBL01_TF04')) cmds.button('edo_createSoftDeformSecCtrl_TBL01_BT05', e=1, c=partial(edo_createSoftDeformSecCtrl_TBL01Cmd)) #transfer cmds.button('edo_transferToSkinCluster_bt', e=1, c=partial(edo_transferAllSelectedSDHtoSKJ, 0)) cmds.window(ui, e=1, wh=[350, 230])
def __init__(self): # Load the QT Designer UI file relPath = os.path.dirname(os.path.realpath(__file__)) self.UIElements = {} self.UIElements["window"] = mc.loadUI(uiFile = relPath + '/dialog.ui') # Fill in the start and end frames along with the batch number mc.textField("startFrameLineEdit", edit=True, text= str(int(mc.getAttr('defaultRenderGlobals.startFrame')))) mc.textField("endFrameLineEdit", edit=True, text= str(int(mc.getAttr('defaultRenderGlobals.endFrame')))) mc.textField("batchSizeLineEdit", edit=True, text="1") # Show the window mc.showWindow(self.UIElements["window"])
def __init__(self, *args): # first delete window if it already exists if (cmds.window('MainWindow', exists=True)): cmds.deleteUI('MainWindow') path = os.path.dirname(__file__) ui_file = path + '/ui/launcher.ui' self.ui = cmds.loadUI(f=ui_file) ## Create dock layout and tell it where it can go dockLayout = cmds.paneLayout(configuration='single', parent=self.ui) cmds.dockControl(allowedArea='all', area='right', floating=True, content=dockLayout, label='RenderBOX 1.0 Launcher') ## parent our window underneath the dock layout cmds.control(self.ui, e=True, parent=dockLayout) cmds.button("send_PB", edit=True, command=self.sendJob)
def __init__(self): self.projInfo = ppc.ProjectInfo() if not self.projInfo.validProject: utils.msgWin("Error", "Not a valid Project", False) return self.cachePipe = True if self.projInfo.pipelineType == "cache" else False if mc.window('shotManager', exists=1): mc.deleteUI('shotManager') if mc.windowPref('shotManager', exists=1): mc.windowPref('shotManager', r=1) if mc.dockControl('shotDock', q=True, exists=1): mc.deleteUI('shotDock') if mc.tabLayout("mainShotTab", ex=True): mc.deleteUI("mainShotTab") mel.eval( "global string $gMainWindow;tabLayout -parent $gMainWindow mainShotTab" ) self.win = mc.loadUI(f=shotUi) mc.control(self.win, e=1, ebg=1, p="mainShotTab") mc.tabLayout("mainShotTab", e=1, tv=0) mc.dockControl('shotDock', w=375, a='right', con="mainShotTab", aa=['right', 'left'], l='Toonz Shot Manager', vcc=self.clearDock) eporsq = "Episode : " if self.projInfo.epOrSeq == "ep" else "Sequence : " mc.text("lblEpisode", e=True, l=eporsq) breakDown = self.projInfo.breakDown self.breakDownPath = "%s/%s" % (self.projInfo.mapDrive, breakDown) self.setDept() self.deptChange() mc.optionMenu('cmbDepts', e=1, cc=lambda event: self.deptChange()) mc.optionMenu('cmbEpisode', e=1, cc=lambda event: self.loadShots()) mc.optionMenu('cmbShot', e=1, cc=lambda event: self.selectDeptVer()) mc.optionMenu('cmbDeptVer', e=1, cc=lambda event: self.loadVersions()) mc.optionMenu('cmbRetake', e=1, cc=lambda event: self.loadVersions()) mc.optionMenu('cmbCategory', e=1, cc=lambda event: self.fgbgSwitch()) mc.button('btnOpen', e=1, c=lambda event: self.openFile("file")) mc.button('btnOpenVer', e=1, c=lambda event: self.openFile("ver")) mc.button('btnImpCam', e=1, c=lambda event: self.importCamera()) mc.button('btnOpenBlast', e=1, c=lambda event: self.openBlast()) mc.button('btnCreateWs', e=1, c=lambda event: self.createWs()) mc.button('btnSaveToWs', e=1, c=lambda event: self.saveFile()) mc.button('btnSaveToLocal', e=1, c=lambda event: self.saveFile(True)) mc.checkBox('chkPlayblast', e=1, cc=lambda event: self.toggleCache()) mc.checkBox('chkCache', e=1, cc=lambda event: self.togglePb())
def __init__(self,uiFile): uiWidgetList = ['inputRenameMask','inputCounterText','inputPrefix','inputSufix','inputSearch','inputReplace','listOriginal','listPreview','updateBtn','renameBtn','replaceBtn'] self.window = 'bdMRMainWindow' if cmds.window(self.window,exists=True): cmds.deleteUI(self.window) self.window = cmds.loadUI(f=uiFile) self.uiObjects = widgetPath(self.window,uiWidgetList) cmds.showWindow(self.window) intValidator = QIntValidator() self.inputStartCounter.setValidator(intValidator) self.startCount = 1 self.inputStartCounter.setText(self.startCount) self.bdPopulateListOriginal() cmds.button(self.uiObjects['renameBtn'], edit = True, command = self.bdRenameSelected) cmds.button(self.uiObjects['updateBtn'], edit = True, command = self.bdUpdateSelected) cmds.button(self.uiObjects['replaceBtn'], edit = True, command = self.bdReplaceSelected)
def config(self): if cmds.window(self.__win_name, exists=True): cmds.deleteUI(self.__win_name, window=True) # url of ui file url = '%s/%s' % (self.__path, 'ui/rename.ui') self.__dialog = cmds.loadUI(f=url) # radio button cmds.radioButton('renameRb', edit=True, cc=self.changeAction) # buttons cmds.button('renameBt', edit=True, command=self.renameAll) cmds.button('closeBt', edit=True, command=self.close) # combobox cmds.optionMenu('patternCb', edit=1, changeCommand=self.changeMenuItem) cmds.menuItem(p='patternCb', label='#') cmds.menuItem(p='patternCb', label='##') cmds.menuItem(p='patternCb', label='###') cmds.menuItem(p='patternCb', label='####')
def config(self): if cmds.window(self.__win_name, exists=True): cmds.deleteUI(self.__win_name, window=True) # url of ui file url = '%s/%s' % (self.__path, 'ui/main.ui') self.__dialog = cmds.loadUI(f=url) # buttons cmds.button('bt_about', edit=1, command=self.credits) cmds.button('bt_add', label='Create', edit=1, command=self.addCurve) cmds.button('bt_history', edit=1, command=self.clearHistory) cmds.button('bt_freeze', edit=1, command=self.freezeTransformation) cmds.button('bt_reset', edit=1, command=self.resetTransformation) cmds.button('bt_pivot', edit=1, command=self.centerPivot) cmds.button('bt_rename', edit=1, command=self.renameFiles) cmds.button('bt_outliner', edit=1, command=self.openOutliner) cmds.button('bt_node', edit=1, command=self.openNodeEditor) cmds.button('bt_component', edit=1, command=self.openComponentEditor) cmds.button('bt_set_driven', edit=1, command=self.openSetDrivenKey) cmds.button('bt_anim_graph', edit=1, command=self.getListOfCvPoints) cmds.button('bt_close', edit=1, command=self.close) # combobox cmds.optionMenu('curves_combobox', edit=1, changeCommand=self.changeMenuItem) cmds.menuItem(p='curves_combobox', label='') cmds.menuItem(p='curves_combobox', label=Constants.SQUARE_CONTROL) cmds.menuItem(p='curves_combobox', label=Constants.CUBE_CENTER_PIVOT) cmds.menuItem(p='curves_combobox', label=Constants.CUBE_BASE_PIVOT) cmds.menuItem(p='curves_combobox', label=Constants.MOVE_CONTROL) cmds.menuItem(p='curves_combobox', label=Constants.FOOT_CONTROL) cmds.menuItem(p='curves_combobox', label=Constants.SPHERE_CONTROL) cmds.menuItem(p='curves_combobox', label=Constants.ARROW_180) # cmds.menuItem(p='curves_combobox', label=Constants.COG) # instance of Curves self.curves = Curves()
def __init__(self): #these functions are needed to call functions not possible to call by changeCommand, or command #it is not possible to call multiple functions with cc or c (and calling through self) def runPutDeptComponentsAndInvisible(*args): self.putDeptComponents() self.makeSaveInvisible() self.makeModelSceneInvisible() self.comboVersionLoad() self.changeRequests() def runCreateAsset(*pargs): self.createAsset() self.putDeptComponents() self.makeSaveVisible() def runchangeCharBgComboAndInvisible(*args): self.changeCharBgCombo() self.makeSaveInvisible() self.comboVersionLoad() self.makeModelSceneVisible() def runchangeCharBgComboAndInvisibleFromCharBg(*args): self.makeSaveInvisible() self.comboVersionLoad() self.makeModelSceneVisible() def runLoadAndVisible(*args): self.loadFile() self.makeSaveVisible() def runLoadLatestAndVisible(*args): self.loadLatestFile() self.makeSaveVisible() def runChangeVersionList(*pargs): self.makeModelSceneVisible() def saveToNWFunction(*args): self.saveToNW() def saveToWorkspaceFunction(*args): self.saveToWorkspace() def cancelCallback(*args): if cmds.window(windowID, exists=True): cmds.deleteUI(windowID) if cmds.window(windowID, exists=True): cmds.deleteUI(windowID) mainWindow = cmds.window( windowID, title='Shot Manager -- Sid',minimizeButton=False , \ maximizeButton=False, sizeable=False, resizeToFitChildren=True) self.filepathnew = None self.dictModelName = {} thewindow = cmds.loadUI(f=uiPath) cmds.control(thewindow, e=1, ebg=1) cmds.optionMenu( "deptList", e=1, changeCommand=lambda event: runPutDeptComponentsAndInvisible()) cmds.button("btnNewFile", e=1, command=lambda event: runCreateAsset()) cmds.optionMenu("charBgList", e=1, changeCommand=lambda event: runchangeCharBgComboAndInvisibleFromCharBg()) cmds.optionMenu( "sceneList", e=1, changeCommand=lambda event: runchangeCharBgComboAndInvisible()) cmds.optionMenu("versionList", e=1, changeCommand=lambda event: runChangeVersionList()) cmds.button("btnLoadVersion", e=1, command=lambda event: runLoadAndVisible()) cmds.button("btnLoadLatest", e=1, command=lambda event: runLoadLatestAndVisible()) cmds.button("btnSaveNetwork", e=1, command=lambda event: saveToNWFunction()) cmds.button("btnSaveWs", e=1, command=lambda event: saveToWorkspaceFunction()) #UI init end csvfile = open('D:\Work.Area\Siddharth-ShotManager\data.csv', 'rb') #data for new requests of assets reader = csv.reader(csvfile, delimiter=',') self.list = [] for row in reader: self.list.append(row) #add all data to assetsList #call after all UI initialisation else the objects will be unknown #for content initialisation in the UI combo boxes self.comboSceneLoad( 'char') #for entering values into the scene combo box self.changeCharBgCombo() # enter values into the model combo box self.comboVersionLoad() #for versionList initialisation self.makeSaveInvisible( ) #for making save buttons inactive - cannot save until you open a file self.makeModelSceneInvisible( ) #cannot load a file until you select from the list menu self.changeRequests() #for loading the newly requested assets cmds.showWindow()
def __init__(self, uiFile=None, **info): try: cmds.deleteUI(self.__UI[self.__class__].window) except: pass try: self.__UI[self.__class__].window.close() except: pass if self.__class__ in self.__messages: for msg in self.__messages[self.__class__]: try: om.MMessage.removeCallback(msg) except: pass self.__messages.update({self.__class__:[]}) self.__UI.update({self.__class__:self}) if uiFile: self.window = cmds.loadUI(f=config.getPath(config.kUI, "%s.ui"%uiFile)) width = cmds.window(self.window, q=True, width=True) height = cmds.window(self.window, q=True, height=True) left = (1920 - width) / 2 top = (1080 - height) / 2 cmds.windowPref(self.window, topLeftCorner=[top, left], width=width, height=height) detector = {"button" : cmds.button, "checkBox" : cmds.checkBox, "intSlider" : cmds.intSlider, "optionMenu" : cmds.optionMenu, "progressBar" : cmds.progressBar, "radioButton" : cmds.radioButton, "text" : cmds.text, "textField" : cmds.textField, "textScrollList" : cmds.textScrollList} for item in info: found = False for target in detector: if detector[target](info[item], exists=True): found = True pathList = detector[target](info[item], q=True, fpn=True).split('|') self.__setattr__(item, "%s|%s"%(self.window, '|'.join(pathList[1:]))) break if not found: if cmds.layout(info[item], exists=True): parentList = cmds.layout(info[item], q=True, parent=True).split('|') self.__setattr__(item, "%s|%s|%s"%(self.window, '|'.join(parentList[1:]), info[item])) children = cmds.layout(self.__getattribute__(item), q=True, fpn=True, ca=True) for child in children: cmds.deleteUI(child) else: try: widget = '|'.join(cmds.control(info[item], q=True, fpn=True).split("|")[1:]) self.__setattr__(item, "%s|%s"%(self.window, widget)) except: cmds.confirmDialog(message=u'未找到控件:'+info[item], icon='warning', title=u'PuTao') self.uiMessage = omui.MUiMessage.addUiDeletedCallback(self.window, self.close) cmds.showWindow(self.window) self.setupUi() else: self.uiMessage = None self.window = QMayaWindow() self.window.closed.connect(lambda *_: self.__UI.update({self.__class__:None})) self.setupUi(self.window)
def loadUI(self): self.path = PATH + 'HairSystemTool.ui' self.dialog = cmds.loadUI(uiFile = self.path) self.window = cmds.showWindow(self.dialog) self.intiUI()
text=currentLayer.maxHeight) for i in range( cmds.optionMenu(UI_Widgets['InterpType'], q=True, numberOfItems=True)): cmds.optionMenu(UI_Widgets['InterpType'], e=True, numberOfItems=True) print def generateTerrain(): print "Generating terrain..." cmds.intSlider(UI_Widgets['FeatureSizeSlider'], query=True, v=True) if 'window' in globals(): if (cmds.window(window, exists=True)): cmds.deleteUI(window) cmds.treeView(UI_Widgets['LayersList'], e=True, removeAll=True) window = cmds.loadUI( uiFile="/home/i7245143/maya/2014-x64/resources/terrain_gui.ui") cmds.textScrollList(UI_Widgets['LayersList'], e=True, selectCommand=layerSelectionChanged) cmds.showWindow(window)
def buildUI(self): ui = "kl_tools/ui/kl_toolsUI.ui" self.klToolsWindow = mc.loadUI( uiFile=(mc.internalVar(userScriptDir=True) + ui))
def __init__(self): windowState = cmds.window('saver_window', q=True, exists=True) if windowState: cmds.deleteUI('saver_window') self.firstRun = True self.description = '' self.activeUser = '******' %(__main__.activeUser.firstName, __main__.activeUser.lastName) # Load the standard UI file mayaUI = cmds.loadUI(uiFile=data.Constants().toolPath() + '/core/handler/saver/saver.ui') # Find the tab parent layout and create the actual tab layout tabParentLayout = cmds.button('saverFindLayout_button', q=True, parent=True) cmds.deleteUI('saverFindLayout_button') # Delete button after finding its layout self.saverTabLayout = cmds.tabLayout('saverTabs_tab', p=tabParentLayout) # Hook up functions cmds.radioButton('saverWork_radio', e=True, onc=self.loadWorkTabs, ofc=self.deleteTabContent) cmds.radioButton('saverSandbox_radio', e=True, onc=self.loadSandboxTabs, ofc=self.deleteTabContent) cmds.radioButton('saverPublish_radio', e=True, onc=self.loadPublishTabs, ofc=self.deleteTabContent) cmds.button('saverInitiate_button', e=True, c=self.initiate) # Initiate default setting - work tabs self.loadWorkTabs() # Set data self.activeUser = '******' %(__main__.activeUser.firstName, __main__.activeUser.lastName) sceneName = cmds.file(q=True, sn=True) if not sceneName: cmds.text('saverFilepath_label', e=True, l='Unsaved Scene') else: cmds.text('saverFilepath_label', e=True, l=sceneName) cmds.text('saverArtist_label', e=True, l=self.activeUser) cmds.text('saverCurrentStatus_label', e=True, l=__main__.activeComponent.status) try: modifiedTime = os.path.getmtime(sceneName) saveTime = datetime.fromtimestamp(modifiedTime).strftime("%d %b %Y, %H:%M:%S") cmds.text('saverLastSaved_label', e=True, l=saveTime) except: cmds.text('saverLastSaved_label', e=True, l='Never') pubPath = __main__.activeBasePath + '/published' files = os.listdir(pubPath) if files: latestFile = max(files) modifiedTime = os.path.getmtime(pubPath + '/' + latestFile) saveTime = datetime.fromtimestamp(modifiedTime).strftime("%d %b %Y, %H:%M:%S") cmds.text('saver_lastPublished', e=True, l=saveTime) else: cmds.text('saver_lastPublished', e=True, l='Never') ''' imagePath = 'https://s3-eu-west-1.amazonaws.com/kove-files/fable/projects/1001_ERK/sequences/sq010/shots/sh210/sh210_largethumb.jpg' imageLayout = cmds.button('saverFindImageLayout_button', q=True, parent=True) cmds.deleteUI('saverFindImageLayout_button') cmds.image(image=imagePath, parent=imageLayout) http://www.hdwallpapersimages.com/wp-content/uploads/2014/01/Winter-Tiger-Wild-Cat-Images.jpg ''' # Show the Window cmds.showWindow(mayaUI)
def csMainWindow(): bdWin1 = mc.loadUI(f='bdAutoRigUI.ui') mc.showWindow(bdWin1)