def create(self):
        
        if cmds.window( WinA_Global.winName, ex=1 ):
            cmds.deleteUI( WinA_Global.winName, wnd=1 )
        cmds.window( WinA_Global.winName, title= WinA_Global.title, titleBarMenu = WinA_Global.titleBarMenu )

        form = cmds.formLayout()
        importPathForm     = self.uiImportPath.create()
        importByMatrixForm = self.importByMatrix.create()
        buttonForm         = self.uiButton.create()
        cmds.setParent( '..' )
        
        cmds.formLayout( form, e=1,
                         af=[(importPathForm, 'top', 8), (importPathForm, 'left', 0), (importPathForm, 'right', 0),
                             (importByMatrixForm, 'left', 120 ), (importByMatrixForm, 'right', 0 ),
                             (buttonForm,     'left', 0 ), (buttonForm,    'right', 0 )],
                         ac=[(importByMatrixForm, 'top', 8, importPathForm),
                             (buttonForm, 'top', 8, importByMatrixForm)] )
        
        cmds.window( WinA_Global.winName, e=1, w= WinA_Global.width, h= WinA_Global.height, rtf=1 )
        cmds.showWindow( WinA_Global.winName )
    
        WinA_uiCmd.setUiDefault()
        WinA_uiCmd.loadInfo()
        WinA_uiCmd.setUiCommand()
 def removeFloatVariable(self, nodeAttr, varslayout, index):
    # Remove variable
    children = cmds.columnLayout(varslayout, query=1, childArray=1)
    
    if len(children) <= index:
       return
    
    baseNameAttr = nodeAttr
    baseValueAttr = nodeAttr.replace("fparam_name", "fparam_value");
    
    for i in xrange(index+1, len(children)):
       rembtn, namefld, _, valfld = cmds.formLayout(children[i], query=1, childArray=1)
       
       indexStr = "[%d]" % (i - 1)
       nextIndexStr = "[%d]" % i
       
       nameAttr = baseNameAttr + indexStr
       valueAttr = baseValueAttr + indexStr
       
       cmds.setAttr(nameAttr, cmds.getAttr(baseNameAttr + nextIndexStr), type="string")
       cmds.setAttr(valueAttr, cmds.getAttr(baseValueAttr + nextIndexStr));
       
       self.setupVariableNameCallback(nameAttr, namefld)
       self.setupFloatVariableValueCallback(valueAttr, valfld)
       cmds.button(rembtn, edit=1, command=lambda *args: self.removeFloatVariable(nodeAttr, varslayout, i-1))
    
    cmds.deleteUI(children[index])
    
    cmds.removeMultiInstance("%s[%d]" % (baseNameAttr, len(children)-1), b=True)
    cmds.removeMultiInstance("%s[%d]" % (baseValueAttr, len(children)-1), b=True)
def animTools():
    #create simple button based GUI for now
    if (cmds.window('zbw_animToolsUI', exists=True)):
        cmds.deleteUI('zbw_animToolsUI', window=True)
        cmds.windowPref('zbw_animToolsUI', remove=True)
    window=cmds.window('zbw_animToolsUI', widthHeight=(350,200), title='zbw_animTools')
    cmds.columnLayout(cal='center')
    #cmds.intFieldGrp('zbw_offsetValue', cal=(1,'left'), label='frequency(frames)', value1=5)
    #CREATE FRAME RANGE AREA (WHICH FRAMES ARE WE DOING?)
    #WHEN THAT HAPPENS, WHAT DO WE DO WITH THE FRAMES AFTER THAT? (PROBABLY NOTHING. . . LET USER WORRY ABOUT IT)
    #checkbox for random freq
    #cmds.checkBoxGrp('zbw_animNoiseRandom', cal=(1,'left'), cw=(1, 175),label='random frequency on', value1=0, cc=zbw_animNoiseRandom)
    cmds.text('zbw_offsetAnim')
    cmds.button('zbw_offsetAnimButton', label='offsetAnim', width=75, command=zbw_offsetAnim)
    cmds.text('zbw_pullDownAnimButton')
    cmds.button('zbw_pullDownAnim', label='pullDownAnim', width=75, command=zbw_pullDownAnim)
    cmds.text('zbw_pullUpAnimButton')
    cmds.button('zbw_pullUpAnimButton', label='pullUpAnim', width=75, command=zbw_pullUpAnim)
    cmds.text('zbw_randomizeKeys')
    cmds.button('zbw_randomizeKeysButton', label='randomizeKeys', width=75, command=zbw_randomizeKeys)
    cmds.text('zbw_animNoise')
    cmds.button('zbw_animNoiseButton', label='animNoise', width=75, command=zbw_animNoise)
    cmds.text('zbw_playblast')
    cmds.button('zbw_playblastButton', label='playblast', width=75, command=zbw_playblast)
    cmds.text('zbw_stepAll')
    cmds.button('zbw_stepAllButton', label='stepAll', width=75, command=zbw_stepAll)
    cmds.text('zbw_cleanKeys')
    cmds.button('zbw_cleanKeysButton', label='cleanKeys', width=75, command=zbw_stepAll)
    cmds.text('zbw_changeFrameRate')
    cmds.button('zbw_changeFrameRate', label='frameRate', width=75, command=zbw_changeFrameRate)

    cmds.showWindow(window)
Example #4
0
def clearMenuItems(menu):
    
    menuItens = cmds.popupMenu(menu, query=True, itemArray=True)

    if menuItens:
        for loopMenu in menuItens:
            if cmds.menuItem(loopMenu, query=True, exists=True): cmds.deleteUI(loopMenu)
    def saveSettings(self, *args):

        #this function will save out the user's preferences they have set in the UI to disk
        settingsLocation = self.mayaToolsDir + "/General/Scripts/projectSettings.txt"

        try:
            f = open(settingsLocation, 'w')


            #create a dictionary with  values
            settings = {}
            settings["UseSourceControl"] = cmds.checkBox(self.widgets["useSourceControl"], q = True, v = True)
            settings["FavoriteProject"] = cmds.optionMenu(self.widgets["favoriteProject_OM"], q = True, v = True)

            #write our dictionary to file
            cPickle.dump(settings, f)
            f.close()

        except:
            cmds.confirmDialog(title = "Error", icon = "critical", message = settingsLocation + " is not writeable. Please make sure this file is not set to read only.")



        #close the UI
        cmds.deleteUI("AnimationRiggingTool_SettingsUI")
Example #6
0
    def __init__(self, uioptions, transformoptions, sourcelist, targetlist):
        '''
        initial setup
        '''
        #create the tool context
        if (mc.draggerContext(spPaint3dContextID, exists=True)):
            mc.deleteUI(spPaint3dContextID);
        mc.draggerContext(spPaint3dContextID, pressCommand=self.onPress, dragCommand=self.onDrag, releaseCommand=self.onRelease, name=spPaint3dContextID, cursor='crossHair', undoMode='step')

        #create context local options
        self.runtimeUpdate(uioptions, transformoptions, sourcelist, targetlist)

        #debug purpose
        self.reentrance = 0

        #initialise world up vector
        if ( (mc.upAxis(q=True, axis=True)) == "y" ):
            self.worldUp = om.MVector (0,1,0);
        elif ( (mc.upAxis(q=True, axis=True)) == "z" ):
            self.worldUp = om.MVector (0,0,1);
        else:
            #can't figure out up vector
            mc.confirmDialog(title='Weird stuff happening', message='Not getting any proper info on what the current up vector is. Quitting...')
            sys.exit()

        #fetch current scene unit
        self.unit = mc.currentUnit(query=True, linear=True)
def zbw_offsetAnim(*args):
    """creates offset from first obj sel to last based on the entered offset value"""
    def zbw_runOffsetAnim(*args):
        #get frame range!!!!!!
        #get selection, check that they are tranforms
        sel = cmds.ls(sl=True,type="transform")
        selSize = int(len(sel))
        #for each selection mult the index by the offset value
        for i in range(0,selSize):
            obj = sel[i]
            offsetRaw = cmds.intFieldGrp('zbw_offsetValue', q=True, v=True)
            offset = offsetRaw[0]
            multFactor = i * offset
            #shift the entire anim curve by the offset mult value
            cmds.keyframe(obj, edit=True,relative=True,timeChange=multFactor,time=(1,24))

    #create UI, get offset value, frame range or all anim
    if (cmds.window('zbw_offsetAnimUI', exists=True)):
        cmds.deleteUI('zbw_offsetAnimUI', window=True)
        cmds.windowPref('zbw_offsetAnimUI', remove=True)
    window=cmds.window('zbw_offsetAnimUI', widthHeight=(350,200), title='zbw_offsetAnim')
    cmds.columnLayout(cal='center')
    cmds.intFieldGrp('zbw_offsetValue', cal=(1,'left'), label='frequency(frames)', value1=5)
    #CREATE FRAME RANGE AREA (WHICH FRAMES ARE WE DOING?)
    #WHEN THAT HAPPENS, WHAT DO WE DO WITH THE FRAMES AFTER THAT? (PROBABLY NOTHING. . . LET USER WORRY ABOUT IT)
    #checkbox for random freq (to give a random amount to offset each object)
    #cmds.checkBoxGrp('zbw_animNoiseRandom', cal=(1,'left'), cw=(1, 175),label='random frequency on', value1=0, cc=zbw_animNoiseRandom)
    cmds.button('zbw_offsetAnimGo', label='offset!', width=75, command=zbw_runOffsetAnim)

    cmds.showWindow(window)
Example #8
0
def showUI():
    win = 'lsWireOffset_window'
    
    # if window exists, delete
    if mc.window(win, ex=True):
        mc.deleteUI(win, wnd=True)
        
    # delete window prefs... if you want...
    mc.windowPref(win, remove=True)
    
    # create window
    mc.window(win, t='lsWireOffset v0.1', wh=(200,335), mxb=False)
    
    # main column
    mainCol = mc.columnLayout(columnAttach=('both', 5), rowSpacing=10, columnWidth=200)
    
    # creation frame
    createFrm = mc.frameLayout(p=mainCol, cl=False, l='Create New Module')
    createCol = mc.columnLayout(columnAttach=('both', 5), rowSpacing=5, columnWidth=188)
    nameTxtFld = mc.textFieldGrp( label='Name: ', text='', cw2=(40,125), p=createCol)
    mc.text(l='Select edge loop OR \n vertices and...')
    creationBtn = mc.button(l='Create', c="lsWireOffset.ui.createNew('%s')"%nameTxtFld)
    
    # edit frame
    editFrm = mc.frameLayout(p=mainCol, cl=False, l='Edit Existing Modules')
    editCol = mc.columnLayout(columnAttach=('both', 5), rowSpacing=5, columnWidth=188)
    scrollList = mc.textScrollList(win+'_wTSL')
    
    refreshTSL(scrollList)
    
    # popop menu for right click
    mc.popupMenu(win+'_wTSL_MM', p=scrollList, mm=True, button=3, pmc=buildMM)
    
    mc.showWindow(win)
Example #9
0
def create_Menu(*args):
	maya_Window = cmds.window('MayaWindow', ma=True, q=True)
	for m in maya_Window:
		if m == 'RDojo_Menu':
			cmds.deleteUI('RDojo_Menu', m=True)
	cmds.menu('RDojo_Menu', label='RDMenu', to=True, p='MayaWindow')
	cmds.menuItem(label="arm", command="run_Script()")
Example #10
0
 def _doExec(incoming):
     values = []
     for propName, propUI in zip(tool.properties, propsUI):
         propValue = cmds.textField(propUI, query=True, text=True)
         values.append(propValue)
     tool.execute(values)
     cmds.deleteUI(propsWindow)
 def create(self):
     """
     Draw the window
     """
     # delete the window if its handle exists
     if cmds.window(self.window, exists=True):
         # deletes window. 'window' flag makes sure that deleted object is a window
         cmds.deleteUI(self.window, window=True)
     # initialize the window
     self.window = cmds.window(title=self.title, widthHeight=self.size, menuBar=True) 
     # main form for the window
     self.mainForm = cmds.formLayout(numberOfDivisions=100)
     # create common menu items items and buttons
     self.commonMenu()
     self.commonButtons()
     # create a tabLayout
     self.optionsBorder = cmds.tabLayout(scrollable=True, tabsVisible=False, height=1)
     # Attach tabLayout to parent formLayout, and to control button
     cmds.formLayout(self.mainForm, edit=True, attachForm=
                     ([self.optionsBorder, 'top', 0],
                     [self.optionsBorder, 'left', 2],
                     [self.optionsBorder, 'right', 2]),
                     attachControl=
                     ([self.optionsBorder, 'bottom', 5, self.applyBtn]))
     # new form to attach controls in displayOptions()
     self.optionForm = cmds.formLayout(numberOfDivisions=100)
     self.displayOptions()
     # Show the window
     cmds.showWindow(self.window)
Example #12
0
def particleLocatorsUI():
    """
    """
    # Get current frame range
    start = cmds.playbackOptions(q=True, min=True)
    end = cmds.playbackOptions(q=True, max=True)

    # Define window
    particleLocatorsUI = 'particleLocatorsWindow'
    if cmds.window(particleLocatorsUI, q=True, ex=True): cmds.deleteUI(particleLocatorsUI)
    particleLocatorsUI = cmds.window(particleLocatorsUI, t='Generate Locators')

    # UI Layout
    cmds.columnLayout(adj=False, cal='left')
    partiTFG = cmds.textFieldGrp('partiLoc_particleTFG', label='Particle', text='', cw=[(1, 120)])
    prefixTFG = cmds.textFieldGrp('partiLoc_prefixTFG', label='Prefix', text='', cw=[(1, 120)])
    bakeAnicmdsBG = cmds.checkBoxGrp('partiLoc_bakeAnicmdsBG', label='Bake Animation', ncb=1, v1=0, cw=[(1, 120)])
    startEndIFG = cmds.intFieldGrp('partiLoc_startEndISG', nf=2, label='Frame Range', v1=start, v2=end, cw=[(1, 120)])

    rotateLocCBG = cmds.checkBoxGrp('partiLoc_rotateCBG', label='Rotate (rotatePP)', ncb=1, v1=0, cw=[(1, 120)])
    scaleLocCBG = cmds.checkBoxGrp('partiLoc_scaleCBG', label='Scale (scalePP)', ncb=1, v1=0, cw=[(1, 120)])

    cmds.button(l='Create Locators', c='glTools.tools.generateParticles.particleLocatorsFromUI()')

    # Popup menu
    cmds.popupMenu(parent=partiTFG)
    for p in cmds.ls(type=['particle', 'nParticle']):
        cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")')

    # Show Window
    cmds.showWindow(particleLocatorsUI)
Example #13
0
def locatorParticlesUI():
    """
    """
    # Define window
    locParticleUI = 'locatorParticleWindow'
    if cmds.window(locParticleUI, q=True, ex=True): cmds.deleteUI(locParticleUI)
    locParticleUI = cmds.window(locParticleUI, t='Generate Particles')

    # UI Layout
    cmds.columnLayout(adj=False, cal='left')
    partiTFG = cmds.textFieldGrp('locParticle_particleTFG', label='Particle', text='', cw=[(1, 100)])
    radiusFFG = cmds.floatSliderGrp('locParticle_radiusFSG', label='radius', f=True, min=0.1, max=10.0, fmn=0.01,
                                  fmx=100.0, pre=2, v=1.0, cw=[(1, 100)])
    rotateLocCBG = cmds.checkBoxGrp('locParticle_rotateCBG', label='Add rotatePP', ncb=1, v1=0, cw=[(1, 100)])
    scaleLocCBG = cmds.checkBoxGrp('locParticle_scaleCBG', label='Add scalePP', ncb=1, v1=0, cw=[(1, 100)])
    selfCollideCBG = cmds.checkBoxGrp('locParticle_selfCollideCBG', label='self collide', ncb=1, v1=0, cw=[(1, 100)])

    cmds.button(l='Create Particles', c='glTools.tools.generateParticles.locatorParticlesFromUI()')

    # Popup menu
    cmds.popupMenu(parent=partiTFG)
    for p in cmds.ls(type=['particle', 'nParticle']):
        cmds.menuItem(p, c='cmds.textFieldGrp("' + partiTFG + '",e=True,text="' + p + '")')

    # Show Window
    cmds.showWindow(locParticleUI)
 def gen_button(self, *args):
     if self.col != None:
         cmds.deleteUI(self.col)
     self.col = cmds.columnLayout(co=['both', 5], parent=self.dyna)
     # Loop through given objects.
     for obj in self.objs:
         cmds.nodeIconButton( p=self.col, w=self.width - 40, style='iconAndTextHorizontal', image1='cone.png', label=obj, c=pm.Callback(self.select_obj, obj) )
Example #15
0
    def create(self):

        if cmds.menu( self.uiname, ex=1 ):
            cmds.deleteUI( self.uiname )
        cmds.menu( self.uiname, l= self.title, p='MayaWindow', to=1 )
        
        return self.uiname
Example #16
0
 def refreshPic (self, *args):
     cmds.deleteUI(self.posePic)
     poseQuery = cmds.textScrollList(self.poseToLoad, q = True, selectItem = True)
     picName = (self.fileLoc + '/Images/'+ self.folderQuery[0] + '/' + poseQuery[0])
     len (picName)
     picNameB = (picName.rpartition('.txt')[0] + '.0000.iff')
     self.posePic = cmds.iconTextButton(parent = self.imgParent ,style = 'iconOnly', image1 = picNameB, label = 'Pose Name', width = 255, height = 100)
Example #17
0
 def build(self):
     if mc.window( self.win, ex=1 ): mc.deleteUI( self.win )
     if mc.windowPref( self.win, ex=1 ): mc.windowPref( self.win, remove=1 )
     mc.window(self.win, title=self.title, wh=(410,378))
     mc.columnLayout( 'mainColumn', adj=True )
     mc.separator( h=10 )
     mc.rowLayout( numberOfColumns=2, columnWidth2=(200, 200), columnAttach=[(1, "both", 5),(2 ,"both", 5)] )
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.text( l=self.textsk )
     self.skcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True  )
     mc.setParent('..')
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.text( l=self.textqp )
     self.qpcharacterList = mc.textScrollList( numberOfRows=20, allowMultiSelection=True  )
     mc.setParent( '..' )
     mc.setParent('..')
     mc.separator ( h=10 )
     mc.rowLayout( numberOfColumns=4, columnWidth4=(100, 100, 100, 100), columnAttach=[(1, "both", 1),(2 ,"both", 1), (3 ,"both", 1), (4 ,"both", 1)] )
     mc.button( l=self.buttonsk, c=self.selSKItem )
     mc.button( l=self.buttonAllSk, c=self.mainSK )
     mc.button( l=self.buttonqp, c=self.selQPItem )
     mc.button( l=self.buttonAllQp, c=self.mainQP )
     mc.setParent('..')
     mc.columnLayout( adj=True, columnAlign="center" )
     mc.separator ( h=10 )
     mc.setParent('..')
     self.addSKList()
Example #18
0
def main():
	if INMAYA:
		if mc.window( 'ManagerUI', q = 1, ex = 1 ):
			mc.deleteUI( 'ManagerUI' )
	global PyForm
	PyForm=ManagerUI(parent=QtGui.QApplication.activeWindow())
	PyForm.show()
Example #19
0
    def __init__(s):
        with report.Report():
            tracker = JointTracker()
            winName = "Orient_Joints"
            if cmds.window(winName, ex=True):
                cmds.deleteUI(winName)
            s.win = cmds.window(rtf=True, w=300, t="Orient Joints")
            cmds.columnLayout(adj=True)
            cmds.button(
                l="Attach Marker",
                h=50,
                c=Callback(tracker.addMarker),
                ann="""
Attach a Marker to the selected Joint.
Rotate the marker into the desired joint rotation.
"""
            )
            cmds.button(
                l="Update Joints",
                h=50,
                c=Callback(tracker.orientJoints),
                ann="""
Rotate all joints that have markers to their respective rotations.
"""
            )
            cmds.showWindow(s.win)
            cmds.scriptJob(uid=[s.win, tracker.removeMarkers])
Example #20
0
    def __init__(self):
        winName = "Size set"
        global typeMenu
        winTitle = winName
        if cmds.window(winName, exists=True):
                cmds.deleteUI(winName)

#         self.window = cmds.window(self.winName, title=self.winTitle, tbm=1, w=150, h=100 )
        window = cmds.window(winName, title=winTitle, tbm=1, w=250, h=100 )

        cmds.menuBarLayout(h=30)
        cmds.rowColumnLayout  (' selectArrayRow ', nr=1, w=250)

        cmds.frameLayout('LrRow', label='', lv=0, nch=1, borderStyle='out', bv=1, p='selectArrayRow')
        
        cmds.rowLayout  (' rMainRow ', w=300, numberOfColumns=6, p='selectArrayRow')
        cmds.columnLayout ('selectArrayColumn', parent = 'rMainRow')
        cmds.setParent ('selectArrayColumn')
        cmds.separator(h=10, p='selectArrayColumn')
        cmds.gridLayout('listBuildButtonLayout', p='selectArrayColumn', numberOfColumns=2, cellWidthHeight=(100, 20))
        typeMenu=cmds.optionMenu( label='ctrl size')
        cmds.menuItem( label="Large" )
        cmds.menuItem( label="Med" )
        cmds.menuItem( label="Small" )           
        cmds.button (label='Change Selection', p='listBuildButtonLayout', command = lambda *args:self.controllerSize())
        cmds.showWindow(window)    
Example #21
0
def load_ui():

    current_script_path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    if (cmds.window('jt_autorig', exists=True)):
        cmds.deleteUI('jt_autorig')
    window = cmds.loadUI(uiFile=os.path.join(current_script_path, 'jt_autorig.ui'))
    cmds.showWindow(window)
Example #22
0
    def _reloadUI(self, frame):

        flg = logging.getLogger("lettuce._reloadUI")

        mc.deleteUI(frame)
        flg.info("Deleting UI: {}".format(frame))

        mc.frameLayout('masterFrame',
                       parent=self.uiWindow,
                       label='',
                       width=400,
                       labelVisible=False,
                       marginWidth=0
                       )

        if self.xml_load_state:
            flg.info("XML File Loaded")
            self.char_in_scene_list = self._get_characters(self.char_xml_file)

            if len(self.char_in_scene_list) > 0:
                self.char_in_scene = True
                flg.info("Characters verified in Scene")
            else:
                self.char_in_scene = False
                flg.info("Characters verified not in scene")

        if self.char_in_scene:
            flg.info("Creating Character Menus")
            self._create_character_frame(self.char_in_scene_list, "masterFrame")
        else:
            flg.info("Added reload button ")
            mc.button('reloadButton',
                      label="Reload",
                      command=lambda *_: self._reloadUI("masterFrame")
                      )
	def create(self):
		if cmds.window('uvShellAlignWindow', exists = True):
			cmds.deleteUI('uvShellAlignWindow')

		self.window = cmds.window(self.window, title = self.title, widthHeight = self.size)
		self.frameForm = cmds.frameLayout(label = " 1. 基準とする UVShell を選択して登録", bgc = (0.5, 0.3, 0.2), cll = False)
		self.setUVSBtn1 = cmds.button(label = "基準 UVShell を登録"  , command = self.registUVBndBox1, height = 30 )
		cmds.rowLayout( numberOfColumns = 1, adj = True)					

				




		cmds.setParent("..")			
		self.frameForm = cmds.frameLayout(label = " 2. 位置を揃えたい UVShell を選択して実行", bgc = (0.2, 0.3, 0.5), cll = False)
		self.distDcheckBox = cmds.radioButtonGrp('radioBtn', label = "", numberOfRadioButtons = 4 ,
							 sl = 1, cl4 = ['left','left','left','left'] , la4 = [ 'Left', 'Right', 'Bottom', 'Top'], adj = True)

		self.backupPathText = cmds.text("※ 2016/1/5 現在、複数UVを選択した状態での位置揃えには対応していません", font = "smallBoldLabelFont", align = 'left');
		self.setUVSBtn2 = cmds.button(label = "選択した UVShell を揃える" , command = self.registUVBndBox2, height = 30 )
		cmds.setParent("..")	
		
		cmds.separator(width = self.width, style = 'in')
		
		cmds.text("【問い合わせ先】 : TAセクション.村岡", bgc = (0.2, 0.2, 0.2), align = 'left', width = self.width);

		cmds.setParent("..")	
		cmds.showWindow()
Example #24
0
def showSpooler(tskType = 0, imgPath=None, tskFile=False, prjPath=False, tskScript='', opt='', title='', start=False, end=False, priority=50, taskSize=1):
    tsT = tskType
    tsFile = tskFile
    pPath = prjPath
    tsSc = tskScript
    op = opt
    t = title
    p = priority
    st = start
    e = end
    pT = taskSize
    iP = imgPath
    try:
        if cmds.window(WINDOW_NAME, exists=True, q=True):
            cmds.deleteUI(WINDOW_NAME)
            dialog = None
        dialog = jobSpooler(imgPath=iP, tskType = tsT, tskFile=tsFile, prjPath=pPath, tskScript=tsSc, opt=op, title=t, start=st, end=e, priority=p, taskSize=pT, standalone=False)
        dialog.show()
        return
    except:
        app = QtGui.QApplication(sys.argv)
        myApp = jobSpooler(imgPath=iP, tskType = tsT, tskFile=tsFile, prjPath=pPath, tskScript=tsSc, opt=op, title=t, start=st, end=e, priority=p, taskSize=pT)
        myApp.show()
        sys.exit(app.exec_())
        return
Example #25
0
def transfertSelectionToTarget_window():
	"""
	This definition creates the 'Transfert Selection To Target' main window.
	"""

	cmds.windowPref(enableAll=False)

	if (cmds.window("transfertSelectionToTarget_window", exists=True)):
		cmds.deleteUI("transfertSelectionToTarget_window")

	cmds.window("transfertSelectionToTarget_window",
		title="Transfert Selection To Target",
		width=320)

	spacing = 5

	cmds.columnLayout(adjustableColumn=True, rowSpacing=spacing)

	cmds.rowLayout(numberOfColumns=3, columnWidth3=(125, 150, 130), adjustableColumn=2, columnAlign=(2, "left"), columnAttach=[(1, "both", spacing), (2, "both", spacing), (3, "both", spacing)])
	cmds.text(label="Target:")
	sources_textField = cmds.textField("target_textField")
	cmds.button("pickTarget_button", label="Pick Target!", command=pickTarget_button_OnClicked)
	cmds.setParent(topLevel=True)

	cmds.separator(style="single")

	cmds.button("transfertSelection_button", label="Transfert Selection!", command=transfertSelection_button_OnClicked)

	setUnsetContextHotkeys()
	scriptJob = cmds.scriptJob(uiDeleted=("transfertSelectionToTarget_window", setUnsetContextHotkeys), runOnce=True)

	cmds.showWindow("transfertSelectionToTarget_window")

	cmds.windowPref(enableAll=True)
 def create(self):
     
     if cmds.window( self.winName, ex=1 ):
         cmds.deleteUI( self.winName, wnd=1 )
     cmds.window( self.winName, title= self.title )
     
     form = cmds.formLayout()
     field_meshForm = self.field_mesh.create()
     field_uvForm   = self.field_uv.create()
     checkForm      = self.check.create()
     buttons_form   = self.buttons.create()
     cmds.setParent( '..' )
     
     cmds.formLayout( form, e=1,
                      af=[(field_meshForm, 'top', 0 ), ( field_meshForm, 'left', 0 ), ( field_meshForm, 'right', 0 ),
                          (field_uvForm, 'left', 0 ), ( field_uvForm, 'right', 0 ),
                          (checkForm, 'left', 0 ), (checkForm, 'right', 0 ),
                          (buttons_form, 'left', 0 ), ( buttons_form, 'right', 0 ) ],
                      ac=[(field_uvForm, 'top', 0, field_meshForm ),
                          (checkForm, 'top', 0, field_uvForm),
                          (buttons_form, 'top', 0, checkForm )])
     
     cmds.window( self.winName, e=1, w=self.width, h=self.height )
     cmds.showWindow( self.winName ) 
 
     self.setTextInfomation()
     self.popupSetting()
     self.buttonCommandSetting()
Example #27
0
def addMultiAttr():
    #Create a variable for the window name
    winName = 'blend'
    winTitle = 'rh_addMultiAttr'
    #Delete the window if it exists
    if cmds.window(winName, exists=True):
        cmds.deleteUI(winName, window=True)
    #Build the main window
    cmds.window(winName, title=winTitle, sizeable=True)
    cmds.textFieldButtonGrp('Obj',label='Object :', text='', ed = False,buttonLabel='Load Sel',bc = 'sel()')
    cmds.columnLayout(adjustableColumn=True)    
    cmds.textFieldGrp('Attr',l='Attribute:',text='')   

    cmds.columnLayout(adjustableColumn=True)  
    cmds.floatFieldGrp('minAttr', numberOfFields=1, label='Min Value', value1=0) 
       
    cmds.columnLayout(adjustableColumn=True) 
    cmds.floatFieldGrp('maxAttr', numberOfFields=1, label='Max Value', value1=0)
    
    cmds.columnLayout(adjustableColumn=True)        
    cmds.button(label='Contact', command='Connect()')
    cmds.columnLayout(adjustableColumn=True)
    #Show the window
    cmds.showWindow(winName)
    cmds.window(winName, edit=True, width=300, height=120)
Example #28
0
def createMayaWindow(title, new, brand="studio.coop", tooltip="introduction to the UI"):
    if cmds.window(title, exists=True):
        if not new:
            cmds.showWindow(title)
            return None, True
        cmds.deleteUI(title, wnd=True)  # delete old window
    mWindow = mayaUI()
    mWindow.setWindowTitle(title)
    mWindow.setObjectName(title)
    mWindow.setWindowFlags(QtCore.Qt.Tool)  # always on top (multiplatform)

    # Default UI elements
    """ Create the widgets for the dialog """
    mWindow.header = QtGui.QLabel(title)
    mWindow.header.setAlignment(QtCore.Qt.AlignHCenter)
    mWindow.header.setFont(fontHeader)
    mWindow.header.setContentsMargins(10, 10, 10, 10)

    mWindow.brand = QtGui.QLabel(brand)
    mWindow.brand.setToolTip(tooltip)
    mWindow.brand.setStyleSheet("background-color: rgb(40,40,40); color: rgb(180,180,180); border:solid black 1px")
    mWindow.brand.setAlignment(QtCore.Qt.AlignHCenter)
    mWindow.brand.setGeometry(10, 10, 20, 20)
    mWindow.brand.setFont(fontFooter)
    print "window successfully created"
    return mWindow, False
Example #29
0
def dock(window):

    main_window = None
    for obj in QtWidgets.qApp.topLevelWidgets():
        if obj.objectName() == "MayaWindow":
            main_window = obj

    if not main_window:
        raise ValueError("Could not find the main Maya window.")

    # Deleting existing dock
    print "Deleting existing dock..."
    if self._dock:
        self._dock.setParent(None)
        self._dock.deleteLater()

    if self._dock_control:
        if cmds.dockControl(self._dock_control, query=True, exists=True):
            cmds.deleteUI(self._dock_control)

    # Creating new dock
    print "Creating new dock..."
    dock = Dock(parent=main_window)

    dock_control = cmds.dockControl(label=window.windowTitle(), area="right",
                                    visible=True, content=dock.objectName(),
                                    allowedArea=["right", "left"])
    dock.layout().addWidget(window)

    self._dock = dock
    self._dock_control = dock_control
Example #30
0
def quitBtn():
    mc.deleteUI(myWindow)
Example #31
0
 def close(self):
     if mc.window(self.windowName, q=True, exists=True):
         mc.deleteUI(self.windowName)
Example #32
0
 def close(self, *args):
     # This will delete our UI, thereby closing it
     cmds.deleteUI(self.windowName)
Example #33
0
def splinifyUI():

    # Create window
    if cmds.window('splinifyWin', exists=1):
        cmds.deleteUI('splinifyWin')
    window = cmds.window('splinifyWin', title='Splinify', sizeable=1)

    # Create form + UI elements
    form = cmds.formLayout(numberOfDivisions=100)
    scroll = cmds.scrollLayout(parent=form)
    scrollForm = cmds.formLayout(numberOfDivisions=100, parent=scroll)

    startJointText = cmds.textFieldGrp(label='Start Joint: ',
                                       adjustableColumn=2,
                                       editable=0)
    startJointBtn = cmds.button(label='Set Selected',
                                command=partial(checkSelectedJoint,
                                                startJointText))

    endJointText = cmds.textFieldGrp(label='End Joint: ',
                                     adjustableColumn=2,
                                     editable=0)
    endJointBtn = cmds.button(label='Set Selected',
                              command=partial(checkSelectedJoint,
                                              endJointText))

    boneIntSlider = cmds.intSliderGrp(label='Number of Bones: ',
                                      field=1,
                                      step=2,
                                      minValue=2,
                                      maxValue=100,
                                      value=10,
                                      adjustableColumn=3)
    jointChainOptions = cmds.optionMenuGrp(label='Joint Chain: ',
                                           changeCommand=partial(
                                               changeJointChain,
                                               boneIntSlider))
    cmds.menuItem(label='Create From Start/End Joints')
    cmds.menuItem(label='Use Existing Joint Chain')

    controlIntSlider = cmds.intSliderGrp(label='Number of Controls: ',
                                         field=1,
                                         step=2,
                                         minValue=2,
                                         maxValue=30,
                                         value=4,
                                         adjustableColumn=3)
    startColorSlider = cmds.colorSliderGrp(label='Start Control Color: ',
                                           rgb=(0, 0, 1))
    endColorSlider = cmds.colorSliderGrp(label='End Control Color: ',
                                         rgb=(0, 1, 0))

    volumePrsvCheckbox = cmds.checkBoxGrp(label='Preserve Volume: ', visible=0)

    splineTypeOptions = cmds.optionMenuGrp(
        label='Spline Type: ',
        changeCommand=partial(changeSplineType, controlIntSlider,
                              startColorSlider, endColorSlider,
                              volumePrsvCheckbox))
    cmds.menuItem(label='Cluster Controls')
    cmds.menuItem(label='Stretchy Spine')

    splinifyBtn = cmds.button(
        label='Splinify!',
        command=partial(executeSplinify, jointChainOptions, startJointText,
                        endJointText, boneIntSlider, splineTypeOptions,
                        controlIntSlider, startColorSlider, endColorSlider,
                        volumePrsvCheckbox),
        parent=form)
    applyBtn = cmds.button(label='Apply',
                           command=partial(applySplinify, jointChainOptions,
                                           startJointText, endJointText,
                                           boneIntSlider, splineTypeOptions,
                                           controlIntSlider, startColorSlider,
                                           endColorSlider, volumePrsvCheckbox),
                           parent=form)
    closeBtn = cmds.button(label='Close',
                           command="cmds.deleteUI('splinifyWin')",
                           parent=form)

    # Format UI elements
    cmds.formLayout(form,
                    edit=1,
                    attachForm=[(scroll, 'top', 5), (scroll, 'left', 5),
                                (scroll, 'right', 5), (splinifyBtn, 'left', 5),
                                (splinifyBtn, 'bottom', 5),
                                (applyBtn, 'bottom', 5),
                                (closeBtn, 'bottom', 5),
                                (closeBtn, 'right', 5)],
                    attachControl=[(scroll, 'bottom', 5, splinifyBtn),
                                   (splinifyBtn, 'right', 5, applyBtn),
                                   (closeBtn, 'left', 5, applyBtn)],
                    attachPosition=[
                        (applyBtn, 'left', 0, 34),
                        (applyBtn, 'right', 0, 66),
                    ])
    cmds.formLayout(scrollForm,
                    edit=1,
                    attachForm=[
                        (jointChainOptions, 'top', 25),
                        (jointChainOptions, 'left', 0),
                        (startJointText, 'left', 0),
                        (startJointBtn, 'right', 10),
                        (endJointText, 'left', 0),
                        (endJointText, 'right', 0),
                        (endJointBtn, 'right', 10),
                        (boneIntSlider, 'left', 0),
                        (boneIntSlider, 'right', 0),
                        (splineTypeOptions, 'left', 0),
                        (controlIntSlider, 'left', 0),
                        (controlIntSlider, 'right', 0),
                        (startColorSlider, 'left', 0),
                        (startColorSlider, 'right', 0),
                        (endColorSlider, 'left', 0),
                        (endColorSlider, 'right', 0),
                        (volumePrsvCheckbox, 'left', 0),
                        (volumePrsvCheckbox, 'right', 0),
                        (volumePrsvCheckbox, 'bottom', 5),
                    ],
                    attachControl=[
                        (jointChainOptions, 'bottom', 5, startJointText),
                        (startJointText, 'bottom', 5, endJointText),
                        (startJointText, 'right', 5, startJointBtn),
                        (startJointBtn, 'bottom', 5, endJointBtn),
                        (endJointText, 'right', 5, endJointBtn),
                        (endJointText, 'bottom', 5, boneIntSlider),
                        (endJointBtn, 'bottom', 5, boneIntSlider),
                        (boneIntSlider, 'bottom', 5, splineTypeOptions),
                        (splineTypeOptions, 'bottom', 5, controlIntSlider),
                        (controlIntSlider, 'bottom', 5, startColorSlider),
                        (startColorSlider, 'bottom', 5, endColorSlider),
                        (endColorSlider, 'bottom', 5, volumePrsvCheckbox),
                    ])
    cmds.showWindow(window)
Example #34
0
 def cancelCallback(*pArgs):
     if cmds.window(windowID, exists=True):
         cmds.deleteUI(windowID)
Example #35
0
 def _close():
     cmds.deleteUI("MMtoKeyAbout")
Example #36
0
    def __init__(self, preferences):
        QMainWindow.__init__(self, QtWrapper.wrapWidget())
        self._preferences = preferences
        while cmds.window("MMtoKeyPreferences", ex=True):
            cmds.deleteUI("MMtoKeyPreferences")
        self.setObjectName("MMtoKeyPreferences")
        self.setWindowTitle("MMtoKey Preferences")
        self.setWindowFlags(Qt.Tool)

        # from QT designer
        self.setFixedSize(260, 280)
        layout_widget = QWidget(self)
        layout_widget.setGeometry(QRect(10, 10, 238, 260))
        grid_layout = QGridLayout(layout_widget)
        grid_layout.setContentsMargins(0, 0, 0, 0)
        grid_layout.setHorizontalSpacing(2)
        grid_layout.setVerticalSpacing(2)
        label_4 = QLabel("LMB (selected) default marking menu", layout_widget)
        label_4.setMinimumSize(QSize(0, 20))
        grid_layout.addWidget(label_4, 0, 0, 1, 2)
        self._cmb_lmb = QComboBox(layout_widget)
        self._cmb_lmb.setMinimumSize(QSize(0, 20))
        self._cmb_lmb.addItems(["mel", "python"])
        self._cmb_lmb.setCurrentIndex(preferences["default_lmb_type"])
        grid_layout.addWidget(self._cmb_lmb, 1, 0, 1, 1)
        self._line_lmb = QLineEdit(preferences["default_lmb"], layout_widget)
        self._line_lmb.setMinimumSize(QSize(0, 20))
        grid_layout.addWidget(self._line_lmb, 1, 1, 1, 1)
        label_3 = QLabel("MMB (tools) default marking menu", layout_widget)
        label_3.setMinimumSize(QSize(0, 20))
        grid_layout.addWidget(label_3, 2, 0, 1, 2)
        self._cmb_mmb = QComboBox(layout_widget)
        self._cmb_mmb.setMinimumSize(QSize(0, 20))
        self._cmb_mmb.addItems(["mel", "python"])
        self._cmb_mmb.setCurrentIndex(preferences["default_mmb_type"])
        grid_layout.addWidget(self._cmb_mmb, 3, 0, 1, 1)
        self._line_mmb = QLineEdit(preferences["default_mmb"], layout_widget)
        self._line_mmb.setMinimumSize(QSize(0, 20))
        grid_layout.addWidget(self._line_mmb, 3, 1, 1, 1)
        self._chb_dag = QCheckBox("same dag nodes", layout_widget)
        self._chb_dag.setMinimumSize(QSize(0, 20))
        self._chb_dag.setChecked(preferences["same_dag"])
        grid_layout.addWidget(self._chb_dag, 4, 0, 1, 2)
        self._chb_non_dag = QCheckBox("same non dag nodes", layout_widget)
        self._chb_non_dag.setMinimumSize(QSize(0, 20))
        self._chb_non_dag.setChecked(preferences["same_non_dag"])
        grid_layout.addWidget(self._chb_non_dag, 5, 0, 1, 2)
        self._chb_radial = QCheckBox("radial menu for presets", layout_widget)
        self._chb_radial.setMinimumSize(QSize(0, 20))
        self._chb_radial.setChecked(preferences["preset_radial"])
        grid_layout.addWidget(self._chb_radial, 6, 0, 1, 2)
        self._chb_hud = QCheckBox("Heads-up display for presets",
                                  layout_widget)
        self._chb_hud.setMinimumSize(QSize(0, 20))
        self._chb_hud.setChecked(preferences["preset_hud"])
        grid_layout.addWidget(self._chb_hud, 7, 0, 1, 2)
        self._spin_hud_s = QSpinBox(layout_widget)
        self._spin_hud_s.setMinimumSize(QSize(0, 20))
        self._spin_hud_s.setMinimum(0)
        self._spin_hud_s.setMaximum(9)
        self._spin_hud_s.setValue(preferences["preset_hud_s"])
        grid_layout.addWidget(self._spin_hud_s, 8, 0, 1, 1)
        label = QLabel("HUD section", layout_widget)
        label.setMinimumSize(QSize(0, 20))
        grid_layout.addWidget(label, 8, 1, 1, 1)
        self._spin_hud_b = QSpinBox(layout_widget)
        self._spin_hud_b.setMinimumSize(QSize(0, 20))
        self._spin_hud_b.setMinimum(0)
        self._spin_hud_b.setMaximum(9)
        self._spin_hud_b.setValue(preferences["preset_hud_b"])
        grid_layout.addWidget(self._spin_hud_b, 9, 0, 1, 1)
        label_2 = QLabel("HUD block", layout_widget)
        label_2.setMinimumSize(QSize(0, 20))
        grid_layout.addWidget(label_2, 9, 1, 1, 1)
        button = QPushButton("save", layout_widget)
        button.setMinimumSize(QSize(0, 20))
        grid_layout.addWidget(button, 10, 0, 1, 1)

        # signals
        self._chb_hud.toggled.connect(self._spin_hud_b.setEnabled)
        self._chb_hud.toggled.connect(self._spin_hud_s.setEnabled)
        button.released.connect(self._save)
        self._spin_hud_s.setEnabled(preferences["preset_hud"])
        self._spin_hud_b.setEnabled(preferences["preset_hud"])
        self.show()
Example #37
0
 def close(self, sender):
     try:
         cmds.deleteUI(self.win)
     except:
         print('Error on close.')
Example #38
0
    def cancel_window(self, *args):

        cmds.deleteUI(self.ui_elements["window"])
Example #39
0
	def UI (self):
		'''Creates UI - Main function
		
		Call functions: 'eyeParentJnt', 'eyeParentCtrl', 'placeEyeCenter', 'placeEyeCenterUndo', 
						'upLidVtxSet', 'lowLidVtxSet', 'buildRig' '''

		# Main window
		
		winWidth = 290
		
		UKDP_mainWin = "UKDP_WIN_AUTO_EYELIDS_RIG"

		if cmds.window ("UKDP_WIN_AUTO_EYELIDS_RIG", exists = 1):
			cmds.deleteUI ("UKDP_WIN_AUTO_EYELIDS_RIG", window = 1)

		cmds.window ("UKDP_WIN_AUTO_EYELIDS_RIG", title = "UKDP - Auto Eyelids Rig", s = 0, mxb = 0)

		# Main layout
		cmds.columnLayout (co = ("both", 5))
		
		# Define eye name
		cmds.text (h = 5, l = "")
		cmds.rowLayout (numberOfColumns = 2)
		cmds.text (w = 120, l = "Eye name (ex.: L_Eye)")
		self.txtfEye = cmds.textField (w = 166)
		cmds.setParent ("..")

		cmds.text (h = 10, l = "")
		
		cmds.frameLayout (w = winWidth, collapsable = 1, collapse = 1, marginWidth = 5, l = "Define rig hierarchy (optional)")
		
		# Define parent joint
		cmds.text (h = 10, l = "")
		cmds.text (l = "Select eyelids parent joint (would be the head joint)")
		self.btnEyeParentJnt = cmds.button (l = "Set", c = self.eyeParentJnt)
		self.txtfJnt = cmds.textField (ed = 0)
		
		cmds.text (h = 10, l = "")
		
		# Define parent control
		cmds.text (l = "Select eyelids parent control (would be the head control)")
		self.btnEyeParentCtrl = cmds.button (w = (winWidth - 50), l = "Set", c = self.eyeParentCtrl)
		self.txtfCtrl = cmds.textField (w = (winWidth - 50), ed = 0)
		
		cmds.text (h = 5, l = "")
		cmds.setParent ("..")
		
		cmds.separator (h = 15, w = winWidth, style = "in")
		
		# Define eyeball center
		cmds.text (h = 30, l = "Select eyeball, then click 'Place center'.")
		cmds.rowLayout (numberOfColumns = 2)
		self.btnPlaceCenter = cmds.button (w = ((winWidth / 2) - 2), l = "Place center", c = self.placeEyeCenter)
		self.btnUndoPlaceCenter = cmds.button (w = ((winWidth / 2) - 2), l = "Undo", c = self.placeEyeCenterUndo, en = 0)
		cmds.setParent ("..")
		cmds.text (h = 5, l = "")
		self.txtfLoc = cmds.textField (w = winWidth, ed = 0)
		
		cmds.separator (h = 15, w = winWidth, style = "in")

		# List upper lid vertices
		cmds.text (h = 30, l = "Select vertices of upper eyelid, then click 'Set'.")
		self.btnUpLid = cmds.button (w = winWidth, l = "Set", c = self.upLidVtxSet)
		self.scrollfUpLid = cmds.scrollField (w = winWidth, h = 35, wordWrap = 1, ed = 0, en = 0)
		
		cmds.separator (h = 15, w = winWidth, style = "in")

		# List lower lid vertices
		cmds.text (h = 30, l = "Select vertices of lower eyelid, then click 'Set'.")
		self.btnLowLid = cmds.button (w = winWidth, l = "Set", c = self.lowLidVtxSet)
		self.scrollfLowLid = cmds.scrollField (w = winWidth, h = 35, wordWrap = 1, ed = 0, en = 0)
		
		cmds.separator (h = 15, w = winWidth, style = "in")
		
		# Allow/disallow smart blink
		self.isSmartBlink =  cmds.checkBox (h = 30, l = "Add smart blink?", v = 1)
		
		# Build final rig
		self.btnBuild = cmds.button (w = winWidth, h = 60, l = "BUILD RIG", c = self.buildRig, bgc = (0.1,0.7,0.7))
		
		cmds.text (h = 5, l = "")
		
		# Script infos
		cmds.text (en = 0, w = winWidth, l = MadeBy + " (" + Contact + ") - " + ScriptName + " " + Version)
		cmds.text (en = 0, w = winWidth, l = "Based on Marco Giordano's tutorials")
		
		cmds.text (h = 5, l = "")
		
		cmds.setParent ("..")
		
		cmds.showWindow ("UKDP_WIN_AUTO_EYELIDS_RIG")
def CloseUI(*pArgs):
    if cmds.window(windowID, exists=True):
        cmds.deleteUI(windowID)
Example #41
0
    def accept_window(self, *args):

        # a module info entry = (original_module, mirrored_module, mirror_plane, rotation_function, translation_function)

        self.module_info = []

        self.mirror_plane = cmds.radioCollection(
            self.ui_elements["mirror_plane_radio_collection"],
            query=True,
            select=True)

        for i in range(len(self.modules)):

            original_module = self.modules[i]
            original_module_name = self.module_names[i]

            original_module_prefix = original_module.partition("__")[0]
            mirrored_module_user_specified_name = cmds.textField(
                self.ui_elements["module_name_" + original_module_name],
                query=True,
                text=True)

            mirrored_module_name = original_module_prefix + "__" + mirrored_module_user_specified_name

            if utils.does_blueprint_user_specified_name_exist(
                    mirrored_module_user_specified_name):

                cmds.confirmDialog(title="Name Conflict",
                                   message="Name \"" +
                                   mirrored_module_user_specified_name +
                                   "\" already exists, aborting mirror.",
                                   button=["Accept"],
                                   defaultButton="Accept")
                return

            rotation_function = ""
            translation_function = ""

            if self.same_mirror_settings_for_all == True:

                rotation_function = cmds.radioCollection(
                    self.ui_elements["rotation_radioCollection_all"],
                    query=True,
                    select=True)
                translation_function = cmds.radioCollection(
                    self.ui_elements["translation_radioCollection_all"],
                    query=True,
                    select=True)

            else:

                rotation_function = cmds.radioCollection(
                    self.ui_elements["rotation_radioCollection_" +
                                     original_module_name],
                    query=True,
                    select=True)
                translation_function = cmds.radioCollection(
                    self.ui_elements["translation_radioCollection_" +
                                     original_module_name],
                    query=True,
                    select=True)

            rotation_function = rotation_function.partition("__")[0]
            translation_function = translation_function.partition("__")[0]

            self.module_info.append([
                original_module, mirrored_module_name, self.mirror_plane,
                rotation_function, translation_function
            ])

        cmds.deleteUI(self.ui_elements["window"])

        self.mirror_modules()
    def populateMaterials(self):

        # Remove any existing materials.
        if (cmds.layout("RPRMaterialsFlow", exists=True)):
            cmds.deleteUI("RPRMaterialsFlow", layout=True)

        # Ensure that the material container is the current parent.
        cmds.setParent(self.materialsContainer)

        # Create the new flow layout.
        cmds.flowLayout("RPRMaterialsFlow", columnSpacing=0, wrap=True)

        # Add materials for the selected category.
        for material in self.materials:
            fileName = material["fileName"]
            imageFileName = self.libraryPath + "/" + fileName + "/" + fileName + ".jpg"

            materialName = material["name"]

            # Horizontal layout for small icons.
            if (self.iconSize < 64):
                iconWidth = self.iconSize + 5
                cmds.rowLayout(width=self.cellWidth,
                               height=self.cellHeight,
                               numberOfColumns=2,
                               columnWidth2=(self.iconSize,
                                             self.cellWidth - iconWidth - 5))

                cmds.iconTextButton(style='iconOnly',
                                    image=imageFileName,
                                    width=self.iconSize,
                                    height=self.iconSize,
                                    command=partial(self.selectMaterial,
                                                    material),
                                    doubleClickCommand=partial(
                                        self.importMaterial, material))

                cmds.iconTextButton(style='textOnly',
                                    height=self.iconSize,
                                    label=self.getTruncatedText(
                                        materialName,
                                        self.cellWidth - iconWidth - 5),
                                    align="left",
                                    command=partial(self.selectMaterial,
                                                    material),
                                    doubleClickCommand=partial(
                                        self.importMaterial, material))

            # Vertical layout for large icons.
            else:
                cmds.columnLayout(width=self.cellWidth, height=self.cellHeight)
                cmds.iconTextButton(style='iconOnly',
                                    image=imageFileName,
                                    width=self.iconSize,
                                    height=self.iconSize,
                                    command=partial(self.selectMaterial,
                                                    material),
                                    doubleClickCommand=partial(
                                        self.importMaterial, material))

                cmds.text(label=self.getTruncatedText(materialName,
                                                      self.iconSize),
                          align="center",
                          width=self.iconSize)

            cmds.setParent('..')

        # Perform an initial layout update.
        self.updateMaterialsLayout()
Example #43
0
    def mirror_module_ui(self):

        self.module_names = []

        for module in self.modules:

            self.module_names.append(module.partition("__")[2])

        self.same_mirror_settings_for_all = False

        if len(self.modules) > 1:

            result = cmds.confirmDialog(
                title="Mirror Multiple Modules",
                message=str(len(self.modules)) +
                " modules selected for mirror. \nHow would you like to apply mirror settings?",
                button=["Same for All", "Individually", "Cancel"],
                defaultButton="Same for All",
                cancelButton="Cancel",
                dismissString="Cancel")
            if result == "Cancel":

                return

            if result == "Same for All":

                self.same_mirror_settings_for_all = True

        self.ui_elements = {}

        if cmds.window("mirror_module_ui_window", exists=True):

            cmds.deleteUI("mirror_module_ui_window")

        window_width = 300
        window_height = 400

        self.ui_elements["window"] = cmds.window("mirror_module_ui_window",
                                                 width=window_width,
                                                 height=window_height,
                                                 title="Mirror Module(s)",
                                                 sizeable=False)

        self.ui_elements["scroll_layout"] = cmds.scrollLayout(hst=0)
        self.ui_elements["top_column_layout"] = cmds.columnLayout(adj=True,
                                                                  rs=3)

        # Mirror options XY, YZ, XZ
        scroll_width = window_width - 30
        mirror_plane_text_width = 85
        mirror_plane_column_width = (scroll_width -
                                     mirror_plane_text_width / .4)

        self.ui_elements["mirror_plane_row_column"] = cmds.rowColumnLayout(
            nc=4,
            columnAttach=(1, "right", 0),
            columnWidth=[(1, mirror_plane_text_width),
                         (2, mirror_plane_column_width),
                         (3, mirror_plane_column_width),
                         (4, mirror_plane_column_width)])

        cmds.text(label="Mirror Plane: ")

        self.ui_elements[
            "mirror_plane_radio_collection"] = cmds.radioCollection()

        cmds.radioButton("XY", label="XY", select=False)
        cmds.radioButton("YZ", label="YZ", select=True)
        cmds.radioButton("XZ", label="XZ", select=False)

        cmds.setParent(self.ui_elements["top_column_layout"])
        cmds.separator()

        # list of modules in the selected group
        cmds.text(label="Mirrored Name(s):")

        column_width = scroll_width / 2

        self.ui_elements["module_name_row_column"] = cmds.rowColumnLayout(
            nc=2,
            columnAttach=(1, "left", 0),
            columnWidth=[(1, column_width - 60), (2, column_width)])

        for module in self.module_names:

            cmds.text(label=module + " >> ")

            self.ui_elements["module_name_" + module] = cmds.textField(
                enable=True, text=module + "_mirror")

        cmds.setParent(self.ui_elements["top_column_layout"])
        cmds.separator()

        if self.same_mirror_settings_for_all:

            self.generate_mirror_function_controls(None, scroll_width)

        else:

            for module in self.module_names:

                cmds.setParent(self.ui_elements["top_column_layout"])
                self.generate_mirror_function_controls(module, scroll_width)

        cmds.setParent(self.ui_elements["top_column_layout"])
        cmds.separator()

        self.ui_elements["button_row"] = cmds.rowLayout(
            nc=2,
            columnWidth=[(1, column_width), (2, column_width)],
            columnAttach=[(1, "both", 10), (2, "both", 10)],
            columnAlign=[(1, "center"), (2, "center")])

        cmds.button(label="Accept", c=self.accept_window)
        cmds.button(label="Cancel", c=self.cancel_window)

        cmds.showWindow(self.ui_elements["window"])
Example #44
0
def removeMenu(menuName='iQA'):
    """"""
    if cmds.menu(menuName, q=True, exists=True):
        cmds.deleteUI(menuName, menu=True)
def UI(instanceIteration):

    windowID = 'myWindowID'
    global windowID
    if cmds.window(windowID, exists=True):
        cmds.deleteUI(windowID)

    win = cmds.window(windowID,
                      title="PointonPolyConstraintInstancer",
                      sizeable=False,
                      resizeToFitChildren=True)

    cmds.rowColumnLayout(numberOfColumns=4)

    cmds.separator(width=1, style='none')
    cmds.text(label="Random Rotation Range:", align="right")
    cmds.separator(w=1, style='none')
    RotationRangeField = cmds.floatFieldGrp(numberOfFields=3,
                                            value1=0,
                                            value2=0,
                                            value3=0)

    cmds.separator(w=1, style='none')
    cmds.text(label="Random Scale Range Start Values:", align="right")
    cmds.separator(width=1, style='none')
    ScaleRangeStartField = cmds.floatFieldGrp(numberOfFields=3,
                                              value1=1,
                                              value2=1,
                                              value3=1)

    cmds.separator(w=1, style='none')
    cmds.text(label="Random Scale Range End Values:", align="right")
    cmds.separator(width=1, style='none')
    ScaleRangeEndField = cmds.floatFieldGrp(numberOfFields=3,
                                            value1=1,
                                            value2=1,
                                            value3=1)

    cmds.separator(w=1, style='none')
    cmds.text(label="Random Component Placement Value:", align="right")
    cmds.separator(width=1, style='none')
    PlacementAmountField = cmds.floatField(value=1, minValue=0, maxValue=1)

    cmds.separator(w=1, style='none')
    cmds.text(label="Offset", align="right")
    cmds.separator(width=1, style='none')
    OffsetField = cmds.floatFieldGrp(numberOfFields=3,
                                     value1=0,
                                     value2=0,
                                     value3=0)

    cmds.separator(w=1, style='none')
    cmds.text(label="Weight", align="right")
    cmds.separator(width=1, style='none')
    WeightField = cmds.floatSliderGrp(field=True, min=0, max=1, value=1)

    cmds.separator(h=20, style='none')
    cmds.separator(h=20, style='none')
    cmds.separator(h=20, style='none')
    cmds.separator(h=20, style='none')

    cmds.separator(w=1, style='none')
    cmds.separator(w=1, style='none')

    cmds.button(label="Apply",
                command=functools.partial(instanceIteration,
                                          RotationRangeField,
                                          ScaleRangeEndField,
                                          ScaleRangeStartField,
                                          PlacementAmountField, OffsetField,
                                          WeightField))
    cmds.button(label="Cancel", command=CloseUI)

    cmds.showWindow(win)
def ccUi(*args):
    lst = []
    chk = []
    hgt = 0
    k = 0
    a = mc.textScrollList(tsl2, q=True, ai=True)
    for i in range(len(obj)):
        hgt = hgt + 30
        b = []
        for f in a:
            if obj[i] in f:
                hgt = hgt + 30
                b.append(f)
                if obj[i] not in chk:
                    chk.append(obj[i])

        lst.append(b)
    if mc.window('ccWindow', exists=True):
        mc.deleteUI('ccWindow')

    if hgt < 300:
        win = mc.window('ccWindow', t='ccWindow', widthHeight=(410, hgt))
        mc.window('ccWindow', e=True, widthHeight=(410, hgt))
    else:
        win = mc.window('ccWindow', t='ccWindow', widthHeight=(410, 300))
        mc.window('ccWindow', e=True, widthHeight=(410, 300))
    mc.scrollLayout(vst=16)
    mc.columnLayout()
    for i in lst:
        if len(i) != 0:
            c = i[0]
        else:
            continue
        d = c.split('.')
        # mc.scrollLayout(vst=16)
        mc.frameLayout(l=d[0])
        for j in i:
            e = j.split('.')
            tp = mc.getAttr(j, typ=True)
            g = mc.getAttr(j)
            if '{}'.format(tp) == 'doubleLinear':
                mc.floatSliderGrp('flt{}'.format(k),
                                  l=e[1],
                                  field=True,
                                  min=-10.0,
                                  max=10.0,
                                  fmn=-10000.0,
                                  fmx=10000.0,
                                  v=g)
            if '{}'.format(tp) == 'doubleAngle':
                mc.floatSliderGrp('flt{}'.format(k),
                                  l=e[1],
                                  field=True,
                                  min=-180.0,
                                  max=180.0,
                                  fmn=-3600.0,
                                  fmx=3600.0,
                                  v=g)
            elif '{}'.format(tp) == 'double':
                if 'scale' in '{}'.format(e[1]):
                    mc.floatSliderGrp('flt{}'.format(k),
                                      l=e[1],
                                      field=True,
                                      min=0.0,
                                      max=10.0,
                                      fmn=0.0,
                                      fmx=10000.0,
                                      v=g)
                else:
                    mc.floatSliderGrp('flt{}'.format(k),
                                      l=e[1],
                                      field=True,
                                      min=0.0,
                                      max=1.0,
                                      fmn=0.0,
                                      fmx=1.0,
                                      v=g)
            elif '{}'.format(tp) == 'bool':
                mc.floatSliderGrp('flt{}'.format(k),
                                  l=e[1],
                                  field=True,
                                  min=0,
                                  max=1,
                                  fmn=0,
                                  fmx=1,
                                  v=g)
            mc.connectControl('flt{}'.format(k), '{}'.format(j))
            k += 1

    mc.showWindow(win)
Example #47
0
def createWindow():
    if cmds.window('MeshLightSetter',ex=True):
        cmds.deleteUI('MeshLightSetter')

    cmds.window('MeshLightSetter',t='MeshLight Setter',w=600,h=800)
    cmds.rowLayout(nc=2)
    cmds.frameLayout(l='aiTranslatorAttributes',w=380)
    cmds.formLayout('MeshLight_FormLayout')
    f1 = cmds.optionMenu('MeshLight_aiTranslator')
    cmds.menuItem(l='polymesh',p='MeshLight_aiTranslator')
    cmds.menuItem(l='mesh_light',p='MeshLight_aiTranslator')
    cmds.menuItem(l='procedural',p='MeshLight_aiTranslator')
    f2 = cmds.colorSliderGrp('MeshLight_aiColor',l='Color')
    f3 = cmds.floatFieldGrp('MeshLight_aiIntensity',l='Intensity')
    f4 = cmds.floatSliderGrp('MeshLight_aiExposure',l='Exposure',field=True)
    f5 = cmds.checkBox('MeshLight_aiUseTemp',l='Use Temperature')
    f6 = cmds.floatSliderGrp('MeshLight_aiTemperature',l='Temperature',minValue=0.0,maxValue=20000.0,field=True)
    f7 = cmds.checkBox('MeshLight_aiVisible',l='Light Visible')
    f8 = cmds.intFieldGrp('MeshLight_aiSample',l='Sample')
    f9 = cmds.checkBox('MeshLight_aiNormalize',l='Normalize')
    f10 = cmds.checkBox('MeshLight_aiCastShadows',l='Cast Shadows')
    f11 = cmds.floatSliderGrp('MeshLight_aiShadowDensity',l='ShadowDensity',minValue=0.0,maxValue=1.0,field=True)
    f12 = cmds.colorSliderGrp('MeshLight_aiShadowColor',l='Shadow Color')
    f13 = cmds.checkBox('MeshLight_aiCastVolumeShadow',l='Cast Volumeric Shadow')
    f14 = cmds.intFieldGrp('MeshLight_aiVolumeSample',l='Volume Sample')
    f15 = cmds.textFieldGrp('MeshLight_aiAov',l='AOV Group')
    f16 = cmds.rowLayout(nc=2)
    f17 = cmds.button(l='List LightGroup',c=lambda *args:refreshLightGroupMenu(),w=98)
    f18 = cmds.button(l='Set LightGroup',c=lambda *args:setLightGroupFromMenu(),w=98)
    cmds.setParent(u=True)
    f19 = cmds.textFieldGrp('AOVString',l='AOVs')
    f20 = cmds.textScrollList('MeshLight_LightGroupList',w=200,h=372)
    
    cmds.formLayout('MeshLight_FormLayout',e=True,af = [(f1,'top',0),(f1,'left',100),
                                                        (f2,'top',22),(f2,'left',-40),
                                                        (f3,'top',44),(f3,'left',-40),
                                                        (f4,'top',66),(f4,'left',-40),
                                                        (f5,'top',88),(f5,'left',90),
                                                        (f6,'top',110),(f6,'left',-40),
                                                        (f7,'top',132),(f7,'left',90),
                                                        (f8,'top',154),(f8,'left',-40),
                                                        (f9,'top',176),(f9,'left',90),
                                                        (f10,'top',198),(f10,'left',90),
                                                        (f11,'top',220),(f11,'left',-40),
                                                        (f12,'top',242),(f12,'left',-40),
                                                        (f13,'top',264),(f13,'left',90),
                                                        (f14,'top',286),(f14,'left',-40),
                                                        (f15,'top',308),(f15,'left',-40),
                                                        (f16,'top',333),(f16,'left',90),
                                                        (f19,'top',360),(f19,'left',-40),
                                                        (f20,'top',383),(f20,'left',90)
                                                        ])
    
    
    cmds.setParent(u=True)
    cmds.setParent(u=True)
    cmds.frameLayout(l='Mesh Light List',w=400)
    cmds.formLayout('MeshLightList_FormLayout')
    cmds.radioCollection()
    w1 = cmds.radioButton('AllLightCheck',l='List All Light',sl=True)
    w2 = cmds.radioButton('SelLightCheck',l='List Sel Light')
    #w1 = cmds.button(l='ALL MESH light',c=lambda *args:lightListRefresh(True),w=100)
    #w2 = cmds.button(l='Sel MESH Light',c=lambda *args:lightListRefresh(False),w=100)
    w3 = cmds.checkBox('List_NormalLight',l='Normal_Light')
    w4 = cmds.checkBox('List_MeshLight',l='Mesh_Light')
    w5 = cmds.textFieldGrp('MeshLight_Template',l='Template',w=400)
    w6 = cmds.button(l='Set Template',c=lambda *args:cmds.textFieldGrp('MeshLight_Template',e=True,tx=cmds.ls(sl=True,dag=True,ni=True)[0]),w=100)
    w7 = cmds.button(l='Convert!',c=lambda *args:convertMeshToMeshLight(),w=100)
    w8 = cmds.textScrollList('MeshLightList',w=400,h=700,ams=True)
    w9 = cmds.text('ListTotalNumber',l='0',w=50,nbg=True)
    w10 = cmds.text('ListSelectNumber',l='0',w=50,nbg=True)
    cmds.formLayout('MeshLightList_FormLayout',e=True,af = [(w1,'top',3),(w1,'left',0),
                                                            (w2,'top',3),(w2,'left',101),
                                                            (w3,'top',3),(w3,'left',205),
                                                            (w4,'top',3),(w4,'left',320),
                                                            (w5,'top',27),(w5,'left',-90),
                                                            (w6,'top',27),(w6,'left',297),
                                                            (w7,'top',52),(w7,'left',297),
                                                            (w8,'top',77),(w8,'left',0),
                                                            (w9,'top',55),(w9,'left',0),
                                                            (w10,'top',55),(w10,'left',50)
                                                            ])
    cmds.popupMenu('MeshLightListMenu',p='MeshLightList')
    cmds.menuItem(l='Select...',p='MeshLightListMenu',c=lambda *args:cmds.select([item for item in cmds.textScrollList('MeshLightList',q=True,si=True)]))

    cmds.showWindow('MeshLightSetter')

    cmds.textScrollList('MeshLightList',e=True,dcc=lambda *args:cmds.select(cmds.textScrollList('MeshLightList',q=True,si=True),r=True))
    cmds.textScrollList('MeshLightList',e=True,sc=lambda *args:getMeshLightAttrsAndShow())
    cmds.textScrollList('MeshLight_LightGroupList',e=True,ams=True,sc=lambda *args:genAovString(),dcc=lambda *args:selectLightByGroupName())
    cmds.optionMenu(f1,e=True,cc=lambda *args:setMeshLightAttrsAndShow('translator'))
    cmds.colorSliderGrp(f2,e=True,cc=lambda *args:setMeshLightAttrsAndShow('color'))
    cmds.floatFieldGrp(f3,e=True,cc=lambda *args:setMeshLightAttrsAndShow('intensity'))
    cmds.floatSliderGrp(f4,e=True,cc=lambda *args:setMeshLightAttrsAndShow('exposure'))
    cmds.checkBox(f5,e=True,cc=lambda *args:setMeshLightAttrsAndShow('useTemp'))
    cmds.floatSliderGrp(f6,e=True,cc=lambda *args:setMeshLightAttrsAndShow('temp'))
    cmds.checkBox(f7,e=True,cc=lambda *args:setMeshLightAttrsAndShow('visible'))
    cmds.intFieldGrp(f8,e=True,cc=lambda *args:setMeshLightAttrsAndShow('sample'))
    cmds.checkBox(f9,e=True,cc=lambda *args:setMeshLightAttrsAndShow('normalize'))
    cmds.checkBox(f10,e=True,cc=lambda *args:setMeshLightAttrsAndShow('castShadows'))
    cmds.floatSliderGrp(f11,e=True,cc=lambda *args:setMeshLightAttrsAndShow('shadowDensity'))
    cmds.colorSliderGrp(f12,e=True,cc=lambda *args:setMeshLightAttrsAndShow('shadowColor'))
    cmds.checkBox(f13,e=True,cc=lambda *args:setMeshLightAttrsAndShow('castVolumeShadow'))
    cmds.intFieldGrp(f14,e=True,cc=lambda *args:setMeshLightAttrsAndShow('volumeSample'))
    cmds.textFieldGrp(f15,e=True,cc=lambda *args:setMeshLightAttrsAndShow('aiAov'))
    cmds.radioButton('AllLightCheck',e=True,cc=lambda *args:lightListRefresh())
    cmds.radioButton('SelLightCheck',e=True,cc=lambda *args:lightListRefresh())
    cmds.checkBox('List_NormalLight',e=True,cc=lambda *args:lightListRefresh())
    cmds.checkBox('List_MeshLight',e=True,cc=lambda *args:lightListRefresh())
Example #48
0
def object_view_menu(*args):
    if not cmds.ls( sl=True ):
        print 'Nothing is selected'
    else:
        first_selected_node = cmds.ls(sl=True)[0]

        cmds.select(clear=True)

        all_model_panels = cmds.getPanel(type='modelPanel')
        m_panel_list =[]
        for o_panel in all_model_panels:
            o_label = cmds.panel(o_panel, q=True, label=True)
            if "CustomObjectViewer" in o_label:
                m_panel_list.append(o_panel) 

        invis_panel_list = cmds.getPanel(invisiblePanels=True)

        for d_panel in m_panel_list:
            if d_panel in invis_panel_list:
                cmds.deleteUI(d_panel,panel=True)

        cmds.select(clear=True)
        mel.eval('CreateCameraAimUp;')
        aimup_list = cmds.ls( sl=True )
        cmds.select(clear=True)

        for n_camdata in aimup_list:
            cmds.select(n_camdata,r=True)
            n_dataShape = cmds.listRelatives(n_camdata, children=True)[0]
            n_cam_type = cmds.objectType(n_dataShape)
            if n_cam_type == 'camera':
                n_number = n_camdata[len('camera'):]
                cmds.setAttr( n_dataShape + '.nearClipPlane', 10 )
                cmds.setAttr( n_camdata + '.translateZ', 30)
                o_cam = n_camdata
            if '_aim' in n_camdata:
                cmds.setAttr( n_camdata + '.translateX', 0)
                cmds.setAttr( n_camdata + '.translateY', 0)                
                cmds.setAttr( n_camdata + '.translateZ', 0)
            cmds.select(clear=True)

        o_pregrp = cmds.listRelatives(o_cam,parent=True )[0]
        cmds.select(o_pregrp,r=True)
        o_grp = cmds.rename('ObjectViewCamera_group' + n_number )
        cmds.parent(o_grp, first_selected_node, relative=True )


        cmds.select(clear=True)
        cmds.select(o_grp,r=True)
        pre_parent = cmds.listRelatives(o_grp,parent=True )[0]
        cmds.parent(o_grp,world=True)
        const_node = cmds.parentConstraint(pre_parent,o_grp,maintainOffset=True)[0]
        cmds.select(clear=True)

        try:
            cmds.window()
            window = cmds.window('CustomObjectViewer' + n_number, 
                title='Custom ObjectViewer' + n_number, sizeable=True, 
                topLeftCorner=[200, 200], widthHeight=(400,470))
            form = cmds.formLayout()
            c_model= cmds.modelPanel(label='CustomObjectViewer_Panel' + n_number, camera=o_cam)
        except:
            print 'Check Panel Editor & CleanUp Unused Panels !!'

        cmds.setParent('..')
        column = cmds.columnLayout()
        cmds.rowLayout(numberOfColumns=2)
        cmds.floatSliderGrp(label=' Far ClipPlane ',field=True,columnWidth3=[85,40,70],
            adjustableColumn=3, minValue=0.1, maxValue=100,fieldMinValue=0.1,
            fieldMaxValue=100, value=70,
            dragCommand=lambda x:cam_far_slider(x,o_cam),
            changeCommand=lambda x:cam_far_slider(x,o_cam))
        cmds.floatSliderGrp(label='NearClipPlane ',field=True,columnWidth3=[85,40,70],
            adjustableColumn=3, minValue=0.01, maxValue=100,fieldMinValue=0.01,
            fieldMaxValue=100, value=10,
            dragCommand=lambda x:cam_near_slider(x,o_cam),
            changeCommand=lambda x:cam_near_slider(x,o_cam))
        cmds.setParent('..')

        cmds.rowLayout(numberOfColumns=3)
        cmds.floatSliderGrp(label='Trans Offset X',field=True,columnWidth3=[85,40,50],
            adjustableColumn=3, minValue=-100, maxValue=100,fieldMinValue=-100,
            fieldMaxValue=100, value=0,
            dragCommand=lambda x:cam_txoffset_slider(x,const_node),
            changeCommand=lambda x:cam_txoffset_slider(x,const_node))
        cmds.floatSliderGrp(label='Y',field=True,columnWidth3=[10,40,50],
            adjustableColumn=3, minValue=-100, maxValue=100,fieldMinValue=-100,
            fieldMaxValue=100, value=0,
            dragCommand=lambda x:cam_tyoffset_slider(x,const_node),
            changeCommand=lambda x:cam_tyoffset_slider(x,const_node))
        cmds.floatSliderGrp(label='Z',field=True,columnWidth3=[10,40,50],
            adjustableColumn=3, minValue=-100, maxValue=100,fieldMinValue=-100,
            fieldMaxValue=100, value=0,
            dragCommand=lambda x:cam_tzoffset_slider(x,const_node),
            changeCommand=lambda x:cam_tzoffset_slider(x,const_node))
        cmds.setParent('..')

        cmds.rowLayout(numberOfColumns=3)
        cmds.floatSliderGrp(label='RotateOffset X',field=True,columnWidth3=[85,40,50],
            adjustableColumn=3, minValue=0, maxValue=360,fieldMinValue=0,
            fieldMaxValue=360, value=0,
            dragCommand=lambda x:cam_rxoffset_slider(x,const_node),
            changeCommand=lambda x:cam_rxoffset_slider(x,const_node))
        cmds.floatSliderGrp(label='Y',field=True,columnWidth3=[10,40,50],
            adjustableColumn=3, minValue=0, maxValue=360,fieldMinValue=0,
            fieldMaxValue=360, value=0,
            dragCommand=lambda x:cam_ryoffset_slider(x,const_node),
            changeCommand=lambda x:cam_ryoffset_slider(x,const_node))
        cmds.floatSliderGrp(label='Z',field=True,columnWidth3=[10,40,50],
            adjustableColumn=3, minValue=0, maxValue=360,fieldMinValue=0,
            fieldMaxValue=360, value=0,
            dragCommand=lambda x:cam_rzoffset_slider(x,const_node),
            changeCommand=lambda x:cam_rzoffset_slider(x,const_node))
        cmds.setParent('..')


        cmds.formLayout(form,edit=True,
             attachForm=[
                  (c_model,'left',5),(c_model,'top',0),(c_model,'right',5),(c_model,'bottom',80),
                  (column,'left',5),(column,'top',400),(column,'right',0),(column,'bottom',0)
                  ],
             attachPosition=[(column,'right',0,100)],
             attachNone=[(column,'top')]
             )
        cmds.modelEditor(c_model,edit=True,grid=False,
            displayAppearance='smoothShaded',activeOnly=False, displayTextures=True )
        cmds.showWindow( window )
Example #49
0
def toolWindow():
    mainWindow = 'Main Window'

    if cmds.window(mainWindow, exists=True):
        cmds.deleteUI(mainWindow)

    mainWindow = cmds.window(mainWindow, title='Toolbox')
    mainCol = cmds.columnLayout(parent=mainWindow, adjustableColumn=True)

    cmds.text('Main Toolbox:\n')

    # Create 1st row for Random Tree Placement:
    treeRowLayout = cmds.rowLayout(parent=mainCol, numberOfColumns=6)
    cmds.text(parent=treeRowLayout, label="Random Tree Placer: ")
    xRange = cmds.intField(parent=treeRowLayout, value=15)
    yRange = cmds.intField(parent=treeRowLayout, value=25)
    zRange = cmds.intField(parent=treeRowLayout, value=30)
    cmds.button(parent=treeRowLayout,
                label='Place Trees',
                command='RndPlace("xRange", "yRange", "zRange")')

    # Create 2nd row for Sequential Renamer:
    renamerRowLayout = cmds.rowLayout(parent=mainCol, numberOfColumns=3)
    cmds.text(parent=renamerRowLayout, label="Sequential Renamer : ")
    input = cmds.textFieldGrp(parent=renamerRowLayout, text='')
    cmds.button(parent=renamerRowLayout,
                label='Rename Selected Objects',
                command='SequentialRenamer(input)')

    # Create 3rd row for other tools:
    toolColumnLayout = cmds.columnLayout(parent=mainCol)
    #toolRowLayout = cmds.rowLayout(parent=mainCol, numberOfColumns=6)
    cmds.button(parent=toolColumnLayout,
                label='Center Locator',
                command='CreateLoc()')
    cmds.button(parent=toolColumnLayout, label='Control Creator', command='')
    cmds.button(parent=toolColumnLayout,
                label='FK Joint Hierarchy Creator',
                command='')

    # Create 4th row for other tools:
    toolColumnLayout = cmds.columnLayout(parent=mainCol)
    cmds.text(parent=toolColumnLayout, label='\nAdditional Tools:')
    cmds.button(parent=toolColumnLayout,
                label='Freeze Tranforms',
                command='FreezeTransforms()')
    cmds.button(parent=toolColumnLayout,
                label='Delete History',
                command='DeleteHistory()')
    cmds.button(parent=toolColumnLayout,
                label='Parent Group w/ Pivots',
                command='ParentGroupPivots()')
    cmds.button(parent=toolColumnLayout,
                label='Parent/Scale Constraints',
                command='ParentScaleConstraints()')
    cmds.button(parent=toolColumnLayout,
                label='Build Joint Chain from Selected CV Curve',
                command='BuildJointChainFromSelection()')
    cmds.button(parent=toolColumnLayout,
                label='Show/Hide Local Rotation Axes',
                command='ShowHideLocalRotationAxes()')
    cmds.button(parent=toolColumnLayout,
                label='Switch Unlocked Influences',
                command='SwitchUnlockedInfluences()')

    cmds.showWindow(mainWindow)
Example #50
0
 def delete(self):
     if cmds.window(self.my_window, exists=True):
         cmds.deleteUI(self.my_window)
Example #51
0
def UI():
    settings.readFromFile(settingsName)

    #Icon path
    icon = scriptsDir + "Icons/menuIconFile.png"

    #Check to see if our window exists
    if cmds.window("batchExportUI", exists=True):
        cmds.deleteUI("batchExportUI")

#Create UI window
    window = cmds.window("batchExportUI",
                         title="batchExport",
                         w=400,
                         h=190,
                         mnb=False,
                         mxb=False,
                         sizeable=False,
                         titleBarMenu=True,
                         menuBar=True)

    #Create main layout
    mainLayout = cmds.columnLayout(w=400, h=190)

    #Banner image
    bannerPath = scriptsDir + "Icons/batchExportBanner.jpg"
    cmds.image(w=400, h=40, image=bannerPath)

    #Create our row column layout
    cmds.separator(height=5)
    rowColumnLayout = cmds.rowColumnLayout(nc=2,
                                           cw=[(1, 360), (2, 40)],
                                           columnOffset=[(1, "both", 5),
                                                         (2, "both", 5)])

    #Export Directory
    cmds.text(label="Export Directory:", align="left")
    cmds.text(label="")
    inputField = cmds.textField("inputField", width=360)

    #Edit the inputfield to have filepath as default
    defaultDir = getDefaultDir()
    if defaultDir == "/FBX":
        cmds.textField("inputField", edit=True, text="SET OUTPUT DIR")
    else:
        cmds.textField("inputField", edit=True, text=defaultDir)
    exportBrowseButton = cmds.symbolButton(w=20,
                                           h=25,
                                           image=icon,
                                           c=browseFilePath)

    #Origo checkbox
    cmds.separator(height=10, style="none")
    cmds.separator(height=10, style="none")
    rowColumnLayout2 = cmds.rowColumnLayout(nc=2, cw=[(1, 200), (2, 148)])
    origoBox = cmds.checkBox("origoBox",
                             label="Move to Origo",
                             value=settings.moveToOrigo,
                             cc=saveSettings)

    #FBX dropdown
    cmds.optionMenu("FBXVersion", label="FBXVersion", cc=saveSettings)
    cmds.menuItem(label='2013')
    cmds.menuItem(label='2014')
    cmds.menuItem(label='2016')
    cmds.optionMenu("FBXVersion", edit=True, v=settings.FBXVersion)

    #Build Button
    cmds.separator(height=10, style="none")
    cmds.separator(height=10, style="none")
    createButton = cmds.button(label="EXPORT",
                               w=385,
                               h=40,
                               p=mainLayout,
                               c=exportMain)

    #Show window
    cmds.showWindow(window)
Example #52
0
                    mc.connectAttr ('%s.sz' %getDriverTrans[count], '%s.sz' %obj)
                
                count = count + 1
                        
    elif len_driverTrans > 1 and len_driverTrans != len_drivenTrans:
        
        mc.warning ('Driver count must be either 1 or match driven count')

# Create UI

jsCA_winHide = 'jsCA_createWin'
jsCA_winTitleHide = 'Connect Attributes'
mc.windowPref (jsCA_winHide, width = 200, height = 200)

if (mc.window (jsCA_winHide, exists = True)):
    mc.deleteUI (jsCA_winHide)

mc.window (jsCA_winHide, rtf = True, width = 200, height = 200, title = jsCA_winTitleHide, s = True)
mc.columnLayout (adj = True, rs = 2)

mc.text (' ')
mc.text ('Normal/Batch Connect', al = 'center', fn = 'boldLabelFont')
mc.text (' ')

mc.rowColumnLayout (rowSpacing = (2,1), nc = 2)

jsCA_getDriverTrans_TF = mc.textField (bgc = (.15,.15,.15), w=200, ed = 1, text = 'object, object, object...')
mc.button (l = 'Pick Driver Object', c = 'jsCA_driverTrans()')

jsCA_getDriverAttrs_TF = mc.textField (bgc = (.15,.15,.15), w=200, ed = 1, text = 'attr')
mc.button (l = 'Pick Driver Attribute', c = 'jsCA_driverAttrs()')
Example #53
0
def removeMenu():

    if cmds.menu("etTools", query=True, exists=True):
        cmds.deleteUI("etTools", menu=True)
    def installProc(self, characterName, *args):

        # Return the directory names from setupDirs
        projectDirs = turbineUtils.setupDirs(self,
                                             self.characterName,
                                             create=False)
        setupDir = projectDirs[1]
        xmlDir = projectDirs[2]
        rigDir = projectDirs[3]
        characterFileName = projectDirs[5]
        setupFileName = projectDirs[6]
        xmlFileName = projectDirs[7]

        # use turbineUtils to find out the namespaces.
        namespaces = turbineUtils.getCharacterNamespace(
            self, self.characterName)

        characterNamespace = namespaces[0]
        exportNamespace = namespaces[1]
        try:
            cmds.namespace(add=exportNamespace)
        except:
            pass

        characterNameString = (characterNamespace + ":")

        # Import the rig
        # Return the directory names from setupDirs
        projectDirs = turbineUtils.setupDirs(self,
                                             self.characterName,
                                             create=False)
        characterFileName = projectDirs[5]
        print characterFileName
        if cmds.namespace(exists=characterNamespace):
            print "Rig Installed"
        else:
            cmds.file(characterFileName, i=True, namespace=characterNamespace)

        cmds.namespace(setNamespace=":")

        # Unlock
        characterContainer = (characterNamespace + ":character_container")
        cmds.lockNode(characterContainer, lock=False, lockUnpublished=False)
        """ Check to see if a setup file already exists."""
        """If a setup exists, delete it."""
        setupContainer = exportNamespace + ":Setup"
        if cmds.objExists(setupContainer):
            cmds.select(setupContainer)
            cmds.lockNode(lock=False, lu=False)
            cmds.delete(setupContainer)

        # Import the setup
        # If the setup file exists on disk, import it.  Else we should build the setup
        if cmds.file(setupFileName, q=True, ex=True):
            cmds.file(setupFileName, i=True)
            cmds.setAttr("Setup_grp.visibility", 0)
            constraints = utils.parentToBlueprint(xmlFileName,
                                                  characterNameString)
            parentConstraints = constraints[0]
            scaleConstraints = constraints[1]
            """ Create the setup container if it does not exist """
            try:
                cmds.container(n=setupContainer)
            except:
                pass
            """ Add the setup and geometry groups to the setup container """
            cmds.container(setupContainer,
                           edit=True,
                           addNode="Setup_grp",
                           ihb=True,
                           force=True)
            try:
                cmds.container(setupContainer,
                               edit=True,
                               addNode="Geometry",
                               ihb=True,
                               force=True)
            except:
                pass
            """ Add the game_joint_parentConstraints to the Setup container """
            for constraint in parentConstraints:
                cmds.container(setupContainer,
                               edit=True,
                               addNode=constraint,
                               ihb=True,
                               force=True)
            for constraint in scaleConstraints:
                cmds.container(setupContainer,
                               edit=True,
                               addNode=constraint,
                               ihb=True,
                               force=True)

        else:
            cmds.group(n="Setup_grp", empty=True)
            cmds.setAttr("Setup_grp.visibility", 0)
            try:
                cmds.namespace(add=exportNamespace)
            except:
                pass
            newSetupName = (exportNamespace + ":" + "Setup")

            cmds.select("Setup_grp")
            setupContents = cmds.listConnections("Setup_grp", type="joint")

            if setupContents != None and "game_joints" in (setupContents):
                constraints = utils.parentToBlueprint(xmlFileName,
                                                      characterNameString)
                parentConstraints = constraints[0]
                scaleConstraints = constraints[1]
                """ Add the game_joint_parentConstraints to the Setup container """
                for constraint in parentConstraints:
                    cmds.container(setupContainer,
                                   edit=True,
                                   addNode=constraint,
                                   ihb=True,
                                   force=True)
                for constraint in scaleConstraints:
                    cmds.container(setupContainer,
                                   edit=True,
                                   addNode=constraint,
                                   ihb=True,
                                   force=True)

            else:
                #Create the game joints and return the joint names
                cmds.select("Setup_grp")
                utilInfo = utils.importJointInfo(xmlFileName)
                listJoints = utilInfo

                # parent the joints into the setup group
                cmds.parent(listJoints, "Setup_grp")

                setupContainer = cmds.container(n="Setup",
                                                addNode="Setup_grp",
                                                inc=True,
                                                ihb=True,
                                                includeNetwork=True,
                                                force=True)

                utils.setJointAttrs(xmlFileName)
                constraints = utils.parentToBlueprint(xmlFileName,
                                                      characterNameString)
                parentConstraints = constraints[0]
                scaleConstraints = constraints[1]
                """ Add the game_joint_parentConstraints to the Setup container """
                for constraint in parentConstraints:
                    cmds.container(setupContainer,
                                   edit=True,
                                   addNode=constraint,
                                   ihb=True,
                                   force=True)
                for constraint in scaleConstraints:
                    cmds.container(setupContainer,
                                   edit=True,
                                   addNode=constraint,
                                   ihb=True,
                                   force=True)

                try:
                    cmds.namespace(add=exportNamespace)
                except:
                    pass

                newSetupName = (exportNamespace + ":" + "Setup")
                cmds.rename("Setup", newSetupName)

        newSetupName = (exportNamespace + ":" + "Setup")

        # Use turbineUtils to set bone marking and holding locations.
        turbineUtils.boneMarking()
        holdLocs = turbineUtils.loadHoldLocs()

        # add holding locs to the setup container
        cmds.container(newSetupName,
                       edit=True,
                       addNode=holdLocs,
                       inc=True,
                       ihb=True,
                       includeNetwork=True,
                       force=True)

        cmds.namespace(set=":")

        cmds.lockNode(characterContainer, lock=True, lockUnpublished=True)
        cmds.lockNode(newSetupName, lock=True, lockUnpublished=True)
        cmds.deleteUI(self.UIElements["window"])

        currentUser = getUser()

        niceName = (currentUser)[1]
        cmds.headsUpMessage(self.characterName + " has been installed " +
                            niceName)

        return (characterContainer, newSetupName)
Example #55
0
def variantSets_Replace(nodeAttr, new):
    # Store the original parent and restore it below
    origParent = cmds.setParent(q=True)

    frameLayoutName = 'AEpxrUsdReferenceAssemblyTemplate_variantSets_Layout'
    if new == True:
        cmds.frameLayout(frameLayoutName, label='VariantSets', collapse=False)
    else:
        cmds.setParent(frameLayoutName)

    # Remove existing children of layout
    children = cmds.frameLayout(frameLayoutName, q=True, childArray=True)
    if children:
        for child in children:
            cmds.deleteUI(child)

    # Calculate some parameters
    node = nodeAttr.split('.', 1)[0]

    # Create variantSetsDict
    variantSetsDict = {}
    usdPrim = UsdMaya.GetPrim(node)
    from pxr import Usd, UsdUtils

    regVarSetNames = [
        regVarSet.name for regVarSet in UsdUtils.GetRegisteredVariantSets()
    ]

    if usdPrim:
        variantSets = usdPrim.GetVariantSets()
        variantSetNames = variantSets.GetNames()
        for variantSetName in variantSetNames:

            if regVarSetNames and (variantSetName not in regVarSetNames):
                continue

            usdVariant = usdPrim.GetVariantSet(variantSetName)
            if not usdVariant:
                continue
            usdVariantChoices = usdVariant.GetVariantNames()
            usdVariantSelection = usdVariant.GetVariantSelection()
            variantSetsDict[variantSetName] = {
                'variants': usdVariantChoices,
                'selection': usdVariantSelection,
            }
            # Handle override
            variantAttrName = 'usdVariantSet_%s' % variantSetName
            if cmds.attributeQuery(variantAttrName, node=node, exists=True):
                variantSetPlgVal = cmds.getAttr('%s.%s' %
                                                (node, variantAttrName))
                if variantSetPlgVal:
                    variantSetsDict[variantSetName][
                        'override'] = variantSetPlgVal
                variantSetsDict[variantSetName]['settable'] = cmds.getAttr(
                    '%s.%s' % (node, variantAttrName), settable=True)

    # Construct the UI from the variantSetsDict
    for variantSetName, variantSetDict in variantSetsDict.items():
        variantResolved = variantSetDict.get('selection', '')
        variantOverride = variantSetDict.get('override', '')
        variantSetChoices = [''] + variantSetDict['variants']
        variantSettable = variantSetDict.get('settable', True)

        omg = cmds.optionMenuGrp(
            label=variantSetName,
            columnWidth=(2, 150),
            enable=variantSettable,
            extraLabel=variantResolved,
        )
        for choice in variantSetChoices:
            cmds.menuItem(label=choice)
        try:
            cmds.optionMenuGrp(omg, e=True, value=variantOverride)
        except RuntimeError, e:
            cmds.warning('Invalid choice %r for %r' %
                         (variantOverride, variantSetName))

        cmds.optionMenuGrp(omg,
                           e=True,
                           changeCommand=functools.partial(
                               variantSets_changeCommmand,
                               omg=omg,
                               node=node,
                               variantSetName=variantSetName))
Example #56
0
def randomAttrsUI():
    if cmds.window("rndAttrWin", exists=True):
        cmds.deleteUI("rndAttrWin")

    w = 250

    widgets["win"] = cmds.window("rndAttrWin",
                                 t="zbw_randomAttrs",
                                 w=w,
                                 rtf=True)
    widgets["mainCLO"] = cmds.columnLayout()

    widgets["transformFrLO"] = cmds.frameLayout("Transforms",
                                                w=w,
                                                bgc=(0, 0, 0))
    widgets["settingsCLO"] = cmds.columnLayout()
    widgets["optionsCBG"] = cmds.checkBoxGrp(w=w,
                                             ncb=2,
                                             cw2=(100, 100),
                                             la2=("Relative?",
                                                  "Obj Space Trans/Rot?"),
                                             va2=(1, 1))

    cmds.setParent(widgets["transformFrLO"])
    # switch to Row column layout to break up the channels
    widgets["transRCLO"] = cmds.rowColumnLayout(nc=2, cw=([1, 100], [2, 150]))
    widgets["transCB"] = cmds.checkBox(l="Translates",
                                       v=1,
                                       cc=partial(enableChannel, "transCB",
                                                  "translateCBG"))
    widgets["translateCBG"] = cmds.checkBoxGrp(w=w,
                                               cw3=(50, 50, 50),
                                               ncb=3,
                                               l1="TX",
                                               l2="TY",
                                               l3="TZ",
                                               l4="Vis",
                                               va3=(1, 1, 1),
                                               bgc=(.5, .5, .5),
                                               en=True,
                                               cc=partial(
                                                   toggleOnOff,
                                                   "translateCBG"))
    widgets["rotCB"] = cmds.checkBox(l="Rotates",
                                     v=1,
                                     cc=partial(enableChannel, "rotCB",
                                                "rotateCBG"))
    widgets["rotateCBG"] = cmds.checkBoxGrp(w=w,
                                            cw3=(50, 50, 50),
                                            ncb=3,
                                            l1="RX",
                                            l2="RY",
                                            l3="RZ",
                                            l4="Vis",
                                            va3=(1, 1, 1),
                                            bgc=(.5, .5, .5),
                                            en=True,
                                            cc=partial(toggleOnOff,
                                                       "rotateCBG"))
    widgets["scaleCB"] = cmds.checkBox(l="Scales",
                                       v=1,
                                       cc=partial(enableChannel, "scaleCB",
                                                  "scaleCBG"))
    widgets["scaleCBG"] = cmds.checkBoxGrp(w=w,
                                           cw3=(50, 50, 50),
                                           ncb=3,
                                           l1="SX",
                                           l2="SY",
                                           l3="SZ",
                                           l4="Vis",
                                           va3=(1, 1, 1),
                                           bgc=(.5, .5, .5),
                                           en=True,
                                           cc=partial(toggleOnOff, "scaleCBG"))
    cmds.setParent(widgets["transRCLO"])
    widgets["transCLO"] = cmds.columnLayout(w=w)
    cmds.separator(h=10)
    widgets["txFFG"] = cmds.floatFieldGrp(w=w,
                                          l="tX Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70])
    widgets["tyFFG"] = cmds.floatFieldGrp(w=w,
                                          l="tY Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70])
    widgets["tzFFG"] = cmds.floatFieldGrp(w=w,
                                          l="tZ Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70])
    cmds.separator(h=10)
    widgets["rxFFG"] = cmds.floatFieldGrp(w=w,
                                          l="rX Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70])
    widgets["ryFFG"] = cmds.floatFieldGrp(w=w,
                                          l="rY Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70])
    widgets["rzFFG"] = cmds.floatFieldGrp(w=w,
                                          l="rZ Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70])
    cmds.separator(h=10)
    widgets["sxFFG"] = cmds.floatFieldGrp(w=w,
                                          l="sX Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70],
                                          v1=1,
                                          v2=1)
    widgets["syFFG"] = cmds.floatFieldGrp(w=w,
                                          l="sY Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70],
                                          v1=1,
                                          v2=1)
    widgets["szFFG"] = cmds.floatFieldGrp(w=w,
                                          l="sZ Range",
                                          nf=2,
                                          cl3=["left", "left", "left"],
                                          cw3=[95, 70, 70],
                                          v1=1,
                                          v2=1)
    cmds.separator(h=10)
    widgets["randTransBut"] = cmds.button(w=w,
                                          l="Randomize Transforms",
                                          h=35,
                                          bgc=(.5, .4, .4),
                                          c=randomizeTransforms)
    cmds.separator(h=5)

    cmds.setParent(widgets["mainCLO"])
    widgets["floatFrLO"] = cmds.frameLayout("Other Float Attributes",
                                            w=w,
                                            cll=True,
                                            cl=True,
                                            bgc=(0, 0, 0),
                                            cc=resizeWindow)
    widgets["floatCLO"] = cmds.columnLayout()
    cmds.text(
        "This will randomize float/int attributes\nselected in the channel box",
        al="left")
    cmds.separator(h=10)
    widgets["floatFFG"] = cmds.floatFieldGrp(w=w,
                                             l="Value Range",
                                             nf=2,
                                             cl3=["left", "left", "left"],
                                             cw3=[95, 70, 70])
    widgets["floatCB"] = cmds.checkBox(w=w, l="Relative to current?", v=1)
    cmds.separator(h=10)
    widgets["floatTransBut"] = cmds.button(w=w,
                                           l="Randomize Float Attributes",
                                           h=35,
                                           bgc=(.4, .5, .4),
                                           c=randomizeFloats)
    cmds.separator(h=5)

    cmds.setParent(widgets["mainCLO"])
    widgets["multFrLO"] = cmds.frameLayout("Multiply Float Attributes",
                                           w=w,
                                           cll=True,
                                           cl=True,
                                           bgc=(0, 0, 0),
                                           cc=resizeWindow)
    widgets["multCLO"] = cmds.columnLayout()
    cmds.text(
        "This will multiply float/int attributes\nselected in the channel box",
        al="left")
    cmds.separator(h=10)
    widgets["multFFG"] = cmds.floatFieldGrp(w=w,
                                            l="Multiplier",
                                            nf=1,
                                            cl2=["left", "left"],
                                            v1=1.0,
                                            cw2=[95, 70])
    cmds.separator(h=10)
    widgets["multBut"] = cmds.button(w=w,
                                     l="Multiply Attributes",
                                     h=35,
                                     bgc=(.4, .4, .5),
                                     c=multiplyFloats)
    cmds.separator(h=5)

    resizeWindow()
    cmds.showWindow(widgets["win"])
Example #57
0
import maya.cmds as mc
if mc.window("MyWindow", q=True, ex=True):
    mc.deleteUI("MyWindow")
mc.window("MyWindow", t="Example Window", width=298, height=255)
mc.rowColumnLayout("myMainRowCol", numberOfRows=2)
mc.button(l="Button 1")
mc.button(l="Button 2")
mc.button(l="Button 3")
mc.button(l="Button 4")
mc.showWindow("MyWindow")
'''
if ( `window -exists MyWindow` ) {
 deleteUI MyWindow;
}
window -t "Example Window" MyWindow;
 rowColumnLayout -numberOfRows 2;
  button -l "button1";
  button -l "button2";
  button -l "button3";
  button -l "button4";
showWindow

'''
 def closeCmd(self, *args):
     cmds.deleteUI(self.windowID, window = True)
Example #59
0
import maya.cmds as mc
"""
This tool will aid in the creation of a humanoid rig.
It takes all the neccessary steps to set up a basic humanoid rig
"""
winID = "AutoRig"
if mc.window(winID, exists=True):
    mc.deleteUI(winID)

myWindow = mc.window(winID,
                     title="AutoRig",
                     menuBar=True,
                     nde=True,
                     s=True,
                     tlc=(300, 1000))
mc.frameLayout(l="Skeleton SetUp", mw=4, mh=4, bgc=[0.15, 0.25, 0.3])
mc.rowColumnLayout(nc=2)

mc.text(l="Place Joints: ")
placeJointsBtn = mc.button(l="Place", w=175, h=30, c="placeJoints()")

mc.text(l="Make Controls: ")
placeControlsBtn = mc.button(l="Make", w=175, h=30, c="controlsSetUp()")

mc.text(l="AutoRig: ")
autorigbtn = mc.button(l="Create", w=150, h=30, c="finishAutoRig()")

mc.setParent('..')
mc.frameLayout(l="Skin SetUp", mw=4, mh=4, bgc=[0.15, 0.25, 0.3])

mc.rowColumnLayout(nc=2)
Example #60
-2
    def __enter__(self):
        '''
        Initialize the UI
        '''
        if mc.window(self.name, exists=True):
            mc.deleteUI(self.name)

        mc.window(self.name, title='ml :: '+self.title, iconName=self.title, width=self.width, height=self.height, menuBar=self.menu)
        
        
        if self.menu:
            self.createMenu()
        
        self.form = mc.formLayout()
        self.column = mc.columnLayout(adj=True)

        
        mc.rowLayout( numberOfColumns=2, columnWidth2=(34, self.width-34), adjustableColumn=2, 
                    columnAlign2=('right','left'),
                    columnAttach=[(1, 'both', 0), (2, 'both', 8)] )

        #if we can find an icon, use that, otherwise do the text version
        if self.icon:
            mc.iconTextStaticLabel(style='iconOnly', image1=self.icon)
        else:
            mc.text(label=' _ _ |\n| | | |')
            
        if not self.menu:
            mc.popupMenu(button=1)
            mc.menuItem(label='Help', command=(_showHelpCommand(wikiURL+'#'+self.name)))
        
        mc.text(label=self.info)
        mc.setParent('..')
        mc.separator(height=8, style='single')
        return self