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()
        exportPathForm = self.uiExportPath.create()
        exportTypeForm = self.uiExportType.create()
        searchForForm  = self.uisearchFor.create()
        searchForTypeForm = self.uisearchForType.create()
        buttonsForm = cmds.button( l='<<   EXPORT   M E S H   >>', bgc=[0.5,0.5,0.6], h=30 )
        cmds.setParent( '..' )
        
        cmds.formLayout( form, e=1,
                         af = [( exportPathForm, 'top', 8 ), ( exportPathForm, 'left', 0 ), ( exportPathForm, 'right', 5 ),
                               ( exportTypeForm, 'left',0 ), ( exportTypeForm, 'right', 0 ),
                               ( searchForForm, 'left', 0 ),
                               ( searchForTypeForm, 'left', 0 ),
                               ( buttonsForm, 'left', 0 ), ( buttonsForm, 'right', 0 ) ],
                         ac = [( exportTypeForm, 'top', 8, exportPathForm ),
                               ( searchForForm, 'top', 8, exportTypeForm ),
                               ( searchForTypeForm, 'top', 8, searchForForm ),
                               ( buttonsForm, 'top', 12, searchForTypeForm )] )

        cmds.window( WinA_Global.winName, e=1,
                     w = WinA_Global.width, h = WinA_Global.height )
        cmds.showWindow( WinA_Global.winName )

        self.button = buttonsForm
        self.setUiCommand()

        WinA_Cmd.read_windowInfo()
        WinA_Cmd.setWindowCondition()
Example #2
0
 def UI_custom(self): 
        
     cmds.rowLayout(nc=2, columnWidth=[1, 100], adj=2)
     cmds.text(label="Number Of Joints:")
     numJoints = len(self.jointInfo)
     self.numberOfJointsField = cmds.intField(value=numJoints, min=2, changeCommand=self.changeNumberOfJoints)
     
     cmds.setParent("..")
     
     joints = self.getJoints()
     
     self.createRotationOrderUIControl(joints[0])
     
     cmds.separator()
     
     cmds.text(label="Orientation:", align="left")
     cmds.rowLayout(nc=3)
     cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+":module_grp.sao_local", label="Local:")
     cmds.text(label="will be oriented to")
     cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+":module_grp.sao_world", label="World:")
     
     cmds.setParent("..")
     
     cmds.separator()
     
     interpolating = False
     if cmds.objExists(self.moduleNamespace+":interpolation_container"):
         interpolating = True
         
     cmds.rowLayout(nc=2, columnWidth=[1, 80], adj=2)
     cmds.text(label="Interpolate:")
     cmds.checkBox(label="", value=interpolating, onc=partial(self.setup_interpolation, True), ofc=self.delete_interpolation)
Example #3
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 #4
0
def main():
	mc.python('from kmAnimImpExp import *')

	if mc.window( 'AnimImpExpUI', exists=True ):
		mc.deleteUI('AnimImpExpUI')
		
	WinName = mc.window( 
		'AnimImpExpUI', 
		title='Anim Import/Export with select', 
		iconName='AnimImpExpUI', 
		width=100, 
		height=200,
		menuBar=True
	)
	mc.menu( label='Menu', tearOff=False )
	mc.menuItem( label='Reload',command='from kmAnimImpExp import *;main()')
	mc.menuItem( divider=True )
	mc.menuItem( label='Quit' )
	
	mc.columnLayout(adj=True)
	mc.button(label='Import Anim',command='kmAnimImp()')
	mc.button(label='Export Anim',command='kmAnimExp()')
	mc.setParent('..') #columnLayout
		
	mc.showWindow(WinName)
Example #5
0
    def createBrushSettingsGroup(self,parent):
        group = self.createUIGroup(parent, 'Brush Settings')

        self.createTitledRow(group, 'Brush Shape')
        brushWidth = 35;
        cmds.rowLayout(nc=4,cw4=[brushWidth,brushWidth,brushWidth,brushWidth])
        self.createBrushShapeButtons()
        cmds.setParent("..")
        
        def innerLayout():
            return cmds.rowColumnLayout( numberOfColumns=2,columnWidth=[(1,100),(2,100)])

        self.createTitledRow(group, 'Mode',innerContentConstructor=innerLayout)

        cmds.radioCollection()
        for index,i in enumerate(['Replace','Add','Scale','Smooth']):
            ctrl = self.controls.__dict__['paintMode'+i] = RadioButtonField(self.VAR_PREFIX+'paintMode'+i,defaultValue=1 if index==0 else 0,label=i)
            ctrl.changeCommand.addHandler(self.paintValuesChanged)
            
        
        self.controls.intensitySlider = FloatSliderField()
        self.controls.intensitySlider.flexibleRange = True
        self.createTitledRow(group, 'Intensity',self.controls.intensitySlider.create)
        self.controls.intensitySlider.onChange.addHandler(self.paintValuesChanged)

        self.controls.brushRadiusSlider = FloatSliderField(range=[0,30])
        self.controls.brushRadiusSlider.flexibleRange = True
        self.createTitledRow(group, 'Brush Radius',self.controls.brushRadiusSlider.create)
        self.controls.brushRadiusSlider.onChange.addHandler(self.changeBrushRadius)
Example #6
0
 def new(self):
     cmds.setParent(self.parent)
     self.name = cmds.button(self.name, label=self.label, c=self.cmd, h=self.h)
     if self.bgc:
         cmds.button(self.name, e=True, bgc=self.bgc)
     attachForm = [(self.name, 'bottom', self.moveUp), (self.name, 'right', 0), (self.name, 'left', 0)]
     cmds.formLayout(self.parent, edit=True, attachForm=attachForm)
Example #7
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 #8
0
	def buildTimeMenu( self, parent, uiItem ):
		cmd.menu( parent, e=True, dai=True )
		cmd.setParent( parent, m=True )

		cmd.menuItem( l="! - use current range", c=lambda a: cmd.textField( uiItem, e=True, tx='!' ) )
		cmd.menuItem( l=". - use current frame", c=lambda a: cmd.textField( uiItem, e=True, tx='.' ) )
		cmd.menuItem( l="$ - use scene range", c=lambda a: cmd.textField( uiItem, e=True, tx='$' ) )
Example #9
0
    def createMenu(self, *args):
        '''
        Create the main menu for the UI
        '''
        
        #generate shelf label by removing ml_
        shelfLabel = self.name.replace('ml_','')
        module = self.module
        if not module:
            module = self.name
            
        #if icon exists, use that
        argString = ''
        if not self.icon:
            argString = ', label="'+shelfLabel+'"'
        
        mc.menu(label='Tools')
        mc.menuItem(label='Add to shelf', 
            command='import ml_utilities;ml_utilities.createShelfButton("import '+module+';'+module+'.ui()", name="'+self.name+'", description="Open the UI for '+self.name+'."'+argString+')')
        if not self.icon:
            mc.menuItem(label='Get Icon',
                command=(_showHelpCommand(websiteURL+'/wp-content/files/'+self.name+'.png')))
        mc.menuItem(label='Get More Tools!', 
            command=(_showHelpCommand(websiteURL+'/downloads')))
        mc.setParent( '..', menu=True )

        mc.menu(label='Help')
        mc.menuItem(label='About', command=self.about)
        mc.menuItem(label='Documentation', command=(_showHelpCommand(wikiURL+'#'+self.name)))
        mc.menuItem(label='Python Command Documentation', command=(_showHelpCommand(wikiURL+'#\%5B\%5B'+self.name+'\%20Python\%20Documentation\%5D\%5D')))
        mc.menuItem(label='Submit a Bug or Request', command=(_showHelpCommand(websiteURL+'/downloads/feedback-and-bug-reports/?1ex_field1='+self.name)))
        
        mc.setParent( '..', menu=True )
Example #10
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()
    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()
Example #13
0
def separator( w=300, h=5 ):
    
    cmds.rowColumnLayout( nc=1, cw=( 1,w ) )
    setSpace( h )
    cmds.separator()
    setSpace( h )
    cmds.setParent( '..' )
Example #14
0
    def create(self):
        
        if cmds.window( Win_Global.winName, q=1, ex=1 ):
            cmds.deleteUI( Win_Global.winName )
        
        cmds.window( Win_Global.winName, title= Win_Global.title )
        
        formOuter = cmds.formLayout()
        stdForm = self.stdArea.create()
        rigForm = self.rigArea.create()
        followForm = self.followArea.create()
        addRigForm = self.addRigArea.create()
        cmds.setParent( '..' )

        cmds.formLayout( formOuter, e=1, 
                         af = [ (stdForm, 'left', 5), (stdForm, 'right', 5), (stdForm, 'top', 5),
                                (rigForm, 'left', 5), (rigForm, 'right', 5),
                                (followForm, 'left', 5), (followForm, 'right', 5),
                                (addRigForm, 'left', 5), (addRigForm, 'right', 5), (addRigForm, 'bottom', 5) ],
                         ac = [ (rigForm, 'top', 5, stdForm ),
                                (followForm, 'top', 5, rigForm ),
                                (addRigForm, 'top', 5, followForm )] )
        
        cmds.window( Win_Global.winName, e=1, width = Win_Global.width, height= Win_Global.height )
        cmds.showWindow( Win_Global.winName )
        
        Win_Global.loadInfo()
 def enterTimecodeUI(self, buttonlabel='set', buttonfunc=None):
     '''
     generic UI to enter timecode
     
     :param buttonlabel' = label to add to the button
     :param buttonfunc' = function to bind to the button on exit
     '''
     self.win='Timecode_UI'
     if cmds.window(self.win, exists=True):
         cmds.deleteUI(self.win, window=True)
     cmds.window(self.win, title=self.win)
     cmds.columnLayout(adjustableColumn=True)
     cmds.text(label='Timecode Reference')
     cmds.separator(h=10, style='in')
     cmds.rowColumnLayout(nc=8)
     cmds.text(label='  smpte :  ')
     cmds.textField('tchrs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tchrs'))
     cmds.text(label=' : ')
     cmds.textField('tcmins', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcmins'))
     cmds.text(label=' : ')
     cmds.textField('tcsecs', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcsecs'))
     cmds.text(label=' : ')
     cmds.textField('tcfrms', tx='00', w=40, cc=lambda x:self.__uicb_checkfield('tcfrms'))
     cmds.setParent('..')
     cmds.button(label=buttonlabel, command=lambda x:self.__uicb_gatherTimecode(buttonfunc))
     cmds.showWindow(self.win)
Example #16
0
    def add(self, driverName, angleValues=[] ):
        
        if not angleValues:
            angleValues = [0,0,0]
        
        defaultBgc = [ .1, .1, .1 ]
        onBgc      = [ .9,  .9,  .2  ]
        
        enList = [0,0,0]
        
        bgcList = [None,None,None]
        
        for i in range( 3 ):
            if math.fabs( angleValues[i] ) >= self._minValue:
                bgcList[i] = onBgc
                enList[i] = 1
            else:
                bgcList[i] = defaultBgc
                enList[i] = 0
        
        widthList = uifnc.setWidthByPerList( [70,15,15,15] , self._width )

        cmds.rowColumnLayout( nc=4, cw=[(1,widthList[0]),(2,widthList[1]),(3,widthList[2]),(4,widthList[3])] )
        cmds.text( l= driverName+' : ', al='right' )
        
        cmds.floatField( precision=2, v=angleValues[0], bgc= bgcList[0] )
        cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle0 : %3.2f' %angleValues[0] ) )
        cmds.floatField( precision=2, v=angleValues[1], bgc= bgcList[1] )
        cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle1 : %3.2f' %angleValues[1] ) )
        cmds.floatField( precision=2, v=angleValues[2], bgc= bgcList[2] )
        cmds.popupMenu(); cmds.menuItem( l='Add Driver', c= partial( self.addConnectDriver, driverName+' | angle2 : %3.2f' %angleValues[2] ) )
        
        self.driverScrollAddPopupCmd()
        
        cmds.setParent( '..' )
Example #17
0
 def create(self):
     
     try:frame = cmds.frameLayout( l='Follow Area', bgs=1, bgc=[0.2,0.2,.4] )
     except:frame = cmds.frameLayout( l='Follow Area', bgc=[0.2,0.2,.4] )
     form = cmds.formLayout()
     text  = cmds.text( l='Select Ik And Set' )
     root  = cmds.checkBox( l='Root', v=1 )
     fly   = cmds.checkBox( l='Fly', v=1 )
     move  = cmds.checkBox( l='Move', v=1 )
     world = cmds.checkBox( l='World', v=1 )
     btSet = cmds.button( l='Set', c= Win_Cmd.addFollow )
     cmds.setParent( '..' )
     cmds.setParent( '..' )
     
     cmds.formLayout( form, e=1,
                      af=[ ( text, 'left', 0 ), ( text, 'right', 0 ), ( text, 'top', 0 ),
                           ( root, 'left', 0 ), ( world, 'right', 0 ),
                           ( btSet, 'left', 0 ), ( btSet, 'right', 0 ) ],
                      ac=[ ( root, 'top', 5, text ), ( fly, 'top', 5, text ), ( move, 'top', 5, text ), ( world, 'top', 5, text ),
                           ( btSet, 'top', 5, move ) ],
                      ap=[ ( root, 'right', 0, 25 ), 
                           ( fly, 'left', 0, 25 ), ( fly, 'right', 0, 50 ),
                           ( move, 'left', 0, 50 ), ( move, 'right', 0, 75 ),
                           ( world, 'left', 0, 75 ) ] )
     
     Win_Global.rootfollow = root
     Win_Global.flyfollow = fly
     Win_Global.movefollow = move
     Win_Global.worldfollow = world
     
     return frame
	def popup_filemenu( self, parent, *args ):
		cmd.menu(parent, e=True, dai=True)
		cmd.setParent(parent, m=True)

		other = self.other()
		items = self.selected()
		numItems = len(items)
		if numItems:
			cmd.menuItem(l='copy to %s' % other, c=self.copy)
			cmd.menuItem(l='move to %s' % other, c=self.move)

			if len(items) == 1:
				filepath = items[0].resolve()
				cmd.menuItem(d=True)
				cmd.menuItem(l='open in notepad', c=lambda *x: self.on_notepad( filepath ))

				#if the files are global files, display the perforce menu
				if self.locale == GLOBAL:
					cmd.menuItem(d=True)
					api.addPerforceMenuItems(filepath)
				cmd.menuItem(d=True)
				api.addExploreToMenuItems(filepath)

			cmd.menuItem(d=True)
			cmd.menuItem(l='delete', c=self.delete)

		#if the file is a global file, display an option to sync to presets
		if self.locale == GLOBAL:
			if numItems: cmd.menuItem(d=True)
			cmd.menuItem(l='sync to presets', c=self.syncall)

		#if no files are selected, prompt the user to select files
		if numItems == 0: cmd.menuItem(en=False, l='select a preset file')
Example #19
0
 def create( self, *args ):
     
     if cmds.window( self.winName, ex=1 ):
         cmds.deleteUI( self.winName, wnd=1 )
     cmds.window( self.winName, title= self.title, titleBarMenu=0 )
     
     cmds.columnLayout()
     cmds.rowColumnLayout( nc=1, cw=[( 1,self.width-2)] )
     cmds.text( l='Register ID', h=30 )
     idField = cmds.textField( h=25 )
     helpField = cmds.textField( en=0 )
     cmds.setParent( '..' )
     
     firstWidth = (self.width-2)*0.5
     secondWidth = (self.width-2)-firstWidth
     cmds.rowColumnLayout( nc=2, cw=[(1,firstWidth),(2,secondWidth)])
     cmds.button( l='Create', h=25, c=self.cmdCreate )
     cmds.button( l='Cancel', h=25, c=self.cmdCancel )
     cmds.setParent( '..' )
     
     cmds.window( self.winName, e=1,
                  width = self.width,
                  height = self.height )
     cmds.showWindow( self.winName )
     
     self.idField = idField
     self.helpField = helpField
Example #20
0
 def installFalloffGradient(self):
     """"""
     layout = cmds.frameLayout( "falloffLayout",
                                l='Falloff:',
                                cl=True,
                                cll=True,
                                mw=5,
                                mh=5,
                                ec=lambda *args: self.resizeMainWindow(),
                                cc=lambda *args: self.resizeMainWindow())
     
     # Install falloff mode scroll List
     cmds.rowLayout(nc=2, adj=1)
     falloffMode = self.installFalloffOption()
     resetBtn = cmds.button(l='Reset', c=lambda *args: self.resetFalloff(), w=40)
     cmds.setParent( '..' )
     
     # Install falloff gradient control
     self.gradient = cmds.gradientControlNoAttr( 'falloffCurve', h=90)
     self.copyFromMayaFalloffCurve()
     cmds.gradientControlNoAttr( 'falloffCurve',
                                 e=True,
                                 optionVar='falloffCurveOptionVar',
                                 changeCommand=lambda *args: self.changeSoftSelectValue(),
                                 currentKeyChanged=lambda *args: self.softSelectCurveKeyChanged() )
     
     # Install interpolation scroll List
     interpolation = self.installInterpolationOption()
     
     cmds.setParent( '..' )
     return layout
Example #21
0
 def installCreateButton(self):
     """"""
     layout = cmds.frameLayout("createLayout", lv=False, bv=False)
     form = cmds.formLayout()
     self.createBtn = cmds.iconTextButton(st='iconOnly',
                                          l='Create',
                                          ann="Create cluster by default, turn on \"J\" to create joint.",
                                          c=lambda *args: self.createSoftDeformerCmd() )
     
     self.jointCheck = cmds.iconTextCheckBox(st='textOnly',
                                             l='   J   ',
                                             ann="Create joint",
                                             cc=lambda *args: self.setCreateBtnIcon())
     cmds.formLayout(form,
                     e=1,
                     af=[(self.createBtn, 'left', 0),
                         (self.createBtn, 'right', 0),
                         (self.createBtn, 'top', 0),
                         (self.createBtn, 'bottom', 0),
                         (self.jointCheck, 'right', 0),
                         (self.jointCheck, 'top', 0)]
                     )
     cmds.setParent( '..' )
     cmds.setParent( '..' )
     
     self.setCreateBtnIcon()
     return layout
Example #22
0
File: mayaUI.py Project: gj210/upy
    def createMenu(self,menuDic,menuOrder=None):
        """ Define and draw the window/widget top file menu
        @type  menuDic: dictionary
        @param menuDic: the menu elements, ie entry, callback and submenu
        @type  menuOrder: array
        @param menuOrder: the menu keys oredered
        """        
        
        if menuOrder : 
            lookat = menuOrder
        else :
            lookat = menuDic.keys()
        for mitem in lookat:
            cmds.menu( label=mitem, tearOff=True , parent = self.winName)
            for elem in menuDic[mitem]:            
                if elem["sub"] is not None:
                    elem['id']=cmds.menuItem(subMenu=True, label=elem["name"])
                    for sub in elem['sub'].keys():
                        checkBox = False#elem['sub'][sub]['checkBox']
                        if elem['sub'][sub]["action"] is not None :
                            elem['sub'][sub]['id']=cmds.menuItem( label=elem['sub'][sub]["name"],
#                                                            checkBox=checkBox,
                                                            c=partial(elem['sub'][sub]["action"],sub))
                        else :
                            elem['sub'][sub]['id']=cmds.menuItem( label=elem['sub'][sub]["name"],)
#                                                            checkBox=checkBox,)
#                        if checkBox and elem['sub'][sub].has_key("var"):
#                            cmds.menuItem(elem['sub'][sub]['id'],e=1,checkBox=bool(elem['sub'][sub]['var']))
                    cmds.setParent( '..', menu=True )
                else:
                    if elem["action"] is not None :
                        elem['id']=cmds.menuItem( label=elem["name"],c=elem["action"])
                    else :
                        elem['id']=cmds.menuItem( label=elem["name"])
def renameGui(parent):
	renCol = cmds.columnLayout()
	colWidth = winWidth/4
	cmds.rowColumnLayout(nc=4, cw=[[1,colWidth],[2,colWidth+40],[3,colWidth-40],[4,colWidth]],
		co=[[1,"both",3],[2,"both",3],[3,"both", 3],[4,"both",3]])
	cmds.text( label="Prefix", al="center" )
	cmds.text( label="Name", al="center" )
	cmds.text( label="###", al="center" )
	cmds.text( label="Suffix", al="center" )	
	
	cmds.textField( "mecRenPre" )
	cmds.textField( "mecRenName" )
	cmds.intField( "mecRenCount" )
	cmds.textField( "mecRenSuf" )
	cmds.setParent(renCol)
	
	cmds.rowColumnLayout( nc=3, cw=[[1,winWidth/3-20],[2,winWidth/3+40],[3,winWidth/3-20]],
		co=[[1,"both",3],[3,"both",3]])
	cmds.button(label="Prefix",
		c=Callback(prefix))
	cmds.button(label="Full Rename",
		c=Callback(fullRename))
	cmds.button(label="Suffix",
		c=Callback(suffix))
	cmds.setParent( parent )	
Example #24
0
    def create(self):
        
        if cmds.window( Win_Global.winName, q=1, ex=1 ):
            cmds.deleteUI( Win_Global.winName )
        cmds.window( Win_Global.winName, title=Win_Global.title )
        
        form  = cmds.formLayout()
        text   = cmds.text( l= "Select joint tops", al='center', h=30, bgc=[.5,.5,.5] )
        check = cmds.checkBox( l='Add Pin Control' )
        controllerName = self.ui_controllerName.create()
        colorIndex = self.ui_colorIndex.create()
        controllerSize = self.ui_controllerSize.create()
        button = self.ui_buttons.create()
        cmds.setParent( '..' )

        cmds.formLayout( form, e=1, af=[ (text, 'top', 0 ), (text, 'left', 0 ), (text, 'right', 0 ),
                                         (check, 'top', 5 ), (check, 'left', 10 ), (check, 'right', 0 ),
                                         (controllerName, 'left', 10 ), (controllerName, 'right', 5 ),
                                         (colorIndex, 'left', 10 ), (colorIndex, 'right', 5 ),
                                         (controllerSize, 'left', 10 ), (controllerSize, 'right', 5 ),
                                         (button, 'left', 0 ), (button, 'right', 0 ), (button, 'bottom', 0 )],
                                    ac=[ (check, 'top', 5, text),
                                         (controllerName, 'top', 5, check),
                                         (colorIndex, 'top', 5, controllerName), 
                                         (controllerSize, 'top', 5, colorIndex), 
                                         (button, 'top', 5, controllerSize) ] )
        
        cmds.window( Win_Global.winName, e=1,
                     width = Win_Global.width, height = Win_Global.height,
                     rtf=1 )
        cmds.showWindow( Win_Global.winName )
        
        Win_Global.checkBox = check
Example #25
0
def setOptionMenuList(OMG,itemList,add=False):
	'''
	Set the list of items for the specified optionMenuGrp control
	@param OMG: OptionMenuGrp to set the item list for
	@type OMG: str
	@param itemList: List of items to add to optionMenuGrp
	@type itemList: list
	@param add: Add to existing menu items
	@type add: bool
	'''
	# Check optionMenuGrp
	if not mc.optionMenuGrp(OMG,q=True,ex=True):
		raise UIError('OptionMenu "'+OMG+'" does not exist!')
	
	# Get existing items
	exItemList = mc.optionMenuGrp(OMG,q=True,ill=True)
	
	# Add items
	for item in itemList:
		mc.setParent(OMG)
		mc.menuItem(l=item)
	
	# Remove previous items
	if exItemList:
		for item in exItemList:
			mc.deleteUI(item)
def deleteChannelsUI( win):
    chnlUI = mkList( mc.layout( win.channelsParent, q=1, ca=1))
    if len(chnlUI): mc.deleteUI( chnlUI)
    win.cRange = []
    win.cOffset = []
    win.cStep = []
    mc.setParent( win.channelsParent)
Example #27
0
 def installConvertOption(self):
     """"""
     cmds.rowLayout(nc=2, adj=2)
     cmds.text(l=' Convert:', fn='boldLabelFont')
     self.keepCheck = cmds.iconTextCheckBox( st='textOnly', l='Keep original', v=True )
     cmds.setParent( '..' )
     cmds.separator( style='none' )
Example #28
0
def snapOnClosestVertex_window():
	"""
	Creates the 'Snap On Closest Vertex' vertex window.
	"""

	cmds.windowPref(enableAll=False)

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

	cmds.window("snapOnClosestVertex_window",
		title="Snap On Closest Vertex",
		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="Reference Object:")
	referenceObject_textField = cmds.textField("referenceObject_textField")
	cmds.button("getReferenceObject_button", label="Get Reference Object!", command=getReferenceObject_button_OnClicked)
	cmds.setParent(topLevel=True)

	cmds.separator(style="single")

	cmds.button("snapIt_button", label="Snap It!", al="center", command=snapIt_button_OnClicked)

	cmds.showWindow("snapOnClosestVertex_window")
	cmds.windowPref(enableAll=True)
Example #29
0
def secondaryUI():
    sec_UIname = 'secondary'
    if cmds.window(sec_UIname,exists = True):
        cmds.deleteUI(sec_UIname)
    cmds.window(sec_UIname,title = 'rosa_secondary')
    clmLot = cmds.columnLayout( adjustableColumn=True)
    cmds.textField('ctrl_name',text = 'ctrl_name')
    cmds.button('createctrl',label = 'create ctrl',h = 30,c = 'ctrl()')
    cmds.button('load_model',label = 'load "org" model',c = 'load_org()')
    cmds.textField('org_model',text = '"org" model')
    cmds.button('load_property_obj',label = 'loading property add object',c = 'load_vis()')
    cmds.textField('vis',text = 'Visibility')
    #
    flLot = cmds.flowLayout(columnSpacing = 6)
    cmds.text(label = 'ctrl axial:')
    cmds.radioCollection()
    cmds.radioButton('follic',label = 'follic',select = 0)
    cmds.radioButton('Custom',label = 'Custom',select = 1)
    #
    cmds.setParent( clmLot)
    cmds.button(label = 'Generate',c = 'secondary_add()')
    cmds.button('add_ctrl',label = 'add controller',c = 'add_controller()')
    cmds.button('Add_modelSec',label = 'Add_modelSec',c = 'Add_modelSec()')
    cmds.button(label = 'inverse_connect',c =  'inverse_connect01()')
    #
    cmds.frameLayout( label='modify ctrl:',borderStyle='etchedOut')
    cmds.setParent( clmLot)
    cmds.button(label = 'loding want to modify the controller',c = 'load_ctrl()')
    cmds.textField('sec_ctrl',text = 'secondary_ctrl')
    cmds.button(label = 'modify the controller position',c = 'ctrl_modify()')
    cmds.button(label = 'complete controller modifies',c = 'modify_complete()')
    cmds.showWindow()
Example #30
0
def windows():
    i = 'cici'
    try:
        cmds.deleteUI(i)
    except:pass  
    window = cmds.window('cici',title='面部<骨骼>次级添加',iconName='Short Name',widthHeight=(380,130))
    cmds.columnLayout(columnAttach=('both',20),rowSpacing=20,columnWidth=400)
    cmds.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,300),(2,300),])
    cmds.setParent('..') 
    cmds.rowColumnLayout(numberOfRows=3)
    cmds.columnLayout(columnAttach=('both',-100),adjustableColumn = True,rowSpacing=2)
    cmds.radioButtonGrp("pipei",label='配适: ',labelArray2=['ADV专用','通用版'],numberOfRadioButtons=2,select=1)
    cmds.setParent('..') 
    cmds.rowColumnLayout(numberOfRows=2)
    cmds.frameLayout(label='通用版点开',cll=1,cl=1,borderStyle='in',bgc=(0.3,0.3,1))
    cmds.columnLayout(columnAttach=('both',-80),adjustableColumn = True,rowSpacing=2)
    bb=cmds.textFieldButtonGrp('zong',label="载入骨骼",buttonLabel="载入")  
    cmds.textFieldButtonGrp(bb,e=1,bc='bb("'+bb+'"),')  
    cmds.setParent('..') 
    cmds.setParent('..') 
    cmds.rowColumnLayout(numberOfRows=3)
    cmds.text('选择面部曲线')
    cmds.textField('w',tx='',w=350,h=30)
    cmds.rowLayout(numberOfColumns=1,)
    cmds.button(command="cici()",label='确定',w=350,h=50) 
    cmds.setParent('..')
    cmds.setParent('..')
    cmds.setParent('..')
    cmds.rowLayout(numberOfColumns=1)
    cmds.text('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx') 
    cmds.setParent('..')
    cmds.showWindow(window)
    def __init__(self, parent):
        MelForm.__init__(self, parent)

        self.sortBySrcs = True  #otherwise it sorts by tgts when doing traces
        self._clipPreset = None
        self.UI_mapping = mappingEditor.MappingForm(self)
        self.UI_options = MelFrame(
            self,
            l="xfer options",
            labelVisible=True,
            collapsable=False,
            collapse=False,
            h=115,
            borderStyle='etchedIn'
        )  #need to specify the height for 2011 coz its ghey!

        cmd.columnLayout(adjustableColumn=True, rowSpacing=5)
        cmd.rowLayout(numberOfColumns=2,
                      columnWidth2=(175, 165),
                      columnAttach=((1, "both", 5), (2, "both", 5)))

        cmd.columnLayout(adjustableColumn=True)
        self.UI_radios = cmd.radioCollection()
        self.RAD_dupe = cmd.radioButton(l="duplicate nodes",
                                        align='left',
                                        sl=True,
                                        cc=self.on_update)
        self.RAD_copy = cmd.radioButton(l="copy/paste keys",
                                        align='left',
                                        cc=self.on_update)
        self.RAD_trace = cmd.radioButton(l="trace objects",
                                         align='left',
                                         cc=self.on_update)
        setParent('..')

        cmd.columnLayout(adjustableColumn=True)
        self.UI_check1 = cmd.checkBox(l="instance animation")
        self.UI_check2 = cmd.checkBox(l="match rotate order", v=1)
        self.UI_check3 = cmd.checkBox(l="", vis=0, v=0)
        self.UI_check4 = cmd.checkBox(l="", vis=0, v=1)
        setParent('..')
        setParent('..')

        cmd.rowColumnLayout(numberOfColumns=7,
                            columnWidth=((1, 75), (2, 95), (3, 35), (4, 45),
                                         (5, 35), (6, 45)),
                            columnAttach=((1, "both", 1), (2, "both", 1),
                                          (3, "both", 1), (4, "both", 1),
                                          (5, "both", 5), (6, "both",
                                                           1), (7, "both", 5)))
        self.UI_keysOnly = cmd.checkBox(l="keys only", v=0, cc=self.on_update)
        self.UI_withinRange = cmd.checkBox(l="within range:",
                                           v=0,
                                           cc=self.on_update)
        cmd.text(l="start ->")
        self.UI_start = cmd.textField(en=0, tx='!')
        cmd.popupMenu(p=self.UI_start, b=3, pmc=self.buildTimeMenu)

        cmd.text(l="end ->")
        self.UI_end = cmd.textField(en=0, tx='!')
        cmd.popupMenu(p=self.UI_end, b=3, pmc=self.buildTimeMenu)

        cmd.setParent(self)
        UI_button = cmd.button(l='Xfer Animation', c=self.on_xfer)

        self(e=True,
             af=((self.UI_mapping, 'top', 0), (self.UI_mapping, 'left', 0),
                 (self.UI_mapping, 'right', 0), (self.UI_options, 'left', 0),
                 (self.UI_options, 'right', 0), (UI_button, 'left', 0),
                 (UI_button, 'right', 0), (UI_button, 'bottom', 0)),
             ac=((self.UI_mapping, 'bottom', 0, self.UI_options),
                 (self.UI_options, 'bottom', 0, UI_button)))

        self.on_update()  #set initial state
Example #32
0
def main(force=False):

    if force:
        if mc.dockControl("dc_FRW", ex=True) == True:
            mc.deleteUI("dc_FRW")
        if mc.window("w_FRW", ex=True):
            mc.deleteUI("w_FRW")

    if not mc.window("w_FRW", ex=True):
        a = mc.window("w_FRW", t="the Fastest Rig in the West")
        tl = mc.tabLayout()
        tab1 = mc.paneLayout(cn="horizontal3",
                             st=1,
                             shp=1,
                             ps=[(1, 1, 1), (2, 1, 99), (3, 1, 1)])
        mc.columnLayout(adj=True)
        mc.rowLayout(nc=5, adj=4)
        mc.iconTextButton(st="iconOnly",
                          i1="QR_add.png",
                          ann="create new asset",
                          c=__createAsset_ui)
        mc.iconTextButton(st="iconOnly",
                          i1="QR_delete.png",
                          ann="delete selected asset",
                          c=__deleteAsset)
        mc.iconTextButton(st="iconOnly",
                          i1="CN_refresh.png",
                          ann="update assets list",
                          c=__update)
        mc.text(l="")
        mc.iconTextButton(st="iconOnly",
                          i1="UVEditorSnapshot.png",
                          ann="update icon",
                          c=__icon)
        mc.setParent("..")
        mc.rowLayout(nc=3, adj=2)
        mc.textScrollList("tsl_type_FRW", w=100, h=200, sc=__updateNames)
        mc.textScrollList("tsl_name_FRW", w=170, h=200, sc=__updateIconAndPath)
        mc.image("img_FRW", w=200, h=200)
        mc.setParent("..")
        mc.rowLayout(nc=2, adj=1)
        mc.textField("tf_path_FRW", ed=False)
        mc.iconTextButton(st="iconOnly",
                          i1="passSetRelationEditor.png",
                          ann="edit",
                          c=__edit)
        mc.setParent("..")
        mc.setParent("..")
        mc.scrollLayout("sl_inspector_FRW", bv=True)
        mc.setParent("..")
        mc.button("b_execute_FRW", l="execute", c=__execute)
        mc.setParent("..")
        tab2 = mc.scrollLayout(bv=True)
        mc.columnLayout("cl_library_FRW", adj=True, rs=5)
        mc.setParent("..")
        mc.setParent("..")
        tab3 = mc.scrollLayout(bv=True)
        mc.columnLayout("cl_extensions_FRW", adj=True, rs=5)
        mc.setParent("..")
        mc.setParent("..")
        mc.tabLayout(tl,
                     e=True,
                     tl=[(tab1, "builder"), (tab2, "library"),
                         (tab3, "extensions")])

    if not mc.dockControl("dc_FRW", ex=True):
        mc.dockControl("dc_FRW",
                       l="the Fastest Rig in the West",
                       con="w_FRW",
                       aa=["left", "right"],
                       a="left",
                       w=1)
        mc.dockControl("dc_FRW", e=True, fl=True)
    else:
        mc.dockControl("dc_FRW", e=True, vis=True)

    __initialize()
    __update()
    __library()
    __extensions()
Example #33
0
def __updateInspector():

    global CACHE
    CACHE = {"index": {}, "function": {}, "execute": {}}

    mc.button("b_execute_FRW", e=True, en=False)
    l = mc.scrollLayout("sl_inspector_FRW", q=True, ca=True) or []
    if len(l): mc.deleteUI(l)
    if mc.textScrollList("tsl_type_FRW", q=True, nsi=True):
        t = mc.textScrollList("tsl_type_FRW", q=True, si=True)[0]
        if mc.textScrollList("tsl_name_FRW", q=True, nsi=True):
            CACHE["name"] = mc.textScrollList("tsl_name_FRW", q=True,
                                              si=True)[0]
            CACHE["file"] = STAGING_DIR + t + "/" + CACHE[
                "name"] + "/" + CACHE["name"] + ".py"
            if os.path.isfile(CACHE["file"]):
                m = imp.load_source(CACHE["name"], CACHE["file"])
                for n, o in inspect.getmembers(m, inspect.isfunction):
                    CACHE["index"][o.__code__.co_firstlineno] = [
                        n, inspect.getargspec(o)
                    ]
                ids = sorted(CACHE["index"].viewkeys())
                c = len(ids)
                for i in range(c):
                    if i == 0: mc.button("b_execute_FRW", e=True, en=True)
                    fn = CACHE["index"][ids[i]][0]
                    CACHE["function"][fn] = {
                        "checkbox": None,
                        "arguments": {},
                        "presets": {}
                    }
                    mc.rowLayout(nc=10, adj=2, p="sl_inspector_FRW")
                    cb = mc.iconTextCheckBox(i="checkboxOff.png",
                                             si="checkboxOn.png",
                                             v=__loadStatePreset(fn),
                                             cc=partial(
                                                 __saveStatePreset, ids[i]))
                    CACHE["function"][fn]["checkbox"] = cb
                    mc.text(l=CACHE["index"][ids[i]][0],
                            w=250,
                            al="left",
                            fn="fixedWidthFont")
                    ab = mc.iconTextButton(st="iconOnly",
                                           i1="fileOpen.png",
                                           ann="load preset",
                                           vis=False,
                                           c=partial(__loadAllArgPresets,
                                                     ids[i]))
                    eb = mc.iconTextButton(st="iconOnly",
                                           i1="fileSave.png",
                                           ann="save preset",
                                           vis=False,
                                           c=partial(__saveAllArgPresets,
                                                     ids[i]))
                    db = mc.iconTextButton(st="iconOnly",
                                           i1="QR_delete.png",
                                           ann="delete preset",
                                           vis=False,
                                           c=partial(__deleteAllArgPresets,
                                                     ids[i]))
                    rv = mc.iconTextButton(st="iconOnly",
                                           i1="RS_disable.png",
                                           ann="reset value",
                                           vis=False,
                                           c=partial(__resetAllArgValues,
                                                     ids[i]))
                    mc.text(l="", w=5)
                    CACHE["function"][fn]["error"] = mc.image(
                        i="RS_WarningOldCollection", vis=False)
                    e = mc.iconTextButton(st="iconOnly",
                                          i1="timeplay.png",
                                          c=partial(__execute, ids[i]))
                    CACHE["execute"][e] = CACHE["index"][ids[i]][0]
                    mc.setParent("..")
                    arg_nms = CACHE["index"][ids[i]][1][0]
                    c_nms = len(arg_nms)
                    arg_val = CACHE["index"][ids[i]][1][3] or []
                    c_val = len(arg_val)
                    offset = c_nms - c_val
                    # arguments
                    for j in range(offset):
                        if j == 0:
                            for s in [ab, eb, db, rv]:
                                mc.iconTextButton(s, e=True, vis=True)
                        tfg, img = __argumentWidget(j, ids[i],
                                                    CACHE["index"][ids[i]][0],
                                                    arg_nms[j], None)
                        CACHE["function"][fn]["arguments"][arg_nms[j]] = tfg
                        CACHE["function"][fn]["presets"][arg_nms[j]] = img
                    # keyword arguments
                    for j in range(c_val):
                        if j == 0:
                            for s in [ab, eb, db, rv]:
                                mc.iconTextButton(s, e=True, vis=True)
                        jj = j + offset
                        tfg, img = __argumentWidget(jj, ids[i],
                                                    CACHE["index"][ids[i]][0],
                                                    arg_nms[jj], arg_val[j])
                        CACHE["function"][fn]["arguments"][arg_nms[jj]] = tfg
                        CACHE["function"][fn]["presets"][arg_nms[jj]] = img
                    if i < c - 1:
                        mc.separator(st="in",
                                     w=435,
                                     h=10,
                                     p="sl_inspector_FRW")
                    # Load at once any available presets for the arguments of the inspected function.
                    __loadArgPreset(ids[i], arg_nms)
Example #34
0
def initialize_plugin():
    cmds.setParent('MayaWindow')
    cmds.menu(label=u'GA_Tools', tearOff=True)
    cmds.menuItem(subMenu=True, label='Test', tearOff=True)
    cmds.menuItem(label='GATrackingWindow', command=open_ga_tracking_window)
Example #35
0
        (1, 'both', 0),
        (2, 'both', 0),
        (3, 'both', 0)
    ]
)

dirLabelCtrl = cmds.text(label='Directory')

if DEBUG:
    dirTextCtrl = cmds.textField('dirTextCtrl', text='/Users/master/Documents/maya/projects/__Shader_Ball_TEST/sourceimages/pressa') # WARNING: DEBUG!
else:
    dirTextCtrl = cmds.textField('dirTextCtrl')

dirBtnCtrl = cmds.iconTextButton(style='iconOnly', image='fileOpen.png', command=select_input_dir)

cmds.setParent('..')

cmds.button('loadButtonCtrl', label='Load', command=get_textures_info, en=DEBUG)
cmds.separator()
textureOptionCtrl = cmds.optionMenu('textureOptionCtrl', label='Texture', enable=False)

cmds.columnLayout(adjustableColumn=True, rowSpacing=3)
baseColorTextCtrl = cmds.text(label="Base color", bgc=[0, 0, 0], ebg=True, height=20)
metalnessTextCtrl = cmds.text(label="Metalness", bgc=[0, 0, 0], ebg=True, height=20)
roughnessTextCtrl = cmds.text(label="Roughness", bgc=[0, 0, 0], ebg=True, height=20)
normalTextCtrl = cmds.text(label="Normal", bgc=[0, 0, 0], ebg=True, height=20)
heightTextCtrl = cmds.text(label="Height", bgc=[0, 0, 0], ebg=True, height=20)
cmds.setParent('..')

dirSelectorLayout = cmds.rowLayout(
    numberOfColumns=2,
Example #36
0
    def OCT_RenderDeepSet_UI(self):
        if mc.window('OCT_RenderDeepSet_UI', exists=True):
            mc.deleteUI('OCT_RenderDeepSet_UI', window=True)

        myRenderwidth = mc.getAttr("defaultResolution.width")
        myRenderheight = mc.getAttr("defaultResolution.height")
        myRenderGlobals = mc.getAttr("defaultRenderGlobals.currentRenderer")
        numberRender = 1
        if myRenderGlobals == 'vray':
            numberRender = 1
        elif myRenderGlobals == 'arnold':
            numberRender = 2

        getWindow = mc.window('OCT_RenderDeepSet_UI',
                              wh=(300, 150),
                              resizeToFitChildren=1,
                              sizeable=True)
        mc.formLayout('formLyt', numberOfDivisions=100)
        one = mc.columnLayout('First_Set', parent='formLyt')
        mc.rowLayout('projectRow',
                     numberOfColumns=3,
                     columnAttach3=['left', 'left', 'left'],
                     columnWidth3=[5, 200, 35],
                     columnOffset3=[2, 2, 2],
                     adjustableColumn3=True,
                     parent='First_Set')
        #mc.columnLayout(rowSpacing=2,columnWidth=100,columnAlign='center')
        mc.radioButtonGrp('RenderSet',
                          columnAlign3=('left', 'left', 'left'),
                          columnWidth3=(90, 80, 90),
                          numberOfRadioButtons=2,
                          label=u'渲染器设置:',
                          labelArray2=('vray', 'arnold'),
                          sl=numberRender,
                          enable=True)
        mc.setParent('..')
        mc.columnLayout()
        mc.text("")
        mc.setParent("..")
        #mc.columnLayout(rowSpacing=2,columnWidth=50,columnAlign='center')
        mc.rowLayout('fiveRow',
                     numberOfColumns=3,
                     columnAttach3=[
                         'left',
                         'left',
                         'left',
                     ],
                     columnWidth3=[90, 30, 10],
                     columnOffset3=[2, 2, 10],
                     adjustableColumn3=True,
                     parent='First_Set')
        mc.text(label=u'分辨率:', w=68, parent='fiveRow')
        mc.text(label=u'宽:', w=68, parent='fiveRow')
        mc.textField('RenderWidth',
                     text=myRenderwidth,
                     width=60,
                     alwaysInvokeEnterCommandOnReturn=True,
                     parent='fiveRow')
        mc.setParent('..')
        mc.columnLayout()
        mc.text("")
        mc.setParent("..")
        mc.rowLayout('fiveRow1',
                     numberOfColumns=3,
                     columnAttach3=[
                         'left',
                         'left',
                         'left',
                     ],
                     columnWidth3=[90, 30, 10],
                     columnOffset3=[2, 2, 10],
                     adjustableColumn3=True,
                     parent='First_Set')
        mc.text(label=u'', w=68, parent='fiveRow1')
        mc.text(label=u'高:', w=68, parent='fiveRow1')
        mc.textField('RenderHeight',
                     text=myRenderheight,
                     width=60,
                     alwaysInvokeEnterCommandOnReturn=True,
                     parent='fiveRow1')
        mc.setParent("..")
        mc.columnLayout()
        mc.text("")
        mc.setParent("..")
        mc.rowLayout(numberOfColumns=4,
                     columnWidth4=(80, 120, 120, 20),
                     columnAlign4=('center', 'center', 'center', 'center'))
        mc.text(l='', vis=0)
        mc.button(l='OK',
                  w=80,
                  h=30,
                  backgroundColor=(0.0, 0.7, 0),
                  align='center',
                  c=lambda *args: self.OCT_StartDeepRenderSet())
        mc.button(l='Close',
                  width=80,
                  h=30,
                  backgroundColor=(0.7, 0.0, 0),
                  c=('mc.deleteUI(\"' + getWindow + '\",window=True)'))
        mc.text(l='', vis=0)
        mc.showWindow(getWindow)
Example #37
0
    def keyOffsetPanelUI(self, name, parent, collapse=False):
        """Create UI controls"""

        mc.frameLayout(width=400,
                       collapsable=True,
                       cl=collapse,
                       borderStyle="etchedIn",
                       label="Keyframe Offset Options")
        mc.columnLayout(name)
        mc.separator(height=4, style="none")
        mc.rowLayout(numberOfColumns=1,
                     columnAttach1="left",
                     columnAlign1="both",
                     columnOffset1=4)
        mc.text(label="Offset keys on selected objects.")
        mc.setParent(name)
        mc.separator(height=8, style="none")
        mc.floatSliderGrp(
            "globalOffset",
            label="Global Offset: ",
            value=0,
            field=True,
            precision=3,
            minValue=-50,
            maxValue=50,
            fieldMinValue=-99999999,
            fieldMaxValue=99999999,
            annotation=
            "Animation keys on all selected objects will be offset by this value."
        )
        mc.floatSliderGrp(
            "keySeparation",
            label="Increment: ",
            value=0,
            field=True,
            precision=3,
            minValue=-10,
            maxValue=10,
            fieldMinValue=-99999999,
            fieldMaxValue=99999999,
            annotation=
            "Animation keys will be incremented by this value for each selected object."
        )
        mc.floatSliderGrp(
            "randomAmount",
            label="Random Amount: ",
            value=0,
            field=True,
            precision=3,
            minValue=0,
            maxValue=10,
            fieldMinValue=-99999999,
            fieldMaxValue=99999999,
            annotation=
            "Random value to be added or subracted to the offset for each key."
        )
        mc.separator(height=4, style="none")
        mc.radioButtonGrp("timeUnits",
                          label="Units: ",
                          labelArray2=['Frames', 'Seconds'],
                          numberOfRadioButtons=2,
                          columnWidth3=[140, 78, 156],
                          select=1)
        mc.separator(height=8, style="none")
        mc.setParent(parent)
Example #38
0
 def makeAcoolButton(btn, comm, widt):
     cmds.frameLayout(borderVisible=True, labelVisible=False)
     cmds.button(l=btn, command=comm, w=widt)
     cmds.setParent('..')
Example #39
0
def win(fakeInput=True):
    win_Name = "PandaMenu 3D Choose Tool"
    versionNumber = 0.1

    #if old ui not closed, close it
    if cmds.window(win_Name, exists=True):
        cmds.deleteUI(win_Name)
    window = cmds.window(win_Name,
                         sizeable=True,
                         titleBar=True,
                         resizeToFitChildren=False,
                         menuBar=True,
                         title=win_Name + " ver " + str(versionNumber))

    #global list that contains cross-window selection names
    vertList = []
    polyList = []
    typeList = ["additive"]
    existedTypeList = []

    #col layout
    cmds.columnLayout()

    cmds.rowLayout(numberOfColumns=1,
                   columnAttach=(1, 'both', 135),
                   columnWidth=(1, 250),
                   height=50)
    cmds.button(label='Confirm Objects need to be chosen',
                command=partial(getVerts, vertList=vertList),
                width=250)
    cmds.setParent("..")

    addRowLayout = cmds.columnLayout()
    cmds.setParent("..")

    cmds.rowLayout(numberOfColumns=3,
                   columnAttach=[(1, 'both', 10), (2, "both", 10),
                                 (3, "both", 10)],
                   columnWidth=[(1, 200), (2, 150), (3, 150)],
                   height=50)

    cmds.optionMenu(label='box type',
                    changeCommand=partial(fillBoxType, typeList=typeList))
    cmds.menuItem(label="additive")
    cmds.menuItem(label="subtractive")

    cmds.button(label='Create Box',
                command=partial(create,
                                vertList=vertList,
                                polyList=polyList,
                                typeList=typeList,
                                layoutName=addRowLayout,
                                existedTypeList=existedTypeList))
    cmds.button(label="Refresh",
                command=partial(refresh,
                                vertList=vertList,
                                polyList=polyList,
                                existedTypeList=existedTypeList))
    cmds.setParent("..")
    cmds.rowLayout(numberOfColumns=1,
                   columnAttach=(1, 'both', 135),
                   columnWidth=(1, 250),
                   height=50)
    cmds.button(label='Delete All Boxes',
                command=partial(delete, polyList=polyList),
                width=250)
    cmds.setParent("..")
    cmds.showWindow(window)
    def showWindows(self):
        if cmds.window('ArnoldSettingUI', q=1, exists=1):
            cmds.deleteUI('ArnoldSettingUI')
        Mytool = cmds.window('ArnoldSettingUI',title='Mili Arnold Setting',widthHeight=(420,600),sizeable=False)
        cmds.rowColumnLayout( numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.text(label='Arnold Global Setting',height=30, backgroundColor=[0.5, 0.5, 0.6])
        cmds.separator(style='out')
        tabs = cmds.tabLayout('tabsNameSpace')

        #################################
        #Common
        child1 = cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.scrollLayout('scrollLayoutUnique1', height=600)


        #File Output
        cmds.frameLayout(label='File Output', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.separator(style='in')
        cmds.attrControlGrp('defaultResolutionWidth',attribute="defaultRenderGlobals.imageFilePrefix ",label='File name prefix:')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.animation",label='Frame/Animation ext')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.outFormatControl",label='Out Format Control:')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.extensionPadding",label='Frame padding:')
        cmds.setParent('..')
        cmds.setParent('..')


        #Image Size
        cmds.frameLayout(label='Image Size', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.separator(style='in')
        cmds.attrControlGrp('defaultResolutionWidth',attribute="defaultResolution.width",label='Width in pixels:')
        cmds.attrControlGrp('defaultResolutionHeight',attribute="defaultResolution.height",label='Height in pixels:')
        cmds.attrControlGrp(attribute="defaultResolution.imageSizeUnits",label='Size units:')
        cmds.attrControlGrp(attribute="defaultResolution.dpi",label='Resolution:')
        cmds.attrControlGrp(attribute="defaultResolution.pixelDensityUnits",label='Resolution units:')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultResolution.deviceAspectRatio",label='Device aspect ratio:')
        cmds.attrControlGrp(attribute="defaultResolution.pixelAspect",label='Pixel aspect ratio:')
        cmds.setParent('..')
        cmds.setParent('..')


        #Render Option
        cmds.frameLayout(label='Render Option', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultRenderGlobals.preMel",label='Pre render MEL:')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.postMel",label='Post render MEL')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.prlm",label='Pre render layer MEL')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.polm",label='Post render layer MEL')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.prm",label='Post render frame MEL')
        cmds.attrControlGrp(attribute="defaultRenderGlobals.pom",label='Post render frame MEL')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #################################
        #Arnold Renderer
        child2 = cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.scrollLayout('scrollLayoutUnique2', height=600)

        #Sampling
        cmds.frameLayout(label='Sampling', collapsable=True, collapse=False,borderStyle='etchedIn',width=410)
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp( attribute='defaultArnoldRenderOptions.AASamples',label='Camera(AA)')
        cmds.attrControlGrp( attribute='defaultArnoldRenderOptions.GIDiffuseSamples',label='Diffuse')
        cmds.attrControlGrp( attribute='defaultArnoldRenderOptions.GIGlossySamples',label='Glossy')
        cmds.attrControlGrp( attribute='defaultArnoldRenderOptions.GIRefractionSamples',label='Refraction')
        cmds.attrControlGrp( attribute='defaultArnoldRenderOptions.sssBssrdfSamples',label='SSS')
        cmds.attrControlGrp( attribute='defaultArnoldRenderOptions.volumeIndirectSamples',label='Volume Indirect')
        cmds.separator(style='in')
        cmds.attrControlGrp( attribute="defaultArnoldRenderOptions.lock_sampling_noise",label='Lock Sampling Pattern')
        cmds.attrControlGrp( attribute="defaultArnoldRenderOptions.sssUseAutobump",label='Use Autobump in SSS')
        cmds.setParent('..')
        cmds.columnLayout(adjustableColumn=True)
        cmds.frameLayout(label='Clamping', collapsable=True, collapse=True,borderStyle='out')
        cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 145),(2,200)])
        cmds.text('Clamp Sample Values ',align='right',height=25)
        cmds.checkBox('Clamp_Sample_Values',value=cmds.getAttr("defaultArnoldRenderOptions.use_sample_clamp"),label='',onCommand=lambda *arg:self.Clamp_Sample_Values_On(),offCommand=lambda *arg:self.Clamp_Sample_Values_Off())
        cmds.text('Affect_AOVs_text',enable=cmds.getAttr("defaultArnoldRenderOptions.use_sample_clamp"),label='Affect AOVs ',align='right')
        cmds.checkBox('Affect_AOVs',enable=cmds.getAttr("defaultArnoldRenderOptions.use_sample_clamp"),value=cmds.getAttr("defaultArnoldRenderOptions.use_sample_clamp_AOVs"),label='',onCommand=lambda *arg:cmds.setAttr("defaultArnoldRenderOptions.use_sample_clamp_AOVs",1),offCommand=lambda *arg:cmds.setAttr("defaultArnoldRenderOptions.use_sample_clamp_AOVs",0))
        cmds.setParent('..')
        cmds.attrControlGrp('Max_Value',attribute="defaultArnoldRenderOptions.AASampleClamp",label='Max Value',enable=cmds.getAttr("defaultArnoldRenderOptions.use_sample_clamp"))
        cmds.setParent('..')
        cmds.frameLayout(label='Filter', collapsable=True, collapse=True,borderStyle='out')
        cmds.columnLayout(adjustableColumn=True)
        cmds.text(label=u'很抱歉,这项功能暂不支持。如有需要请联系RnD!',align='center',backgroundColor=(0.6,0.5,0.5),height=40)
        '''
        cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 115),(2,120)])
        cmds.text(' ')
        cmds.optionMenu('Filter_optionMenu',label='Type')
        cmds.menuItem(label='gaussian')
        cmds.menuItem(label='blackman_harris')
        cmds.menuItem(label='box')
        cmds.menuItem(label='catrom')
        cmds.menuItem(label='catrom2d')
        cmds.menuItem(label='closest')
        cmds.menuItem(label='cone')
        cmds.menuItem(label='cook')
        cmds.menuItem(label='cubic')
        cmds.menuItem(label='disk')
        cmds.menuItem(label='farthest')
        cmds.menuItem(label='heatmap')
        cmds.menuItem(label='mitnet')
        cmds.menuItem(label='sinc')
        cmds.menuItem(label='triangle')
        cmds.menuItem(label='variance')
        cmds.menuItem(label='video')
        cmds.optionMenu('Filter_optionMenu',value='gaussian',e=True)
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldFilter.width",label='Width')
        cmds.setParent('..')
        '''
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #Ray Depth
        cmds.frameLayout(label='Ray Depth', collapsable=True, collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.GITotalDepth",label='Total')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.GIDiffuseDepth",label='Diffuse')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.GIGlossyDepth",label='Glossy')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.GIReflectionDepth",label='Reflection')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.GIRefractionDepth",label='Refraction')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.GIVolumeDepth",label='Volume')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.autoTransparencyDepth",label='Transparency Depth')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.autoTransparencyThreshold",label='Transparency Threshold')
        cmds.setParent('..')
        cmds.setParent('..')

        #Environment
        cmds.frameLayout(label='Environment', collapsable=True, collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.text(label=u'很抱歉,这项功能暂不支持。如有需要请联系RnD!',align='center',backgroundColor=(0.6,0.5,0.5),height=80)
        cmds.setParent('..')
        cmds.setParent('..')

        #Motion Blur
        cmds.frameLayout(label='Motion Blur', collapsable=True, collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 145),(2,255)])
        cmds.text('Enable  ',height=18,align='right')
        cmds.checkBox('Enable_MB',value=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"),label='',onCommand=lambda *args:self.Enable_MB_On(),offCommand=lambda *args:self.Enable_MB_Off())
        cmds.text('Deformation_Text', enable=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"),label='Deformation  ',height=18,align='right')
        cmds.checkBox('Deformation_MB',value=cmds.getAttr("defaultArnoldRenderOptions.mb_object_deform_enable"),label='',enable=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"),onCommand=lambda *args:self.Deformation_MB_On(),offCommand=lambda *args:self.Deformation_MB_Off())
        cmds.text('Camera_MB',label='Camera  ',height=18,align='right',enable=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"))
        cmds.checkBox('Camera_MB',value=cmds.getAttr("defaultArnoldRenderOptions.mb_camera_enable"),label='',enable=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"),onCommand=lambda *args:self.Camera_MB_On(),offCommand=lambda *args:self.Camera_MB_Off())
        cmds.setParent('..')
        cmds.attrControlGrp('Keys_MB',attribute="defaultArnoldRenderOptions.motion_steps",label='Keys',enable=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"))
        cmds.separator(style='in')
        cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 145),(2,100)])
        cmds.text('Position_MB',label='Position  ',align='right',enable=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"))
        flag_MB = cmds.getAttr("defaultArnoldRenderOptions.range_type")
        if flag_MB == 0:
            optionValue = 'Start On Frame'
            enableFlag1 = True
            enableFlag2 = False
        elif flag_MB == 1:
            optionValue = 'Center On Frame'
            enableFlag1 = True
            enableFlag2 = False
        elif flag_MB == 2:
            optionValue = 'End On Frame'
            enableFlag1 = True
            enableFlag2 = False
        else:
            optionValue = 'Custom'
            enableFlag1 = False
            enableFlag2 = True
        cmds.optionMenu('Position_optionMenu_MB',label='',enable=cmds.getAttr("defaultArnoldRenderOptions.motion_blur_enable"),changeCommand=lambda *args:self.Position_optionMenu_MB())
        cmds.menuItem(label='Start On Frame')
        cmds.menuItem(label='Center On Frame')
        cmds.menuItem(label='End On Frame')
        cmds.menuItem(label='Custom')
        cmds.optionMenu('Position_optionMenu_MB',value=optionValue,e=True)
        cmds.setParent('..')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp('Length_MB',attribute="defaultArnoldRenderOptions.motion_frames",label='Length ',enable=enableFlag1)
        cmds.attrControlGrp('Start_MB',attribute="defaultArnoldRenderOptions.motion_start",label='Start ',enable=enableFlag2)
        cmds.attrControlGrp('End_MB',attribute="defaultArnoldRenderOptions.motion_end",label='End ',enable=enableFlag2)
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #Lights
        cmds.frameLayout(label='Lights', collapsable=True, collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.lowLightThreshold",label='Low Light Threshold')
        cmds.separator(style='in')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.lightLinking",label='Light Linking')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.shadowLinking" ,label='Shadow Linking')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #Gamma Correction
        cmds.frameLayout(label='Gamma Correction', collapsable=True, collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.display_gamma",label='Display Driver Gamma')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.light_gamma",label='Lights')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.shader_gamma",label='Shaders')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.texture_gamma",label='Textures')
        cmds.setParent('..')
        cmds.setParent('..')

        #Textures
        cmds.frameLayout(label='Textures', collapsable=True, collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.textureAutomip",label='Auto-mipmap')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.textureAcceptUnmipped",label='Accept Unmipped')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.autotile",label='Auto-tile',changeCommand=lambda *args:self.Auto_tile())
        cmds.attrControlGrp('Tile_Size_T',attribute="defaultArnoldRenderOptions.textureAutotile",label='Tile Size',enable=cmds.getAttr("defaultArnoldRenderOptions.autotile"))
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.textureAcceptUntiled",label='Accept Untiled')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.use_existing_tiled_textures",label='Use Existing .tx Textures')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.textureMaxMemoryMB",label='Max Cache Size(MB)')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.textureMaxOpenFiles",label='Max Open Files')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.textureDiffuseBlur",label='Diffuse Blur')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.textureGlossyBlur",label='Glossy Blur')
        cmds.setParent('..')
        cmds.setParent('..')

        cmds.setParent('..')
        cmds.setParent('..')

        #################################
        #Systrm
        child3 = cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.scrollLayout('scrollLayoutUnique3', height=600)

        #Maya Integration
        cmds.frameLayout(label='Maya Integration', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.progressive_rendering",label='Progressive Refinement')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.progressive_initial_level",label='Initial Sampling Level')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.clear_before_render",label='Clear Before Render')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.force_scene_update_before_IPR_refresh",label='Force Scene Update On IPR Refresh')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.force_texture_cache_flush_after_render",label='Force Texture Cache Flush After Render')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.enable_swatch_render",label='Enable Swatch Render')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.standinDrawOverride",label='StandIn Viewport Override')
        cmds.setParent('..')
        cmds.setParent('..')

        #Render Settings
        cmds.frameLayout(label='Render Settings', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.renderType",label='Render Type')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.bucketScanning",label='Bucket Scanning')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.bucketSize",label='Bucket Size')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.outputOverscan",label='Overscan')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.threads_autodetect",label='Autodetect Threads',changeCommand=lambda *args:self.Autodetect_Threads())
        key = cmds.getAttr("defaultArnoldRenderOptions.threads_autodetect")
        if key == True:
            flag = False
        else:
            flag = True
        cmds.attrControlGrp('Threads_S',attribute="defaultArnoldRenderOptions.threads",label='Threads',enable=flag)
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.binaryAss",label='Binary-encode ASS Files')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.outputAssBoundingBox",label='Export Bounding Box(.asstoc)')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.expandProcedurals",label='Expand Procedurals')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.kickRenderFlags",label='Kick Render Flags')
        cmds.setParent('..')
        cmds.setParent('..')

        #Search Paths
        cmds.frameLayout(label='Search Paths', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.absoluteTexturePaths",label='Absolute Texture Paths')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.absoluteProceduralPaths",label='Absolute Procedural Paths')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.procedural_searchpath",label='Procedural Search Path')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.shader_searchpath",label='Shader Search Path')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.texture_searchpath",label='Texture Search Path')
        cmds.setParent('..')
        cmds.setParent('..')

        #Licensing
        cmds.frameLayout(label='Licensing', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.abortOnLicenseFail",label='About On License Fail')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.skipLicenseCheck",label='Skip License Check')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #################################
        #AOVs
        child4 = cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.aovMode",label='Mode',changeCommand=lambda *args:self.Mode_A())
        cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 143),(2,200),(3,50)])
        cmds.text('Render View AOV ',align='right')
        cmds.optionMenu('RenderViewAOVs_optionMenu',label='',changeCommand=lambda *args:self.renderViewAov())
        aiAOVs = cmds.listConnections('defaultArnoldRenderOptions.aovList')
        cmds.menuItem(label='beauty')
        if aiAOVs != None:
            for aiAOV in aiAOVs:
                name = cmds.getAttr('%s.name'%aiAOV)
                cmds.menuItem(label=name)
        cmds.text(' ')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        key = cmds.getAttr("defaultArnoldRenderOptions.aovMode")
        if key == 0:
            flag = False
        else:
            flag = True
        cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.scrollLayout('scrollLayoutUnique', height=550)

        #Default Drivers
        cmds.frameLayout('Default_Drivers_frameLayout',label='Default Drivers', collapsable=True, collapse=True,width=410,borderStyle='etchedIn',enable=flag)
        cmds.columnLayout(adjustableColumn=True)
        cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 140),(2,100),(3,50)])
        cmds.text('Default Arnold Display Driver ',align='right')
        cmds.optionMenu(label='')
        cmds.menuItem(label='exr')
        cmds.text(' ')
        cmds.setParent('..')
        cmds.frameLayout(collapsable=False, labelVisible=False,collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldDisplayDriver.exrCompression",label='Compression')
        cmds.attrControlGrp(attribute="defaultArnoldDisplayDriver.halfPrecision",label='Half Precision')
        cmds.attrControlGrp(attribute="defaultArnoldDisplayDriver.preserveLayerName",label='Preserve Layer Name')
        cmds.attrControlGrp(attribute="defaultArnoldDisplayDriver.tiled",label='Tiled')
        cmds.attrControlGrp(attribute="defaultArnoldDisplayDriver.autocrop",label='Autocrop')
        cmds.attrControlGrp(attribute="defaultArnoldDisplayDriver.append",label='Append')
        cmds.frameLayout(label='Default Drivers', collapsable=True, collapse=True,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.text(label=u'很抱歉,这项功能暂不支持。如有需要请联系RnD!',align='center',backgroundColor=(0.6,0.5,0.5),height=40)
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #AOV Browser
        cmds.frameLayout('AOV_Browser_frameLayout',label='AOV Browser', collapsable=True, collapse=False,width=410,borderStyle='etchedIn',height=200,enable=flag)
        cmds.columnLayout(adjustableColumn=True)
        cmds.text(label=u'很抱歉,这项功能正在开发,请耐心等待。',align='center',backgroundColor=(0.6,0.5,0.5),height=30)
        cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 135),(2,135),(3,135)])
        cmds.columnLayout(adjustableColumn=True)
        cmds.text('AOV Groups',align='center')
        cmds.textScrollList('AOV_Groups_A', numberOfRows=8, allowMultiSelection=True,
                            append=['<builtin>', 'aiHair', 'aiSkin', 'aiStandard', 'alCel', 'alHair','alHairX','alLayer','alSurface','alSurfaceX'],height=160)
        cmds.setParent('..')
        cmds.columnLayout(adjustableColumn=True)
        cmds.text('Available AOVs',align='center')
        cmds.textScrollList('Available_AOVs_A', numberOfRows=8, allowMultiSelection=True,append=[],height=135)
        cmds.button(label='>>')
        cmds.setParent('..')
        cmds.columnLayout(adjustableColumn=True)
        cmds.text('Active AOVs',align='center')
        cmds.textScrollList('Active_AOVs_A', numberOfRows=8, allowMultiSelection=True,
                        append=[],height=135)

        cmds.button(label='<<')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #AOVs
        cmds.frameLayout('AOVs_frameLayout',label='AOVs', collapsable=True, collapse=False,width=410,borderStyle='in')
        cmds.columnLayout(adjustableColumn=True)
        cmds.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 140),(2,100),(3,100),(4,80)])
        cmds.text(' ')
        cmds.button(label='Add Custom',command=lambda *args:self.addCustom_AOVS())
        cmds.button(label='Delete All',command=lambda *args:self.deleteAll_AOVs())
        cmds.text(' ')
        cmds.setParent('..')
        cmds.separator(style='in')
        cmds.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 140),(2,60),(3,60),(4,80)])
        cmds.text(label='name',align='center')
        cmds.text(label='data',align='center')
        cmds.text(label='driver',align='center')
        cmds.text(label='filter',align='center')
        cmds.setParent('..')
        cmds.frameLayout('aiAOV_nodeList',labelVisible=False,width=420,borderStyle='in')
        aiAOVs = cmds.listConnections('defaultArnoldRenderOptions.aovList')
        if aiAOVs != None:
            for aiAOV in aiAOVs:
                self.cmdsGuiGroup(aiAOV)
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #################################
        #Diagnostics
        child5 = cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.scrollLayout('scrollLayoutUnique5', height=600)

        #Log
        cmds.frameLayout(label='Log', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.log_verbosity",label='Verbosity Level')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.log_to_console",label='Console')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.log_to_file",label='File',changeCommand=lambda *args:self.File_D())
        cmds.attrControlGrp('Filename_D',attribute="defaultArnoldRenderOptions.log_filename",label='Filename',enable=cmds.getAttr("defaultArnoldRenderOptions.log_to_file"))
        cmds.attrControlGrp('Max_Warnings_D',attribute="defaultArnoldRenderOptions.log_max_warnings",label='Max.Warnings',enable=cmds.getAttr("defaultArnoldRenderOptions.log_to_file"))
        cmds.setParent('..')
        cmds.setParent('..')

        #Error Handing
        cmds.frameLayout(label='Error Handing', collapsable=True, collapse=False,width=410,borderStyle='etchedIn')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.abortOnError",label='About On Error')
        cmds.separator(style='in')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.errorColorBadTexture",label='Texture Error Color')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.errorColorBadPixel",label='NaN Error Color')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        #################################
        #Override
        child6 = cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, 420)])
        cmds.scrollLayout('scrollLayoutUnique6', height=600)

        #User Options
        cmds.frameLayout(label='User Options', collapsable=True, collapse=False,width=410,borderStyle='out')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.aiUserOptions",label='Option')
        cmds.setParent('..')
        cmds.setParent('..')

        #Feature Overrides
        cmds.frameLayout(label='Feature Overrides', collapsable=True, collapse=False,width=410,borderStyle='out')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreTextures",label='Ignore Textures')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreShaders",label='Ignore Shaders')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreAtmosphere",label='Ignore Atmosphere')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreLights",label='Ignore Lights')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreShadows",label='Ignore Shadows')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreSubdivision",label='Ignore Subdivision')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreDisplacement",label='Ignore Displacement')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreBump",label='Ignore Bump')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreSmoothing",label='Ignore Normal Smoothing')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreMotionBlur",label='Ignore Motion Blur')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreDof",label='Ignore Depth of Field')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.ignoreSss",label='Ignore Sub-Surface-Scattering')
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.forceTranslateShadingEngines",label='Force Translation of Shading Engines')
        cmds.setParent('..')
        cmds.setParent('..')

        #Subdivision
        cmds.frameLayout(label='Subdivision', collapsable=True, collapse=False,width=410,borderStyle='out')
        cmds.columnLayout(adjustableColumn=True)
        cmds.attrControlGrp(attribute="defaultArnoldRenderOptions.maxSubdivisions",label='Max.Subdvisions')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')
        cmds.setParent('..')

        cmds.tabLayout(tabs, edit=True, tabLabel=((child1, 'Common'),(child2,'Arnold Renderer'),(child3,'Systrm'),(child4,'AOVs'),(child5,'Diagnosics'),(child6,'Override')) )
        cmds.setParent('..')
        cmds.button(label='Close',height=30,command=lambda *args:cmds.deleteUI('ArnoldSettingUI'))
        cmds.showWindow(Mytool)
	def __init__( self, winName= 'colorWin' ):
		''' colorWinUI is all part of __init__ constructor.'''
		self.winName= winName
		self.winHeight = 290
		self.winWidth = 420
		

		self.fieldTexts=[ 'controlName',]
		self.checkBoxes=[ 'SingleController','SnapConnect' ]
		self.menuItems=[ 'None','Hierarchy','TweakHierarchy' ]
		self.connectBoxes=[ 'parent','point','rotate','scale' ]
		self.radioBoxes=[ 'parentCon','pointCon','rotateCon','scaleCon' ]
		self.locCheckBoxes=[ 'parentSelection', 'additionalGroups', 'selectionName' ]
		self.locTexts=[ 'locName' ]
		

		if cmds.windowPref( self.winName, query=True, exists=True, ):
			cmds.windowPref( self.winName, wh= ( self.winWidth, self.winHeight ),  )
			cmds.windowPref( self.winName, remove=True )
		

		if cmds.window( self.winName, q=1, ex= 1 ) == True:
			cmds.deleteUI( self.winName )

		cmds.window( self.winName, tlb=1, wh=( self.winWidth, self.winHeight ), t= "Curve Controller Utility" )
		tabs = cmds.tabLayout()
		cmds.setParent( tabs )
		child1 = cmds.rowColumnLayout( nr=3, rh= [(1, 100),( 2, 60 ),( 3, 20)])
		
		# Tab1
		cmds.frameLayout( label= 'Choose Colour :', width= 412, h=30, parent= child1 )
		cmds.rowColumnLayout( nc=3, cw= [(1, 135),( 2, 135 ),( 3, 135 )] )
		
		# Color buttons.
		cmds.button( 'purple',   l= 'Purple ',  w= 60, h=25, bgc=(0.846000000089406967,0.03,0.7839999794960022 ), aop=1, c= "cmds.color(ud=7 )" )
		cmds.button( 'red',    l= 'Red ',   w= 60, h=25, bgc=(0.85699999332427979,0.14800000190734863,0.3190000057220459 ), aop=1,c= "cmds.color(ud=8 )" )
		cmds.button( 'brown',  l= 'Brown ', w= 60, h=25, bgc=(0.602,0.452,0.173 ), aop=1, c= "cmds.color(ud=1)" )
		cmds.button( 'green',  l= 'Green ', w= 60, h=25, bgc=(0.5311,0.662,0.1 ), aop=1,c= "cmds.color(ud=3)" )
		cmds.button( 'beige', l= 'Beige ',   w= 60, h=25, bgc=(0.225,0.415,0.1 ), aop=1,c= "cmds.color(ud=2)" )
		cmds.button( 'lightGreen', l= 'LightGreen ',   w= 60, h=25, bgc=(0.0,0.668,0.268 ), aop=1,c= "cmds.color(ud=4)" )
		cmds.button( 'cyan', l= 'Cyan ',  w= 60, h=25, bgc=(0.1, 0.4, 0.5 ), aop=1,c= "cmds.color(ud=5)" )
		cmds.button( 'skyBlue', l= 'SkyBlue ',   w= 60, h=25, bgc=(0.36,0.49,0.811 ), aop=1,c= "cmds.color(ud=6 )" )

		# Create controllers.
		nameFrame= cmds.frameLayout( label= 'Name Controllers: ', width= 412, h=50, parent=child1  )

		cmds.text( "Put down 'Name' and it will result in:  Name#_ctl ", parent= nameFrame )


		for i in self.fieldTexts:
			cmds.textField( i, text= 'defaultControlName', parent= nameFrame )

		funcFrame= cmds.frameLayout( l= "Choose Function:", w=412, h= 100, parent= child1 )
		funcLabel = cmds.rowColumnLayout( numberOfColumns=4, columnWidth=[(1, 120), (2, 100), (3, 100)] )

		for i in self.checkBoxes:
			cmds.checkBox( i, parent= funcLabel )
			
		self.featureOptions = cmds.optionMenu( label='Features:' )
		for eachItem in self.menuItems:
			cmds.menuItem( label= eachItem )

		cmds.button( label= "Create Controller(s)", bgc= ( 0.05, 0.4, 0.5 ), height=30, command= self.function, parent = funcFrame )
		cmds.button( label= "Close", height=20, command= self.deleteUI, parent=funcFrame )
		
		cmds.setParent( tabs )

		# Tab2
		child2= cmds.rowColumnLayout( numberOfColumns= 2, cw= [(1, 250),( 2, 100 )], parent=tabs )
		
		# Constraint boxes.
		constraintBox= cmds.frameLayout( l= "Choice Connections:", w=206, h= 150, parent=child2 )

		cmds.radioButtonGrp( self.connectBoxes[0], numberOfRadioButtons=2, labelArray2=['parentConstraint', 'parentConnect'], sl=1 )
		cmds.radioButtonGrp( self.connectBoxes[1], numberOfRadioButtons=2, labelArray2=['pointConstraint', 'normallateConnect'], sl=1 )
		cmds.radioButtonGrp( self.connectBoxes[2], numberOfRadioButtons=2, labelArray2=['rotateConstraint', 'rotateConnect'], sl=1 )
		cmds.radioButtonGrp( self.connectBoxes[3], numberOfRadioButtons=2, labelArray2=['scaleConstraint', 'scaleConnect'], sl=1 )

		# Connection boxes.
		connectBox= cmds.frameLayout( l= "ApplyConnections:", w=206, h= 150, parent=child2 )
		for eachConnect in self.radioBoxes:
			cmds.checkBox( eachConnect,label=eachConnect, parent = connectBox )

		cmds.checkBox( self.radioBoxes[0], e=1, value=1 )
		cmds.checkBox( self.radioBoxes[3], e=1, value=1 )


		# Tab3
		child3= cmds.rowColumnLayout( numberOfColumns= 1, cw= [(1, 50)], parent=tabs )

		locFuncFrame= cmds.frameLayout( l= "Choose Name :", w=412, h= 80, parent= child3 )

		for i in self.locTexts:
			cmds.text( "Put down 'name' and you'll get 'name#_grp; " )
			cmds.text( "With selectionName: 'geo_name_grp'; Text field will be void." )
			cmds.textField( i, text='defaultGroupName', parent= locFuncFrame )


		locFrame= cmds.frameLayout( l= "Create Locator(s) with function(s):", w=412, h= 120, parent= child3 )
		locFuncLabel = cmds.rowColumnLayout( numberOfColumns=3, columnWidth=[(1, 150), (2, 150), (2, 150) ] )

		for i in self.locCheckBoxes:
			cmds.checkBox( i, parent= locFuncLabel )


		cmds.text( "Choose normalforms or vertices, click button to create a locator.", parent=locFrame )
		cmds.button( label= "Create Locator(s)", bgc= ( 0.5, 0.4, 0.5 ), height=40, command= self.locators, parent = locFrame )




		cmds.tabLayout( tabs, edit=True, tabLabel=((child1, 'Controllers'), (child2, 'snapConnections'), (child3, 'Locators') ) )
		cmds.tabLayout( tabs, edit=True, selectTabIndex=1 )



		cmds.showWindow(self.winName)
		cmds.window(self.winName, edit= True, wh=[self.winWidth,self.winHeight])
Example #42
0
    def buildLayout(self):
        """
		Build a new multi-rig template UI. 
		"""
        curParent = cmds.setParent(query=True)

        self._frameName = cmds.frameLayout(collapsable=True,
                                           label=self._template.rigName())

        self.setControl(self._frameName)
        cmds.columnLayout(adjustableColumn=True)

        labelL10N = maya.stringTable['y_cameraSetTool.kMultiRigName']
        self._templateCamSetField = cmds.textFieldGrp(
            label=labelL10N,
            text=self._template.rigName(),
            changeCommand=self.multiRigNameChanged)
        labelL10N = maya.stringTable['y_cameraSetTool.kMultiRigPrefix']
        self._camSetPrefix = cmds.textFieldGrp(
            label=labelL10N,
            text=self._template.camSetPrefix(),
            changeCommand=self.namingPrefixChanged)

        camSetTemplate = self._template.cameraSetNodeType()
        availCameraSets = ['cameraSet']
        camSet = cmds.pluginInfo(query=True, dependNodeByType='kCameraSetNode')
        if camSet and len(camSet):
            availCameraSets = availCameraSets + camSet
        if camSetTemplate not in availCameraSets:
            availCameraSets = availCameraSets + [camSetTemplate]

        if len(availCameraSets) > 1:
            labelL10N = maya.stringTable['y_cameraSetTool.kCameraSetNodeType']
            self._cameraSetName = cmds.optionMenuGrp(label=labelL10N)
            for c in availCameraSets:
                cmds.menuItem(label=c)

            callback = self.cameraSetNameChanged
            cmds.optionMenuGrp(self._cameraSetName,
                               edit=True,
                               changeCommand=callback)
            cmds.optionMenuGrp(self._cameraSetName,
                               edit=True,
                               value=camSetTemplate)

        cmds.scrollLayout(childResizable=True, minChildWidth=200)
        self._layerParent = cmds.columnLayout(adjustableColumn=True)
        # Build the layout for each of the layers.
        #
        for i in range(self._template.layers()):
            self.layoutForLayer(i)
        cmds.setParent('..')
        cmds.setParent('..')
        form = cmds.formLayout()
        b1 = cmds.button(label=maya.stringTable['y_cameraSetTool.kCreateIt'],
                         command=self.createIt)
        b2 = cmds.button(label=maya.stringTable['y_cameraSetTool.kRemoveIt'],
                         command=self.removeDef)
        b3 = cmds.button(label=maya.stringTable['y_cameraSetTool.kAddIt'],
                         command=self.addLayer)
        attachForm = [(b1, "top", 0), (b1, "bottom", 0), (b1, "left", 0),
                      (b2, "top", 0), (b2, "bottom", 0), (b3, "right", 0),
                      (b3, "top", 0), (b3, "bottom", 0)]
        attachControl = [(b2, "right", 5, b3)]
        attachNone = [(b1, "right"), (b3, "left")]
        cmds.formLayout(form,
                        edit=True,
                        attachForm=attachForm,
                        attachNone=attachNone,
                        attachControl=attachControl)

        cmds.setParent(curParent)
Example #43
0
 def createUI(self,parent):
     '''
     override this method to implement gui creation
     '''
     cmds.setParent(parent);
     self.baseLayout = cmds.columnLayout(rowSpacing=Constants.MARGIN_SPACING_VERTICAL,adjustableColumn=1)
Example #44
0
def rigUI():
	ui = cmds.columnLayout(adj=True, enable=False)

	# Root

	cmds.frameLayout(mh=10, mw=10, bgs=True, cll=False, cl=True, lv=False)
	nameField = cmds.textFieldGrp(l='Rig Name: ', tx='character', adj=2, cw2=[60, 60], nbg=False)
	button(l='1. Root', i=UIImage('icon_01_100.png'), c=lambda *x: rig.parts.ROOT(
			name=cmds.textFieldGrp(nameField, q=True, tx=True) if cmds.textFieldGrp(nameField, q=True,
			                                                                        tx=True) else 'character'))
	cmds.setParent('..')

	# Cog

	cmds.frameLayout(l='2. COG Setup', bgs=True, mh=10, mw=10, cll=False, cl=True, lv=False)
	button(l='2. Center of Gravity', i=UIImage('icon_02_100.png'), c=rig.parts.COG)
	cmds.setParent('..')

	# Spine

	cmds.frameLayout(l='3. Spine Setup', bgs=True, mh=10, mw=10, cll=False, cl=True, lv=False)
	button(l='3. Spine', i=UIImage('icon_06_100.png'), c=rig.parts.SPINE)
	cmds.setParent('..')

	# Neck / Head

	cmds.frameLayout(l='4. Neck / Head Setup', bgs=True, mh=10, mw=10, cll=False, cl=True, lv=False)
	button(l='4. Neck / Head', i=UIImage('icon_03_100.png'), c=rig.parts.HEAD)
	cmds.setParent('..')

	# Arms

	cmds.frameLayout(l='5. Arms / Hands', bgs=True, mh=10, mw=10, cll=False, cl=True, lv=False)
	button(l='5. Arm', i=UIImage('icon_05_100.png'), c=rig.parts.ARM)
	cmds.setParent('..')

	# Legs

	cmds.frameLayout(l='6. Legs / Feet', bgs=True, mh=10, mw=10, cll=False, cl=True, lv=False)
	#button(l='6. Hip', i=UIImage('icon_04_100.png'), c=parts.HIP)
	#button(l='7. Leg', i=UIImage('icon_04_100.png'), c=parts.LEG)
	cmds.setParent('..')

	cmds.setParent('..')

	return ui
Example #45
0
    def createInfluenceMappingGroup(self):
        group = self.createUIGroup(self.cmdLayout.innerLayout,
                                   'Influence Mapping')

        self.createFixedTitledRow(group, 'Infl. Distance Error')
        self.controls.influenceDistanceError = FloatField(
            self.VAR_PREFIX + 'distanceError',
            minValue=0,
            maxValue=None,
            step=0.01,
            defaultValue=0.001,
            annotation=
            'Defines maximum inaccuracy between left and right influence positions'
        )
        self.controls.influenceDistanceError.changeCommand.addHandler(
            self.previewInfluenceMapping, group)

        if self.mirrorMode:
            self.createTitledRow(group, 'Ignore')
            cmds.radioCollection()
            for index, i in enumerate(['Prefixes', 'Suffixes']):
                ctrl = self.controls.__dict__['ignore' + i] = RadioButtonField(
                    self.VAR_PREFIX + 'ignoreMode' + i,
                    defaultValue=1 if index == 0 else 0,
                    label=i)
                ctrl.changeCommand.addHandler(self.ignoreModeChanged, group)

            self.controls.prefixesGroup = self.createTitledRow(
                group, 'Influence Prefixes')
            self.controls.influencePrefixes = StoredTextEdit(
                self.VAR_PREFIX + 'inflPrefix',
                annotation=
                'Specifies influence prefixes to be ignored when matching by name;\nUsually you would put your left/right influence prefixes here;\nseparate them with commas, e.g. "L_, R_"'
            )
            self.controls.influencePrefixes.changeCommand.addHandler(
                self.previewInfluenceMapping, group)

            self.controls.suffixesGroup = self.createTitledRow(
                group, 'Influence Suffixes')
            self.controls.influenceSuffixes = StoredTextEdit(
                self.VAR_PREFIX + 'inflSuffix',
                annotation=
                'Specifies influence suffixes to be ignored when matching by name;\nUsually you would put your left/right influence suffixes here;\nseparate them with commas, e.g. "_Lf, _Rt"'
            )
            self.controls.influenceSuffixes.changeCommand.addHandler(
                self.previewInfluenceMapping, group)

        influencesLayout = cmds.columnLayout(
            parent=group,
            adjustableColumn=1,
            rowSpacing=Constants.MARGIN_SPACING_VERTICAL)
        cmds.text(parent=influencesLayout,
                  label="Influence mapping to be used:",
                  align='left')
        self.controls.influencesList = cmds.textScrollList(
            parent=influencesLayout,
            height=200,
            numberOfRows=5,
            allowMultiSelection=True,
            selectCommand=self.onInfluenceSelected,
            deleteKeyCommand=lambda *args: self.removeSelectedManualMappings())

        manualGroup = self.createUIGroup(self.cmdLayout.innerLayout,
                                         'Manual influence mapping')
        cmds.rowLayout(parent=manualGroup, nc=3)

        buttonWidth = 110
        cmds.button(
            'Disconnect link',
            width=buttonWidth,
            command=lambda *args: self.doDisconnectMapping(),
            annotation=
            'Disconnect two associated influences, and make each influence point to itself'
        )
        if self.mirrorMode:
            cmds.button(
                'Link, both ways',
                width=buttonWidth,
                command=lambda *args: self.doConnectMapping(bidirectional=True
                                                            ),
                annotation=
                'Connect two selected influences and link them both ways')
        cmds.button(
            'Link, one way' if self.mirrorMode else "Link",
            width=buttonWidth,
            command=lambda *args: self.doConnectMapping(bidirectional=False),
            annotation=
            'Connect two selected influences and link on source to destination'
        )
        cmds.rowLayout(parent=manualGroup, nc=2)
        cmds.button(
            'Remove manual rule',
            width=buttonWidth,
            command=lambda *args: self.removeSelectedManualMappings(),
            annotation=
            'Remove manual rule; influence will be a subject to automatic matching'
        )

        self.ignoreModeChanged()

        cmds.setParent(group)
Example #46
0
	def gui(self):
		'''
		Generates the interface for the AttrGUISingle object.
		'''
				
		btnWidth = 30
		btnSep = 2
		# textWidth = 70
		# fieldWidth
		# if( cmds.about( os=True ) == "mac" ):
			
		self.mainLayout = cmds.rowColumnLayout(parent=self.parent, nc=7, h=20, 
			rat=[[1,"both", btnSep ],[2,"both", btnSep ],[3,"both", btnSep ],[4,"both", btnSep ],[5,"both", btnSep ],[6,"both", btnSep ],[7,"both", btnSep ]],
			cw=[[1,100],[2,70],[3,125],[4, btnWidth ],[5,btnWidth ],[6,btnWidth ],[7,btnWidth ]])
		cmds.text(label=self.text, w=70, al="center")
		self.fieldGui = cmds.floatField( w=100, pre=2 )	
		pop = cmds.popupMenu(parent=self.fieldGui)
		cmds.menuItem(parent=pop, label="0 - 1", c=Callback( self.setMinMax, 0, 1))
		cmds.menuItem(parent=pop, label="0 - 10", c=Callback( self.setMinMax, 0, 10))
		cmds.menuItem(parent=pop, label="-10 - 10", c=Callback( self.setMinMax, -10, 10))		
		cmds.menuItem(parent=pop, label="Set Min/Max")
		cmds.menuItem( divider=1)
		cmds.menuItem(label="Step 1", c=Callback( self.setStep, 1 ))
		cmds.menuItem(label="Step .1", c=Callback( self.setStep, .1 ))
		cmds.menuItem(label="Step .01", c=Callback( self.setStep, .01 ))

		
		self.sliderGui = cmds.floatSlider( w=100, h=20)

		cmds.popupMenu(parent=self.sliderGui)
		cmds.menuItem(label="0 - 1", c=Callback( self.setMinMax, 0, 1))
		cmds.menuItem(label="0 - 10", c=Callback( self.setMinMax, 0, 10))
		cmds.menuItem(label="-10 - 10", c=Callback( self.setMinMax, -10, 10))		
		cmds.menuItem(label="Set Min/Max")
		cmds.menuItem( divider=1)
		cmds.menuItem(label="Step 1", c=Callback( self.setStep, 1 ))
		cmds.menuItem(label="Step .1", c=Callback( self.setStep, .1 ))
		cmds.menuItem(label="Step .01", c=Callback( self.setStep, .01 ))

		
		print("Min Value: " + str(self.attrs.min))
		print("Max Value: " + str(self.attrs.max))
		
		if( self.attrs.min != None ):
			cmds.floatField( self.fieldGui, e=1, min=self.attrs.min )
			cmds.floatSlider( self.sliderGui, e=1, min=self.attrs.min )
		if( self.attrs.max != None ):
			cmds.floatField( self.fieldGui, e=1, max=self.attrs.max )
			cmds.floatSlider( self.sliderGui, e=1, max=self.attrs.max )
			
		cmds.connectControl( self.fieldGui, self.attrNames )
		cmds.connectControl( self.sliderGui, self.attrNames )
		
		cmds.symbolButton(image='MENUICONKEYS.XPM', h=20,
			ann="Keyframe",
			command=Callback(self.key))
		cmds.symbolButton(image='REDRAWPAINTEFFECTS.XPM', h=20,
			ann="Reset to Default",
			command=Callback(self.reset))
		self.symGUI = cmds.symbolCheckBox( image='ONRADIOBTNICON.XPM', h=20,
			oni='ONRADIOBTNICON.XPM',
			ofi='OFFRADIOBTNICON.XPM',
			ann="Set Offset",
			onc=Callback(self.setOffset))
		self.resOffName = cmds.symbolButton(image='AUTOLOAD.XPM', h=20,
			ann="Reset Offset", 
			command=Callback( self.resetOffset ) )
		
		cmds.setParent(self.parent)
Example #47
0
    def __init__(self, *args):

        temp = len(args)

        #Test to see if called with arguments, if so, run script by passing arguments to it
        if (temp > 0):
            self.createRibbon(
                args)  #Passing arguments to function, by passing GUI

        else:
            ### Initialize, definitions
            if (mc.window("ms_autoRbbnWin", exists=True)):
                mc.deleteUI("ms_autoRbbnWin", window=True)
            mc.window("ms_autoRbbnWin",
                      title="autoRibbon Limb Rig Maker v1.0",
                      rtf=True)
            mc.columnLayout()

            mc.text(" ")
            self.prefixField = mc.textFieldGrp(label="Prefix: ")
            #self.numJntsField = mc.intFieldGrp( numberOfFields=1, label='Skin Joints:', value1=5 )
            self.widthField = mc.intFieldGrp(numberOfFields=1,
                                             label='Length',
                                             value1=20)
            mc.text(" ")
            self.aimAxisField = mc.radioButtonGrp(label="Build/Aim Axis:",
                                                  nrb=3,
                                                  labelArray3=('x', 'y', 'z'),
                                                  sl=1)
            self.upAxisField = mc.radioButtonGrp(label="Up Axis:",
                                                 nrb=3,
                                                 labelArray3=('x', 'y', 'z'),
                                                 sl=2)

            mc.frameLayout(label="Parent to:", w=500, cll=False)
            mc.columnLayout()
            self.typeField = mc.radioButtonGrp(label='Type:',
                                               nrb=3,
                                               labelArray3=('Constraint',
                                                            'Make Child',
                                                            'None'),
                                               sl=3)
            self.moField = mc.radioButtonGrp(label='Maintain Offset:',
                                             nrb=2,
                                             labelArray2=('On', 'Off'),
                                             sl=2)
            self.topField = mc.textFieldButtonGrp(
                label='Top (i.e. ShouldrJnt):', bl='Load', bc=self.topLoad)
            self.btmField = mc.textFieldButtonGrp(
                label='Bottom (i.e. WristJnt):', bl='Load', bc=self.btmLoad)
            mc.setParent("..")
            mc.setParent("..")

            mc.rowLayout(nc=3)
            mc.text(" ")
            mc.text(" ")
            mc.button(label="Make Ribbon", c=self.createRibbon)
            mc.setParent("..")
            mc.text(" ")

            mc.showWindow("ms_autoRbbnWin")
def gui():
    '''
    Creats the gui
    '''
    bw = 500
    sw = 200

    win = 'win3DFGrade'
    if (cmds.window(win, ex=True)):
        cmds.deleteUI(win)
    if (cmds.windowPref(win, ex=True)):
        cmds.windowPref(win, r=1)

    cmds.window(win, w=bw, h=400)
    '''
    Main section of tool
    Displays scene name with button for opening new scene files
    '''
    top_main = cmds.columnLayout(w=500)
    cmds.rowColumnLayout(w=500, nc=3)
    cmds.text(l='Scene Name', w=133)
    cmds.textField(w=133, tx=(cmds.file(q=True, sn=True)))
    cmds.button(l='Open Scene', w=133, c=open_scene)
    cmds.setParent(top_main)
    '''
    Dislays grading options such as professionalism and late turnin decutions
    '''
    cmds.rowColumnLayout(w=500, nc=6)
    cmds.text('Professional', w=66)
    cmds.floatField(v=0.00, w=66)
    cmds.text('Late Turnin', w=66)
    cmds.floatField(v=0.00, w=66)
    cmds.text('Total Grade', w=66)
    cmds.floatField(v=0.00, w=66)
    cmds.setParent(top_main)
    '''
    Creats Export button
    '''
    cmds.columnLayout(w=bw, cat=['left', 200])
    cmds.button(l='Export', w=100, c=excel_export)
    cmds.setParent(top_main)
    '''
    Subsection of tool
    '''
    cmds.columnLayout(w=500)
    cmds.scrollLayout(w=500)
    bottom_main = cmds.columnLayout(w=bw)
    '''    
    Creates the 'Joint' grading sections
    '''
    joint_frame = cmds.frameLayout('Joints', cll=True, w=bw - 10)
    joint_col = cmds.columnLayout()
    main_widget1 = Main_Widget('Joint Naming - Invalid',
                               check_joint_naming(cmds.ls(typ='joint')),
                               joint_naming,
                               pf=0)
    cmds.setParent(joint_col)
    main_widget2 = Main_Widget('Joint Rotations - Invalid',
                               check_joint_rotates(cmds.ls(typ='joint')),
                               joint_rotates,
                               pf=1)
    cmds.setParent(joint_col)
    main_widget3 = Main_Widget('Joint Translates - Warning',
                               check_joint_translates(cmds.ls(typ='joint')),
                               joint_naming,
                               pf=0)
    cmds.setParent(joint_col)
    #main_widget4 = Main_Widget('Joint Orientaiton - Invalid', check_joint_orient(cmds.ls(typ='joint')), joint_naming, pf=0)
    cmds.setParent(bottom_main)
    '''
    Creates the 'Curve' grading sections
    '''
    cmds.frameLayout(l='Curves', cll=True, w=bw - 10)
    curve_col = cmds.columnLayout()
    main_widget5 = Main_Widget('Curve Naming - Invalid',
                               check_curve_naming(cmds.ls(typ='nurbsCurve')),
                               joint_naming,
                               pf=1)
    cmds.setParent(curve_col)
    main_widget6 = Main_Widget('Curve Transforms - Invalid',
                               check_transforms(cmds.ls(typ='nurbsCurve')),
                               joint_rotates,
                               pf=1)
    cmds.setParent(curve_col)
    main_widget7 = Main_Widget('Curve History - Invalid',
                               check_curve_hist(cmds.ls(typ='nurbsCurve')),
                               joint_rotates,
                               pf=1)
    cmds.setParent(bottom_main)
    '''    
    Creates the 'Geometry' grading sections
    '''
    cmds.frameLayout(l='Geometry', cll=True, w=bw - 10)
    geo_col = cmds.columnLayout()
    main_widget8 = Main_Widget('Geo Naming - Invalid',
                               check_geo_naming(cmds.ls(typ='mesh')),
                               joint_naming,
                               pf=0)
    cmds.setParent(geo_col)
    main_widget9 = Main_Widget('Geo Transforms - Invalid',
                               check_transforms(cmds.ls(typ='mesh')),
                               joint_naming,
                               pf=0)
    cmds.setParent(geo_col)
    main_widget10 = Main_Widget('Geo History - Invalid',
                                check_geo_hist(cmds.ls(typ='mesh')),
                                joint_naming,
                                pf=0)
    cmds.setParent(bottom_main)

    cmds.showWindow(win)
Example #49
0
def skeletonUI():
	# Header
	ui = cmds.columnLayout(adj=True)

	# Body UI
	cmds.frameLayout(l='Display', mh=mar, mw=mar, bgs=True, cl=True)
	j1 = cmds.button(l='Toggle LRA', enable=False)
	j2 = cmds.button(l='Show', enable=False)
	j3 = cmds.button(l='Hide', enable=False)
	autoRow([j1, j2, j3])
	divider('Joint Scale')
	jdUI = cmds.floatSliderGrp(field=True, pre=2, min=0.01, max=10.00, v=cmds.jointDisplayScale(q=True),
	                           cc=lambda *x: cmds.jointDisplayScale(cmds.floatSliderGrp(jdUI, q=True, v=True)))
	cmds.setParent('..')

	cmds.frameLayout(l='Create', mh=mar, mw=mar, bgs=True, cl=True)
	b1 = cmds.button(l='Create Joint', c=utils.createJoint)
	b2 = cmds.button(l='Orient Chain', c=utils.orientJointChain)
	b3 = cmds.button(l='Select Hierarchy', c=utils.getJointHierarchy)
	autoRow([b1, b2, b3])
	cmds.setParent('..')

	cmds.frameLayout(l='Joint Labels', mh=mar, mw=mar, bgs=True, cl=True)
	a1 = cmds.button(l='Toggle Visibility', c=utils.toggleJointLabel)
	a2 = cmds.button(l='Show', c=lambda *x: mel.eval('displayJointLabels 4;'))
	a3 = cmds.button(l='Hide', c=lambda *x: mel.eval('displayJointLabels 3;'))
	autoRow([a1, a2, a3])

	# Add Label UI
	divider('Add Label')
	cmds.rowLayout(nc=2, adj=1, cat=[1, 'right', -4], rat=[1, 'both', 0])
	om1 = cmds.optionMenuGrp(adj=1, rat=[1, 'both', -2], cat=[1, 'right', 0],
	                         cc=lambda *x: utils.jointLabel().addTypeFromUI(cmds.optionMenuGrp(om1, q=True, sl=True)))
	for l in utils.jointLabel().masterList:
		cmds.menuItem(l=l, dtg=l)
	cmds.button(l='+', w=20, c=lambda *x: utils.jointLabel().addTypeFromUI(cmds.optionMenuGrp(om1, q=True, sl=True)))
	cmds.setParent('..')

	cmds.setParent('..')

	cmds.frameLayout(l='Skinning', mh=mar, mw=mar, bgs=True, cl=True)
	swb1 = cmds.button(l='Paint Weights', c=lambda *x: mel.eval('ArtPaintSkinWeightsToolOptions;'))
	#swb2 = cmds.button(l='Smooth Weights', c=tf_smoothSkinWeight.paint)
	swb3 = cmds.button(l='Mirror Weights', c=lambda *x: [utils.mirrorSkinWeights(mesh=x) for x in cmds.ls(sl=True)])
	autoRow([swb1, swb3])
	cmds.setParent('..')

	# End UI
	cmds.setParent('..')

	return ui
Example #50
0
def snapToMeshUI():
    """
    UI for snapToMesh()
    """
    # Window
    window = 'snapToMeshUI'
    if cmds.window(window, q=True, ex=1): cmds.deleteUI(window)
    window = cmds.window(window, t='Snap To Mesh')

    # Layout
    FL = cmds.formLayout(numberOfDivisions=100)

    # UI Elements
    # ---

    # Mesh
    meshTFB = cmds.textFieldButtonGrp('snapToMeshTFB',
                                      label='Target Mesh',
                                      text='',
                                      buttonLabel='Load Selected')

    # Orient
    orientCBG = cmds.checkBoxGrp('snapToMeshOrientCBG',
                                 label='Orient To Face',
                                 ncb=1,
                                 v1=False)

    # ----------
    # - Orient -
    # ----------

    # Orient Frame
    orientFrameL = cmds.frameLayout('snapToMeshOriFL',
                                    l='Orient Options',
                                    cll=0,
                                    en=0)
    orientFormL = cmds.formLayout(numberOfDivisions=100)

    # OptionMenuGrp
    axList = ['X', 'Y', 'Z', '-X', '-Y', '-Z']
    orientNormAxisOMG = cmds.optionMenuGrp('snapToMeshNormOMG',
                                           label='Normal Axis',
                                           en=False)
    for ax in axList:
        cmds.menuItem(label=ax)
    orientUpVecAxisOMG = cmds.optionMenuGrp('snapToMeshUpVecOMG',
                                            label='UpVector Axis',
                                            en=False)
    for ax in axList:
        cmds.menuItem(label=ax)
    # Set Default Value
    cmds.optionMenuGrp('snapToMeshUpVecOMG', e=True, sl=2)

    # Up Vector
    upVectorFFG = cmds.floatFieldGrp('snapToMeshUpVecFFG',
                                     label='UpVector',
                                     nf=3,
                                     v1=0,
                                     v2=1,
                                     v3=0,
                                     en=0)
    upVectorObjectTFB = cmds.textFieldButtonGrp('snapToMeshUpVecObjTFG',
                                                label='WorldUpObject',
                                                text='',
                                                buttonLabel='Load Selected',
                                                en=0)

    cmds.setParent('..')
    cmds.setParent('..')

    # UI callback commands
    cmds.textFieldButtonGrp(meshTFB,
                            e=True,
                            bc='glTools.ui.utils.loadMeshSel("' + meshTFB +
                            '")')
    cmds.checkBoxGrp(orientCBG,
                     e=True,
                     cc='glTools.ui.utils.checkBoxToggleLayout("' + orientCBG +
                     '","' + orientFrameL + '")')
    cmds.textFieldButtonGrp(upVectorObjectTFB,
                            e=True,
                            bc='glTools.ui.utils.loadObjectSel("' +
                            upVectorObjectTFB + '")')

    # Buttons
    snapB = cmds.button('snapToMeshSnapB',
                        l='Snap!',
                        c='glTools.ui.mesh.snapToMeshFromUI(False)')
    snapCloseB = cmds.button('snapToMeshSnapCloseB',
                             l='Snap and Close',
                             c='glTools.ui.mesh.snapToMeshFromUI(True)')
    cancelB = cmds.button('snapToMeshCancelB',
                          l='Cancel',
                          c='cmds.deleteUI("' + window + '")')

    # Form Layout - MAIN
    cmds.formLayout(FL,
                    e=True,
                    af=[(meshTFB, 'top', 5), (meshTFB, 'left', 5),
                        (meshTFB, 'right', 5)])
    cmds.formLayout(FL,
                    e=True,
                    ac=[(orientCBG, 'top', 5, meshTFB)],
                    af=[(orientCBG, 'left', 5), (orientCBG, 'right', 5)])
    cmds.formLayout(FL,
                    e=True,
                    ac=[(orientFrameL, 'top', 5, orientCBG),
                        (orientFrameL, 'bottom', 5, snapB)],
                    af=[(orientFrameL, 'left', 5), (orientFrameL, 'right', 5)])
    cmds.formLayout(FL,
                    e=True,
                    ac=[(snapB, 'bottom', 5, snapCloseB)],
                    af=[(snapB, 'left', 5), (snapB, 'right', 5)])
    cmds.formLayout(FL,
                    e=True,
                    ac=[(snapCloseB, 'bottom', 5, cancelB)],
                    af=[(snapCloseB, 'left', 5), (snapCloseB, 'right', 5)])
    cmds.formLayout(FL,
                    e=True,
                    af=[(cancelB, 'left', 5), (cancelB, 'right', 5),
                        (cancelB, 'bottom', 5)])

    # Form Layout - Orient
    cmds.formLayout(orientFormL,
                    e=True,
                    af=[(orientNormAxisOMG, 'top', 5),
                        (orientNormAxisOMG, 'left', 5),
                        (orientNormAxisOMG, 'right', 5)])
    cmds.formLayout(orientFormL,
                    e=True,
                    ac=[(orientUpVecAxisOMG, 'top', 5, orientNormAxisOMG)])
    cmds.formLayout(orientFormL,
                    e=True,
                    af=[(orientUpVecAxisOMG, 'left', 5),
                        (orientUpVecAxisOMG, 'right', 5)])

    cmds.formLayout(orientFormL,
                    e=True,
                    ac=[(upVectorFFG, 'top', 5, orientUpVecAxisOMG)])
    cmds.formLayout(orientFormL,
                    e=True,
                    af=[(upVectorFFG, 'left', 5), (upVectorFFG, 'right', 5)])

    cmds.formLayout(orientFormL,
                    e=True,
                    ac=[(upVectorObjectTFB, 'top', 5, upVectorFFG)])
    cmds.formLayout(orientFormL,
                    e=True,
                    af=[(upVectorObjectTFB, 'left', 5),
                        (upVectorObjectTFB, 'right', 5)])

    # Show Window
    cmds.showWindow(window)
Example #51
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.rowLayout(nc=4) 
    cmds.checkBox('CPU_Process_Limit_Switch',l='Max Process',v=1)   
    cmds.intSliderGrp('CPU_Process_Limit_Percent',w=200,field=True,enable=False,min=1,max=100)
    cmds.text('CPU_Process_Limit_Max',w=35,l='0',enable=False)
    cmds.text('CPU_Process_Limit_Total_Count',l=str(multiprocessing.cpu_count()),w=35)
    cmds.setParent(u=True)
    cmds.separator(style='none')    
    
    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')
    cmds.menuItem(l='quad',p='MeshLight_aiTranslator')
    cmds.menuItem(l='cylinder',p='MeshLight_aiTranslator')
    cmds.menuItem(l='disk',p='MeshLight_aiTranslator')
    f2 = cmds.colorSliderGrp('MeshLight_aiColor',l='Color')
    f3 = cmds.floatSliderGrp('MeshLight_aiIntensity',l='Intensity',field=True)
    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',w=88,c=lambda *args:refreshLightGroupMenu())
    f18 = cmds.button(l='Set LightGroup',w=88,c=lambda *args:setLightGroupFromMenu())
    cmds.setParent(u=True)
    f19 = cmds.textFieldGrp('AOVString',l='AOVs String')
    f20 = cmds.textScrollList('MeshLight_LightGroupList',w=180,h=380)
    f21 = cmds.textScrollList('LightFilterList',w=180,h=380,ams=True)
    f22 = cmds.rowLayout(nc=3)
    cmds.button(l='List',w=58,c=lambda *args:refreshAiLightFilterList())
    cmds.button(l='Connect',w=58,c=lambda *args:connectAiLightFilter())
    cmds.button(l='Cut',w=58,c=lambda *args:disconnectExistsFilters())
    cmds.setParent(u=True)
    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',355),(f16,'left',5),
                                                        (f19,'top',330),(f19,'left',-40),
                                                        (f20,'top',383),(f20,'left',5),
                                                        (f21,'top',383),(f21,'left',195),
                                                        (f22,'top',355),(f22,'left',195)
                                                        ])
    
    
    cmds.setParent(u=True)
    cmds.setParent(u=True)
    cmds.frameLayout(l='Mesh Light List',w=400)
    cmds.rowLayout(nc=5)
    cmds.button(l='aiAreaLight',w=80,c=lambda *ars:createAreaLight())
    cmds.textField('nodeTypeFilterText',w=130)
    cmds.popupMenu(p='nodeTypeFilterText')
    cmds.menuItem(l='getTypeBySelect',c=lambda *args:cmds.textField('nodeTypeFilterText',e=True,tx=cmds.nodeType(cmds.ls(sl=True)[0])))
    cmds.button(l='Selected',w=60,c=lambda args:cmds.select(cmds.ls(sl=True,dag=True,ni=True,type=cmds.textField('nodeTypeFilterText',q=True,tx=True)),r=True))
    cmds.button(l='Scene',w=60,c=lambda args:cmds.select(cmds.ls(dag=True,ni=True,type=cmds.textField('nodeTypeFilterText',q=True,tx=True)),r=True))
    cmds.button(l='Group',w=60,c=lambda args:cmds.select(groupAnalyzer(cmds.ls(dag=True,sl=True,ni=True),cmds.textField('nodeTypeFilterText',q=True,tx=True),'down'),r=True))
    cmds.setParent(u=True)
    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.radioCollection()
    w11 = cmds.radioButton('Single_Check',l='Single')
    w12 = cmds.radioButton('Double_Check',l='Double',sl=True)
    w13 = cmds.button('ListWireframeColor',l='Color Dis',w=70,c=lambda *args:displayLightColorAsWireframe())
    
    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',57),(w9,'left',0),
                                                            (w10,'top',57),(w10,'left',50),
                                                            (w11,'top',55),(w11,'left',100),
                                                            (w12,'top',55),(w12,'left',160),
                                                            (w13,'top',52),(w13,'left',225)
                                                            ])
    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.menuItem(l='Light Color Button Window',c=lambda *args:colorAnalyzer())
    cmds.menuItem(l='Key Light Color',c=lambda *args:hsvColorKeyframeWindow())
    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.floatSliderGrp(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())
    cmds.textScrollList('LightFilterList',e=True,dcc=lambda *args:cmds.select(cmds.textScrollList('LightFilterList',q=True,si=True),r=True))
    cmds.checkBox('CPU_Process_Limit_Switch',e=True,cc=lambda *args:setCpuLimited())
    cmds.intSliderGrp('CPU_Process_Limit_Percent',e=True,cc=lambda *args:setCpuLimited())
Example #52
0
def stretchyIkSplineUI():
	'''
	UI for stretchyIkSpline()
	'''
	# Window
	window = 'stretchyIkSplineUI'
	if mc.window(window,q=True,ex=1): mc.deleteUI(window)
	window = mc.window(window,t='Stretchy IK Spline')
	# Layout
	FL = mc.formLayout()
	# UI Elements
	#---
	# IK Handle
	handleTFB = mc.textFieldButtonGrp('stretchyIkSplineTFB',label='IK Handle',text='',buttonLabel='Load Selected')
	# Prefix
	prefixTFG = mc.textFieldGrp('stretchyIkSplinePrefixTFG',label='Prefix', text='')
	# Scale Axis
	axisList = ['X','Y','Z']
	scaleAxisOMG = mc.optionMenuGrp('stretchyIkSplineAxisOMG',label='Joint Scale Axis')
	for axis in axisList: mc.menuItem(label=axis)
	mc.optionMenuGrp(scaleAxisOMG,e=True,sl=1)
	# Scale Attr
	scaleAttrTFB = mc.textFieldButtonGrp('stretchyIkSplineScaleAttrTFB',label='Scale Attribute',text='',buttonLabel='Load Selected')
	# Blend
	blendCtrlTFB = mc.textFieldButtonGrp('stretchyIkSplineBlendCtrlTFB',label='Blend Control',text='',buttonLabel='Load Selected')
	blendAttrTFG = mc.textFieldGrp('stretchyIkSplineBlendAttrTFG',label='Blend Attribute',text='stretchScale')
	
	# Stretch Method
	methodList = ['Arc Length','Parametric']
	methodOMG = mc.optionMenuGrp('stretchyIkSplineMethodOMG',label='Stretch Method')
	for method in methodList: mc.menuItem(label=method)
	mc.optionMenuGrp(methodOMG,e=True,sl=2)
	
	# Parametric Layout
	paramFrameL = mc.frameLayout('stretchyIkSplineParamFL',l='Parametric Bounds',cll=0)
	paramFormL = mc.formLayout(numberOfDivisions=100)
	
	# Min/Max Percent
	minPercentFSG = mc.floatSliderGrp('stretchyIkSplineMinPFSG',label='Min Percent',field=True,minValue=0.0,maxValue=1.0,fieldMinValue=0.0,fieldMaxValue=1.0,value=0.0)
	maxPercentFSG = mc.floatSliderGrp('stretchyIkSplineMaxPFSG',label='Max Percent',field=True,minValue=0.0,maxValue=1.0,fieldMinValue=0.0,fieldMaxValue=1.0,value=1.0)
	closestPointCBG = mc.checkBoxGrp('stretchyIkSplineClosestPointCBG',l='Use Closest Point',ncb=1,v1=True)
	
	mc.setParent('..')
	mc.setParent('..')
	
	# Buttons
	createB = mc.button('stretchyIkSplineCreateB',l='Create',c='glTools.ui.ik.stretchyIkSplineFromUI(False)')
	cancelB = mc.button('stretchyIkSplineCancelB',l='Cancel',c='mc.deleteUI("'+window+'")')
	
	# UI callback commands
	mc.textFieldButtonGrp(handleTFB,e=True,bc='glTools.ui.utils.loadTypeSel("'+handleTFB+'","'+prefixTFG+'",selType="ikHandle")')
	mc.textFieldButtonGrp(scaleAttrTFB,e=True,bc='glTools.ui.utils.loadChannelBoxSel("'+scaleAttrTFB+'")')
	mc.textFieldButtonGrp(blendCtrlTFB,e=True,bc='glTools.ui.utils.loadObjectSel("'+blendCtrlTFB+'")')
	mc.optionMenuGrp(methodOMG,e=True,cc='mc.frameLayout("'+paramFrameL+'",e=True,en=mc.optionMenuGrp("'+methodOMG+'",q=True,sl=True)-1)')
	
	# Form Layout - MAIN
	mc.formLayout(FL,e=True,af=[(handleTFB,'top',5),(handleTFB,'left',5),(handleTFB,'right',5)])
	mc.formLayout(FL,e=True,ac=[(prefixTFG,'top',5,handleTFB)])
	mc.formLayout(FL,e=True,af=[(prefixTFG,'left',5),(prefixTFG,'right',5)])
	mc.formLayout(FL,e=True,ac=[(scaleAxisOMG,'top',5,prefixTFG)])
	mc.formLayout(FL,e=True,af=[(scaleAxisOMG,'left',5),(scaleAxisOMG,'right',5)])
	mc.formLayout(FL,e=True,ac=[(scaleAttrTFB,'top',5,scaleAxisOMG)])
	mc.formLayout(FL,e=True,af=[(scaleAttrTFB,'left',5),(scaleAttrTFB,'right',5)])
	mc.formLayout(FL,e=True,ac=[(blendCtrlTFB,'top',5,scaleAttrTFB)])
	mc.formLayout(FL,e=True,af=[(blendCtrlTFB,'left',5),(blendCtrlTFB,'right',5)])
	mc.formLayout(FL,e=True,ac=[(blendAttrTFG,'top',5,blendCtrlTFB)])
	mc.formLayout(FL,e=True,af=[(blendAttrTFG,'left',5),(blendAttrTFG,'right',5)])
	mc.formLayout(FL,e=True,ac=[(methodOMG,'top',5,blendAttrTFG)])
	mc.formLayout(FL,e=True,af=[(methodOMG,'left',5),(methodOMG,'right',5)])
	mc.formLayout(FL,e=True,ac=[(paramFrameL,'top',5,methodOMG),(paramFrameL,'bottom',5,createB)])
	mc.formLayout(FL,e=True,af=[(paramFrameL,'left',5),(paramFrameL,'right',5)])
	mc.formLayout(FL,e=True,af=[(createB,'left',5),(createB,'bottom',5)])
	mc.formLayout(FL,e=True,ap=[(createB,'right',5,50)])
	mc.formLayout(FL,e=True,af=[(cancelB,'right',5),(cancelB,'bottom',5)])
	mc.formLayout(FL,e=True,ap=[(cancelB,'left',5,50)])
	
	# Form Layout - Parametric
	mc.formLayout(paramFormL,e=True,af=[(minPercentFSG,'top',5),(minPercentFSG,'left',5),(minPercentFSG,'right',5)])
	mc.formLayout(paramFormL,e=True,ac=[(maxPercentFSG,'top',5,minPercentFSG)])
	mc.formLayout(paramFormL,e=True,af=[(maxPercentFSG,'left',5),(maxPercentFSG,'right',5)])
	mc.formLayout(paramFormL,e=True,ac=[(closestPointCBG,'top',5,maxPercentFSG)])
	mc.formLayout(paramFormL,e=True,af=[(closestPointCBG,'left',5),(closestPointCBG,'right',5)])
	
	# Show Window
	mc.showWindow(window)
Example #53
0
def attachToMeshUI():
    """
    UI for attachToMesh()
    """
    # Window
    window = 'attachToMeshUI'
    if cmds.window(window, q=True, ex=1): cmds.deleteUI(window)
    window = cmds.window(window, t='Attach To Mesh')
    # Layout
    FL = cmds.formLayout(numberOfDivisions=100)
    # UI Elements
    # ---
    # Surface
    meshTFB = cmds.textFieldButtonGrp('attachToMeshTFB',
                                      label='Target Mesh',
                                      text='',
                                      buttonLabel='Load Selected')
    # Transform
    transformTFB = cmds.textFieldButtonGrp('attachToMeshTransformTFB',
                                           label='Transform',
                                           text='',
                                           buttonLabel='Load Selected')
    # Transform
    prefixTFG = cmds.textFieldGrp('attachToMeshPrefixTFG',
                                  label='Prefix',
                                  text='')
    # Orient
    orientCBG = cmds.checkBoxGrp('attachToMeshOrientCBG',
                                 label='Orient To Face',
                                 ncb=1,
                                 v1=False)

    # Orient Frame
    orientFrameL = cmds.frameLayout('attachToMeshOriFL',
                                    l='Orient Options',
                                    cll=0,
                                    en=0)
    orientFormL = cmds.formLayout(numberOfDivisions=100)
    # OMG
    axList = ['X', 'Y', 'Z', '-X', '-Y', '-Z']
    orientNormAxisOMG = cmds.optionMenuGrp('attachToMeshNormOMG',
                                           label='Normal Axis',
                                           en=False)
    for ax in axList:
        cmds.menuItem(label=ax)
    orientTanAxisOMG = cmds.optionMenuGrp('attachToMeshTanOMG',
                                          label='Tangent Axis',
                                          en=False)
    for ax in axList:
        cmds.menuItem(label=ax)
    # Set Default Value
    cmds.optionMenuGrp(orientTanAxisOMG, e=True, sl=2)

    cmds.setParent('..')
    cmds.setParent('..')

    # UI callback commands
    cmds.textFieldButtonGrp(meshTFB,
                            e=True,
                            bc='glTools.ui.utils.loadMeshSel("' + meshTFB +
                            '")')
    cmds.textFieldButtonGrp(transformTFB,
                            e=True,
                            bc='glTools.ui.utils.loadObjectSel("' +
                            transformTFB + '","' + prefixTFG + '")')
    cmds.checkBoxGrp(orientCBG,
                     e=True,
                     cc='glTools.ui.utils.checkBoxToggleLayout("' + orientCBG +
                     '","' + orientFrameL + '")')

    # Buttons
    snapB = cmds.button('attachToMeshAttachB',
                        l='Attach',
                        c='glTools.ui.mesh.attachToMeshFromUI(False)')
    snapCloseB = cmds.button('attachToMeshAttachCloseB',
                             l='Attach and Close',
                             c='glTools.ui.mesh.attachToMeshFromUI(True)')
    cancelB = cmds.button('attachToMeshCancelB',
                          l='Cancel',
                          c='cmds.deleteUI("' + window + '")')

    # Form Layout - MAIN
    cmds.formLayout(FL,
                    e=True,
                    af=[(meshTFB, 'top', 5), (meshTFB, 'left', 5),
                        (meshTFB, 'right', 5)])
    cmds.formLayout(FL, e=True, ac=[(transformTFB, 'top', 5, meshTFB)])
    cmds.formLayout(FL,
                    e=True,
                    af=[(transformTFB, 'left', 5), (transformTFB, 'right', 5)])
    cmds.formLayout(FL, e=True, ac=[(prefixTFG, 'top', 5, transformTFB)])
    cmds.formLayout(FL,
                    e=True,
                    af=[(prefixTFG, 'left', 5), (prefixTFG, 'right', 5)])
    cmds.formLayout(FL, e=True, ac=[(orientCBG, 'top', 5, prefixTFG)])
    cmds.formLayout(FL,
                    e=True,
                    af=[(orientCBG, 'left', 5), (orientCBG, 'right', 5)])
    cmds.formLayout(FL, e=True, ac=[(orientFrameL, 'top', 5, orientCBG)])
    cmds.formLayout(FL,
                    e=True,
                    af=[(orientFrameL, 'left', 5), (orientFrameL, 'right', 5)])
    cmds.formLayout(FL, e=True, ac=[(orientFrameL, 'bottom', 5, snapB)])
    cmds.formLayout(FL, e=True, ac=[(snapB, 'bottom', 5, snapCloseB)])
    cmds.formLayout(FL, e=True, af=[(snapB, 'left', 5), (snapB, 'right', 5)])
    cmds.formLayout(FL, e=True, ac=[(snapCloseB, 'bottom', 5, cancelB)])
    cmds.formLayout(FL,
                    e=True,
                    af=[(snapCloseB, 'left', 5), (snapCloseB, 'right', 5)])
    cmds.formLayout(FL,
                    e=True,
                    af=[(cancelB, 'left', 5), (cancelB, 'right', 5),
                        (cancelB, 'bottom', 5)])

    # Form Layout - Orient
    cmds.formLayout(orientFormL,
                    e=True,
                    af=[(orientNormAxisOMG, 'top', 5),
                        (orientNormAxisOMG, 'left', 5),
                        (orientNormAxisOMG, 'right', 5)])
    cmds.formLayout(orientFormL,
                    e=True,
                    ac=[(orientTanAxisOMG, 'top', 5, orientNormAxisOMG)])
    cmds.formLayout(orientFormL,
                    e=True,
                    af=[(orientTanAxisOMG, 'left', 5),
                        (orientTanAxisOMG, 'right', 5)])

    # Show Window
    cmds.showWindow(window)
Example #54
0
    def buildUI(self):
        """
        Main UI just to confirm very basic info of production
        :return:
        """

        w = 500
        h = 30

        # Production name by default
        prodName = "VoxelPicture"
        # Check if UI exists
        if cmds.window(self.winid, q=True, exists=True):
            cmds.deleteUI(self.winid)
        # Create UI
        cmds.window(self.winid, t=self.title, rtf=True, wh=(w, 25 * h))
        # Main layout
        mainLayout = cmds.scrollLayout('main', hst=15, vst=15)

        # Title
        self.bts.makeSeparator(h=h / 6, w=w)
        cmds.text(l=self.label, h=h, w=w, align='center')
        self.bts.makeSeparator(h=h / 6, w=w)

        # Content
        nc = 9
        adj1 = 5
        w2 = (w - (5 * adj1)) / (nc - 5)

        cmds.rowColumnLayout(
            nc=nc,
            cw=self.bts.cwCustomize(
                nc, [adj1, w2, adj1, w2, adj1, w2, adj1, w2, adj1]))
        cmds.text(l="")
        cmds.text(l='Project Name', align='center')
        cmds.text(l="")
        self.prodName = cmds.textField(tx=prodName)
        cmds.text(l="")
        cmds.text(l="Abbreviated as", align='center')
        cmds.text(l="")
        self.prodShort = cmds.textField(tx='vxp')
        cmds.text(l="")

        cmds.setParent(mainLayout)
        cmds.text(l="")

        nc = 5
        w1 = 100

        cmds.rowColumnLayout(nc=nc,
                             cw=self.bts.cwCustomize(
                                 nc,
                                 [adj1, w1, adj1, w - (3 * adj1 + w1), adj1]))

        cmds.text(l="")
        cmds.button(l='Set Path', c=self.setPth)
        cmds.text(l="")
        self.setPath = cmds.textField(tx="E:/")
        cmds.text(l="")

        cmds.setParent(mainLayout)
        cmds.text(l="")
        cmds.text(l="DUE TO THE POSSIBILITY TO USE ONLINE RENDER SERVICE\n"
                  "SETTING PATH TO E DRIVE IS ALWAYS PREFERABLE\n"
                  "IF YOU DO NOT USE THAT KIND OF SERVICE, NEVER MIND",
                  align='center',
                  w=w,
                  h=2 * h,
                  bgc=(0, .5, 1),
                  fn="boldLabelFont")
        cmds.text(l="")

        nc = 9

        cmds.rowColumnLayout(
            nc=nc,
            cw=self.bts.cwCustomize(
                nc, [adj1, w2, adj1, w2, adj1, w2, adj1, w2, adj1]))

        cmds.text(l="")
        cmds.text(l="Project Mode")
        cmds.text(l="")
        self.setMode = cmds.optionMenu()
        cmds.menuItem(l="Group Mode", p=self.setMode)
        cmds.menuItem(l="Studio Mode", p=self.setMode)
        cmds.text(l="")
        cmds.text(l="Sequences")
        cmds.text(l="")
        self.numShot = cmds.intField(v=1, min=1)
        cmds.text(l="")
        cmds.setParent(mainLayout)
        cmds.text(l="")

        nc = 13
        w3 = (w - (7 * adj1)) / (nc - 7)

        cmds.rowColumnLayout(nc=nc,
                             cw=self.bts.cwCustomize(nc, [
                                 adj1, w3, adj1, w3, adj1, w3, adj1, w3, adj1,
                                 w3, adj1, w3, adj1
                             ]))

        cmds.text(l="")
        cmds.text(l="Character:")
        cmds.text(l="")
        self.numChar = cmds.intField(v=1,
                                     min=1,
                                     cc=partial(self.charNameColumn,
                                                (w - (4 * adj1)) / 3))
        cmds.text(l="")
        cmds.text(l="Environment:")
        cmds.text(l="")
        self.numEnv = cmds.intField(v=1,
                                    min=1,
                                    cc=partial(self.envNameColumn,
                                               (w - (4 * adj1)) / 3))
        cmds.text(l="")
        cmds.text(l="Props:")
        cmds.text(l="")
        self.numProps = cmds.intField(v=1,
                                      min=1,
                                      cc=partial(self.propsNameColumn,
                                                 (w - (4 * adj1)) / 3))
        cmds.text(l="")

        cmds.setParent(mainLayout)
        cmds.text(l="")

        nc = 7
        w4 = (w - (4 * adj1)) / (nc - 4)

        cmds.rowColumnLayout(nc=3, cw=[(1, w / 3), (2, w / 3), (3, w / 3)])
        cmds.text(l="Characters Name")
        cmds.text(l="Envs Name")
        cmds.text(l="Props Name")

        cmds.setParent(mainLayout)
        cmds.text(l="")

        self.editableColumnsLayout = cmds.rowColumnLayout(
            nc=nc,
            cw=self.bts.cwCustomize(nc, [adj1, w4, adj1, w4, adj1, w4, adj1]))

        cmds.text(l="")
        self.charColumn = cmds.columnLayout(w=w4)
        self.firstCharColumn = cmds.columnLayout(w=w4)
        cmds.textField('char1', p=self.firstCharColumn, w=w4 - 10)
        cmds.setParent(self.editableColumnsLayout)

        cmds.text(l="")
        self.envColumn = cmds.columnLayout(w=w4)
        self.firstEnvColumn = cmds.columnLayout(w=w4)
        cmds.textField('env1', p=self.firstEnvColumn, w=w4 - 10)
        cmds.setParent(self.editableColumnsLayout)

        cmds.text(l="")
        self.propsColumn = cmds.columnLayout(w=w4)
        self.firstPropsColumn = cmds.columnLayout(w=w)
        cmds.textField('props1', p=self.firstPropsColumn, w=w4 - 10)
        cmds.setParent(self.editableColumnsLayout)
        cmds.text(l="")

        cmds.setParent(mainLayout)

        self.bts.makeSeparator(h=10, w=w)

        cmds.rowColumnLayout(nc=3, cw=[(1, w / 3), (2, w / 3), (3, w / 3)])
        cmds.text(l="")
        cmds.button(l="CREATE PROJECT", c=self.createProject)
        cmds.text(l="")

        cmds.setParent(mainLayout)
        cmds.text(l="")

        cmds.showWindow(self.winid)
Example #55
0
    def ask_user_for_project_shot_other_details_once_then_save_file_in_format(
            self):
        '''

		'''
        self.form = cmds.setParent(q=True)

        cmds.formLayout(self.form, e=True, width=750)

        #		t1 = cmds.text(l=' show 		  scn			 shNo		   description			   version			initials			  comments(optional)	 .extension')
        self.t1 = cmds.columnLayout()
        self.i1 = cmds.image(image='D:/test/versionsHeader.jpg')
        cmds.setParent('..')
        self.l1 = cmds.optionMenu(label=' ',
                                  w=140,
                                  cc='onmi.changeOptionMenu()')
        showrec = self.readSql("select prjName from projects")
        for each in showrec:
            cmds.menuItem(label=each, parent=self.l1)

#		self.l2 = cmds.optionMenu(label=' ',w = 140 )
#		cmds.menuItem( label=' ' ,parent = self.l2)

        self.l3 = cmds.optionMenu(label=' ', w=140)
        cmds.menuItem(label=' ', parent=self.l3)

        self.l4 = cmds.textField()
        self.l5 = cmds.textField()
        self.l6 = cmds.textField()
        self.l7 = cmds.textField()

        cmds.textField(self.l4,
                       edit=True,
                       width=100,
                       enterCommand=('cmds.setFocus(\"' + self.l7 + '\")'))
        cmds.textField(self.l5,
                       edit=True,
                       width=30,
                       enterCommand=('cmds.setFocus(\"' + self.l5 + '\")'),
                       text='01',
                       enable=False)
        cmds.textField(self.l6,
                       edit=True,
                       width=30,
                       enterCommand=('cmds.setFocus(\"' + self.l6 + '\")'),
                       text=self.returnUserPrefix()[0])
        cmds.textField(self.l7,
                       edit=True,
                       width=70,
                       enterCommand=('cmds.setFocus(\"' + self.l7 + '\")'))

        self.l8 = cmds.button(
            label='ok, create first scene file',
            c='onmi.computeFileName();onmi.saveFileName(onmi.minorFolderName,onmi.ffilename)'
        )
        self.l9 = cmds.button(label='go ahead check in project folder')

        spacer = 5
        top = 5
        edge = 5

        #		cmds.formLayout(self.form, edit=True, attachForm=[(self.t1, 'top', 0), (self.t1, 'left', 0),(self.l1,'left', 10),(self.l8,'left',30)], attachControl=[(self.l1, 'top', 10, self.t1),(self.l2, 'top', 10, self.t1),(self.l3, 'top', 10, self.t1), (self.l4, 'top', 10, self.t1),(self.l5, 'top', 10, self.t1), (self.l6, 'top', 10, self.t1),(self.l7, 'top', 10, self.t1), (self.l8,'top',10, self.l1), (self.l9,'top',10, self.l1),(self.l9,'left',20, self.l8), (self.l2,'left', 10, self.l1),(self.l3,'left', 10, self.l2), (self.l4,'left', 10, self.l3), (self.l5,'left', 10, self.l4), (self.l6,'left', 10, self.l5), (self.l7,'left', 10, self.l6)])
        cmds.formLayout(self.form,
                        edit=True,
                        attachForm=[(self.t1, 'top', 0), (self.t1, 'left', 0),
                                    (self.l1, 'left', 10),
                                    (self.l8, 'left', 30)],
                        attachControl=[(self.l1, 'top', 10, self.t1),
                                       (self.l3, 'top', 10, self.t1),
                                       (self.l4, 'top', 10, self.t1),
                                       (self.l5, 'top', 10, self.t1),
                                       (self.l6, 'top', 10, self.t1),
                                       (self.l7, 'top', 10, self.t1),
                                       (self.l8, 'top', 10, self.l1),
                                       (self.l9, 'top', 10, self.l1),
                                       (self.l9, 'left', 20, self.l8),
                                       (self.l3, 'left', 10, self.l1),
                                       (self.l4, 'left', 10, self.l3),
                                       (self.l5, 'left', 10, self.l4),
                                       (self.l6, 'left', 10, self.l5),
                                       (self.l7, 'left', 10, self.l6)])
Example #56
0
def __library():

    l = mc.columnLayout("cl_library_FRW", q=True, ca=True) or []
    if len(l) > 0: mc.deleteUI(l)

    mc.columnLayout(p="cl_library_FRW")
    mc.iconTextButton(st="iconOnly",
                      i1="CN_refresh.png",
                      ann="update",
                      c=__library)
    mc.setParent("..")

    if not os.path.isdir(THIS_DIR): return
    global LIB_CACHE
    LIB_CACHE = {}
    for f in glob.glob(THIS_DIR + "/*.py"):
        f = f.replace("\\", "/")
        n = os.path.splitext(os.path.split(f)[1])[0]
        try:
            m = imp.load_source(n, f)
        except Exception as e:
            print("Library: " + f)
            print("  Error: " + str(e))
            continue
        fl = mc.frameLayout(l=n,
                            bv=True,
                            cll=True,
                            cl=True,
                            mw=15,
                            mh=15,
                            p="cl_library_FRW")
        mc.rowLayout(nc=2, adj=1)
        mc.textField(tx=f, ed=False)
        mc.iconTextButton(st="iconOnly",
                          i1="passSetRelationEditor.png",
                          ann="edit",
                          c=partial(__edit2, f))
        mc.setParent("..")
        mc.separator(st="in", w=420, h=10)
        LIB_CACHE[f] = {}
        for n, o in inspect.getmembers(m, inspect.isfunction):
            LIB_CACHE[f][o.__code__.co_firstlineno] = [
                n, inspect.getargspec(o)
            ]
        ids = sorted(LIB_CACHE[f].viewkeys())
        c = len(ids)
        for i in range(c):
            fn = LIB_CACHE[f][ids[i]][0]
            arg_nms = LIB_CACHE[f][ids[i]][1][0]
            c_nms = len(arg_nms)
            arg_val = LIB_CACHE[f][ids[i]][1][3] or []
            c_val = len(arg_val)
            mc.frameLayout(l=fn,
                           bv=True,
                           cll=True,
                           cl=True,
                           mw=5,
                           mh=5,
                           fn="smallPlainLabelFont")
            mc.rowLayout(nc=2, adj=1)
            mc.text(l="")  #fn, al="left", fn="fixedWidthFont")
            e = mc.iconTextButton(st="iconOnly",
                                  i1="timeplay.png",
                                  c=partial(__execute2, f, ids[i]))
            mc.setParent("..")
            if c_nms > 0:
                LIB_CACHE[f][ids[i]].append({})
                offset = c_nms - c_val
                # arguments
                for j in range(offset):
                    LIB_CACHE[f][ids[i]][2][arg_nms[j]] = __argumentWidget(
                        j,
                        ids[i],
                        LIB_CACHE[f][ids[i]][1][0],
                        arg_nms[j],
                        None,
                        presets=False)[0]
                # keyword arguments
                for j in range(c_val):
                    jj = j + offset
                    LIB_CACHE[f][ids[i]][2][arg_nms[jj]] = __argumentWidget(
                        jj,
                        ids[i],
                        LIB_CACHE[f][ids[i]][1][0],
                        arg_nms[jj],
                        arg_val[j],
                        presets=False)[0]
            # if i < c-1: mc.separator(st="in", h=10)
            mc.setParent("..")
        mc.frameLayout(fl, e=True, cl=False)
        mc.frameLayout(fl, e=True, cl=True)
Example #57
0
def ikHandleUI():
	'''
	UI for ikHandle()
	'''
	# Window
	window = 'ikHandleUI'
	if mc.window(window,q=True,ex=1): mc.deleteUI(window)
	window = mc.window(window,t='Create IK Handle')
	# Layout
	FL = mc.formLayout()
	# UI Elements
	#---
	# Joints
	sJointTFB = mc.textFieldButtonGrp('ikHandleStartJointTFB',label='Start Joint',text='',buttonLabel='Load Selected')
	eJointTFB = mc.textFieldButtonGrp('ikHandleEndJointTFB',label='End Joint',text='',buttonLabel='Load Selected')
	# Prefix
	prefixTFG = mc.textFieldGrp('ikHandlePrefixTFG',label='Prefix', text='')
	
	# IK Solver
	solverList = ['ikSplineSolver','ikSCsolver','ikRPsolver','ik2Bsolver']
	solverOMG = mc.optionMenuGrp('ikHandleSolverOMG',label='IK Solver')
	for solver in solverList: mc.menuItem(label=solver)
	mc.optionMenuGrp(solverOMG,e=True,sl=3)
	
	# Spline IK
	splineFrameL = mc.frameLayout('ikHandleSplineFL',l='Spline IK Options',cll=0,en=0)
	splineFormL = mc.formLayout(numberOfDivisions=100)
	# Curve
	curveTFB = mc.textFieldButtonGrp('ikHandleCurveTFB',label='Curve',text='',buttonLabel='Load Selected',en=0)
	offsetFSG = mc.floatSliderGrp('ikHandleOffsetFSG',label='Offset',field=True,minValue=0.0,maxValue=1.0,fieldMinValue=0.0,fieldMaxValue=1.0,value=0,en=0)
	
	mc.setParent('..')
	mc.setParent('..')
	
	# Buttons
	createB = mc.button('ikHandleCreateB',l='Create',c='glTools.ui.ik.ikHandleFromUI(False)')
	cancelB = mc.button('ikHandleCancelB',l='Cancel',c='mc.deleteUI("'+window+'")')
	
	# UI callback commands
	mc.optionMenuGrp(solverOMG,e=True,cc='mc.frameLayout("'+splineFrameL+'",e=True,en=not(mc.optionMenuGrp("'+solverOMG+'",q=True,sl=True)-1))')
	mc.textFieldButtonGrp(sJointTFB,e=True,bc='glTools.ui.ik.ikHandleUI_autoComplete("'+sJointTFB+'","'+eJointTFB+'","'+prefixTFG+'")')
	mc.textFieldButtonGrp(eJointTFB,e=True,bc='glTools.ui.utils.loadTypeSel("'+eJointTFB+'",selType="joint")')
	mc.textFieldButtonGrp(curveTFB,e=True,bc='glTools.ui.utils.loadCurveSel("'+curveTFB+'")')
	
	# Form Layout - MAIN
	mc.formLayout(FL,e=True,af=[(sJointTFB,'top',5),(sJointTFB,'left',5),(sJointTFB,'right',5)])
	mc.formLayout(FL,e=True,ac=[(eJointTFB,'top',5,sJointTFB)])
	mc.formLayout(FL,e=True,af=[(eJointTFB,'left',5),(eJointTFB,'right',5)])
	mc.formLayout(FL,e=True,ac=[(prefixTFG,'top',5,eJointTFB)])
	mc.formLayout(FL,e=True,af=[(prefixTFG,'left',5),(prefixTFG,'right',5)])
	mc.formLayout(FL,e=True,ac=[(solverOMG,'top',5,prefixTFG)])
	mc.formLayout(FL,e=True,af=[(solverOMG,'left',5),(solverOMG,'right',5)])
	mc.formLayout(FL,e=True,ac=[(splineFrameL,'top',5,solverOMG)])
	mc.formLayout(FL,e=True,af=[(splineFrameL,'left',5),(splineFrameL,'right',5)])
	mc.formLayout(FL,e=True,ac=[(splineFrameL,'bottom',5,createB)])
	mc.formLayout(FL,e=True,af=[(createB,'left',5),(createB,'right',5)])
	mc.formLayout(FL,e=True,ac=[(createB,'bottom',5,cancelB)])
	mc.formLayout(FL,e=True,af=[(cancelB,'left',5),(cancelB,'right',5),(cancelB,'bottom',5)])
	
	# Form Layout - Spline
	mc.formLayout(splineFormL,e=True,af=[(curveTFB,'top',5),(curveTFB,'left',5),(curveTFB,'right',5)])
	mc.formLayout(splineFormL,e=True,ac=[(offsetFSG,'top',5,curveTFB)])
	mc.formLayout(splineFormL,e=True,af=[(offsetFSG,'left',5),(offsetFSG,'right',5)])
	
	# Show Window
	mc.showWindow(window)
Example #58
0
    def displayUI(self):
        IDMTRigGUI = 'WDFaceUI'
        if rig.window(IDMTRigGUI, exists=True):
            rig.deleteUI(IDMTRigGUI)
        self.CurveSign = 'OFF'
        self.mainUI = rig.window(IDMTRigGUI,
                                 title=u'当前项目:' + self.project,
                                 menuBar=True,
                                 minimizeButton=True,
                                 maximizeButton=True)
        self.mainFLY = rig.formLayout()
        self.mainSRL = rig.scrollLayout(cr=True)
        self.mainCLM = rig.columnLayout(adj=True)

        #------------------------------------------------------------------ 部件选择
        rig.rowColumnLayout(nc=6,
                            columnWidth=[(1, 60), (2, 60), (3, 60), (4, 60),
                                         (5, 60), (6, 60)])
        self.mainCB = rig.checkBox(
            l=u'主体', v=True, changeCommand=lambda i: self.changeOptionVars())
        self.eyeCB = rig.checkBox(
            l=u'眼睛', v=True, changeCommand=lambda i: self.changeOptionVars())
        self.tongueCB = rig.checkBox(
            l=u'舌头', v=True, changeCommand=lambda i: self.changeOptionVars())
        self.earCB = rig.checkBox(
            l=u'耳朵', v=True, changeCommand=lambda i: self.changeOptionVars())
        self.eyebrowCB = rig.checkBox(
            l=u'眉毛', v=True, changeCommand=lambda i: self.changeOptionVars())
        self.toothCB = rig.checkBox(
            l=u'牙床', v=True, changeCommand=lambda i: self.changeOptionVars())
        self.jointCB = rig.checkBox(
            l=u'骨骼', v=True, changeCommand=lambda i: self.changeOptionVars())
        #        self.eyeCB = rig.checkBox(l = u'眼睛',v = True,changeCommand = lambda i:self.changeOptionVars())
        #        self.tongueCB = rig.checkBox(l = u'舌头',v = True,changeCommand = lambda i:self.changeOptionVars())
        #        self.earCB = rig.checkBox(l = u'耳朵',v = True,changeCommand = lambda i:self.changeOptionVars())
        #        self.eyebrowCB = rig.checkBox(l = u'眉毛',v = True,changeCommand = lambda i:self.changeOptionVars())
        #        self.toothCB = rig.checkBox(l = u'牙床',v = True,changeCommand = lambda i:self.changeOptionVars())
        self.allCB = [
            'mainCB', 'eyeCB', 'tongueCB', 'earCB', 'eyebrowCB', 'toothCB',
            'jointCB'
        ]
        self.allBt = [
            'SkinBT', 'BlendShapeBT', 'LfEyeBT', 'RtEyeBT', 'LfToothBT',
            'RtToothBT', 'LfEyebrowBT', 'RtEyebrowBT', 'TongueBT'
        ]
        self.dictData = {
            'mainCB': ['SkinBT', 'BlendShapeBT'],
            'eyeCB': ['LfEyeBT', 'RtEyeBT'],
            'tongueCB': ['TongueBT'],
            'earCB': [],
            'eyebrowCB': ['LfEyebrowBT', 'RtEyebrowBT'],
            'toothCB': ['LfToothBT', 'RtToothBT'],
            'jointCB': []
        }
        rig.setParent(self.mainCLM)

        #------------------------------------------------------------------ 参数设置
        self.eyebrowISG = rig.intSliderGrp(field=True,
                                           label=u'眉弓控制器个数:',
                                           minValue=3,
                                           maxValue=20,
                                           fieldMinValue=3,
                                           fieldMaxValue=10000,
                                           value=17,
                                           columnAttach=[(1, 'left', 5),
                                                         (2, 'left', 0),
                                                         (3, 'both', 0)],
                                           columnWidth3=(100, 30, 150))
        self.mouthISG = rig.intSliderGrp(field=True,
                                         label=u'嘴巴控制器个数:',
                                         minValue=3,
                                         maxValue=20,
                                         fieldMinValue=3,
                                         fieldMaxValue=10000,
                                         value=7,
                                         columnAttach=[(1, 'left', 5),
                                                       (2, 'left', 0),
                                                       (3, 'both', 0)],
                                         columnWidth3=(100, 30, 150))
        self.cheefISG = rig.intSliderGrp(field=True,
                                         label=u'鼻唇沟控制器个数:',
                                         minValue=3,
                                         maxValue=20,
                                         fieldMinValue=3,
                                         fieldMaxValue=10000,
                                         value=6,
                                         columnAttach=[(1, 'left', 5),
                                                       (2, 'left', 0),
                                                       (3, 'both', 0)],
                                         columnWidth3=(100, 30, 150))

        rig.button(l=u'生成定位控制器', c=lambda x: self.buildPosController())  #生成控制器
        rig.button(l=u'刷新模版', c=lambda x: self.refreshTemplate())  #刷新模版
        self.sizeFSG = rig.floatSliderGrp(
            field=True,
            label=u'调整控制器大小:',
            minValue=0.0001,
            maxValue=2,
            fieldMinValue=0.0001,
            fieldMaxValue=10000,
            value=1,
            columnAttach=[(1, 'left', 5), (2, 'left', 0), (3, 'both', 0)],
            columnWidth3=(100, 30, 150),
            cc=lambda x: self.changeConSize())  #调整控制器大小
        rig.separator(st='out')

        #------------------------------------------------------------------ 载入模型
        rig.text(u'头部模型:')
        rig.rowColumnLayout(nc=2, cal=[(1, 'left'), (2, 'right')])
        self.SkinBT = rig.button(l=u'载入头部模型',
                                 c=lambda x: self.loadObj('SkinBT'))
        self.BlendShapeBT = rig.button(
            l=u'载入蒙皮头部模型', c=lambda x: self.loadObj('BlendShapeBT'))
        rig.setParent(self.mainCLM)
        rig.rowColumnLayout(nc=2)
        self.SkinTF = rig.textField(enable=False)
        self.BlendShapeTF = rig.textField(enable=False)
        rig.setParent(self.mainCLM)

        rig.text(u'眼睛模型:')
        rig.rowColumnLayout(nc=2)
        self.LfEyeBT = rig.button(l=u'载入左眼',
                                  c=lambda x: self.loadObj('LfEyeBT'))
        self.RtEyeBT = rig.button(l=u'载入右眼',
                                  c=lambda x: self.loadObj('RtEyeBT'))
        rig.setParent(self.mainCLM)
        rig.rowColumnLayout(nc=2)
        self.LfEyeTF = rig.textField(enable=False)
        self.RtEyeTF = rig.textField(enable=False)
        rig.setParent(self.mainCLM)

        rig.text(u'牙床模型:')
        rig.rowColumnLayout(nc=2)
        self.LfToothBT = rig.button(l=u'载入上牙床',
                                    c=lambda x: self.loadObj('LfToothBT'))
        self.RtToothBT = rig.button(l=u'载入下牙床',
                                    c=lambda x: self.loadObj('RtToothBT'))
        rig.setParent('..')
        rig.rowColumnLayout(nc=2)
        self.LfToothTF = rig.textField(enable=False)
        self.RtToothTF = rig.textField(enable=False)
        rig.setParent(self.mainCLM)

        rig.text(u'眉毛模型:')
        rig.rowColumnLayout(nc=2)
        self.LfEyebrowBT = rig.button(l=u'载入左边眉毛',
                                      c=lambda x: self.loadObj('LfEyebrowBT'))
        self.RtEyebrowBT = rig.button(l=u'载入右边眉毛',
                                      c=lambda x: self.loadObj('RtEyebrowBT'))
        rig.setParent('..')
        rig.rowColumnLayout(nc=2)
        self.LfEyebrowTF = rig.textField(enable=False)
        self.RtEyebrowTF = rig.textField(enable=False)
        rig.setParent(self.mainCLM)

        rig.text(u'舌头模型:')
        self.TongueBT = rig.button(l=u'载入舌头',
                                   w=300,
                                   c=lambda x: self.loadObj('TongueBT'))
        self.TongueTF = rig.textField(w=300, enable=False)
        rig.setParent(self.mainCLM)

        rig.separator(st='out')
        #----------------------------------------------------------------- 镜像控制器
        rig.rowColumnLayout(nc=3, cw=(1, 100))
        rig.text(l=u'镜像控制器:')
        rig.button(l=u'左 ——>右', c=lambda x: self.mirrorCon('X', True))
        rig.button(l=u'右——>左 ', c=lambda x: self.mirrorCon('X', False))
        rig.setParent(self.mainCLM)

        rig.button(l=u'生成设置', c=lambda x: self.startSetup())  #生成控制器
        rig.separator(st='out')

        #----------------------------------------------------------------- 镜像blendShape曲线
        rig.rowColumnLayout(nc=3)
        rig.button(l=u'修改blendShape',
                   c=lambda x: self.mirrorBlendShape('X', True, False))
        rig.button(l=u'镜像到右',
                   c=lambda x: self.mirrorBlendShape('X', True, True))
        rig.button(l=u'镜像到左',
                   c=lambda x: self.mirrorBlendShape('X', False, True))
        rig.setParent(self.mainCLM)

        #        #----------------------------------------------------------------- 调整范围
        #        rig.rowColumnLayout(nc = 3,cw = (1,100))
        #        rig.text(l = u'调整范围:')
        #        rig.button(l = u'限定位移范围', c = lambda x:rig.setToolTo(self.limitTransformMP))
        #        rig.button(l = u'限定旋转范围', c = lambda x:rig.setToolTo(self.move))
        #        rig.setParent(self.mainCLM)
        #
        #        #----------------------------------------------------------------- 恢复blendShape曲线
        #        rig.rowColumnLayout(nc = 3,cw = (1,100))
        #        rig.text(l = u'恢复BS曲线:')
        #        rig.button(l = u'恢复Belndshape曲线')
        #        rig.button(l = u'恢复所有Belndshape曲线')
        #        rig.setParent(self.mainCLM)

        #----------------------------------------------------------------- 隐藏控制器
        rig.rowColumnLayout(nc=4)
        rig.button(l=u'隐藏small控制器',
                   c=lambda x: self.displayConntroller('small', 'hide'))
        rig.button(l=u'隐藏macro控制器',
                   c=lambda x: self.displayConntroller('macro', 'hide'))
        rig.button(l=u'隐藏main控制器',
                   c=lambda x: self.displayConntroller('main', 'hide'))
        rig.button(l=u'隐藏十字控制器',
                   c=lambda x: self.displayConntroller('cross', 'hide'))
        rig.setParent(self.mainCLM)

        #----------------------------------------------------------------- 显示控制器
        rig.rowColumnLayout(nc=4)
        rig.button(l=u'显示small控制器',
                   c=lambda x: self.displayConntroller('small', 'show'))
        rig.button(l=u'显示macro控制器',
                   c=lambda x: self.displayConntroller('macro', 'show'))
        rig.button(l=u'显示main控制器',
                   c=lambda x: self.displayConntroller('main', 'show'))
        rig.button(l=u'显示十字控制器',
                   c=lambda x: self.displayConntroller('cross', 'show'))
        rig.setParent(self.mainCLM)

        #----------------------------------------------------------------- 导入导出曲线
        rig.separator(st='out')
        rig.separator(st='out')
        rig.rowColumnLayout(nc=3)
        rig.button(l=u'导入导出blendShape曲线',
                   c=lambda x: self.importExportBlendShapeCurve())
        rig.button(l=u'导入导出控制器形状', c=lambda x: self.importExportControlCurve())
        rig.button(l=u'导入导出模版信息', c=lambda x: self.importExportTemplateInfo())
        rig.setParent(self.mainCLM)

        rig.button(l=u'恢复选择的控制器到初始POSE', c=lambda x: self.restorySelectCon())
        rig.button(l=u'恢复模版', c=lambda x: self.restoryTemplate())

        rig.setParent(self.mainFLY)
        rig.formLayout(self.mainFLY,
                       e=True,
                       attachForm=(self.mainSRL, 'top', 2))
        rig.formLayout(self.mainFLY,
                       e=True,
                       attachForm=(self.mainSRL, 'left', 2))
        rig.formLayout(self.mainFLY,
                       e=True,
                       attachForm=(self.mainSRL, 'bottom', 2))
        rig.formLayout(self.mainFLY,
                       e=True,
                       attachForm=(self.mainSRL, 'right', 2))

        #设置OptionVars
        self.getOptionVars()
        self.setOptionVars()
        self.getSkinObj()  #得到蒙皮物体
        rig.showWindow(IDMTRigGUI)  #显示界面
        rig.window(self.mainUI, e=True, wh=(400, 800))
Example #59
0
 def build_gui(self):
     # check if window exists and delete window and/or prefs
     if cmds.window('nuCamIOWin', exists=True):
         cmds.deleteUI('nuCamIOWin', window=True)
     if cmds.windowPref('nuCamIOWin', exists=True):
         cmds.windowPref('nuCamIOWin',edit=True,widthHeight=[10,10])
     #initialize window
     self.window = cmds.window('nuCamIOWin',title="NuCamIO", iconName='NuCamIO', width=300, height=200)
     self.column = cmds.columnLayout(adjustableColumn=True)
     # create main title
     self.title = cmds.text('nuCamIOTitle', label='Nu Design Camera Import', backgroundColor=(0.18,0.18,0.18), height=50 )
     cmds.setParent( self.column )
     # create frame offset form
     cmds.rowLayout(numberOfColumns=2, columnWidth2=(150,150), height=40, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 5), (2, 'both', 5)])
     cmds.text( label='Frame Start', align='center')
     self.anim_start_field = cmds.intField( 'animStart', value=1001, enable=True, height=30, changeCommand=self.set_anim_start)
     cmds.setParent( self.column )
     cmds.rowLayout(numberOfColumns=2, columnWidth2=(150,150), height=40, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 5), (2, 'both', 5)])
     cmds.text( label='Frame Step', align='center')
     self.anim_step_field = cmds.intField( 'animStep', value=4, enable=True, height=30, changeCommand=self.set_anim_step)
     cmds.setParent( self.column )
     cmds.rowLayout(numberOfColumns=2, columnWidth2=(150,150), height=40, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 5), (2, 'both', 5)])
     cmds.text( label='Legacy Offset?', align='center')
     self.legacy_offset = cmds.checkBox('legacy_offset', label='', value=False, cc=self.toggle_legacy_offset)
     cmds.setParent( self.column )
     cmds.rowLayout(numberOfColumns=2, columnWidth2=(150,150), height=40, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 5), (2, 'both', 5)])
     cmds.text( label='Legacy Rotation?', align='center')
     self.legacy_offset = cmds.checkBox('legacy_rot', label='', value=False, cc=self.toggle_legacy_rot)
     cmds.setParent( self.column )
     # create actor column
     self.actorColumn = cmds.columnLayout(adjustableColumn=True, visible=False)
     self.actorList = cmds.textScrollList(visible=True, allowMultiSelection=False, isObscured=False, height=100, highlightColor=(0.5,0.5,0.5))
     cmds.setParent( self.column )
     # create help text
     self.help = cmds.text('nuCamIOStatus', label='Click "Import" to select JSON file', backgroundColor=(0.18,0.18,0.18), height=50 )
     cmds.setParent( self.column )
     # create import button row
     self.importRow = cmds.rowLayout(numberOfColumns=2, columnWidth2=(150,150), rowAttach=(5, 'both', 5))
     cmds.button( 'nuCamIOImBtn', label="Import", height=50, width=150, command=self.import_data )
     cmds.button( 'nuCamIOCloseBtn', label='Close', height=50, width=150, command=self.closeWindow )
     cmds.setParent( self.column )
     # create locator buttons
     self.locatorRow = cmds.rowLayout(numberOfColumns=2, columnWidth2=(150,150), rowAttach=(5, 'both', 5), visible=False)
     cmds.button( 'nuCamIOImBtn', label="Create Locator", height=50, width=150, command=self.create_locators )
     cmds.button( 'nuCamIOCancelBtn', label='Close', height=50, width=150, command=self.closeWindow )
     cmds.setParent( self.column )
     # show window
     cmds.showWindow(self.window)
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