def createPreviewLayout(self): print("ML Log: createPreviewLayout") # Create tab layout. tabLayout = cmds.tabLayout(borderStyle="full") # Add horizontal and vertical flow layouts and # spacers to center the image in the preview area. flowLayout = cmds.flowLayout("RPRPreviewArea") cmds.canvas("RPRHSpacer", width=1, height=1) cmds.flowLayout("RPRPreviewFlow", vertical=True) cmds.canvas("RPRVSpacer", width=1, height=1) cmds.iconTextStaticLabel("RPRPreviewImage", style='iconOnly', width=1, height=1) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') # Assign the top flow layout to the tab. cmds.tabLayout(tabLayout, edit=True, tabLabel=((flowLayout, 'Preview')))
def expose_list(self,tabAnchor,rootData): samplingConnections = rootData[0] caption = rootData[1] mc.textField( tx=caption,ed=False ,p=tabAnchor , font="boldLabelFont",bgc=[0.8,0.8,0.8]) mc.optionMenu( label=' Options: ' ,p=tabAnchor , w=432 -30) mc.menuItem( label='select' ) mc.menuItem( label='connect' ) mc.menuItem( label='swap' ) mc.menuItem( label='constraint' ) mc.menuItem( label='Manage Input' ) scrollWdth = mc.scrollLayout( horizontalScrollBarThickness=0,verticalScrollBarThickness=8, p=tabAnchor ,h=150,childResizable=True ) inputIdxList = mc.getAttr(samplingConnections,mi=True ) ctrlHgt = 24 for idx in inputIdxList: input = mc.listConnections(samplingConnections+'[%s]'%idx) if input is not None and len(input)>0: input = input[0] else: input = samplingConnections+'[%s]'%idx mc.separator(style='none', p=scrollWdth,h=6 ) mc.flowLayout( columnSpacing=4 , p=scrollWdth ) fldLnk = mc.textField( tx=input,ed=False ,w=395 -30,h=ctrlHgt) mc.popupMenu( button=3 ,p=fldLnk) mc.menuItem(l='moveUP' ) mc.menuItem(l='moveDown' ) mc.menuItem(l='Delete' ) mc.button( label='<')
def displayWindow(): menu = cmds.window(title="Game Of Life Tool", iconName='GOLTool', widthHeight=(350, 400)) scrollLayout = cmds.scrollLayout(verticalScrollBarThickness=16) cmds.flowLayout(columnSpacing=10) cmds.columnLayout(cat=('both', 25), rs=10, cw=340) cmds.text( l= "\nThis is the \"Game of Life Tool\"! Use this tool to run Conway's Game of Life on a the surface of a selected polygonal object [input] given a starting seed pattern of selected vertices [selection]. A polygon object and seed vertices are needed.\n\n", ww=True, al="left") cmds.text( l= "To run:\n1) Select the reference vertices for the seed.\n2) Input the information in the fields below.\n3) Click \"Run\".", al="left") cmds.text(label='Enter the time at which to start the animation:', al='left', ww=True) startTimeField = cmds.textField() cmds.text(label='Enter the time at which to end the animation:', al='left', ww=True) endTimeField = cmds.textField() cmds.text( label= 'Enter the step time greater than 2 (this affects the speed of the animation):', al='left', ww=True) stepTimeField = cmds.textField() cmds.button(label='Run', command=partial(startGame, menu, startTimeField, endTimeField, stepTimeField)) cmds.text(l="\n", al='left') cmds.showWindow(menu)
def startBlock(self,m=1,n=1): #currently i will just make basic layou using the rawLayout # columnWidth=[] # for i in range(1,m): # columnWidth.append([i,80])#[(1, 60), (2, 80), (3, 100)] # cmds.rowColumnLayout(numberOfColumns=m,columnWidth=columnWidth) # cmds.flowLayout(wr=True) if not self.inNotebook and self.notebook is not None: if self.afterNoteBook is None: c=self.afterNoteBook = cmds.flowLayout(wr=True,p=self.form) cmds.formLayout( self.form, edit=True, attachForm=((c, 'left', 0),(c, 'bottom', 0), (c, 'right', 0)),attachControl = ((c,'top',5,self.notebook["id"])) ) if m==0: c=cmds.flowLayout(wr=True,w=self.w*self.scale,p=self.afterNoteBook) else : c=cmds.rowLayout(numberOfColumns=m,w=self.w*self.scale,p=self.afterNoteBook) else : # if self.mainlayout is None: # c=self.mainlayout = cmds.scrollLayout('scrollLayout',p=self.form)#cmds.flowLayout(wr=True,p=self.form) # cmds.formLayout( self.form, edit=True, attachForm=((c, 'left', 0),(c, 'bottom', 0), # (c, 'right', 0),(c, 'top', 0),) ) if m==0: cmds.flowLayout(wr=True,w=self.w*self.scale)#,p=self.mainlayout) else : cmds.rowLayout(numberOfColumns=m,w=self.w*self.scale)#,p=self.mainlayout)
def __init__(self): """ Create a dictionary to store UI elements """ self.UIElements = {} """ Check to see if the UI exists """ self.windowName = "Window" if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) """ Define UI elements width and height """ self.windowWidth = 240 self.windowHeight = 200 buttonWidth = 100 buttonHeight = 30 """ Define a window""" self.UIElements["window"] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight, title="Window", sizeable=True) self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=False, width=220, height=self.windowHeight, bgc=[0.2, 0.2, 0.2]) """ Use a flow layout for the UI """ self.UIElements["guiFlowLayout2"] = cmds.flowLayout(v=True, width=110, height=self.windowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["guiFlowLayout1"]) self.UIElements["guiFlowLayout3"] = cmds.flowLayout(v=True, width=110, height=self.windowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["guiFlowLayout1"]) arttools = os.environ["GTOOLS"] lytWtPath = arttools + "/RG_Parts/Parts_Maya/Widgets/Layout/" """ for widget in self.returnWidgets(lytWtPath): print widget mod = __import__("Widgets.Layout."+widget, {}, {}, [widget]) reload(mod) title = mod.TITLE description = mod.DESCRIPTION classname = mod.CLASS_NAME cmds.separator(p=self.UIElements["guiFlowLayout2"]) self.UIElements["module_button_"+widget] = cmds.button(label=title, width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout2"], command=partial(self.installWidget, widget)) """ rigWtPath = arttools + "/RG_Parts/Parts_Maya/Widgets/Rigging/" for widget in self.returnWidgets(rigWtPath): print widget mod = __import__("Widgets.Rigging."+widget, {}, {}, [widget]) reload(mod) title = mod.TITLE description = mod.DESCRIPTION classname = mod.CLASS_NAME cmds.separator(p=self.UIElements["guiFlowLayout3"]) self.UIElements["module_button_"+widget] = cmds.button(label=title, width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout3"], command=partial(self.installWidget, widget)) """ Show the window""" cmds.showWindow(self.windowName)
def ui(self, *args): """ Check to see if the UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ Define width and height for buttons and windows""" windowWidth = 480 windowHeight = 80 buttonWidth = 100 buttonHeight = 30 self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="RDojo_UI", sizeable=True) self.UIElements["mainColLayout"] = cmds.columnLayout( adjustableColumn=True ) self.UIElements["guiFrameLayout1"] = cmds.frameLayout( label='Layout', borderStyle='in', p=self.UIElements["mainColLayout"] ) self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=False, width=windowWidth, height=windowHeight/2, wr=True, bgc=[0.2, 0.2, 0.2], p=self.UIElements["guiFrameLayout1"]) # Menu listing all the layout files. cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["keyMenu"] = cmds.optionMenu('layouts', label='Layouts', p=self.UIElements["guiFlowLayout1"]) # Create a menu item for each json file in the Layout directory. for key in self.layout_info['Keys']: cmds.menuItem(label=key + '_', p=self.UIElements["keyMenu"]) # Check Box to indicate symmetry cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["symmetry_checkbox"] = cmds.checkBox( label='Symmetry', p=self.UIElements["guiFlowLayout1"]) # Check Box to indicate mirror cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["mirror_checkbox"] = cmds.checkBox( label='Mirror', p=self.UIElements["guiFlowLayout1"]) # Option menu for side # Make a list of possible sides sides = ['l_', 'r_', 'c_'] cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["side_optionmenu"] = cmds.optionMenu( label='Side', p=self.UIElements["guiFlowLayout1"]) for s in sides: cmds.menuItem(label=s, p=self.UIElements["side_optionmenu"]) # Load Layout button cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["loadLayout_button"] = cmds.button(label='load layout', width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout1"], c=self.loadLayout) self.UIElements["guiFrameLayout2"] = cmds.frameLayout( label='Rigging', borderStyle='in', p=self.UIElements["mainColLayout"]) self.UIElements["guiFlowLayout2"] = cmds.flowLayout(v=False, width=windowWidth, height=windowHeight/2, wr=True, bgc=[0.2, 0.2, 0.2], p=self.UIElements["guiFrameLayout2"]) # Rig arm button cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout2"]) self.UIElements["rig_button"] = cmds.button(label='rig layout', width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout2"], c=self.runRigCommand) """ Show the window""" cmds.showWindow(windowName)
def addChildFlowLayout(flow_layout, ctrl, index): children = cmds.flowLayout(flow_layout, q=True, ca=True) tempLayout = cmds.flowLayout() displacedChildren = [] for i in range(index, len(children)): displacedChildren.append(children[i]) cmds.control(children[i], e=True, p=tempLayout) cmds.control(ctrl, e=True, p=flow_layout) for child in displacedChildren: cmds.control(child, e=True, p=flow_layout)
def startBlock(self, m=1, n=1): #currently i will just make basic layou using the rawLayout # columnWidth=[] # for i in range(1,m): # columnWidth.append([i,80])#[(1, 60), (2, 80), (3, 100)] # cmds.rowColumnLayout(numberOfColumns=m,columnWidth=columnWidth) # cmds.flowLayout(wr=True) if m == 0: cmds.flowLayout(wr=True, w=self.w * self.scale) else: cmds.rowLayout(numberOfColumns=m, w=self.w * self.scale)
def startBlock(self, m=1, n=1): # currently i will just make basic layou using the rawLayout # columnWidth=[] # for i in range(1,m): # columnWidth.append([i,80])#[(1, 60), (2, 80), (3, 100)] # cmds.rowColumnLayout(numberOfColumns=m,columnWidth=columnWidth) # cmds.flowLayout(wr=True) if m == 0: cmds.flowLayout(wr=True, w=self.w * self.scale) else: cmds.rowLayout(numberOfColumns=m, w=self.w * self.scale)
def SJ_pathbatTool(): ''' {'load':'maya_common','defaultOption':1,'CNname':'批量处理路径工具'} ''' if cmds.window('PathbatToolwd',ex=True): cmds.deleteUI('PathbatToolwd',wnd=True) cmds.window('PathbatToolwd',t='Pathbat_Tool') cmds.columnLayout(adj=True,w=372) cmds.text(l='路径批处理工具V2.0', fn='fixedWidthFont',h=50,ann="" ) cmds.flowLayout( columnSpacing=0) cmds.checkBox("abccb" ,label='输出abc路径',v=1,ann="",w=100,h=30) cmds.checkBox("Aistcb" ,label='输出Ass路径',v=1,ann="",w=120,h=30) cmds.checkBox("refcb" ,label='输出参考路径',v=1,ann="",w=120,h=30) cmds.setParent( '..' ) cmds.flowLayout( columnSpacing=0) cmds.checkBox("texFilecb" ,label='输出贴图路径',v=1,ann="",w=100,h=30) cmds.checkBox("VRayMeshcb" ,label='输出vray缓存路径',v=1,ann="",w=120,h=30) cmds.checkBox("clothCachecb" ,label='输出布料及几何体缓存路径',v=1,ann="",w=150,h=30) cmds.setParent( '..' ) cmds.textField('aistpath',tx=cmds.file(q=1,expandName=1),h=30) cmds.button(l='输出路径到txt',c='fb.com.pathToTxt_main()',h=50,ann="") cmds.setParent( '..' ) cmds.flowLayout( columnSpacing=0) cmds.text(l="需要替换的路径关键字:",h=30,w=185) cmds.text(l="替换后的路径关键字:",h=30,w=185) cmds.setParent( '..' ) cmds.flowLayout( columnSpacing=0) cmds.textField('repalceA',tx="source",h=30,w=185) cmds.textField('repalceB',tx="target",h=30,w=185) cmds.setParent( '..' ) cmds.button(l='替换路径关键字',c='fb.com.pathreplace_main()',h=50,ann="") cmds.showWindow()
def __init__(self): self.UIElements = {} """ This dictionary will be used to store the names of your blueprints. """ self.blueprints = {} """ Here we call on a function that will find the contents of the Layout folder. """ """ Those contents are added to the dictionary """ self.blueprints['Layout'] = self.findAllModules("System/Widgets/Layout") """ Print the self.blueprints['Layout'] """ print self.blueprints['Layout'] wHeight = 100 wWidth = 400 bHeight = 20 if cmds.window("layout_UI_window", exists = True): cmds.deleteUI("layout_UI_window") self.UIElements["window"] = cmds.window("layout_UI_window", width = wWidth, height = wHeight) self.UIElements['flowLayout'] = cmds.flowLayout(visible=True, columnSpacing=5, w=wWidth, h=wHeight, v=True, p=self.UIElements["window"]) cmds.setParent(self.UIElements['flowLayout']) cmds.separator() cmds.showWindow("layout_UI_window")
def __init__(self): """ Get all the settings files from the directory """ dir = "Z:/art/character/GEPPETTO/Data/RigSettings/" settingsFiles = os.listdir(dir) self.UIElements = {} if cmds.window("rigSettings_UI_window", exists=True): cmds.deleteUI("rigSettings_UI_window") windowWidth = 200 windowHeight = 400 self.UIElements["window"]= cmds.window("rigSettings_UI_window", width=windowWidth, height=windowHeight, title="Rig Settings UI", sizeable = False) self.UIElements["buttonColumnLayout"] = cmds.flowLayout(v=True) cmds.setParent( '..' ) cmds.setParent(self.UIElements["buttonColumnLayout"]) self.UIElements["settingsList"] = cmds.textScrollList(numberOfRows=4, allowMultiSelection=False, append=settingsFiles, selectIndexedItem=1, width=windowWidth, h=150) cmds.separator( height=5, style='in' ) self.UIElements["loadButton"] = cmds.button(label="LOAD", width=windowWidth, c=self.loadSettings) cmds.setParent(self.UIElements["window"]) cmds.showWindow(self.UIElements["window"])
def ui(self, *args): """ Check to see if the UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ Define width and height for buttons and windows""" windowWidth = 110 windowHeight = 110 buttonWidth = 100 buttonHeight = 30 self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="RDojo_UI", sizeable=True) self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=False, width=windowWidth, height=windowHeight, bgc=[0.2, 0.2, 0.2]) # Load Layout button cmds.separator(p=self.UIElements["guiFlowLayout1"]) self.UIElements["loadLayout_button"] = cmds.button(label='load layout', width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout1"], c=self.createLayout) # Save Layout button cmds.separator(p=self.UIElements["guiFlowLayout1"]) self.UIElements["saveLayout_button"] = cmds.button(label='save layout', width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout1"], c=self.saveLayout) # Rig arm button cmds.separator(p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigarm_button"] = cmds.button(label='rig arm', width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout1"], c=self.rigArm) """ Show the window""" cmds.showWindow(windowName)
def __init__(self): """ Create a dictionary to store UI elements """ self.UIElements = {} """ Check to see if the UI exists """ self.windowName = "RG_Test1" if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) """ Define UI elements width and height """ self.windowWidth = 120 self.windowHeight = 400 buttonWidth = 100 buttonHeight = 30 """ Define a window""" self.UIElements["window"] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight, title="RG_Test_UI", sizeable=True) """ Use a flow layout for the buttons """ self.UIElements["flowLayout"] = cmds.flowLayout(v=True, width=self.windowWidth, height=self.windowHeight) """ Define the buttons """ self.UIElements["jntInfoButton"] = cmds.button(label="JntInfo", width=buttonWidth, height=buttonHeight, enable=True, annotation='Get information on the bind joints', c=self.getBindJointInfo) self.UIElements["rigSkelButton"] = cmds.button(label="CreateRigSkel", width=buttonWidth, height=buttonHeight, enable=True, annotation='Create a rig skeleton', c=self.createRigSkel) self.UIElements["buildLegButton"] = cmds.button(label="BuildLeg", width=buttonWidth, height=buttonHeight, enable=True, annotation='Create a biped leg', c=self.createIkLegChains) self.UIElements["connectSkelButton"] = cmds.button(label="ConnectSkels", width=buttonWidth, height=buttonHeight, enable=True, annotation='Connect the rig and bind skeletons', c=self.connectJntToRigSkel) self.UIElements["zeroControlButton"] = cmds.button(label="Zero Controls", width=buttonWidth, height=buttonHeight, enable=False, annotation='All animation controls to zero ', c=self.zeroAllControls) """ Show the window""" cmds.showWindow(self.windowName)
def __init__(self): """ Create a dictionary to store UI elements """ self.UIElements = {} """ Check to see if the UI exists """ self.windowName = "AudioWindow" if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) """ Define UI elements width and height """ self.windowWidth = 120 self.windowHeight = 200 buttonWidth = 100 buttonHeight = 30 """ Define a window""" self.UIElements["window"] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight, title="AudioWindow", sizeable=True) self.UIElements["rowColumnLayout"] = cmds.rowColumnLayout( numberOfColumns=1, columnWidth=[(1, 120)], cs=[2, 10] ) """ Use a flow layout for the UI """ self.UIElements["guiFlowLayout"] = cmds.flowLayout(v=True, width=110, height=self.windowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["rowColumnLayout"]) # Alternative way to make buttons self.UIElements["audioNodeButton"] = cmds.button(c=self.createAudioNode) """ Show the window""" cmds.showWindow(self.windowName)
def __init__(self): """ Create a dictionary to store UI elements """ self.UIElements = {} """ Check to see if the UI exists """ self.windowName = "AudioWindow" if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) """ Define UI elements width and height """ self.windowWidth = 120 self.windowHeight = 200 buttonWidth = 100 buttonHeight = 30 """ Define a window""" self.UIElements["window"] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight, title="AudioWindow", sizeable=True) self.UIElements["rowColumnLayout"] = cmds.rowColumnLayout( numberOfColumns=1, columnWidth=[(1, 120)], cs=[2, 10]) """ Use a flow layout for the UI """ self.UIElements["guiFlowLayout"] = cmds.flowLayout( v=True, width=110, height=self.windowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["rowColumnLayout"]) # Alternative way to make buttons self.UIElements["audioNodeButton"] = cmds.button( c=self.createAudioNode) """ Show the window""" cmds.showWindow(self.windowName)
def expose_component(self,tabAnchor,rootData): attrib_link = rootData[0] ctrlHgt = 24 nodeData = attrib_link.split('.') typeChk = mc.attributeQuery( nodeData[-1], node=nodeData[0], attributeType=True ) numericType = ['float','double','short','long','int','bool','enum','string'] clm = mc.columnLayout( adjustableColumn=True, rs=5 ,p=tabAnchor, w=420 -30 ) stringType = mc.getAttr(attrib_link,type=True) fildCaption = mc.textField( tx=rootData[1],ed=False,w=410 -30 ,p=clm , font="boldLabelFont",bgc=[0.8,0.8,0.8]) mc.popupMenu( button=3 ,p=fildCaption) mc.menuItem(l='Open in connection Editor' ) if stringType == 'string': attrFld = mc.textField( ed=True,w=410 -30 ,p=clm ) mc.connectControl( attrFld, attrib_link ) else: if typeChk in numericType: mc.attrFieldSliderGrp( attribute=rootData[0],p=clm ) else: flw = mc.flowLayout( columnSpacing=4 , p=clm ) fldLnk = mc.textField( tx=rootData[0],ed=False ,w=385,h=ctrlHgt,p=flw) mc.button( label='<',p=flw)
def exportAssets_UI(self, *args): self.UIElements = {} # If the window exists, delete it. if cmds.window("ExportAssets", exists=True): cmds.deleteUI("ExportAssets") # Create the main window self.UIElements["window"] = cmds.window("ExportAssets", widthHeight=(240, 200), s=True ) # Create a flow layout to hold the UI Elements self.UIElements["radioFlowLayout"] = cmds.flowLayout(v=True, w=220) cmds.setParent( '..' ) cmds.setParent(self.UIElements["radioFlowLayout"]) cmds.radioCollection() self.UIElements['rigRadioButton'] = cmds.radioButton(l='Export Rig?') cmds.radioCollection() self.UIElements['setupRadioButton'] = cmds.radioButton(l='Export Setup?') cmds.separator( height=7, style='in' ) cmds.text(l=' Rename the Setup?') self.UIElements['nameTxt'] = cmds.textField(w=220, tx=self.characterName) self.UIElements['exportButton'] = cmds.button(label='Export Game Assets', width=220, c=self.exportGameAssets) cmds.showWindow(self.UIElements["window"])
def ui(self, *args): """ Check to see if the UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ Define width and height variables for buttons and windows""" windowWidth = 120 windowHeight = 60 buttonWidth = 100 buttonHeight = 30 # Define the main ui window and assign it a key in the UIElements dictinary. self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="Example_UI", sizeable=True) # This is a flow layout. self.UIElements["guiFlowLayout1"] = cmds.flowLayout( v=False, width=windowWidth, height=windowHeight, wr=True, bgc=[0.2, 0.2, 0.2]) # Menu listing all the layout files. self.UIElements["keyMenu"] = cmds.optionMenu( 'layouts', label='Layouts', p=self.UIElements["guiFlowLayout1"]) # Create a menu item for each json file in the Layout directory. for key in self.layout_info['Keys']: cmds.menuItem(label=key, p=self.UIElements["keyMenu"]) """ Show the window""" cmds.showWindow(windowName)
def secondaryUI(): sec_UIname = 'secondary' if cmds.window(sec_UIname,exists = True): cmds.deleteUI(sec_UIname) cmds.window(sec_UIname,title = 'rosa_secondary') clmLot = cmds.columnLayout( adjustableColumn=True) cmds.textField('ctrl_name',text = 'ctrl_name') cmds.button('createctrl',label = 'create ctrl',h = 30,c = 'ctrl()') cmds.button('load_model',label = 'load "org" model',c = 'load_org()') cmds.textField('org_model',text = '"org" model') cmds.button('load_property_obj',label = 'loading property add object',c = 'load_vis()') cmds.textField('vis',text = 'Visibility') # flLot = cmds.flowLayout(columnSpacing = 6) cmds.text(label = 'ctrl axial:') cmds.radioCollection() cmds.radioButton('follic',label = 'follic',select = 0) cmds.radioButton('Custom',label = 'Custom',select = 1) # cmds.setParent( clmLot) cmds.button(label = 'Generate',c = 'secondary_add()') cmds.button('add_ctrl',label = 'add controller',c = 'add_controller()') cmds.button('Add_modelSec',label = 'Add_modelSec',c = 'Add_modelSec()') cmds.button(label = 'inverse_connect',c = 'inverse_connect01()') # cmds.frameLayout( label='modify ctrl:',borderStyle='etchedOut') cmds.setParent( clmLot) cmds.button(label = 'loding want to modify the controller',c = 'load_ctrl()') cmds.textField('sec_ctrl',text = 'secondary_ctrl') cmds.button(label = 'modify the controller position',c = 'ctrl_modify()') cmds.button(label = 'complete controller modifies',c = 'modify_complete()') cmds.showWindow()
def ui(self, *args): """ Check to see if the UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ Define width and height variables for buttons and windows""" windowWidth = 120 windowHeight = 60 buttonWidth = 100 buttonHeight = 30 # Define the main ui window and assign it a key in the UIElements dictinary. self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="Example_UI", sizeable=True) # This is a flow layout. self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=False, width=windowWidth, height=windowHeight, wr=True, bgc=[0.2, 0.2, 0.2]) # Menu listing all the layout files. self.UIElements["keyMenu"] = cmds.optionMenu('layouts', label='Layouts', p=self.UIElements["guiFlowLayout1"]) # Create a menu item for each json file in the Layout directory. for key in self.layout_info['Keys']: cmds.menuItem(label=key, p=self.UIElements["keyMenu"]) """ Show the window""" cmds.showWindow(windowName)
def __init__(self): """ Another Dictionary : ) """ self.UIElements = {} """ Check to see if the window exists. If True delete it. If False, delete it. """ if cmds.window("ExUI", exists=True): cmds.deleteUI("ExUI") """ Create a window""" cmds.window("ExUI", width=200, height=200) """ Make a layout. Layouts are parented to the window and hold UI elements. A layout organizes the element in a defined way such as lining them up in a column """ """ Add the layout to the UIElements dictionary """ self.UIElements['flowLayout'] = cmds.flowLayout(visible=True, columnSpacing=5, w=200, h=200, v=True) self.UIElements['textField'] = cmds.textField(w=200, h=36, aie=True, text='Enter Some Text') cmds.button(label='get field val', width=200, height=66, visible=True, command=self.queryTextField) cmds.showWindow("ExUI")
def __init__(self): """ Create a dictionary to store UI elements """ self.UIElements = {} """ Check to see if the UI exists """ self.windowName = "RG_Test1" if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) """ Define UI elements width and height """ self.windowWidth = 120 self.windowHeight = 400 buttonWidth = 100 buttonHeight = 30 """ Define a window""" self.UIElements["window"] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight, title="RG_Test_UI", sizeable=True) """ Use a flow layout for the buttons """ self.UIElements["flowLayout"] = cmds.flowLayout( v=True, width=self.windowWidth, height=self.windowHeight) """ Define the buttons """ self.UIElements["jntInfoButton"] = cmds.button( label="JntInfo", width=buttonWidth, height=buttonHeight, enable=True, annotation='Get information on the bind joints', c=self.getBindJointInfo) self.UIElements["rigSkelButton"] = cmds.button( label="CreateRigSkel", width=buttonWidth, height=buttonHeight, enable=True, annotation='Create a rig skeleton', c=self.createRigSkel) self.UIElements["buildLegButton"] = cmds.button( label="BuildLeg", width=buttonWidth, height=buttonHeight, enable=True, annotation='Create a biped leg', c=self.createIkLegChains) self.UIElements["connectSkelButton"] = cmds.button( label="ConnectSkels", width=buttonWidth, height=buttonHeight, enable=True, annotation='Connect the rig and bind skeletons', c=self.connectJntToRigSkel) self.UIElements["zeroControlButton"] = cmds.button( label="Zero Controls", width=buttonWidth, height=buttonHeight, enable=False, annotation='All animation controls to zero ', c=self.zeroAllControls) """ Show the window""" cmds.showWindow(self.windowName)
def SJ_repeatNameToolUI(): ''' {'load':'maya_common','defaultOption':1,'CNname':'检查重名工具'} ''' if cmds.window('SJ_repeatName_wd',ex=True): cmds.deleteUI('SJ_repeatName_wd',wnd=True) cmds.window('SJ_repeatName_wd',t='SJ_repeatNameToolV1.0') cmds.columnLayout(adj=True,w=400) cmds.text(l='检查重名工具', fn='fixedWidthFont',h=30,ann="") cmds.textScrollList("rpnamelists",allowMultiSelection=1,h=80,sc="fb.com.rpnameselect()") cmds.flowLayout( columnSpacing=0) cmds.button(l='检查重名节点',c="fb.com.getrepeatName()",h=40,w=200,ann="") cmds.button(l='检查不正确Shape节点',c='fb.com.getWrongShape()',h=40,w=200,ann="") cmds.setParent('..') cmds.textField('rpnames',tx="newName",h=30) cmds.button(l='重命名所选节点',c="fb.com.renamerpnode()",h=40,ann="") cmds.showWindow()
def SJ_cleanLayerTool(): u''' {'load':'maya_common','defaultOption':1,'CNname':'清理无用层'} ''' if cmds.window('cleanLayerToolwd',ex=True): cmds.deleteUI('cleanLayerToolwd',wnd=True) cmds.window('cleanLayerToolwd',t='cleanLayer_Tool') cmds.columnLayout(adj=True,w=400) cmds.text(l=u'清理无用层工具', fn='fixedWidthFont',h=50,ann="" ) cmds.flowLayout( columnSpacing=0) cmds.button(l=u'清理(通用)无用显示层',c=u'from fantabox.common.SJ_cleanLayerTool import *;cleanLayerTool_display("com")',w=200,h=50,ann="") cmds.button(l=u'清理(动画,特效)无用显示层',c=u'from fantabox.common.SJ_cleanLayerTool import *;cleanLayerTool_display()',w=200,h=50,ann="") cmds.setParent( '..' ) cmds.flowLayout( columnSpacing=0) cmds.setParent( '..' ) cmds.button(l=u'清理无用渲染层',c=u'cleanLayerTool_layerdel(check_renderLayer())',h=50,ann="") cmds.button(l=u'清理无用动画层',c=u'cleanLayerTool_layerdel(check_invalid_animLayer())',h=50,ann="") cmds.showWindow()
def createFollicleOnsurface_UI(self): ui = 'ToolsBoxUI3' try: cmds.deleteUI(ui) except: pass cmds.window(ui, t='createFollicleOnface') cmds.columnLayout(cat=("both", 2), columnWidth=180, rowSpacing=3) cmds.textFieldGrp('UI3nameTextFieldGrp', l=u'名称', h=28, cw2=(50, 100)) cmds.intFieldGrp('UI3numIntFieldGrp', l=u'数量', h=28, cw2=(50, 100)) cmds.flowLayout(columnSpacing=5) cmds.checkBox('UI3JointcheckBox', l=u'创建骨骼', w=80) cmds.button('UI3RunButton', l="Run", h=28, w=80, c=lambda *args: self.createFollicleOnsurface( cmds.textFieldGrp('UI3nameTextFieldGrp', q=1, tx=1), cmds.intFieldGrp('UI3numIntFieldGrp', q=1, v1=1), cmds.checkBox('UI3JointcheckBox', q=1, v=1))) cmds.setParent('..') cmds.showWindow(ui)
def __init__(self): print "In armRig_UI" self.UI_Elements = {} self.windowName = "armRigUI_Window" if cmds.window(self.windowName, exists = True): cmds.deleteUI(self.windowName) windowWidth = 80 windowHeight = 40 buttonWidth = 80 buttonHeight = 33 self.UI_Elements["window"] = cmds.window(self.windowName, width = windowWidth, height = windowHeight, title = "armRig_UI", sizeable = True) self.UI_Elements["buttonLyt"] = cmds.flowLayout(v=True, width=windowWidth, height=windowHeight) fileDirectory = "/Users/Winsi/Documents/Art Tools/Maya/Modules/Layout/" for widget in self.returnWidgets(fileDirectory): print widget mod = __import__("Maya.Modules.Layout."+widget, {}, {}, [widget]) reload (mod) title = mod.TITLE description = mod.DESCRIPTION classname = mod.CLASS_NAME cmds.separator(p=self.UI_Elements["buttonLyt"]) self.UI_Elements["module_button_" + widget] = cmds.button(label=title, width=buttonWidth, height=buttonHeight, p=self.UI_Elements["buttonLyt"], c=partial(self.installLytWidget, widget)) fileDirectory = "/Users/Winsi/Documents/Art Tools/Maya/Modules/Rig/" for widget in self.returnWidgets(fileDirectory): print widget mod = __import__("Maya.Modules.Rig."+widget, {}, {}, [widget]) reload (mod) title = mod.TITLE description = mod.DESCRIPTION classname = mod.CLASS_NAME cmds.separator(p=self.UI_Elements["buttonLyt"]) self.UI_Elements["module_button_" + widget] = cmds.button(label=title, width=buttonWidth, height=buttonHeight, p=self.UI_Elements["buttonLyt"], c=partial(self.installRigWidget, widget)) cmds.showWindow(self.UI_Elements["window"])
def SJ_fixedShadermodToolUI(): ''' {'load':'maya_common','defaultOption':1,'CNname':'修复模型材质工具'} ''' if cmds.window('fixedshadermodwd',ex=True): cmds.deleteUI('fixedshadermodwd',wnd=True) cmds.window('fixedshadermodwd',t='fixedshadermod_Tool') cmds.columnLayout(adj=True,w=400) cmds.text(l='修复模型材质工具', fn='fixedWidthFont',h=50,ann="" ) cmds.flowLayout( columnSpacing=0) cmds.button(l='选择丢失材质模型',c='from fantabox.modeling.SJ_faceShaderMod import *;fixedmisshader()',w=200,h=50,ann="") cmds.button(l='选择没有连接arnold的毛发节点',c='from fantabox.rendering import *;noAishaderhair()',w=200,h=50,ann="") cmds.setParent( '..' ) cmds.flowLayout( columnSpacing=0) cmds.setParent( '..' ) cmds.button(l='修复按面赋予材质模型',c='from fantabox.modeling.SJ_faceShaderMod import *;fixedfaceshader()',h=50,ann="") cmds.button(l='修复Arnold渲染细分大于3的物体',c='from fantabox.rendering import *;fixed_aiSubdiv()',h=50,ann="") cmds.showWindow()
def __init__(self): # Setup the scene the Turbine way utils.sceneSetup(self) """ Dict for UIElements """ self.UIElements = {} self.rigFiles = {} self.rigs = {} self.setupFile = {} self.rigFile = {} self.characterNamespace = {} self.setupDir = {} self.characterName = {} refUtils = referenceUtils.Reference_Utils() self.rigFiles['rigFiles'] = refUtils.findRigs()[0] self.rigs['rigs'] = refUtils.findRigs()[1] print self.rigFiles['rigFiles'] print self.rigs['rigs'] print self.rigs['rigs'] """ If the window exists, delete it. """ if cmds.window("charRefWindow", exists=True): cmds.deleteUI("charRefWindow") self.windowWidth = 420 self.windowHeight = 300 fieldWidth = (self.windowWidth - 10) fieldHeight = (self.windowHeight - 60) self.buttonWidth = fieldWidth columnOffset = 5 buttonColumnWidth = self.buttonWidth + (2*columnOffset) textScrollWidth = (self.windowWidth - buttonColumnWidth) # Create the main window mainWindow = self.UIElements["window"] = cmds.window("charRefWindow", width=self.windowWidth, height=self.windowHeight, s=True) # Create a couple flow layouts to hold the UI Elements for setup tools self.UIElements["buttonColumnLayout"] = cmds.flowLayout(h=self.windowHeight, v=True) self.UIElements["rigList"] = cmds.textScrollList(numberOfRows=20, allowMultiSelection=False, append=self.rigs['rigs'], width=fieldWidth, h=fieldHeight, fn="boldLabelFont", dcc=self.getFileForReference) cmds.separator( height=5, style='in' ) self.UIElements['button'] = cmds.button( label='Reference Character', width=self.buttonWidth, c=self.setupPicker_UI) cmds.setParent(self.UIElements["buttonColumnLayout"]) cmds.showWindow(self.UIElements["window"])
def SundayUIToolsDockedShaderliner(): if cmds.dockControl('sundayShaderlinerInTheDock', query = True, exists = True): cmds.deleteUI('sundayShaderlinerInTheDock') shaderlinerlinerLayout = cmds.paneLayout('sundayShaderlinerInTheDockPane', parent = mel.eval('$temp1=$gMainWindow')) cmds.dockControl('sundayShaderlinerInTheDock', width = 275, area = 'left', label = 'Shaderliner', content = shaderlinerlinerLayout, allowedArea = [ 'right', 'left']) cmds.setParent(cmds.paneLayout('sundayShaderlinerInTheDockPane', query = True, fullPathName = True)) cmds.menuBarLayout('sundayShaderlinerInTheDockMenuBarLayout') cmds.flowLayout(columnSpacing = 5) cmds.separator(style = 'none', width = 1) cmds.iconTextButton(image = SundayImage + 'SundayRefresh.png', width = 28, height = 28, command = 'import SundayUIToolsPy\nreload(SundayUIToolsPy)\nSundayUIToolsPy.SundayUIToolsDockedShaderlinerUpdate()') if cmds.optionVar(query = 'SundayShaderlinerSwatch'): cmds.iconTextButton('SundayShaderlinerIcon', image = SundayImage + 'SundaySolidSphere.png', width = 30, height = 30, command = 'import SundayUIToolsPy\nreload(SundayUIToolsPy)\nSundayUIToolsPy.SundayUIToolsDockedShaderlinerSwatchToggle()') else: cmds.iconTextButton('SundayShaderlinerIcon', image = SundayImage + 'SundaySolidSphereColor.png', width = 30, height = 30, command = 'import SundayUIToolsPy\nreload(SundayUIToolsPy)\nSundayUIToolsPy.SundayUIToolsDockedShaderlinerSwatchToggle()') cmds.setParent('..') SundayUIToolsDockedShaderlinerUpdate()
def SJ_cleanUpTool(): u''' {'load':'maya_common','defaultOption':1,'CNname':'清理无用节点'} ''' if cmds.window('cleanupToolwd', ex=True): cmds.deleteUI('cleanupToolwd', wnd=True) cmds.window('cleanupToolwd', t='cleanUp_Tool') cmds.columnLayout(adj=True, w=372) cmds.text(l=u'清理无用节点工具', fn='fixedWidthFont', h=50, ann="") cmds.flowLayout(columnSpacing=0) cmds.checkBox("unknowncb", label=u'未知节点', v=1, ann="", w=100, h=30) cmds.checkBox("wkheadcb", label=u'wkHeadsUp节点', v=1, ann="", w=120, h=30) cmds.checkBox("unrefcb", label=u'UNKNOWNREF节点', v=1, ann="", w=120, h=30) cmds.setParent('..') cmds.flowLayout(columnSpacing=0) cmds.checkBox("oigcb", label=u'多余Oig节点', v=1, ann="", w=100, h=30) cmds.checkBox("tsmcb", label=u'TSM残留script节点', v=1, ann="", w=120, h=30) cmds.checkBox("srefnodecb", label=u'shareReferenceNode节点', v=1, ann="", w=150, h=30) cmds.setParent('..') cmds.flowLayout(columnSpacing=0) cmds.checkBox("clbadmatcb", label=u'无用渲染节点', v=1, ann="", w=100, h=30) cmds.checkBox("clnoppcb", label=u'无点的Plolygons', v=1, ann="", w=120, h=30) cmds.checkBox("clbaddiscb", label=u'连接断了的置换节点', v=1, ann="", w=150, h=30) cmds.setParent('..') cmds.button(l=u'清理多余节点', c=u'fb.com.cleanUp_main()', h=50, ann="") cmds.showWindow()
def __init__(self): """ Dictionary containing a key for each character. Each key has data pairs of value label and value """ self.trackerInfo = {} self.characterNames = {} self.csvToArrays() """ Declare the character tracker file """ self.file = '//corp-nas01/DC/dc_art/character/GEPPETTO/CharacterTracker.csv' """ The UI """ self.UIElements = {} self.UIElementsButtons = {} """ If the window exists, delete it.""" if cmds.window("CharacterTrackerWindow", exists=True): cmds.deleteUI("CharacterTrackerWindow") self.windowWidth = 200 self.windowHeight = 550 buttonWidth = (self.windowWidth -5) textWidth = 140 columnOffset = 5 """ Create the main window""" mainWindow = self.UIElements["window"] = cmds.window("CharacterTrackerWindow", widthHeight=(self.windowWidth, self.windowHeight), s=True ) """ Create a flow layout to hold the UI Elements for setup tools""" self.UIElements["flowLayout"] = cmds.flowLayout(v=True, w=buttonWidth) cmds.setParent(self.UIElements["flowLayout"]) cmds.separator( height=7, style='in' ) self.UIElements['characterName'] = cmds.textScrollList(numberOfRows=4, width=self.windowWidth -10, height=120, append=self.characterNames['characterKeys'], dcc=self.updateVersionNumber) """ Create text entries based of the keys recovered from the csv """ keys = self.trackerInfo.keys() values = self.trackerInfo.values() for value in values: textKeys = [] for entry in value: textKey = entry[0] textKeys.append(textKey) for key in textKeys: self.UIElementsButtons[key] = cmds.text(l=key) cmds.separator( height=5, style='in' ) """ Field for entering a new bug """ self.UIElements['textField'] = cmds.textField(tx='Enter bugs here', w=180, h=60) cmds.button( label='Submit', width=buttonWidth , height=22, vis=True) cmds.showWindow(self.UIElements["window"])
def SJ_abcFurCache_ToolwdUI(): ''' 1.5更新说明:修复按面赋予材质无法复原abc材质的问题,增加智能筛选大组功能,已能自动识别大组后带数字的情况,如char_all2,char_geo6..等情况;修复仅模型输出功能失效问题 1.6更新说明:增加魔礼兽表情blender节点烘焙帧功能 1.7更新说明:优化复原abc材质功能,增加复原后不输出mb文件选项。 1.8更新说明:增加Arnold缓存批量指定及拷贝功能。 1.9更新说明:目标路径自动获取本文件所在文件夹;优化abc及毛发输出;增加自动加载abc插件功能;整合miamy的abc输出及材质复原流程 1.9.1更新说明:修复跑多个mb文件,及yeti节点为空时报错问题 2.0更新说明:增加yeti跑Ass缓存功能 2.1更新说明:增加abc与Arnold帧偏移关联功能 2.2更新说明:增加hair及yeti传递毛发到abc模型的功能 ''' if cmds.window('abctoolwd',ex=True): cmds.deleteUI('abctoolwd',wnd=True) updatetxt =fantabox.ani.SJ_abcFurCache_ToolwdUI.__doc__ cmds.window('abctoolwd',t='abcToolV2.2') cmds.columnLayout(adj=True,w=240) cmds.text(l='abc工具V2.2', fn='fixedWidthFont',h=50,ann=updatetxt ) cmds.text(l='帧数区间(开始帧,结束帧,Sample)',fn='fixedWidthFont',h=50,ann="") cmds.flowLayout( columnSpacing=0) cmds.textField('rangenuma',tx="0",h=30,w=100) cmds.textField('rangenumb',tx="1",h=30,w=100) cmds.textField('rangesamnum',tx="1",h=30,w=100) cmds.setParent( '..' ) cmds.text(l='目标路径', fn='fixedWidthFont',h=50,ann="" ) cmds.textField('pathnum',tx=getFileNames(),h=30) cmds.flowLayout( columnSpacing=0) cmds.checkBox("geonlycb" ,label='输出模型',v=1,ann="",w=210,h=30) cmds.checkBox("furonlycb" ,label='输出毛发',v=1,ann="",w=80,h=30) cmds.setParent( '..' ) cmds.button(l='输出abc及毛发缓存',c=abcoutput,h=50,ann="选择角色大组(可多选),输入输出路径,设置起始帧,点击执行命令。") cmds.flowLayout( columnSpacing=0) cmds.checkBox("aiStInselcb" ,label='仅对选择对象进行操作',v=0,ann="默认情况对场景所有Arnold缓存进行操作",w=150,h=30) cmds.checkBox("aiStIncopycb" ,label='仅指定Arnold缓存路径,不拷贝',v=0,ann="默认情况下进行缓存的拷贝并指定到目标路径",w=180,h=30) cmds.setParent( '..' ) cmds.button(l='Arnold缓存批量指认拷贝',c=AiSTsetCopypath,h=50,ann="") cmds.button(l='选中毛发组yeti缓存路径指定\ \n 全场景abc缓存路径指定',c=changecache,h=50,ann="选择输出的毛发缓存大组,输入需要指定的毛发缓存路径,点击执行命令。\ \n 场景内所有abc缓存路径替换为指定路径") cmds.text(l='~~~~~~导入abc文件~~~~~~~', fn='fixedWidthFont',h=50,ann="" ) cmds.flowLayout( columnSpacing=0) cmds.checkBox("recoverNoMb" ,label='复原后不输出mb文件',v=0,ann="",w=210,h=30) cmds.setParent( '..' ) cmds.button(l='复原abc材质并输出abc文件', c= recovershader,h=50,ann="选择原角色大组及导入的abc角色大组,点击自动还原") cmds.button(l='合并角色材质', c= comshder,h=50,ann="合并场景内所有相同角色材质") cmds.button(l='传递毛发', c= hairyetitransfer_main,h=50,ann="先选原毛发生长模型,再选择目标模型,点击传递(可多对多)") cmds.button(l='选中毛发组yeti缓存路径指定\ \n 全场景abc缓存路径指定',c=changecache,h=50,ann="选择输出的毛发缓存大组,输入需要指定的毛发缓存路径,点击执行命令。\ \n 场景内所有abc缓存路径替换为指定路径") cmds.textField('offsetnum',tx="10",h=30) cmds.button(l='偏移缓存动画',c=offsetanim,h=50,ann="选择输出的毛发缓存大组或abc角色大组,输入偏移帧数,点击执行命令") cmds.button(l='abc与AiStandIn关联帧偏移',c=AbcAioffsetConnected,h=50,ann="若场景中只有一个abc缓存节点,请直接执行;若场景中有多个abc缓存节点,请先选一个abc缓存节点,再多选arnold缓存节点,再执行操作") cmds.showWindow()
def ui(self, *args): """ Check to see if the UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ Define width and height for buttons and windows""" windowWidth = 110 windowHeight = 110 buttonWidth = 100 buttonHeight = 30 self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="RDojo_UI", sizeable=True) self.UIElements["guiFlowLayout1"] = cmds.flowLayout( v=False, width=windowWidth, height=windowHeight, bgc=[0.2, 0.2, 0.2]) # Load Layout button cmds.separator(p=self.UIElements["guiFlowLayout1"]) self.UIElements["loadLayout_button"] = cmds.button( label='load layout', width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout1"], c=self.createLayout) # Save Layout button cmds.separator(p=self.UIElements["guiFlowLayout1"]) self.UIElements["saveLayout_button"] = cmds.button( label='save layout', width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout1"], c=self.saveLayout) # Rig leg button cmds.separator(p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigleg_button"] = cmds.button( label='rig leg', width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout1"], c=self.rigLeg) """ Show the window""" cmds.showWindow(windowName)
def __init__(self): # store UI elements in a dictionary self.UIElements = {} if cmds.window("geppetto_UI_window", exists=True): cmds.deleteUI("geppetto_UI_window") buttonSize = 66 buttonSize2 = 86 windowWidth = 66 windowHeight = 520 self.UIElements["geppettoWindow"]= cmds.window("geppetto_UI_window", width=windowWidth, height=windowHeight, title="Geppetto UI", sizeable=True, rtf=True, mnb=False, mxb=False, tlb=True) # Create UI elements self.UIElements ["flowLayout"] = cmds.flowLayout(v=True, columnSpacing=5, w=windowWidth, h=windowHeight) cmds.setParent(self.UIElements["flowLayout"]) icon7 = os.environ["GEPPETTO"] + "/Icons/geppetto.bmp" self.UIElements["geppetto_But"] = cmds.symbolButton(width=buttonSize, height=buttonSize2, image=icon7, annotation='View the Geppetto Documentation', command=self.geppetto_doc_Button) icon = os.environ["GEPPETTO"] + "/Icons/blueprintUI.bmp" self.UIElements["bpUI_But"] = cmds.symbolButton(width=buttonSize, height=buttonSize, image=icon, annotation='Open the Blueprint UI.', command=self.Blueprint_UI_Button) icon3 = os.environ["GEPPETTO"] + "/Icons/characterInstall.bmp" self.UIElements["charInst_But"] = cmds.symbolButton(width=buttonSize, height=buttonSize, image=icon3, annotation='Install a Character', command=self.characterInstall_Button) icon4 = os.environ["GEPPETTO"] + "/Icons/modMaintenance.bmp" self.UIElements["modMaint_But"] = cmds.symbolButton(width=buttonSize, height=buttonSize, image=icon4, annotation='Put the Character in Maintenance mode to add Animation Modules', command=self.moduleMaintenanace_Button) icon6 = os.environ["GEPPETTO"] + "/Icons/setup_button.bmp" self.UIElements["setup_But"] = cmds.symbolButton(width=buttonSize, height=buttonSize, image=icon6, annotation='Load and Save Setup Files', command=self.setup_Button) cmds.separator( height=5, style='in' ) cmds.text(label=' Animation', fn="boldLabelFont") icon5 = os.environ["GEPPETTO"] + "/Icons/animationUI.bmp" self.UIElements["animUI_But"] = cmds.symbolButton(width=buttonSize, height=buttonSize, image=icon5, annotation='Tools for Animators', command=self.animation_UI_Button) #icon8 = os.environ["GEPPETTO"] + "/Icons/animLib_button.bmp" #self.UIElements["animLib_But"] = cmds.symbolButton(width=buttonSize, height=buttonSize, image=icon8, annotation='Animation Library', command=self.animation_Lib_Button) # Display Window cmds.showWindow(self.UIElements["geppettoWindow"])
def updatePreviewLayout(self): print("ML Log: updatePreviewLayout") # Determine the size of the preview area. width = cmds.flowLayout("RPRPreviewArea", query=True, width=True) height = cmds.flowLayout("RPRPreviewArea", query=True, height=True) # Choose the smallest dimension and shrink # slightly so the enclosing layouts can shrink. size = min(width, height) - 10 # Calculate the horizontal and vertical # offsets required to center the preview image. hOffset = max(0, (width - size) / 2.0) vOffset = max(0, (height - size) / 2.0) # Clamp the size to a minimum of 64. newWidth = max(64, width - 10) newHeight = max(64, height - 10) size = max(64, size) # Update the layout and image sizes. cmds.flowLayout("RPRPreviewFlow", edit=True, width=newWidth, height=newHeight) cmds.iconTextStaticLabel("RPRPreviewImage", edit=True, width=size, height=size) cmds.canvas("RPRHSpacer", edit=True, width=hOffset, height=1) cmds.canvas("RPRVSpacer", edit=True, width=1, height=vOffset) # Update the RPR logo size. logoWidth = cmds.iconTextStaticLabel("RPRLogo", query=True, width=True) logoHeight = max(min(logoWidth * 0.16, 60), 1) cmds.iconTextStaticLabel("RPRLogo", edit=True, height=logoHeight) cmds.canvas("RPRLogoBackground", edit=True, height=logoHeight)
def rigWindow_UI(): form = cmds.formLayout(bgc=(0.14, 0.14, 0.14)) flow = cmds.flowLayout(columnSpacing=2, wrap=True) buttons = [{ "highlightImage": "logicGrp.svg", "image": "logicGrp.svg", "l": "Logic Group", "c": "makeBlendshapes()" }, { "highlightImage": "blendshapes.svg", "image": "blendshapes.svg", "l": "Blendshapes", "c": "makeBlendshapes()" }, { "highlightImage": "makeJoints.svg", "image": "makeJoints.svg", "l": "Joints", "c": "makeJoints()" }, { "highlightImage": "mirrorJoints.svg", "image": "mirrorJoints.svg", "l": "Mirror Joints", "c": "mirrorJoints()" }, { "highlightImage": "menuIconSkinning.png", "image": "menuIconSkinning.png", "l": "Hammer Skin Weights", "c": "mel.eval(\"WeightHammer;\")" }] for b in buttons: cmds.iconTextButton(height=60, width=60, flat=True, useAlpha=True, style='iconOnly', highlightImage=b["highlightImage"], image=b["image"], l=b["l"], en=True, c=b["c"]) cmds.setParent('..') cmds.formLayout(form, edit=True, attachForm=[ (flow, 'left', 0), (flow, 'top', 0), (flow, 'right', 0), (flow, 'bottom', 0), ])
def updateMaterialsLayout(self): # Determine the width of the material view # and the total number of materials to display. width = cmds.scrollLayout(self.materialsContainer, query=True, width=True) count = cmds.flowLayout("RPRMaterialsFlow", query=True, numberOfChildren=True) if (count <= 0): return # Calculate the number of materials that can fit on # a row and the total required height of the container. perRow = max(1, math.floor((width - 18) / self.cellWidth)) height = math.ceil(count / perRow) * self.cellHeight cmds.flowLayout("RPRMaterialsFlow", edit=True, height=height) # Adjust the form to be narrower than the tab that # contains it. This is required so the form doesn't # prevent the tab layout shrinking. materialsWidth = cmds.tabLayout(self.materialsTab, query=True, width=True) newMaterialsWidth = max(1, materialsWidth - 10) cmds.formLayout(self.materialsForm, edit=True, width=newMaterialsWidth) # Hide the icon size slider if there isn't enough room for it. cmds.rowLayout("RPRIconSize", edit=True, visible=(materialsWidth > 440)) # Update the preview layout. self.updatePreviewLayout()
def startBlock(self, m=1, n=1): #currently i will just make basic layou using the rawLayout # columnWidth=[] # for i in range(1,m): # columnWidth.append([i,80])#[(1, 60), (2, 80), (3, 100)] # cmds.rowColumnLayout(numberOfColumns=m,columnWidth=columnWidth) # cmds.flowLayout(wr=True) if not self.inNotebook and self.notebook is not None: if self.afterNoteBook is None: c = self.afterNoteBook = cmds.flowLayout(wr=True, p=self.form) cmds.formLayout(self.form, edit=True, attachForm=((c, 'left', 0), (c, 'bottom', 0), (c, 'right', 0)), attachControl=((c, 'top', 5, self.notebook["id"]))) if m == 0: c = cmds.flowLayout(wr=True, w=self.w * self.scale, p=self.afterNoteBook) else: c = cmds.rowLayout(numberOfColumns=m, w=self.w * self.scale, p=self.afterNoteBook) else: # if self.mainlayout is None: # c=self.mainlayout = cmds.scrollLayout('scrollLayout',p=self.form)#cmds.flowLayout(wr=True,p=self.form) # cmds.formLayout( self.form, edit=True, attachForm=((c, 'left', 0),(c, 'bottom', 0), # (c, 'right', 0),(c, 'top', 0),) ) if m == 0: cmds.flowLayout(wr=True, w=self.w * self.scale) #,p=self.mainlayout) else: cmds.rowLayout(numberOfColumns=m, w=self.w * self.scale) #,p=self.mainlayout)
def __init__(self): self.UIElements = {} self.widgets = [] """ I put this in to demonstrate how you could make a widget for various layout modules. """ """ This is not hooked up to anything """ ############################################################ riggingToolRoot = os.environ["RIGTOOL"] self.path = "R:/System/CSV_files/armCsv.csv" lytWidgets = os.listdir(self.path) for widget in lytWidgets: prefix = 'lyt_' result = widget.startswith(prefix) if result == True: self.widgets.append(widget) print self.widgets ######################################################### wHeight = 100 wWidth = 400 bHeight = 20 if cmds.window("layout_UI_window", exists = True): cmds.deleteUI("layout_UI_window") self.UIElements["window"] = cmds.window("layout_UI_window", width = wWidth, height = wHeight) self.UIElements['flowLayout'] = cmds.flowLayout(visible=True, columnSpacing=5, w=wWidth, h=wHeight, v=True, p=self.UIElements["window"]) cmds.setParent(self.UIElements['flowLayout']) cmds.separator() cmds.text(label = "Enter Number of locators to be created") self.UIElements['numLocators'] = cmds.intField() cmds.button(label = 'Load_LYT', width =wWidth, height = bHeight, vis = True, c = self.createLocators) cmds.text(label = "Position locators, select in order and open Rig_UI") cmds.button(label = 'Rig_UI', width =wWidth, height = bHeight, vis = True, c = self.callRig_UI) cmds.showWindow("layout_UI_window")
def wireProfilesLayout(self, fakeFullAttributeName): imageSize = 58 textRowHeight = 10 self.wireProfilesControlsMap = {} # BUTTONS flowLayoutID = cmds.flowLayout(height=75, wrap=True) # rpolygon cmds.rowColumnLayout( numberOfRows = 2, rowHeight = [(1, imageSize), (2, textRowHeight)] ) buttonID = cmds.symbolButton( annotation = "", width = imageSize, height = imageSize, image = "ae_rPolygonWireProfile.png" ) textID = cmds.text( label = WireMeshCreatorNode.rPolygonWireProfileName, font = "tinyBoldLabelFont", backgroundColor = AEwireMeshCreatorTemplate.textBackgroundColorInactive ) self.wireProfilesControlsMap[WireMeshCreatorNode.rPolygonWireProfileIndex] = (buttonID, textID) # line cmds.setParent(flowLayoutID) cmds.rowColumnLayout( numberOfRows = 2, rowHeight = [(1, imageSize), (2, textRowHeight)] ) buttonID = cmds.symbolButton( annotation = "", width = imageSize, height = imageSize, image = "ae_lineWireProfile.png" ) textID = cmds.text( label = WireMeshCreatorNode.lineWireProfileName, font = "tinyBoldLabelFont", backgroundColor = AEwireMeshCreatorTemplate.textBackgroundColorInactive ) self.wireProfilesControlsMap[WireMeshCreatorNode.lineWireProfileIndex] = (buttonID, textID) self.wireProfilesLayoutConnect(fakeFullAttributeName)
def ui(self, *args): """Check to see if UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ define width and height for buttons and windows""" windowWidth = 240 windowHeight = 120 buttonWidth = 55 buttonHeight = 22 self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="LBS_UI", sizeable=True) self.UIElements["mainColLayout"] = cmds.columnLayout( adjustableColumn=True) self.UIElements["guiiFrameLayout1"] = cmds.frameLayout( label='layout', p=self.UIElements["mainColLayout"]) self.UIElements["guiiFlowLayout1"] = cmds.flowLayout( v=False, width=windowWidth, height=windowHeight / 2, wr=True, bgc=[0.2, 0.2, 0.2], p=self.UIElements["guiiFrameLayout1"]) # Dynamically make a button for each rigging module. for mod in self.rigModList: buttonName = mod.replace('.py', '') cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiiFlowLayout1"]) self.UIElements[buttonName] = cmds.button( label=buttonName, width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiiFlowLayout1"], c=partial(self.rigMod, buttonName)) """show the Window""" cmds.showWindow(windowName)
def ui(self, *args): """Check to see if UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ define width and height for buttons and windows""" windowWidth = 240 windowHeight = 120 buttonWidth = 55 buttonHeight = 22 self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="LBS_UI", sizeable=True) self.UIElements["mainColLayout"] = cmds.columnLayout(adjustableColumn=True) self.UIElements["guiFrameLayout1"] = cmds.frameLayout( label='layout', p=self.UIElements["mainColLayout"]) self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=False, width=windowWidth, height=windowHeight/2, wr=True, bgc=[0.2, 0.2, 0.2], p=self.UIElements["guiFrameLayout1"]) cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigMenu"] = cmds.optionMenu('Rig_Install', label='Rig', p=self.UIElements["guiFlowLayout1"]) # Dynamically make a button for each rigging module. for mod in self.rigModList: buttonName = mod.replace('.py', '') cmds.menuItem(label=buttonName, p=self.UIElements["rigMenu"], c=partial(self.rigMod, buttonName)) cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) #make a menu for LF, RT, and CT sides #We will query the value later sides = ['LF_', 'RT_', 'CT_'] self.UIElements["sideMenu"] = cmds.optionMenu('Side', label='side', p=self.UIElements["guiFlowLayout1"]) for s in sides: cmds.menuItem(label=s, p=self.UIElements["sideMenu"]) #make a button to run the rig script modFile = cmds.optionMenu(self.UIElements["rigMenu"], q=True, v=True) cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigButton"] = cmds.button(label="Rig", width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout1"], c=partial(self.rigMod, modFile)) #IK_FI match button self.UIElements["IKFKmatchButton"] = cmds.button(label="Match", width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout1"], c=utils.match_IKFK) """show the Window""" cmds.showWindow(windowName)
def ui(self, *args): """ Check to see if the UI exists """ windowName = "FootRigger" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ Define width and height for buttons and windows""" windowWidth = 120 windowHeight = 320 buttonWidth = 120 buttonHeight = 22 self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="RDojo_UI", sizeable=True) self.UIElements["guiFrameLayout1"] = cmds.columnLayout( adjustableColumn=True ) self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=True, width=windowWidth, height=windowHeight/2, wr=False, bgc=[0.2, 0.2, 0.2], p=self.UIElements["guiFrameLayout1"]) cmds.separator(w=10, hr=True, p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigbutton"] = cmds.button(label="MakeFootLocs", width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout1"], c=self.createFootLyt) cmds.separator(w=10, hr=True, p=self.UIElements["guiFlowLayout1"]) self.UIElements["selctrl"] = cmds.button(label="select foot control", width=buttonWidth, height=buttonHeight, bgc=[0.4, 0.2, 0.2], p=self.UIElements["guiFlowLayout1"], c=partial(self.selBtnCallback, 'selctrl')) cmds.separator(w=10, hr=True, p=self.UIElements["guiFlowLayout1"]) self.UIElements["selik"] = cmds.button(label="select foot ikHandle", width=buttonWidth, height=buttonHeight, bgc=[0.4, 0.2, 0.2], p=self.UIElements["guiFlowLayout1"], c=partial(self.selBtnCallback, 'selik')) cmds.separator(w=10, hr=True, p=self.UIElements["guiFlowLayout1"]) self.UIElements["selankle"] = cmds.button(label="select foot ankle_IKJ", width=buttonWidth, height=buttonHeight, bgc=[0.4, 0.2, 0.2], p=self.UIElements["guiFlowLayout1"], c=partial(self.selBtnCallback, 'selankle')) cmds.separator(w=10, hr=True, p=self.UIElements["guiFlowLayout1"]) sides = ['L_', 'R_', 'C_'] self.UIElements["sideMenu"] = cmds.optionMenu('Side', label='side', p=self.UIElements["guiFlowLayout1"]) for s in sides: cmds.menuItem(label=s, p=self.UIElements["sideMenu"]) cmds.separator(w=10, hr=True, p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigfoot"] = cmds.button(label="Rig The Foot", width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout1"], c=self.setupFoot) """ Show the window""" cmds.showWindow(windowName)
def ui(self, *args): """ Check to see if the UI exists """ windowName = "Window" if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) """ Define width and height for buttons and windows""" windowWidth = 240 windowHeight = 120 buttonWidth = 55 buttonHeight = 22 self.UIElements["window"] = cmds.window(windowName, width=windowWidth, height=windowHeight, title="RDojo_UI", sizeable=True) self.UIElements["mainColLayout"] = cmds.columnLayout( adjustableColumn=True ) self.UIElements["guiFrameLayout1"] = cmds.frameLayout( label='rigging', borderStyle='in', p=self.UIElements["mainColLayout"] ) self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=False, width=windowWidth, height=windowHeight/2, wr=False, bgc=[0.2, 0.2, 0.2], p=self.UIElements["guiFrameLayout1"]) cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigMenu"] = cmds.optionMenu('Rig_Install', label='Rig', p= self.UIElements["guiFlowLayout1"]) # Dynamically make a menu item for each rigging module. for mod in self.rigmodlst: itemname = mod.replace('.py', '') cmds.menuItem(label=itemname, p=self.UIElements["rigMenu"], c=partial(self.rigmod, itemname)) cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) # Make a menu for left, right and center sides. # We will query the value later. sides = ['_L_', '_R_', '_C_'] self.UIElements["sideMenu"] = cmds.optionMenu('Side', label='side', p=self.UIElements["guiFlowLayout1"]) for s in sides: cmds.menuItem(label=s, p=self.UIElements["sideMenu"]) # Make a button to run the rig script modfile = cmds.optionMenu(self.UIElements["rigMenu"], q=True, v=True) cmds.separator(w=10, hr=True, st='none', p=self.UIElements["guiFlowLayout1"]) self.UIElements["rigbutton"] = cmds.button(label="Rig", width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout1"], c=partial(self.rigmod, modfile)) # IK_FK match button self.UIElements["ikfkmatchbutton"] = cmds.button(label="Match", width=buttonWidth, height=buttonHeight, bgc=[0.2, 0.4, 0.2], p=self.UIElements["guiFlowLayout1"], c=utils.match_ikfk) """ Show the window""" cmds.showWindow(windowName)
def __init__(self, *args): """ Create a dictionary to store UI elements """ self.UIElements = {} """ Check to see if the UI exists """ self.windowName = "PartParams" if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) """ Define UI elements width and height """ self.windowWidth = 200 self.windowHeight = 400 self.rowHeight = 40 buttonWidth = 100 buttonHeight = 40 """ Define a window""" self.UIElements["window"] = cmds.window(self.windowName, width=self.windowWidth, height=self.windowHeight, title="Window", sizeable=True) self.UIElements["guiFlowLayout1"] = cmds.flowLayout(v=True, width=self.windowWidth, height=self.windowHeight, bgc=[0.2, 0.2, 0.2]) """ Edit and Create botton row """ self.UIElements["guiFlowLayout2"] = cmds.flowLayout(v=False, width=self.windowWidth, height=self.rowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["guiFlowLayout1"]) self.UIElements["edit_button"] = cmds.button(label="Edit", width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout2"]) self.UIElements["createbutton"] = cmds.button(label="Create", width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout2"], command=self.createPart) """ Name Row """ self.UIElements["guiFlowLayout3"] = cmds.flowLayout(v=False, width=self.windowWidth, height=self.rowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["guiFlowLayout1"]) self.UIElements["name_text"] = cmds.textField(tx="Test", width=buttonWidth, height=buttonHeight, bgc=[1.0, 1.0, 1.0],p=self.UIElements["guiFlowLayout3"]) """ NumParts Row """ self.UIElements["guiFlowLayout4"] = cmds.flowLayout(v=False, width=self.windowWidth, height=self.rowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["guiFlowLayout1"]) self.UIElements["num_text"] = cmds.intField( minValue=3, maxValue=10, step=1, width=buttonWidth, height=buttonHeight, bgc=[1.0, 1.0, 1.0], p=self.UIElements["guiFlowLayout4"]) """ Orientation Row """ self.UIElements["guiFlowLayout5"] = cmds.flowLayout(v=False, width=self.windowWidth, height=self.rowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["guiFlowLayout1"]) self.UIElements["radio_grp1"] = cmds.radioButtonGrp( label='Orientation', labelArray3=['X', 'Y', 'Z'], width=110, numberOfRadioButtons=3, adj=1, p=self.UIElements["guiFlowLayout5"] ) """ Generate and Mirror Row """ self.UIElements["guiFlowLayout6"] = cmds.flowLayout(v=False, width=self.windowWidth, height=self.rowHeight, bgc=[0.4, 0.4, 0.4]) cmds.setParent(self.UIElements["guiFlowLayout1"]) self.UIElements["generate_button"] = cmds.button(label="Generate", width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout6"]) self.UIElements["mirror_button"] = cmds.button(label="Mirror", width=buttonWidth, height=buttonHeight, p=self.UIElements["guiFlowLayout6"]) cmds.showWindow(self.windowName)
def setup_UI(self, *args): characterName = self.characterName self.SaveTemplateUIElements = {} # If the window exists, delete it. if cmds.window("SetupNameWindow", exists=True): cmds.deleteUI("SetupNameWindow") self.windowWidth = 200 self.windowHeight = 550 buttonWidth = (self.windowWidth -5) textWidth = 140 columnOffset = 5 # Create the main window mainWindow = self.SaveTemplateUIElements["window"] = cmds.window("SetupNameWindow", widthHeight=(240, 120), s=True ) # Create a couple flow layouts to hold the UI Elements for setup tools self.SaveTemplateUIElements["buttonColumnLayout"] = cmds.flowLayout(v=True, w=buttonWidth) cmds.setParent( '..' ) cmds.setParent(self.SaveTemplateUIElements["buttonColumnLayout"]) cmds.separator( height=7, style='in' ) cmds.button( label='Export Game Assets', width=buttonWidth, c=self.publishForExport ) cmds.separator( height=7, style='in' ) cmds.button( label='Add Holding Locs', width=buttonWidth, c=self.holdingLocations ) cmds.separator( height=5, style='in' ) self.SaveTemplateUIElements["skinBtn"] = cmds.button(label="Bind Skin", width=buttonWidth, c=self.attachWithSkinning ) cmds.separator( height=5, style='in' ) self.SaveTemplateUIElements["selJntsBtn"] = cmds.button(label="Select Game Joints", width=buttonWidth, c=self.selectGameJoints ) cmds.setParent(self.SaveTemplateUIElements["window"]) cmds.showWindow(self.SaveTemplateUIElements["window"])
def __init__(self): print "In Rdojo_UI" self.UI_Elements = {} self.windowName = "RdojoUI_Window" if cmds.window(self.windowName, exists=True): cmds.deleteUI(self.windowName) windowWidth = 80 windowHeight = 40 buttonWidth = 70 buttonHeight = 33 self.UI_Elements["window"] = cmds.window(self.windowName, width=windowWidth, height=windowHeight, title="RDojo_UI", sizeable=True) self.UI_Elements["buttonLyt"] = cmds.flowLayout(v=True, width=windowWidth, height=windowHeight) fileDirectory = 'R:/Maya/Modules/Layout/' for widget in self.returnWidgets(fileDirectory): print widget # http://docs.python.org/2/library/functions.html#__import__ mod = __import__("Maya.Modules.Layout."+widget, {}, {}, [widget]) reload(mod) title = mod.TITLE description = mod.DESCRIPTION classname = mod.CLASS_NAME cmds.separator(p=self.UI_Elements["buttonLyt"]) # http://stackoverflow.com/questions/15331726/how-does-the-functools-partial-work-in-python self.UI_Elements["module_button_" + widget] = cmds.button(label=title, width=buttonWidth, height=buttonHeight, p=self.UI_Elements['buttonLyt'], c=partial(self.installWidget, widget)) self.UI_Elements["rigArmButton"] = cmds.button(label='Rig_Arm', width=buttonWidth, height=buttonHeight, p=self.UI_Elements['buttonLyt'], c=self.rigArm) cmds.showWindow(self.UI_Elements["window"])
def __init__(self): print "In Rdojo_UI" self.UI_Elements = {} self.windowName = "RDojoUI_Window" if cmds.window(self.windowName, exists = True): cmds.deleteUI(self.windowName) windowWidth = 80 windowHeight = 40 buttonWidth = 70 buttonHeight = 33 self.UI_Elements["window"] = cmds.window(self.windowName, width = windowWidth, height = windowHeight, title = "RDojo_UI", sizeable = True) self.UI_Elements["buttonLyt"] = cmds.flowLayout(v=True, width=windowWidth, height=windowHeight) self.UI_Elements["hingeButton"] = cmds.button(label="Hinge Lyt", width=buttonWidth, height=buttonHeight, p=self.UI_Elements["buttonLyt"], c=self.doStuff) cmds.showWindow(self.windowName)
def __init__(self, *args): import System.directoryExtension as dirExt reload(dirExt) dirExt = dirExt.DirectoryExtension() self.animDir = dirExt.paths['animLib'] """ Call animationModuleSettings """ self.animMods = animModSettings.AnimMod_Info() #animMods = self.animMods self.animLib = animLibrary.animLibFuncs() #animLib = self.animLib try: characterName = self.animMods.characterInfo['characterName'] except: cmds.headsUpMessage("no valid characters in this scene") if cmds.window("animLibWindow", exists=True): cmds.deleteUI("animLibWindow") return """ If the lib directory does not exist, create it. """ turbineUtils.ensure_dir(self.animDir) """ Find all the files in the animation lib directory """ anims = turbineUtils.findAllFiles(self.animDir, ".ma") """ Get the name of the animation file to use as a starting point for naming the output from animLib """ sceneName = cmds.file(q=True, sn=True, shn=True).replace(".ma", "") """ Store the UI elements in a dictionary """ self.animLibUIElements = {} """ If the window exists, delete it. """ if cmds.window("animLibWindow", exists=True): cmds.deleteUI("animLibWindow") self.windowWidth = 440 self.windowHeight = 320 buttonWidth = 100 textWidth = 140 columnOffset = 5 buttonColumnWidth = buttonWidth + (2*columnOffset) textScrollWidth = (self.windowWidth - buttonColumnWidth) fieldWidth = (textScrollWidth -10 ) fieldHeight = (self.windowHeight -40) # Create the main window mainWindow = self.animLibUIElements["window"] = cmds.window("animLibWindow", s=True, rtf=True ) child1 = self.animLibUIElements["listBoxRowLayout"] = cmds.rowLayout(nc=2, columnWidth2=[buttonWidth, textScrollWidth], columnAttach=([1, "left", columnOffset], [2, "both", columnOffset]), rowAttach=([1, "top", columnOffset], [2, "top", columnOffset])) # Create a couple flow layouts to hold the UI Elements for setup tools self.animLibUIElements["buttonColumnLayout"] = cmds.flowLayout(v=True) cmds.setParent( '..' ) self.animLibUIElements["characterColumnLayout"] = cmds.flowLayout(v=True) cmds.setParent( '..' ) # Create the setup UI elements cmds.setParent(self.animLibUIElements["characterColumnLayout"]) self.animLibUIElements["nameField"] = cmds.textField(tx=sceneName, width=fieldWidth) cmds.separator( height=7, style='in' ) self.animLibUIElements["animationList"] = cmds.textScrollList(numberOfRows=4, allowMultiSelection=False, append=anims, selectIndexedItem=1, width=fieldWidth, h=fieldHeight) cmds.setParent(self.animLibUIElements["buttonColumnLayout"]) self.animLibUIElements['saveAnimButton'] = cmds.button( label='Save Anim As', width=buttonWidth, c=self.exportAnimCurves ) cmds.separator( height=5, style='in' ) self.animLibUIElements['loadAnimButton'] = cmds.button( label='Load Animation', width=buttonWidth, h=100, c=self.importAnim ) cmds.setParent(self.animLibUIElements["window"]) cmds.showWindow(self.animLibUIElements["window"])
import maya.cmds as cmds def deleteSample(strDelete,*agre): cmds.deleteUI(strDelete) if cmds.window('samplesss_a',q=True,exists=True): cmds.deleteUI('samplesss_a') if cmds.windowPref('samplesss_a',exists=True): cmds.windowPref('samplesss_a',remove=True) cmds.window('samplesss_a') #cmds.columnLayout('col_layout',adjustableColumn=True) cmds.scrollLayout('scro_layout',width=400,height=450,childResizable=True) cmds.flowLayout('flow_main',height = 1000,columnSpacing=1,wrap=True,vertical=False,p='scro_layout') for i in range(100): cmds.button('sa'+str(i),p='flow_main',width = 60,height = 60,c=partial(deleteSample,'sa'+str(i))) cmds.showWindow('samplesss_a')