def gui(): ''' creates the gui for the tool ''' win = 'uvtools' if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) global scroll_list, dyn_uis myWin = pm.window(win, title='Anim UV Tool' , sizeable = True, mnb = True, width = 500, height = 400, backgroundColor= [.68,.68,.68]) pm.scrollLayout(width= 500) pm.button(label= 'Creates Nodes', command= create_nodes, width= 500) row_layout = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= [[1, 150], [2, 10], [3, 340]]) pm.columnLayout(adjustableColumn= False, width=150) scroll_list = pm.textScrollList(width= 150, height= 200, selectCommand= pm.Callback(create_ui)) pm.button(label= 'List Nodes', command= list_nodes, width= 148) pm.setParent(row_layout) pm.text(label= '') dyn_uis = pm.columnLayout(adjustableColumn= False, width= 340) # listing the nodes at start up list_nodes() myWin.show()
def gui(): file_path = os.path.dirname(__file__) basename = os.path.basename(file_path) file_name = '%s.questions' % (basename) #print file_name, basename, file_path questions_file = os.path.join(file_path, file_name) #print questions_file f = open(questions_file, 'r') info = pickle.load(f) f.close() win = 'quiz_win' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global quiz my_win = pm.window(win, title= basename, toolbox= True, width= 400, height= 600) pm.scrollLayout() quiz = Quiz(info) pm.button(label= 'Done', height= 35, command= pm.Callback(check)) my_win.show()
def gui(): file_path = os.path.dirname(__file__) basename = os.path.basename(file_path) file_name = '%s.questions' % (basename) #print file_name, basename, file_path questions_file = os.path.join(file_path, file_name) #print questions_file f = open(questions_file, 'r') info = pickle.load(f) f.close() win = 'quiz_win' if pm.window(win, exists=True): pm.deleteUI(win) if pm.windowPref(win, exists=True): pm.windowPref(win, remove=True) global quiz my_win = pm.window(win, title=basename, toolbox=True, width=400, height=600) pm.scrollLayout() quiz = Quiz(info) pm.button(label='Done', height=35, command=pm.Callback(check)) my_win.show()
def __init__(self, **kwargs): self.win = window(t= "adbrower - AutoRig v1.0" , tlb = True, s=True, rtf=True, w = 255) pm.scrollLayout(horizontalScrollBarThickness=16,verticalScrollBarThickness=16,) if pm.dockControl('adb_AutoRig', q=1, ex=1): pm.deleteUI('adb_AutoRig') self.ui() self.allgrey()
def populate_selection_layout(self): pm.setParent(self.widgets['selectionSet_vertical']) self.widgets['selectionSet_vertical'].clear() treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) if not treeViewSelected: return pm.scrollLayout(cr=True) path = os.path.abspath(treeViewSelected[0]) set_paths = [] for dir in os.listdir(path): if dir.find(self.library_objects_suffix[2]) != -1: #.set set_paths.append(os.path.abspath(os.path.join(path, dir))) for set_path in set_paths: print "create button" set_obj = Set(set_path) infos = set_obj.get_info() label = infos['name'].split('.')[0] pm.iconTextButton(style='textOnly',label=label, c=pm.Callback(self.selection_set_button_load, set_obj)) pm.popupMenu() pm.menuItem(label='Save Pose', c=pm.Callback(self.selection_set_button_save, set_obj)) pm.menuItem(label='Load Pose', c=pm.Callback(self.selection_set_button_load, set_obj)) self.widgets["selectionSet_vertical"].redistribute()
def _buildupWindow(self): if isinstance(self._window, _pmCore.uitypes.Window) and self._window.exists(self._window.name()): _pmCore.deleteUI(self._window, window=True) self._window = _pmCore.window(title=self._winTitle) _pmCore.columnLayout(adjustableColumn=True) _pmCore.scrollLayout(width=300, height=250, childResizable=True) _pmCore.gridLayout(numberOfColumns=2, cellHeight = self._iconSize, cellWidth=self._iconSize) for versionNum in _Database.getVersionList(self._fileID): versionInfo = _Database.getVersionInfo(self._fileID, versionNum) print versionInfo thumbnailPath = versionInfo[3] if not _os.path.exists(versionInfo[3]): thumbnailPath = "cube.png" button = _pmCore.iconTextButton(self._versionBtnName(versionNum), style='iconAndTextVertical', image1=thumbnailPath, label=self._versionBtnName(versionNum), command=_pmCore.Callback(self._versionSelected, versionNum)) self._uiWidget[self._versionBtnName(versionNum)] = button _pmCore.setParent('..') _pmCore.setParent('..') _pmCore.separator(style='none', height=10) _pmCore.text(label="Comments: ", align='left') self._uiWidget['commentLayout'] = _pmCore.scrollLayout(width=300, height=120, childResizable=True) _pmCore.setParent('..') _pmCore.separator(style='none', height=10) self._uiWidget['comment'] = _pmCore.scrollField(width=300, height=80) _pmCore.button(label='Add Comment', command=_pmCore.Callback(self._commentAdded))
def create_shelves_widget(pref_handler): pm.frameLayout(label='Shelf Menus') currently_pinned_shelves = set(get_pinned_shelves()) all_shelves = Shelf.get_shelves() # Create a scroller with checkboxes. # # A textScrollList looks more appropriate, but there seems to be no way to set # a single-click-multiple-select mode for that widget. pm.scrollLayout(h=150, childResizable=False) pm.columnLayout(adj=True) pm.checkBoxGrp('zmt_ShowMainShelfMenu', numberOfCheckBoxes=1, label='', label1='Show "Shelves" menu', cc=pref_handler.get_change_callback( show_shelf_menu.name)) shelf_items = [] for idx, shelf in enumerate(all_shelves): name = pm.checkBoxGrp(numberOfCheckBoxes=1, label='', label1=shelf.label, cc=pref_handler.get_change_callback( pinned_shelves.name)) shelf_items.append((shelf.label, name)) # Store the shelf checbkxes on the handler so we can access them in OptionHandler_PinnedShelves. pref_handler.shelf_items = shelf_items
def __init__(self): self.window = 'sdkflip' self.title = 'ec Set Driven Key Utility' self.width_height = (312, 289) if py.window(self.window, exists=True): py.deleteUI(self.window) py.window(self.window, title=self.title, wh=self.width_height, sizeable=False) py.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16) py.rowLayout("objRow", numberOfColumns=4, columnAlign2=("left", "right"), p="sdkflip") py.columnLayout("objCol", p="objRow") self.source_field = py.textField("sourceText", tx="Source Driver", p="objCol") py.columnLayout("objbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="objbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "sourcetxt")) py.columnLayout("tarCol", p="objRow") self.target_field = py.textField("targetText", tx="Target Driver", p="tarCol") py.columnLayout("tarbutCol", p="objRow") py.button(label="<<", width=30, height=20, p="tarbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "targettxt")) py.frameLayout("scrollFrame", label="Driver Attributes", cll=False, borderStyle="etchedIn", p="sdkflip") py.rowLayout("scrollRow", p="scrollFrame") self.scroll_list = py.textScrollList("attrList", w=300, h=200, numberOfRows=8, allowMultiSelection=True, p="scrollRow") py.rowLayout("comRow", numberOfColumns=4, p="sdkflip") py.text("preText", l="Target Prefix", p="comRow") self.prefix_field = py.textField("prefixText", tx="rt", w=70, p="comRow") py.button(label="Mirror", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, True)) py.button(label="Copy", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, False)) py.showWindow(self.window)
def MakeScrollLayout(title=None): """ Creates & returns a new PyMel scroll layout. :param title: string, title of the layout, or None. """ if(title is not None): return pm.scrollLayout(title, childResizable=True) else: return pm.scrollLayout(childResizable=True)
def __init__(self, **kwargs): self.win = pm.window(t="adbrower - Module v1.0", tlb=True, s=True, rtf=True) pm.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16, ) if pm.dockControl('adb_Module', q=1, ex=1): pm.deleteUI('adb_Module') self.ui()
def initialiseLayout(self): """ define the layout of the ui, also find every module under the TOOL_FOLDER, create a button for each module found""" #======================================================================= #DEFINE LAYOUT #======================================================================= self.widgets["toplevel_column"] = pm.columnLayout(adj=True) # ASSET LAYOUT pm.setParent(self.widgets["toplevel_column"]) pm.frameLayout(label='Asset', collapsable=False, labelVisible=False) h = pm.horizontalLayout(ratios=[1,5]) pm.text("Search :") self.widgets['assets_searchFilter_textField'] = pm.textField(cc=self.refresh_asset_textScroll) h.redistribute() pm.setParent("..") self.widgets['assets_textScroll'] = pm.textScrollList(ams=True, h=200, selectCommand=self.select_asset_callback) # IMAGE LAYOUT pm.setParent(self.widgets["toplevel_column"]) pm.frameLayout(label='Image', collapsable=True, labelVisible=True) pm.scrollLayout(h=130) pm.popupMenu() pm.menuItem(label='Open Thumbnail Directory', c=self.thumbnail_directory_open_callback) self.widgets['thumbnails_brower'] = pm.horizontalLayout() self.widgets['thumbnails_brower'].redistribute() # pm.setParent(self.widgets["toplevel_column"]) pm.frameLayout(label='Settings', collapsable=True, labelVisible=True) pm.rowColumnLayout(numberOfColumns=4) pm.text(label='Zoom', w=100) self.widgets['zoom_field'] = pm.floatField(minValue=1, value=1, precision=2, w=100) pm.separator(style='none') pm.separator(style='none') pm.text(label='Width', w=100) self.widgets['width_field'] = pm.intField(value=100, w=100) pm.text(label='Height', w=100) self.widgets['height_field'] = pm.intField(value=100, w=100) pm.text(label='Offset W', w=100) self.widgets['shiftWidth_field'] = pm.floatField( value=0, precision=2, w=100) pm.text(label='Offset H', w=100) self.widgets['shiftHeight_field'] = pm.floatField( value=0, precision=2, w=100) # pm.setParent(self.widgets["toplevel_column"]) pm.button(label='Generate Thumbnails', c=self.generate_thumbnail) #INITIAL self.refresh_asset_textScroll()
def gui(): if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) myWin = pm.window(win, title='Testing' , sizeable = True, mnb = True, width = 480, height = 900, backgroundColor = [.5, .5, .5]) pm.scrollLayout() main01 = pm.columnLayout( adjustableColumn=True ) main02 = pm.columnLayout( adjustableColumn=True ) pm.setParent(main02) # file info section pm.frameLayout(label = 'File Info', cll = True, cl = False, borderStyle = 'etchedIn', w = 480) global fileInfo fileInfo = sal.Images() pm.setParent(main02) # grade total section infoFrame = pm.frameLayout( label = 'Grades Total', cll = True, cl = True , borderStyle = 'etchedIn', w = 480 ) infoLayout = pm.formLayout() # isntancing the total grade section global totalGrades totalGrades = sal.UpperSection() totalGrades.create() pm.setParent(infoFrame) pm.button( label = 'Output Grade and Comment' , command = checkWeighting) pm.setParent(main02) pm.frameLayout( label = 'Grade', cll = True, cl = True , borderStyle = 'etchedIn', w = 480 ) mainLayout = pm.formLayout() # grading / commenting section # first intance of Section for antiAliasing / Noise Quality global antiAlising, compFocalLenght, prof antiAlising = sal.Section( name = 'Anitalias/Noise Qual', layout = mainLayout , updateCommand = totalGrades, fileRead = "/Users/Fearman/Library/Preferences/Autodesk/maya/2011-x64/scripts/proj01_antiAlisaing.txt",updateField= totalGrades.queryAnti()) section01 = antiAlising.create() # second intance of Section for Composition / Focal Lenght compFocalLenght = sal.Section( name = 'Comp/Focal Length', layout = mainLayout , updateCommand = totalGrades, fileRead = "/Users/Fearman/Library/Preferences/Autodesk/maya/2011-x64/scripts/proj01_compFocal.txt", updateField = totalGrades.queryComp(), control=section01) section02 = compFocalLenght.create() # first intance of Section for proffesionalism prof = sal.Section( name = 'Professionalism', layout = mainLayout , updateCommand = totalGrades, fileRead = "/Users/Fearman/Library/Preferences/Autodesk/maya/2011-x64/scripts/proj01_prof.txt", updateField = totalGrades.queryPro(), control=section02) section03 = prof.create() myWin.show()
def bdFrogIKFKUI(): bdFrogWin = "FrogIKFK" if pm.window(bdFrogWin,q=True,ex=True): pm.deleteUI(bdFrogWin) pm.window(bdFrogWin,title = "Frog IK <=> FK Switch", widthHeight = [280,80],sizeable=False) pm.scrollLayout(horizontalScrollBarThickness=16) mainCL = pm.columnLayout(columnAttach=("both",5),rowSpacing=10,columnWidth=280) pm.rowColumnLayout(nc=2,cw=[(1,138),(2,138)],p=mainCL) pm.button(l="Left Arm",c=bdSwitchLeftArm) pm.button(l="Right Arm",c=bdSwitchRightArm) pm.button(l="Left Leg",c=bdSwitchLeftLeg) pm.button(l="Right Leg",c=bdSwitchRightLeg) pm.text(l='Remeber to have a controller selected',p=mainCL) pm.showWindow(bdFrogWin)
def gui(): ''' Main Interface ''' win = "Layout" if pm.window(win, exists=True): pm.deleteUI(win, window=True) win = pm.window("Layout", w=300) main = pm.columnLayout() scroll = pm.scrollLayout(w=400, height=200) get_references() global asset_1, asset_2, asset_3 asset_1 = Asset_Widget(scroll, 'trafficLight') asset_2 = Asset_Widget(scroll, 'mailBox1') asset_3 = Asset_Widget(scroll, 'mailBox2') ''' asset_widget(scroll) asset_widget(scroll) asset_widget(scroll) asset_widget(scroll) ''' win.show()
def _categoryUpdated(self, add=None, rename=None, delete=None): _pmCore.setParent(self._uiWidget[_UiWidgetEnum.categoryTabLayout]) if add: # Add a tab in main asset view. childLayout = _pmCore.scrollLayout(width=300, height=200, childResizable=True) self._uiWidget[add] = _pmCore.gridLayout(numberOfColumns=3, cellHeight = self._iconSize, cellWidth=self._iconSize) _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], tabLabel=((childLayout, add),), edit=True) # Add a menu item in category list. From example in Maya doc optionMenuGrp. newMenuItem = _pmCore.menuItem(label=add, parent=self._uiWidget[_UiWidgetEnum.categoryCombox]+'|OptionMenu') self._uiWidget[_UiWidgetEnum.categoryMenuList].append(newMenuItem) if rename: tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True) childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True) _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], edit=True, tabLabel=((childLayoutList[tabNameList.index(rename[0])], rename[1]))) for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]: if _pmCore.menuItem(item, query=True, label=True) != rename[0]: continue _pmCore.menuItem(item, edit=True, label=rename[1]) break if delete: tabNameList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, tabLabel=True) childLayoutList = _pmCore.tabLayout(self._uiWidget[_UiWidgetEnum.categoryTabLayout], query=True, childArray=True) _pmCore.deleteUI(childLayoutList[tabNameList.index(delete)]) for item in self._uiWidget[_UiWidgetEnum.categoryMenuList]: if _pmCore.menuItem(item, query=True, label=True) != delete: continue _pmCore.deleteUI(item) break
def initialiseLayout(self): """ define the layout of the ui, also find every module under the TOOL_FOLDER, create a button for each module found""" logger.debug("Function Called ( %s )"%inspect.stack()[0][3]) # Define Layout self.widgets["topLevel_scroll"] = pm.scrollLayout(childResizable=True, width=self.windowWidth+25) # Add top banner to the toolbox pm.text("Animation GUI", align='center', font='boldLabelFont', height=20, bgc=[0,0,0]) #pm.text("", align='center', font='boldLabelFont', height=5, bgc=[0,0,0]) self.widgets['topLevel_tabLayout'] = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5) tab_folders = [dir for dir in os.listdir( self.top_folder_path ) if not dir.startswith("_") and dir.find('.') == -1] tab_folders = sort_with_index(tab_folders, self.top_folder_path) tab_index = 1 for tab_folder in tab_folders: pm.setParent(self.widgets["topLevel_tabLayout"]) #self.widgets['%s_frameLayout'%tab_folder] = pm.frameLayout ( label = tab_folder, collapsable = True, bgc = [0.15,0.15,0.15]) self.widgets['%s_columnLayout'%tab_folder] = pm.columnLayout(adj=True) tab_folder_path = os.path.join( self.top_folder_path, tab_folder) frame_folders = [dir for dir in os.listdir(tab_folder_path) if not dir.startswith("_") and dir.find('.')==-1] frame_folders = sort_with_index(frame_folders, tab_folder_path) logger.info ("%s|| TabLayout Created" %(tab_folder.ljust(40))) for frame_folder in frame_folders: pm.setParent(self.widgets['%s_columnLayout'%tab_folder]) self.widgets['%s_frameLayout'%frame_folder] = pm.frameLayout ( label = frame_folder, collapsable = True) self.widgets['%s_columnLayout'%frame_folder] = pm.columnLayout (adj=True) frame_folder_path = os.path.join(tab_folder_path, frame_folder) layout_folders = [dir for dir in os.listdir( frame_folder_path ) if not dir.startswith("_") and dir.find('.') == -1] layout_folders = sort_with_index(layout_folders, frame_folder_path) logger.info (" %s|| FrameLayout Created" %(frame_folder.ljust(35))) for module in layout_folders : #print "\tCreate layout for (%s.%s.%s)" %() pm.setParent(self.widgets['%s_columnLayout'%frame_folder]) try : mod = __import__ (".".join([self.top_folder, tab_folder, frame_folder, module, module]), (), (), [module]);reload(mod) mod.main() logger.info (" %s|| Layout Created" %(module.ljust(30))) except Exception, error: logger.error(' %s|| %s'%(module.ljust(30), str(error)), level='error') #print '\t\tERROR: ' + str(error) + ", skipping..." #pm.tabLayout( tabs, edit=True, tabLabel=((child1, 'One'), (child2, 'Two')) ) pm.tabLayout( self.widgets['topLevel_tabLayout'], e=True, tabLabelIndex=[tab_index, tab_folder]) tab_index += 1
def createList(self, parentWidget): self.parentWidget = parentWidget a = pm.scrollLayout(p=self.parentWidget, childResizable=True, h=200) self.widgetName = pm.flowLayout(p=a, backgroundColor=(.17, .17, .17), columnSpacing=5, h=1000, wrap=True, dropCallback=self.dropCallback) pm.popupMenu(parent=self.widgetName) pm.menuItem(label='add item', c=self.addItemCallBack)
def createRadioBtnObj( self ): """ creates a RadioButton Element """ if mel.scrollLayout(self._scrollField, ex=True): mel.setParent( self._ActionCol) mel.separator(h=10,style="none") ObjUIpath = mel.frameLayout(mw=10,l="Radio Buttons") mel.columnLayout('sampleCol') mel.separator(h=10,style="none") mel.radioButtonGrp('rbg',nrb=3, l="Big Options", select=self.gSampleState['rbg'], la3=("Option 1", "Option 2", "Option 3")) mel.radioButtonGrp('rbg2',nrb=3, l="Little Options", select=self.gSampleState['rbg'], la3=("Option 4", "Option 5", "Option 6")) mel.separator(h=10,style="none") return ObjUIpath
def createSliderObj( self ): """ creates a Slider Element """ # control=str(mel.scriptedPanel(self.__name__, # q=1,control=1)) # mel.setParent(control) # mel.setParent(self.panelUIpath) if mel.scrollLayout(self._scrollField, ex=True): # mel.setParent(control+'|'+self._scrollField+'|'+self._rowColumn) mel.setParent( self._ActionCol) mel.separator(h=10,style="none") ObjUIpath = mel.frameLayout(mw=10,l="Sliders") mel.columnLayout('sampleCol',adj=True) mel.separator(h=10,style="none") mel.floatSliderGrp('fsg1',v=self.gSampleState['fsg1'], l="Property A",f=True) mel.floatSliderGrp('fsg2',v=self.gSampleState['fsg2'], l="Property B",f=True) mel.floatSliderGrp('fsg3',v=self.gSampleState['fsg3'], l="Property C",f=True) mel.separator(h=10,style="none") # mel.setParent('..') # mel.setParent('..') return ObjUIpath
def ui_reload_tools(self, *uiargs, **kwargs): ''' Source toolbox base path for tools scripts/folders ''' if self.verbose: print '\t...Reloading tools' # TO-DO: # Add additional registration for tools which # will provide more information to the UI. # - Help Info (button) # - Neat name for button # : This will likely require a secondary # utility script to perform file parsing # possibly using the ast module for literal_eval # or using a JSON/XML format. # - Folder support ## SIMPLE VERSION ## # As the simple version, only take script files at face value and execute. # Check paths if self.ui_path.getText(): source_path = self.ui_path.getText() else: source_path = self.ui_path.getPlaceholderText() source_path = os.path.normpath(source_path) if not os.path.exists(source_path): pm.warning('The toolbox path you are trying to source does not exist.') return # Add to sys.path if source_path not in sys.path: if self.verbose: print 'Adding source path to the sys.path...' sys.path.append(source_path) if self.verbose: print 'Sourcing from: ', source_path # Find contents of folder and identify scripts. tool_dir = os.walk(source_path) tool_file_list = [x for x in tool_dir.next()[2] if not '__init__' in x] if self.verbose: print 'tool_file_list: ', tool_file_list if not tool_file_list: pm.warning('Could not find any valid tool files to add.') return # Kill old toolbox lists (archives) if self.toolbox_archive: pm.deleteUI(self.toolbox_archive) # Add UI elements which represent the files on disk. pm.setParent(self.ui_toolbox_layout) with pm.scrollLayout() as self.toolbox_archive: for tool in tool_file_list: exec_path = os.path.join(source_path, tool) if self.verbose: print exec_path pm.button( label= tool.partition('.')[0], command= pm.Callback(execfile, exec_path) )
def TheaEnvironmentCreateTab(self): log.debug("TheaEnvironmentCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "EnvScrollLayout" if self.rendererTabUiDict.has_key('environment'): self.rendererTabUiDict.pop('environment') uiDict = {} self.rendererTabUiDict['environment'] = uiDict cb = self.TheaEnvironmentUpdateTab with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Environment Lighting", collapsable=False): with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'illumination', uiType = 'enum', displayName = 'Illumination', default='0', data='NoIllumination:DomeIllumination:IBLIllumination:PhysicalSkyIllumination', uiDict=uiDict, callback=cb) self.addRenderGlobalsUIElement(attName='backgroundColor', uiType='color', displayName='Background Color', default='0.4:0.4:1.0', uiDict=uiDict) with pm.frameLayout(label="Physical Sky", collapsable=False) as uiDict['physSkyFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'turbidity', uiType = 'float', displayName = 'Turbidity', default='2.5', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'ozone', uiType = 'float', displayName = 'Ozone', default='0.35', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'waterVapor', uiType = 'float', displayName = 'Water Vapour', default='2.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'turbidityCoefficient', uiType = 'float', displayName = 'Turbidity Coeff', default='0.046', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'wavelengthExponent', uiType = 'float', displayName = 'Wavelength Exponent', default='1.3', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'albedo', uiType = 'float', displayName = 'Albedo', default='0.5', uiDict=uiDict) with pm.frameLayout(label="Physical Sun", collapsable=False) as uiDict['physSunFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'sunPolarAngle', uiType = 'float', displayName = 'Sun Polar Angle', default='-1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sunAzimuth', uiType = 'float', displayName = 'Sun Azimuth', default='-1.0', uiDict=uiDict) #self.addRenderGlobalsUIElement(attName = 'sunDirection', uiType = 'vector', displayName = 'Sun Direction', default='0:0:0', uiDict=uiDict) with pm.frameLayout(label="Time Zone", collapsable=False) as uiDict['timeZoneFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'latitude', uiType = 'float', displayName = 'Latitude', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'longitude', uiType = 'float', displayName = 'Longitude', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'timezone', uiType = 'int', displayName = 'Timezone', default='0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'date', uiType = 'string', displayName = 'Date', default='"1/6/2014"', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'localtime', uiType = 'string', displayName = 'Localtime', default='"12:00:00"', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'ior', uiType = 'float', displayName = 'IOR', default='1.0', uiDict=uiDict) with pm.frameLayout(label="IBL", collapsable=False) as uiDict['iblFrame']: with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn=True, width=400): self.addRenderGlobalsUIElement(attName = 'illuminationMap', uiType = 'color', displayName = 'Illumination Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'backgroundMap', uiType = 'color', displayName = 'Background Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'reflectionMap', uiType = 'color', displayName = 'Reflection Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'RefractionMap', uiType = 'color', displayName = 'Refraction Map', default='0:0:0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'medium', uiType = 'message', displayName = 'Medium', default='', uiDict=uiDict) # self.addRenderGlobalsUIElement(attName='useSunLightConnection', uiType='bool', displayName='Use Sun', uiDict=uiDict) # buttonLabel = "Create Sun" # suns = pm.ls("CoronaSun") # if len(suns) > 0: # buttonLabel = "Delete Sun" # uiDict['sunButton'] = pm.button(label=buttonLabel, command=self.editSun) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) self.TheaEnvironmentUpdateTab()
def uiCreate(self): self.uiClose() self.window = pm.window( WIN_NAME, title=SCRIPT_NAME, maximizeButton=False ) with self.window: with pm.formLayout() as ui_LAY_mainForm: with pm.scrollLayout(childResizable=True) as ui_LAY_mainScroll: with pm.frameLayout( label='Parameters', collapsable=True, marginHeight=3, borderStyle='etchedIn', borderVisible=True, collapse=False ): with pm.columnLayout(adjustableColumn=True, columnOffset=('both', 2)): self.ui_FLTFLDGRP_xPos = pm.floatFieldGrp(numberOfFields=1, label='+X', precision=6) self.ui_FLTFLDGRP_xNeg = pm.floatFieldGrp(numberOfFields=1, label='-X', precision=6) self.ui_FLTFLDGRP_yPos = pm.floatFieldGrp(numberOfFields=1, label='+Y', precision=6) self.ui_FLTFLDGRP_yNeg = pm.floatFieldGrp(numberOfFields=1, label='-Y', precision=6) self.ui_FLTFLDGRP_zPos = pm.floatFieldGrp(numberOfFields=1, label='+Z', precision=6) self.ui_FLTFLDGRP_zNeg = pm.floatFieldGrp(numberOfFields=1, label='-Z', precision=6) pm.separator(style='none', height=5) self.ui_BTN_create = pm.button( label='Create', height=MAIN_BUTTONS_HEIGHT, command=self.ui_on_BTN_create_clicked ) self.ui_BTN_close = pm.button( label='Close', height=MAIN_BUTTONS_HEIGHT, command=self.uiClose ) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'top', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'left', 2) ui_LAY_mainForm.attachForm(ui_LAY_mainScroll, 'right', 2) ui_LAY_mainForm.attachControl(ui_LAY_mainScroll, 'bottom', 2, self.ui_BTN_create) ui_LAY_mainForm.attachNone(self.ui_BTN_create, 'top') ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'left', 2) ui_LAY_mainForm.attachPosition(self.ui_BTN_create, 'right', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_create, 'bottom', 2) ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top') ui_LAY_mainForm.attachPosition(self.ui_BTN_close, 'left', 2, 50) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 2) ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 2) self.setupInitialValues()
def main_GUI(docked=False): global windowWidth, windowHeight, isDocked, windowName, dockedWindow, marginWidth isDocked = docked windowWidth = 390 marginWidth = windowWidth-12 windowHeight = 700 windowLabel = 'HP3D | Simple Lights GUI' windowName = 'hp3dSimpleLightsWin' # Colors global primary_componentColor, secondary_componentColor, windowColor, disabled_componentColor, frameColor primary_componentColor = [.261, .380, .393] secondary_componentColor = [.175, .198, .200] windowColor = [.300, .305, .305] disabled_componentColor = [.322, .384, .388] frameColor = [primary_componentColor[0]/1.5, primary_componentColor[1]/1.5, primary_componentColor[2]/1.5] if pm.window(windowName, q=True, ex=True): pm.deleteUI(windowName) if pm.windowPref(windowName, q=True, ex=True): pm.windowPref(windowName, r=True) if pm.dockControl(windowName, q=True, ex=True): pm.deleteUI(windowName) global window_obj window_obj = pm.window(windowName, title=windowLabel, w=windowWidth, h=windowHeight, mnb=False, mxb=False, bgc=windowColor) pm.scrollLayout(w=windowWidth+40,) pm.columnLayout() pm.rowColumnLayout(nr=2, rh=[1, 7]) pm.text(l='') # GUI SPACER pm.rowColumnLayout(nc=3, cw=[[1, 7], [3, 7]]) pm.text(l='') # GUI SPACER all_sections() pm.text(l='') # GUI SPACER if docked == False: window_obj.show() elif docked == True: allowedAreas = ['right', 'left'] dockedWindow = pm.dockControl(windowName, l=windowLabel, a='right', con=window_obj, aa=allowedAreas, visible=True)
def createList(self, parentWidget): self.parentWidget = parentWidget a = pm.scrollLayout(p=self.parentWidget, childResizable=True, h=200) self.widgetName = pm.flowLayout(p=a, backgroundColor=(.17, .17, .17), columnSpacing=5, h=1000, wrap=True) self.addMenus()
def SetupActiveModuleControls(self): existingControls = pm.columnLayout(self.UIElements["activeModuleColumn"], query = True, childArray = True) if existingControls != None: pm.deleteUI(existingControls) largeButtonSize = 100 enumOptionWidth = self.windowWidth - (2 * largeButtonSize) self.settingsLocator = "%s:SETTINGS" %self.selectedBlueprintModule activeModuleAttribute = "%s.activeModule" %self.settingsLocator currentEntries = pm.attributeQuery("activeModule", node = self.settingsLocator, listEnum = True) enable = True if currentEntries[0] == "None": enable = False self.UIElements["activeModue_rowLayout"] = pm.rowLayout(numberOfColumns = 3, adjustableColumn = 1, columnAttach3 = ("both", "both", "both"), columnWidth3 = (enumOptionWidth, largeButtonSize, largeButtonSize), parent = self.UIElements["activeModuleColumn"]) attributes = pm.listAttr(self.settingsLocator, keyable = False) weightAttributes = [] for attr in attributes: if attr.find("_weight") != -1: weightAttributes.append(attr) self.UIElements["activeModule"] = pm.attrEnumOptionMenu(label = "Active Module", width = enumOptionWidth, attribute = activeModuleAttribute, changeCommand = partial(self.ActiveModule_enumCallback, weightAttributes), enable = enable, parent = self.UIElements["activeModue_rowLayout"]) self.UIElements["keyModuleWeights"] = pm.button(label = "Key All", command = partial(self.KeyModuleWeights, weightAttributes), enable = enable, parent = self.UIElements["activeModue_rowLayout"]) self.UIElements["graphModuleWeights"] = pm.button(label = "Graph Weights", command = self.GraphModuleWeights, enable = enable, parent = self.UIElements["activeModue_rowLayout"]) self.UIElements["moduleWeights_frameLayout"] = pm.frameLayout(collapsable = True, collapse = False, label = "Module Weights", height = 100, collapseCommand = self.ModuleWeights_UICollapse, expandCommand = self.ModuleWeights_UIExpand, parent = self.UIElements["activeModuleColumn"]) pm.scrollLayout("frame_scroll", horizontalScrollBarThickness = 0, parent = self.UIElements["moduleWeights_frameLayout"]) pm.columnLayout("frameScroll_column", adjustableColumn = True, parent = "frame_scroll") pm.attrFieldSliderGrp(attribute = "%s.creationPoseWeight" %self.settingsLocator, enable = False, parent = "frameScroll_column") pm.separator(style = "in", parent = "frameScroll_column") for attr in weightAttributes: self.UIElements[attr] = pm.floatSliderGrp(label = attr, field = True, precision = 4, minValue = 0.0, maxValue = 1.0, value = pm.getAttr("%s.%s" %(self.settingsLocator, attr)), changeCommand = partial(self.ModuleWeights_sliderCallback, attr, weightAttributes), parent = "frameScroll_column") parentUIElement = self.UIElements["moduleWeights_frameLayout"] self.Create_moduleWeightScriptJob(parentUIElement, weightAttributes) self.ModuleWeights_updateMatchingButton()
def gui(path): win = 'salwindow' if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) myWin = pm.window(win, title='SAL_Grading' , sizeable = True, mnb = True, width = 490, height = 800, backgroundColor= [.68,.68,.68], toolbox= 0) main = pm.scrollLayout(width = 490) tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5, width = 490) pm.setParent(tabs) first = pm.columnLayout(adjustableColumn = True, width = 490) proj01 = sal.Project01(path).create() pm.setParent(tabs) second = pm.columnLayout(adjustableColumn = True, width = 490) proj02 = sal.Project02(path).create() pm.setParent(tabs) third = pm.columnLayout(adjustableColumn = True, width = 490) proj03 = sal.Project03(path).create() pm.setParent(tabs) fourth = pm.columnLayout(adjustableColumn = True, width = 490) proj04 = sal.Project04(path).create() pm.setParent(tabs) fith = pm.columnLayout(adjustableColumn = True, width = 490) proj05 = sal.Project05(path).create() pm.setParent(tabs) sixth = pm.columnLayout(adjustableColumn = True, width = 490) proj06 = sal.Project06(path).create() pm.setParent(tabs) seventh = pm.columnLayout(adjustableColumn = True, width = 490) proj07 = sal.Project07(path).create() pm.setParent(tabs) final = pm.columnLayout(adjustableColumn = True, width = 490) final_proj = sal.Final_Project(path).create() # ------------------------------------------ pm.tabLayout( tabs, edit=True, tabLabel=((first, 'Proj01'), (second, 'Proj02'), (third, 'Proj03 '), (fourth, 'Proj04'), (fith, 'Proj05'), (sixth, 'Proj06'), (seventh, 'Proj07'), (final, ' Final ')) ) myWin.show()
def initialize_modulesSettings(self): self.moduleListWidth = self.widthHeight[0] / 3 self.moduleOptionsWidth = self.widthHeight[0] - self.moduleListWidth - 12 self.moduleLayoutHeight = self.widthHeight[1] - 40 # creates the list of modules from Blueprints folder on the left hand side modulesLayoutSpacing = self.widthHeight[0] - self.moduleListWidth - self.moduleOptionsWidth # initializes layouts for modules list and modules options self.UIwidgets["modules_mainLayout"] = pm.columnLayout(adj=True, parent=self.UIwidgets["ui_main_layout"]) self.UIwidgets["modules_columnLayout"] = pm.rowColumnLayout( numberOfColumns=2, parent=self.UIwidgets["modules_mainLayout"] ) pm.rowColumnLayout( self.UIwidgets["modules_columnLayout"], edit=True, columnAlign=([1, "center"], [2, "center"]), columnOffset=([1, "left", 0], [3, "right", 5]), columnSpacing=[2, modulesLayoutSpacing], ) # self.UIwidgets['modulesList_scrollLayout'] = pm.scrollLayout(width = self.moduleListWidth, height = self.moduleLayoutHeight, hst = 6, vst = 6, parent = self.UIwidgets["modules_columnLayout"]) self.UIwidgets["modulesList_frameLayout"] = pm.frameLayout( w=self.moduleListWidth - 12, l="Module List", font="boldLabelFont", collapsable=False, labelIndent=self.moduleListWidth / 3.5, marginWidth=0, marginHeight=3, parent=self.UIwidgets["modules_columnLayout"], ) self.UIwidgets["modulesList_scrollLayout"] = pm.scrollLayout( width=self.moduleListWidth - 18, height=self.moduleLayoutHeight, hst=6, vst=6, parent=self.UIwidgets["modulesList_frameLayout"], ) # self.UIwidgets['modulesOptionScrollLayout'] = pm.scrollLayout(width = self.moduleOptionsWidth, height = self.moduleLayoutHeight, hst = 6, vst = 6, parent = self.UIwidgets["modules_columnLayout"]) self.UIwidgets["modulesOptions_frameLayout"] = pm.frameLayout( w=self.moduleOptionsWidth, l="Module Options", font="boldLabelFont", collapsable=False, labelIndent=self.moduleOptionsWidth / 3.35, marginWidth=3, marginHeight=3, parent=self.UIwidgets["modules_columnLayout"], ) self.initialize_moduleSettings() self.initialize_listAllModules()
def createVariableObj( self , name): """ creates a TextBox Element """ if mel.scrollLayout(self._scrollField, ex=True): mel.setParent( self._VariablesCol ) ObjUIpath = mel.button(label="button %s" % name) return ObjUIpath
def FujiRendererCreateTab(self): log.debug("FujiRendererCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query = True) pm.setUITemplate("attributeEditorTemplate", pushTemplate = True) scLo = self.rendererName + "ScrollLayout" if self.rendererTabUiDict.has_key('common'): self.rendererTabUiDict.pop('common') parentForm = pm.setParent(query = True) uiDict = {} self.rendererTabUiDict['common'] = uiDict with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn = True, width = 400): with pm.frameLayout(label="Sampling", collapsable = True, collapse=False): self.addRenderGlobalsUIElement(attName = 'sampleJitter', uiType = 'float', displayName = 'SampleJitter', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sample_time_range_min', uiType = 'float', displayName = 'Sample Time Range Min', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sample_time_range_max', uiType = 'float', displayName = 'Sample Time Range Max', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'samplesX', uiType = 'int', displayName = 'Pixel Samples x', default=3, uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'samplesY', uiType = 'int', displayName = 'Pixel Samples y', default=3, uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'cast_shadow', uiType = 'bool', displayName = 'Cast Shadows', default='true', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'max_reflect_depth', uiType = 'int', displayName = 'Max Reflection Depth', default='3', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'max_refract_depth', uiType = 'int', displayName = 'Max Refraction Depth', default='3', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_step', uiType = 'float', displayName = 'Raymarching Stepsize', default='0.05', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_shadow_step', uiType = 'float', displayName = 'Raymarching Shadow Stepsize', default='0.1', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_reflect_ste', uiType = 'float', displayName = 'Raymarching Reflection Stepsize', default='0.1', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'raymarch_refract_ste', uiType = 'float', displayName = 'Raymarching Refraction Stepsize', default='0.1', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'doMotionBlur', uiType = 'bool', displayName = 'Motionblur:', default=False, uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'doDof', uiType = 'bool', displayName = 'Depth of Field:', default=False, uiDict=uiDict) with pm.frameLayout(label="Output", collapsable = True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".imageFormat") ui = pm.attrEnumOptionMenuGrp(label = "Image Format", at=self.renderGlobalsNodeName + ".imageFormat", ei = self.getEnumList(attr)) with pm.frameLayout(label="Filtering", collapsable = True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype") ui = pm.attrEnumOptionMenuGrp(label = "Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei = self.getEnumList(attr)) ui = pm.intFieldGrp(label="Filter Size:", numberOfFields = 1) pm.connectControl(ui, self.renderGlobalsNodeName + ".filtersize", index = 2 ) with pm.frameLayout(label="Renderer", collapsable = True, collapse=False): self.addRenderGlobalsUIElement(attName = 'use_max_thread', uiType = 'bool', displayName = 'Use Max Threads', default='true', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'threads', uiType = 'int', displayName = 'Threads', default=8, uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'tilesize', uiType = 'int', displayName = 'Tile Size', default=64, uiDict=uiDict) ui = pm.intFieldGrp(label="Verbosity:", numberOfFields = 1) pm.connectControl(ui, self.renderGlobalsNodeName + ".rendererVerbosity", index = 2 ) pm.setUITemplate("attributeEditorTemplate", popTemplate = True) pm.formLayout(parentForm, edit = True, attachForm = [ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) self.FujiRendererUpdateTab()
def AppleseedEnvironmentCreateTab(self): self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "AOScrollLayout" envDict = {} self.rendererTabUiDict['environment'] = envDict uiDict = envDict with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Environment Lighting", collapsable=False): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): attr = pm.Attribute(self.renderGlobalsNodeName + ".environmentType") envDict['environmentType'] = pm.attrEnumOptionMenuGrp(label="Environment Type", at=self.renderGlobalsNodeName + ".environmentType", ei=self.getEnumList(attr)) with pm.frameLayout(label="Environment Colors", collapsable=False) as envDict['commonEnvFrame']: with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): ui = pm.floatFieldGrp(label="Environment Intensity:", value1=1.0, numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".environmentIntensity", index=2) envDict['environmentColor'] = pm.attrColorSliderGrp(label="Environment Color:", at=self.renderGlobalsNodeName + ".environmentColor") envDict['gradientHorizon'] = pm.attrColorSliderGrp(label="Gradient Horizon Color:", at=self.renderGlobalsNodeName + ".gradientHorizon") envDict['gradientZenit'] = pm.attrColorSliderGrp(label="Gradient Zenith Color:", at=self.renderGlobalsNodeName + ".gradientZenit") envDict['environmentMap'] = pm.attrColorSliderGrp(label="Environment Map:", at=self.renderGlobalsNodeName + ".environmentMap") self.addRenderGlobalsUIElement(attName='latlongHoShift', uiType='float', displayName='Lat-Long Horizontal Shift:', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='latlongVeShift', uiType='float', displayName='Lat-Long Vertical Shift:', uiDict=uiDict) with pm.frameLayout(label="Physical Sky", collapsable=False) as envDict['pysSkyFrame']: with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): attr = pm.Attribute(self.renderGlobalsNodeName + ".skyModel") envDict['pskModel'] = pm.attrEnumOptionMenuGrp(label="Sky Model:", at=self.renderGlobalsNodeName + ".skyModel", ei=self.getEnumList(attr)) uiDict['sunLightOptionMenu'] = pm.optionMenuGrp(label="Sun Light:", changeCommand=self.updateSunLightOptionMenu) envDict['pskGrAlbedo'] = pm.floatFieldGrp(label="Ground Albedo:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskGrAlbedo'], self.renderGlobalsNodeName + ".ground_albedo", index=2) envDict['pskGrHShit'] = pm.floatFieldGrp(label="Horizon Shift:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskGrHShit'], self.renderGlobalsNodeName + ".horizon_shift", index=2) envDict['pskLumMulti'] = pm.floatFieldGrp(label="Luminance Multiplier:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskLumMulti'], self.renderGlobalsNodeName + ".luminance_multiplier", index=2) envDict['pskSatMulti'] = pm.floatFieldGrp(label="Saturation Multiplier:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskSatMulti'], self.renderGlobalsNodeName + ".saturation_multiplier", index=2) envDict['pskTurb'] = pm.floatFieldGrp(label="Turbidity:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskTurb'], self.renderGlobalsNodeName + ".turbidity", index=2) envDict['pskTurbMin'] = pm.floatFieldGrp(label="Turbidity Min:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskTurbMin'], self.renderGlobalsNodeName + ".turbidity_min", index=2) envDict['pskTurbMax'] = pm.floatFieldGrp(label="Turbidity Max:", value1=1.0, numberOfFields=1) pm.connectControl(envDict['pskTurbMax'], self.renderGlobalsNodeName + ".turbidity_max", index=2) with pm.frameLayout(label="OSL", collapsable=False) as envDict['oslFrame']: with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): envDict['environmentOSL'] = pm.attrColorSliderGrp(label="OSL Background", at=self.renderGlobalsNodeName + ".environmentOSL") pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.uiCallback, tab="environment")]) pm.scriptJob(attributeChange=[self.renderGlobalsNode.skyModel, pm.Callback(self.uiCallback, tab="environment")]) self.updateEnvironment()
def MantraTranslatorCreateTab(self): log.debug("MantraTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True): mantraAttributes.mantraTranslatorATList.createUi(self.renderGlobalsNodeName) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def mainBody(self, path, mayaFalse): try: if pm.rowLayout(self.masterRow, exists=True, query=True): print 'yes' pm.deleteUI(self.masterRow, layout=True) except: print 'doesnt exist yet' print(os.listdir(path)) self.fileList = [ i for i in os.listdir(path) if os.path.isfile(os.path.join(path, i)) ] self.masterRow = pm.rowLayout(width=600, nc=5, parent=self.masterCol) spacerCol = pm.columnLayout(width=25, parent=self.masterRow) col = pm.columnLayout(width=600, parent=self.masterRow) mainBox = pm.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16, parent=col, width=500, height=600) self.radColle = pm.radioCollection() self.path = path #creating entry for each file for i in self.fileList: if '.ma' in i[-3:]: row1 = pm.rowLayout(i, nc=5, width=450, parent=mainBox) pm.image(image=str(path + '/' + i).rstrip('.ma') + '.png', height=100, width=100) column1 = pm.columnLayout(parent=row1) #writing a partial for command radioButtonChange = partial(self.fillSceneName, i) pm.radioButton(i, label=i, parent=column1, onCommand=radioButtonChange, annotation=path) radioSpacer = pm.rowLayout(nc=2) pm.text(label='', width=16, align='left', parent=radioSpacer, enable=False) pm.text('SER export', label=u'comment コメント', width=150, height=20, align='left', parent=radioSpacer, enable=False)
def gui(): snapperWindow = pm.window() pm.columnLayout() pm.frameLayout(collapsable=True, label='Create padding') pm.button(label='Create pad on joint') pm.button(label='Pad control and joint') pm.button(label='Test button') pm.setParent('..') pm.frameLayout(collapsable=True, label='Snap to...') pm.scrollLayout(height=60) pm.text(label='field') pm.text(label='field') pm.text(label='field') pm.text(label='field') pm.text(label='field') pm.text(label='field') pm.text(label='field') pm.setParent('..') pm.button() snapperWindow.show()
def KrayFinalGatheringCreateTab(self): log.debug("KrayFinalGatheringCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "PhotonsScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Photons frame", collapsable=True, collapse=False): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): ui = pm.floatFieldGrp(label="Threshold:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgThreshold", index=2) pm.separator() ui = pm.intFieldGrp(label="Min Rays:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMinRays", index=2) ui = pm.intFieldGrp(label="Max Rays:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgMaxRays", index=2) ui = pm.floatFieldGrp(label="Prerender:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPrerender", index=2) ui = pm.intFieldGrp(label="Passes:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPasses", index=2) pm.separator() ui = pm.floatFieldGrp(label="Sploth Detect:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSplotchDetect", index=2) ui = pm.floatFieldGrp(label="Sensitivity:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSensitivity", index=2) pm.separator() ui = pm.checkBoxGrp(label="FG Reflections:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgReflections", index=2) ui = pm.checkBoxGrp(label="FG Refractions:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgRefractions", index=2) pm.separator() ui = pm.floatFieldGrp(label="Spatial Tolerance:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgSpatialTolerance", index=2) ui = pm.floatFieldGrp(label="Angular Tolerance:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgAngularTolerance", index=2) ui = pm.floatFieldGrp(label="FG Min Dist:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMin", index=2) ui = pm.floatFieldGrp(label="FG Dist Max:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgDistMax", index=2) ui = pm.floatFieldGrp(label="Density/Brightness:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgBrightness", index=2) pm.separator() ui = pm.intFieldGrp(label="Path Passes:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgPathPasses", index=2) ui = pm.floatFieldGrp(label="Corner Dist:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgCornerDist", index=2) ui = pm.checkBoxGrp(label="Show Samples:", value1=False) pm.connectControl(ui, self.renderGlobalsNodeName + ".fgShowSamples", index=2) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def _addCallback(self): """Create UI and parent any editors.""" print 'ADD CALLBACK' # # Description: Create UI and parent any editors. # if not self.gSampleState.__len__() : self._createCallback() print "---->gSampleState was Empty" # restore content from database # self._scrollField = mel.scrollLayout(self._scrollField, horizontalScrollBarThickness=16, verticalScrollBarThickness=16) # mel.columnLayout('topCol',adj=True) mel.rowColumnLayout( self._rowColumn, numberOfColumns=2 ) self._ActionCol = mel.columnLayout('ActionCol',adj=True) mel.setParent('..') self._VariablesCol = mel.columnLayout('VariablesCol',adj=True)
def initialiseLayout(self): """ define the layout of the ui """ #======================================================================= # # Define Layout #======================================================================= self.widgets["top_layout"] = pm.scrollLayout(childResizable=True, width=self.windowWidth) #======================================================================= # # Define Buttons #======================================================================= self.widgets['dummy_1_btn'] = pm.button(label="Dummy Button 1", c=self.dummy_1_btn_callback) self.widgets['dummy_2_btn'] = pm.button(label="Dummy Button 2", c=self.dummy_2_btn_callback)
def gui(): ''' # gui for the script ''' win = 'shader_grading' if (pm.window(win, ex=True)): pm.deleteUI(win) if (pm.windowPref(win, ex=True)): pm.windowPref(win, remove=True) my_win = pm.window(win, title='shader_grading', width=550, height=250) main = pm.columnLayout() tab_layout = pm.tabLayout() sorter = pm.columnLayout() grader = Shader_sorter() pm.setParent(tab_layout) assigner_layout = pm.columnLayout() assigner = Shader_assign() pm.setParent(sorter) pm.tabLayout(tab_layout, edit=True, tabLabel=((sorter, 'Grade'), (assigner_layout, 'Assign'))) pm.text(label='Objects With Default Lambert', align='center', height=50, backgroundColor=[1, 0, 0], width=550) pm.scrollLayout(width=560, height=300) lambert_objs = Lambert_objects_checker() my_win.show()
def MantraTranslatorTabCreate(): log.debug("MantraTabCreate from Attribute List") reload(mantraAttributes) if len(pm.ls(type = GLOBALSNAME)) == 0: mrg = pm.createNode(GLOBALSNAME, name = GLOBALSNAME) else: mrg = pm.ls(type = GLOBALSNAME)[0] parentForm = pm.setParent(query = True) pm.setUITemplate( "attributeEditorTemplate", pushTemplate = True) pm.scrollLayout( "MantraTrScrollLayout", horizontalScrollBarThickness = 0) pm.columnLayout("MantraTrColumnLayout", adjustableColumn = True) #mantraAttributes.mantraGlobalsATList.createUi(mrg) pm.setUITemplate( "attributeEditorTemplate", popTemplate = True) pm.formLayout(parentForm, edit = True, attachForm = [ ("MantraTrScrollLayout", "top", 0), ("MantraTrScrollLayout", "bottom", 0), ("MantraTrScrollLayout", "left", 0), ("MantraTrScrollLayout", "right", 0) ])
def gui(): global orient_option, txtName, txtBaseSuffix, txtFinalSuffix TAWindow = pm.window(title="Joint Renamer", width=300, height=300) pm.scrollLayout(verticalScrollBarAlwaysVisible=True) #Frame layout 1 begin pm.frameLayout(collapsable=True, label="Joint Renamer") pm.rowLayout(numberOfColumns=2) pm.text(label="Orientation") orient_option = pm.optionMenu(width=100) pm.menuItem(label="Left") pm.menuItem(label="Center") pm.menuItem(label="Right") pm.setParent("..") pm.rowLayout(numberOfColumns=2) pm.text(label="Name") txtName = pm.textField(text="base") pm.setParent("..") pm.rowLayout(numberOfColumns=2) pm.text(label="Common suffix") txtBaseSuffix = pm.textField(text="bind") pm.setParent("..") pm.rowLayout(numberOfColumns=2) pm.text(label="Final joint suffix") txtFinalSuffix = pm.textField(text="waste") pm.setParent("..") pm.rowLayout(numberOfColumns=1) pm.button(label="Apply", command=pm.Callback(renameJoints)) pm.setParent("..") pm.setParent("..") # Frame layout 1 end TAWindow.show()
def populate_library_layout(self): pm.setParent(self.widgets['library_vertical']) self.widgets['library_vertical'].clear() treeViewSelected = pm.treeView (self.widgets["directory_treeView"], q=True, selectItem=True) if not treeViewSelected: return pm.scrollLayout(cr=True) pm.rowColumnLayout(numberOfColumns=4) path = os.path.abspath(treeViewSelected[0]) pose_paths = [] for dir in os.listdir(path): if dir.find(self.library_objects_suffix[0]) != -1: #.pose pose_paths.append(os.path.abspath(os.path.join(path, dir))) for pose_path in pose_paths: pose_obj = Pose(pose_path) infos = pose_obj.get_info() label = infos['name'].split('.')[0] image = pose_obj.thumbnail_path pm.columnLayout(adj=True) pm.iconTextButton( w=80, h=80, style='iconOnly', image=image, label=label, c=pm.Callback(self.library_button_load_pose, pose_obj)) pm.popupMenu() pm.menuItem(label='Save Pose', c=pm.Callback(self.library_button_save_pose, pose_obj)) pm.menuItem(label='Load Pose', c=pm.Callback(self.library_button_load_pose, pose_obj)) pm.text(label, bgc=[0.1,0.1,0.1]) pm.setParent('..') self.widgets["library_vertical"].redistribute()
def import_error_window(err_comps): """ An error window to display if there are unknown compnents when importing the selected components :param err_comps: :return: """ win = 'anlErrorWindow' # a function to dismiss the window def dismiss(): pm.deleteUI(win, window=True) # destroy the window if it exists if pm.window(win, exists=True): dismiss() # create the window and the size size = (300, 200) pm.window( win, wh=size, s=False, t='Unknown Components' ) main_form = pm.formLayout() # info label info_l = pm.text(label='The following components could not be found.\nThey are being ignored.', al='left') # display a list of components that could not be loaded scroll_l = pm.scrollLayout(w=size[0]) err_str = ''.join('\t- %s\n' % a for a in err_comps).rstrip() pm.text(label=err_str, al='left') # dismiss button btn = pm.button(label='OK', c=dismiss, p=main_form, h=26) # attach controls ac = [] af = [] ac.append([scroll_l, 'top', 5, info_l]) ac.append([scroll_l, 'bottom', 5, btn]) af.append([info_l, 'top', 5]) af.append([info_l, 'left', 5]) af.append([info_l, 'right', 5]) af.append([scroll_l, 'left', 0]) af.append([scroll_l, 'right', 0]) af.append([btn, 'left', 5]) af.append([btn, 'right', 5]) af.append([btn, 'bottom', 5]) pm.formLayout( main_form, e=True, attachControl=ac, attachForm=af ) # show the window pm.window(win, e=True, wh=size) pm.showWindow(win)
def UI(): """The UI """ if pm.window("selectionManagerWindow", ex=True): pm.deleteUI("selectionManagerWindow", wnd=True) selection_manager_window = pm.window( 'selectionManagerWindow', wh=(300, 200), title=("Selection Manager %s" % __version__) ) form_layout1 = pm.formLayout("selectionManager_formLayout1", nd=100) with form_layout1: button1 = pm.button(l="Add selection to List") scroll_layout1 = pm.scrollLayout("selectionManager_scrollLayout1", cr=True) with scroll_layout1: pm.gridLayout( "selectionManager_gridLayout1", nc=1, cwh=(((17 * 4) + 204), 22), aec=False, cr=False ) pm.formLayout( form_layout1, edit=True, attachForm=[ (button1, "left", 0), (button1, "right", 0), (button1, "top", 0), (scroll_layout1, "left", 0), (scroll_layout1, "right", 0), (scroll_layout1, "bottom", 0) ], attachControl=[(scroll_layout1, "top", 0, button1)], attachNone=[(button1, "bottom")]) def create_row(parent): row = SelectionRowFactory.create_row(parent) row._draw() button1.setCommand(pm.Callback(create_row, scroll_layout1)) # restore rows from Maya scene for row in SelectionRowFactory.restore_rows(scroll_layout1): row._draw() pm.showWindow(selection_manager_window)
def createList(self, parentWidget): self.parentWidget = parentWidget form = pm.formLayout(numberOfDivisions=100) a = pm.scrollLayout(childResizable=True) self.widgetName = pm.flowLayout(p=a, backgroundColor=(.17, .17, .17), columnSpacing=5, h=1000, wrap=True) pm.formLayout(form, edit=True, attachForm=[(a, 'left', 5), (a, 'bottom', 5), (a, 'right', 5), (a, 'top', 5)], attachControl=[], attachPosition=[], attachNone=()) self.addMenus()
def MantraTranslatorCreateTab(self): log.debug("MantraTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn=True): mantraAttributes.mantraTranslatorATList.createUi( self.renderGlobalsNodeName) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)])
def gui(): ''' Main Interface ''' win = pm.window(w=300) main = pm.columnLayout() scroll = pm.scrollLayout(w=400, height=200) global asset_1, asset_2, asset_3 asset_1 = Asset_Widget(scroll, 'trafficLight1') asset_2 = Asset_Widget(scroll, 'mailBox1') asset_3 = Asset_Widget(scroll, 'mailBox2') ''' asset_widget(scroll) asset_widget(scroll) asset_widget(scroll) asset_widget(scroll) ''' win.show()
def AppleseedAOVsCreateTab(self): log.debug("AppleseedAOVsCreateTab()") aovDict = {} self.rendererTabUiDict['aovs'] = aovDict pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) with pm.window() as win: scLo = "AOScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout("ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="AOVs", collapsable=True, collapse=False): with pm.columnLayout(): with pm.paneLayout(configuration="vertical2", paneSize=(1, 25, 100)): aovDict['aovSourceField'] = pm.textScrollList( "AOVSource", ams=True, append=self.aovShaders, selectCommand=pm.Callback( self.AppleseedAOVSelectCommand, "source")) aovList = self.AppleseedGetAOVConnections() aovDict['aovDestField'] = pm.textScrollList( "AOVDest", append=aovList, ams=True, dcc=self.AppleseedDoubleClickCommand, selectCommand=pm.Callback( self.AppleseedAOVSelectCommand, "dest")) aovDict['aovButton'] = pm.button( label="Selection", enable=False, c=self.AppleseedAOVButtonCommand) win.show() pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
def IndigoTranslatorCreateTab(self): log.debug("IndigoTranslatorCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query = True) pm.setUITemplate("attributeEditorTemplate", pushTemplate = True) scLo = self.rendererName + "TrScrollLayout" with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0): with pm.columnLayout(self.rendererName + "TrColumnLayout", adjustableColumn = True, width = 400): with pm.frameLayout(label="Translator", collapsable = True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".translatorVerbosity") ui = pm.attrEnumOptionMenuGrp(label = "Translator Verbosity", at=self.renderGlobalsNodeName + ".translatorVerbosity", ei = self.getEnumList(attr)) with pm.frameLayout(label="Indigo Scene File export", collapsable = True, collapse=False): ui = pm.checkBoxGrp(label="Export Indigo Scene file:", value1 = False) pm.connectControl(ui, self.renderGlobalsNodeName + ".exportSceneFile", index = 2 ) xmlDict = {} self.rendererTabUiDict['xml'] = xmlDict defaultXMLPath = pm.workspace.path + "/" + pm.sceneName().basename().split(".")[0] + ".igs" if not defaultXMLPath.dirname().exists(): defaultXMLPath.dirname().makedirs() with pm.rowLayout(nc=3): xmlDict['xmlFileText'] = pm.text(label = "Export to") xmlDict['xmlFile'] = pm.textField(text = defaultXMLPath) pm.symbolButton(image="navButtonBrowse.png", c=self.xmlFileBrowse) pm.connectControl(xmlDict['xmlFile'], self.renderGlobalsNodeName + ".exportSceneFileName", index = 2 ) with pm.frameLayout(label="Optimize Textures", collapsable = True, collapse=False): optiDict = {} ui = pm.checkBoxGrp(label="Use Optimized Textures:", value1 = False) with pm.rowLayout(nc=3): self.rendererTabUiDict['opti'] = optiDict pm.text(label="OptimizedTex Dir:") optiDict['optiField'] = pm.textField(text = self.renderGlobalsNode.optimizedTexturePath.get()) pm.symbolButton(image="navButtonBrowse.png", c=self.dirBrowse) pm.connectControl(optiDict['optiField'], self.renderGlobalsNodeName + ".optimizedTexturePath", index = 2 ) with pm.frameLayout(label="Additional Settings", collapsable = True, collapse=False): ui = pm.floatFieldGrp(label="Scene scale:", value1 = 1.0, numberOfFields = 1) pm.connectControl(ui, self.renderGlobalsNodeName + ".sceneScale", index = 2 ) pm.setUITemplate("attributeEditorTemplate", popTemplate = True) pm.formLayout(parentForm, edit = True, attachForm = [ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ])
def nicoleGUI(): global windowWidth, windowHeight, mainColumnLayout, riggingLayout windowWidth = 325 windowHeight = 600 windowName = "Rigging Toolset" if pm.dockControl("Toolset", ex = True): pm.deleteUI("Toolset", uit = True) window_object = pm.window(windowName, w = windowWidth, h = windowHeight, t = "toolSet") allowedAreas = ["right", "left"] scrollFieldColumnLayout = rcl(nc = 1) scrollField = pm.scrollLayout(w = (windowWidth)+30, h = windowHeight) mainColumnLayout = rcl(nc = 1) riggingLayout() pm.dockControl(l = "Nicole Krason's GUI", a = "right", con = window_object, aa = allowedAreas)
def IndigoEnvironmentCreateTab(self): log.debug("IndigoEnvironmentCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query = True) pm.setUITemplate("attributeEditorTemplate", pushTemplate = True) scLo = self.rendererName + "ScrollLayout" if self.rendererTabUiDict.has_key('environment'): self.rendererTabUiDict.pop('environment') uiDict = {} self.rendererTabUiDict['environment'] = uiDict with pm.scrollLayout(scLo, horizontalScrollBarThickness = 0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn = True, width = 400): with pm.frameLayout(label='Environment', collapsable = True, collapse=False): with pm.columnLayout(self.rendererName + 'ColumnLayout', adjustableColumn = True, width = 400): self.addRenderGlobalsUIElement(attName = 'environmentType', uiType = 'enum', displayName = 'Environment Type', default='0', data='Color/Map:Sun', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'environmentColor', uiType = 'color', displayName = 'Environment Color', default='0.4:0.4:1.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'environmentMapMultiplier', uiType = 'float', displayName = 'Emission Multiplier', default='10', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'environmentMapType', uiType = 'enum', displayName = 'Environment Map Type', default='0', data='Spherical:Lat-Long', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName = 'sky_model', uiType = 'enum', displayName = 'Sky Model', default='0', data='original:captured-simulation', uiDict=uiDict) buttonLabel = "Create Sun" suns = pm.ls("IndigoSun") if len(suns) > 0: buttonLabel = "Delete Sun" uiDict['sunButton'] = pm.button(label = buttonLabel, command = self.editSun) self.addRenderGlobalsUIElement(attName = 'turbidity', uiType = 'float', displayName = 'Sky Turbidity', default='2.0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'extra_atmospheric', uiType = 'bool', displayName = 'Extra Atmospheric', default='false', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sun_layer', uiType = 'int', displayName = 'Sun Layer', default='0', uiDict=uiDict) self.addRenderGlobalsUIElement(attName = 'sky_layer', uiType = 'int', displayName = 'Sky Layer', default='0', uiDict=uiDict) pm.setUITemplate("attributeEditorTemplate", popTemplate = True) pm.formLayout(parentForm, edit = True, attachForm = [ (scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0) ]) pm.scriptJob(attributeChange=[self.renderGlobalsNode.environmentType, pm.Callback(self.uiCallback, tab="environment")]) self.updateEnvironment()
def gui(): win = 'lighting' if pm.window(win, exists= True): pm.deleteUI(win) if pm.windowPref(win, exists= True): pm.windowPref(win, remove= True) global first, second my_win = pm.window(win, title= 'lighting_tools', sizeable= True, width= 400, backgroundColor= [.5, .5, .5]) main_layout = pm.scrollLayout(width= 400) tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5, width = 400) first = pm.columnLayout(adjustableColumn= True) global light_type light_type = pm.optionMenu( label='Light Type', width= 250,) pm.menuItem( label='Spot') pm.menuItem( label='Area') pm.menuItem( label='Directional') pm.menuItem( label='Point') pm.menuItem( label='Ambient') pm.menuItem( label='Volume') my_text = pm.textFieldButtonGrp('myText', label= 'light name', buttonLabel= 'create', buttonCommand= create_light, columnWidth3= [100, 100, 100]) pm.setParent(tabs) second = pm.columnLayout(adjustableColumn = True, width = 400) pm.button(label= 'Create IBL UI', command= create_ibl) pm.tabLayout( tabs, edit=True, tabLabel=((first, 'Create Lights'),(second, 'IBL UI'))) my_win.show()
def FujiRendererCreateTab(self): log.debug("FujiRendererCreateTab()") self.createGlobalsNode() parentForm = pm.setParent(query=True) pm.setUITemplate("attributeEditorTemplate", pushTemplate=True) scLo = self.rendererName + "ScrollLayout" if self.rendererTabUiDict.has_key('common'): self.rendererTabUiDict.pop('common') parentForm = pm.setParent(query=True) uiDict = {} self.rendererTabUiDict['common'] = uiDict with pm.scrollLayout(scLo, horizontalScrollBarThickness=0): with pm.columnLayout(self.rendererName + "ColumnLayout", adjustableColumn=True, width=400): with pm.frameLayout(label="Sampling", collapsable=True, collapse=False): self.addRenderGlobalsUIElement(attName='sampleJitter', uiType='float', displayName='SampleJitter', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='sample_time_range_min', uiType='float', displayName='Sample Time Range Min', default='0.0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='sample_time_range_max', uiType='float', displayName='Sample Time Range Max', default='1.0', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='samplesX', uiType='int', displayName='Pixel Samples x', default=3, uiDict=uiDict) self.addRenderGlobalsUIElement( attName='samplesY', uiType='int', displayName='Pixel Samples y', default=3, uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName='cast_shadow', uiType='bool', displayName='Cast Shadows', default='true', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='max_reflect_depth', uiType='int', displayName='Max Reflection Depth', default='3', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='max_refract_depth', uiType='int', displayName='Max Refraction Depth', default='3', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='raymarch_step', uiType='float', displayName='Raymarching Stepsize', default='0.05', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='raymarch_shadow_step', uiType='float', displayName='Raymarching Shadow Stepsize', default='0.1', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='raymarch_reflect_ste', uiType='float', displayName='Raymarching Reflection Stepsize', default='0.1', uiDict=uiDict) self.addRenderGlobalsUIElement( attName='raymarch_refract_ste', uiType='float', displayName='Raymarching Refraction Stepsize', default='0.1', uiDict=uiDict) pm.separator() self.addRenderGlobalsUIElement(attName='doMotionBlur', uiType='bool', displayName='Motionblur:', default=False, uiDict=uiDict) self.addRenderGlobalsUIElement( attName='doDof', uiType='bool', displayName='Depth of Field:', default=False, uiDict=uiDict) with pm.frameLayout(label="Output", collapsable=True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".imageFormat") ui = pm.attrEnumOptionMenuGrp( label="Image Format", at=self.renderGlobalsNodeName + ".imageFormat", ei=self.getEnumList(attr)) with pm.frameLayout(label="Filtering", collapsable=True, collapse=False): attr = pm.Attribute(self.renderGlobalsNodeName + ".filtertype") ui = pm.attrEnumOptionMenuGrp( label="Filter Type", at=self.renderGlobalsNodeName + ".filtertype", ei=self.getEnumList(attr)) ui = pm.intFieldGrp(label="Filter Size:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".filtersize", index=2) with pm.frameLayout(label="Renderer", collapsable=True, collapse=False): self.addRenderGlobalsUIElement( attName='use_max_thread', uiType='bool', displayName='Use Max Threads', default='true', uiDict=uiDict) self.addRenderGlobalsUIElement(attName='threads', uiType='int', displayName='Threads', default=8, uiDict=uiDict) self.addRenderGlobalsUIElement(attName='tilesize', uiType='int', displayName='Tile Size', default=64, uiDict=uiDict) ui = pm.intFieldGrp(label="Verbosity:", numberOfFields=1) pm.connectControl(ui, self.renderGlobalsNodeName + ".rendererVerbosity", index=2) pm.setUITemplate("attributeEditorTemplate", popTemplate=True) pm.formLayout(parentForm, edit=True, attachForm=[(scLo, "top", 0), (scLo, "bottom", 0), (scLo, "left", 0), (scLo, "right", 0)]) self.FujiRendererUpdateTab()
def gui(dir_path): if(pm.window(win, ex = True)): pm.deleteUI(win) if(pm.windowPref(win, ex = True)): pm.windowPref(win, remove = True) myWin = pm.window(win, title='sal_testing' , sizeable = True, mnb = True, width = 480, height = 900, backgroundColor= [.68,.68,.68]) pm.scrollLayout() main01 = pm.columnLayout( adjustableColumn=True ) main02 = pm.columnLayout( adjustableColumn=True ) global antiAlising, compFocalLenght, prof pm.setParent(main02) # file info section pm.setParent(main02) infoColumn = pm.columnLayout(adjustableColumn=True) global fileInfo pm.setParent(main02) # grade total section infoFrame = pm.columnLayout(adjustableColumn=True) #infoLayout = pm.formLayout() # isntancing the total grade section global totalGrades totalGrades = sal.Total_Grades() totalGrades.create() #pm.setParent(infoFrame) pm.button( label = 'Output Grade and Comment' , command = checkWeighting) pm.setParent(main02) #pm.frameLayout( label = 'Grade', cll = True, cl = True , borderStyle = 'etchedIn', w = 480 ) #mainLayout = pm.formLayout() # grading / commenting section # first intance of Section for antiAliasing / Noise Quality grading = pm.frameLayout( label= 'Grading', cll = True, cl = True , borderStyle = 'etchedIn', w = 480) pm.setParent(grading) antiAlising = sal.Grading_Section( name = 'Anitalias/Noise Qual', fileName = r"%s/Comments/proj01_antiAlisaing.txt" % dir_path, field = totalGrades.queryAnti(), toUpdate = totalGrades) section01 = antiAlising.create() pm.setParent(grading) # second intance of Section for Composition / Focal Lenght compFocalLenght = sal.Grading_Section( name = 'Comp/Focal Length', fileName = r"%s/Comments/proj01_compFocal.txt" % dir_path, field = totalGrades.queryComp(), toUpdate = totalGrades) section02 = compFocalLenght.create() pm.setParent(grading) prof = sal.Grading_Prof( name = 'Professionalism', fileName = r"%s/Comments/proj01_prof.txt" % (dir_path), field = totalGrades.queryPro(), fileStart = r"%s/Startup/proj01_start.db" % (dir_path), toUpdate = totalGrades) prof.create() # first intance of Section for proffesionalism #prof = sal.Checker( fileName= r"/Users/Fearman/Desktop/sal_package/Sartup/proj01_start") #section03 = prof.create() pm.setParent(infoColumn) fileInfo = sal.Images(prof) myWin.show()
def mermaidUI(): if(pm.window(mainWin, ex=1)): pm.deleteUI(mainWin) pm.window(mainWin, t='mermaidMainWindow', widthHeight=(380,500)) pm.scrollLayout( h=700,w=380, vis=1) #load active agent Name pm.separator(h=10,style='none',w=380) mainUI=pm.columnLayout(w=380,cal='center',adj=1) pm.separator(h=5,style='none',w=380) ###################content############################# ########################################## #1. import puppet pm.text(l='STEP 1.',al='center') pm.button(c=lambda x: mermaid.importRigPuppet(),l='import puppet',h=25) ########################################## #2. create path pm.separator(h=5,style='single',w=380) pm.text(l='STEP 2.',al='center') sectionsInput = pm.intSliderGrp('numCtrls',fmx=20, min=1, max=20, cw3=(110, 40, 165), value=4, label=' numCtrl', fmn=1, field=True, cal=(1, 'left'), adj=3) directionInput = pm.textFieldGrp('direction',cw=[(1, 110), (2, 70), (3, 70)], cal=(1, 'left'), text="+x", adj=3, label=' start frame:') pm.button(c=lambda motionCurve: mermaid.createMotionTrail(sections=sectionsInput.getValue(), direction=directionInput.getText()),l='create path',h=25) ########################################## #3. rebuild path pm.separator(h=10,style='single',w=380) pm.text(l='STEP 3.',al='center') pm.intSliderGrp('rebuildCtrls',fmx=20, min=1, max=20, cw3=(110, 40, 165), value=4, label=' numCtrl', fmn=1, field=True, cal=(1, 'left'), adj=3) motionCurve = "" attachObj = "" pm.button(c=lambda attachObj: mermaid.importRigPuppet(),l='rebuild path',h=25) pm.button(c=lambda attachObj: mermaid.resetMotionTrail(),l='reset path',h=25) ########################################## #4. connect puppet to path pm.separator(h=5,style='single',w=380) pm.text(l='STEP 4.',al='center') startframeInput = pm.intFieldGrp('start',cw=[(1, 110), (2, 70), (3, 70)], cal=(1, 'left'), value1=970, adj=3, label=' start frame:') endframeInput = pm.intFieldGrp('end',cw=[(1, 110), (2, 70), (3, 70)], cal=(1, 'left'), value1=1500, adj=3, label=' end frame:') pm.button(c=lambda x: mermaid.motionpathConformObject(motionCurve, attachObj, starttime=startframeInput.getValue(),endtime=endframeInput.getValue()),l='connect to path',h=25) ########################################## #5. snap rit to puppet pm.separator(h=5,style='single',w=380) pm.text(l='STEP 5.',al='center') pm.button(c=lambda x: mermaid.snapMermaid(),l='snap rigg to puppet',h=25) pm.showWindow(mainWin)
def buildUI(self, filter=None): count = 0 #self.form = formLayout() with pm.frameLayout(collapsable=False, label='%s (%s)' % (self.className, self.apiClassName), width=FRAME_WIDTH) as self.frame: #labelAlign='top') with pm.tabLayout() as tab: invertibles = factories.apiClassInfo[self.apiClassName].get( 'invertibles', []) usedMethods = [] with pm.formLayout() as pairdForm: tab.setTabLabel([pairdForm, 'Paired']) with pm.scrollLayout() as pairedScroll: with pm.columnLayout( visible=False, adjustableColumn=True) as pairedCol: for setMethod, getMethod in invertibles: pm.setParent(pairedCol) # column frame = pm.frameLayout(label='%s / %s' % (setMethod, getMethod), labelVisible=True, collapsable=True, collapse=True, width=FRAME_WIDTH) col2 = pm.columnLayout() pairCount = 0 pairCount += self.rows[setMethod].buildUI( filter) pairCount += self.rows[getMethod].buildUI( filter) usedMethods += [setMethod, getMethod] if pairCount == 0: #deleteUI(col2) frame.setVisible(False) frame.setHeight(1) count += pairCount pairedCol.setVisible(True) pairdForm.attachForm(pairedScroll, 'top', 5) pairdForm.attachForm(pairedScroll, 'left', 5) pairdForm.attachForm(pairedScroll, 'right', 5) pairdForm.attachForm(pairedScroll, 'bottom', 5) with pm.formLayout() as unpairedForm: tab.setTabLabel([unpairedForm, 'Unpaired']) with pm.scrollLayout() as unpairedScroll: with pm.columnLayout(visible=False) as unpairedCol: # For some reason, on linux, the unpairedCol height is wrong... # track + set it ourselves unpairedHeight = 10 # a little extra buffer... #rowSpace = unpairedCol.getRowSpacing() for methodName in sorted(self.classInfo.keys()): pm.setParent(unpairedCol) if methodName not in usedMethods: frame = pm.frameLayout(label=methodName, labelVisible=True, collapsable=True, collapse=True, width=FRAME_WIDTH) col2 = pm.columnLayout() count += self.rows[methodName].buildUI( filter) unpairedHeight += self.rows[ methodName].frame.getHeight( ) # + rowSpace unpairedCol.setHeight(unpairedHeight) #self.form.attachForm( self.frame, 'left', 2) #self.form.attachForm( self.frame, 'right', 2) #self.form.attachForm( self.frame, 'top', 2) #self.form.attachForm( self.frame, 'bottom', 2) unpairedCol.setVisible(True) unpairedForm.attachForm(unpairedScroll, 'top', 5) unpairedForm.attachForm(unpairedScroll, 'left', 5) unpairedForm.attachForm(unpairedScroll, 'right', 5) unpairedForm.attachForm(unpairedScroll, 'bottom', 5) return self.frame
def show_UI(self): # Init main window if (pm.window("main_window", exists=True)): pm.deleteUI("main_window") self.main_window = pm.window(t=MAIN_WINDOW_TITLE, wh=MAIN_WINDOW_DIMENSIONS, s=MAIN_WINDOW_RESIZEABLE) # Main vertical layout window_v_layout = pm.columnLayout(adj=True, rs=MAIN_WINDOW_CONTENT_SPACING, h=MAIN_WINDOW_DIMENSIONS[1]) # Checklist scroll layout checklist_scroll_layout = pm.scrollLayout(cr=True) # Checklist vertical layout checklist_vertical_layout = pm.columnLayout(adj=True) # Checklist header checklist_frame_layout = pm.frameLayout(l='Checker Options') opVars = pm.language.Env.optionVars # Show function checklist for fn_name in self.lookup_order: # If option is in opVars, use that value # Otherwise, use default value fn = self.functions[fn_name] if fn_name in opVars: option = opVars[fn_name] self.options[fn_name] = option else: option = self.options[fn_name] # Per-row layout checklist_row_layout = pm.rowLayout(nc=2, cl2=('right', 'center'), cw2=CHECKLIST_COLUMN_WIDTHS) # Function description label pm.text(l=fn.desc, align='right') # Begin radio buttons radio_row_layout = pm.rowLayout(nc=3) collection = pm.radioCollection() # Draw skip radio button set_skip = pm.Callback(self.set_option, fn_name, self.checker_option.SKIP) skip_button = pm.radioButton(l='Skip', onc=set_skip) # Draw check radio button if fn.checkFn: set_check = pm.Callback(self.set_option, fn_name, self.checker_option.CHECK) check_button = pm.radioButton(l='Check', onc=set_check) # Draw cleanup radio button if fn.cleanupFn: set_cleanup = pm.Callback(self.set_option, fn_name, self.checker_option.CLEANUP) cleanup_button = pm.radioButton(l='Cleanup', onc=set_cleanup) # End radio row collection pm.setParent('..') # End radio row layout pm.setParent('..') # End per-row layout pm.setParent('..') # Set selected radio button based on selected option if option is self.checker_option.SKIP: selected = skip_button elif option is self.checker_option.CHECK: selected = check_button else: selected = cleanup_button pm.radioCollection(collection, edit=True, select=selected) # End checklist vertical layout pm.setParent('..') # End checklist scroll layout pm.setParent('..') log_frame_layout = pm.frameLayout(l='Log Output') # Start log scroll layout log_scroll_layout = pm.scrollLayout(cr=True, h=LOG_SCROLL_AREA_HEIGHT) # Log text object # The -32 is prevent the horizontal scrollbar from appearing self.log_text = pm.text(l=self.log_results, h=MAX_LOG_HEIGHT, al='left', w=MAIN_WINDOW_DIMENSIONS[0] - 32, ww=True) # End log scroll layout pm.setParent('..') pm.setParent('..') # Start button horizontal layout button_h_layout = pm.rowLayout(nc=3, cw3=(128, 128, 128), ct3=('both', 'both', 'both'), h=MAIN_BUTTON_AREA_HEIGHT) # If Run and Export Selected, check and attempt to export pm.button(l='Run and Export Selected', c=self.check_and_export) # If Check/Cleanup, run check and cleanup pm.button(l='Run', c=self.check) # If Cancel, close the window pm.button(l='Close', c=self.close_main_window) # End button horizontal layout pm.setParent('..') # End main vertical layout pm.setParent('..') pm.showWindow(self.main_window)