Exemplo n.º 1
0
    def initialize_buildButton(self):
        """ creates the BUILD and CLOSE buttons on the bottom """

        button_width = self.widthHeight[0] / 2 - 6
        button_height = 36
        buttonLayoutSpacing = self.widthHeight[0] - button_width * 2 - 10

        self.UIwidgets["buildButtonLayout"] = pm.rowColumnLayout(
            numberOfColumns=2, parent=self.UIwidgets["ui_main_layout"]
        )
        pm.rowColumnLayout(
            self.UIwidgets["buildButtonLayout"],
            edit=True,
            columnAlign=([1, "center"], [2, "center"]),
            columnOffset=([1, "left", 3], [3, "right", 5]),
            columnSpacing=[2, buttonLayoutSpacing],
        )

        self.UIwidgets["buildButton"] = pm.button(
            l=" :: BUILD ALL :: ",
            width=button_width,
            height=button_height,
            parent=self.UIwidgets["buildButtonLayout"],
            command=self.build_rig,
        )
        self.UIwidgets["closeButton"] = pm.button(
            l=" :: PRINT MODULE INFO :: ",
            width=button_width,
            height=button_height,
            parent=self.UIwidgets["buildButtonLayout"],
            command=self.tmp_module_information,
        )
	def __init__(self, lightTransform, lightType, lightShape):
		super(PointLight, self).__init__(lightTransform, lightType, lightShape)
		pm.setParent(self.indivLight_layout)
		
		pm.rowColumnLayout(nc=3)
		pm.text(l='Decay Rate', w=140, al='right')
		pm.text(l='', w=3)
		decayRate_menu = pm.optionMenu(bgc=primary_componentColor)
		pm.menuItem(l='No Decay', da=0)
		pm.menuItem(l='Linear', da=1)
		pm.menuItem(l='Quadratic', da=2)
		pm.menuItem(l='Cubic', da=3)
		pm.connectControl(decayRate_menu, lightShape+'.decayRate')
		pm.setParent(self.indivLight_layout)

		pm.rowColumnLayout(nc=2)
		pm.text(l='Shadow Settings', w=90, al='left', en=False)
		pm.separator(w=marginWidth-90, h=14)
		pm.setParent(self.indivLight_layout)

		pm.attrFieldSliderGrp(at=lightShape+'.lightRadius', cw=[[2, 75], [3, 120]], hmb=False)
		self.shadowRays_slide = pm.attrFieldSliderGrp(at=lightShape+'.shadowRays', cw=[[2, 75], [3, 120]], hmb=False)
		pm.attrFieldSliderGrp(at=lightShape+'.rayDepthLimit', cw=[[2, 75], [3, 120]], hmb=False)

		pm.setParent(lights_layout)
def GUI():
    winName = 'squishy_ik_win'

    if pmc.window(winName, exists=1):
        pmc.deleteUI(winName)
    win = pmc.window(winName, t='Squishy IK')
    pmc.formLayout(numberOfDivisions=100)
    pmc.rowColumnLayout(nc=2, rs=[15, 15], columnOffset=(1, 'both', 5))
    pmc.text(l='1 - Create Placement Locators')
    pmc.button(l='Make Locators', c=pmc.Callback(makeAutoRigLocators))

    pmc.separator()
    pmc.separator()

    pmc.text(l='2 - Place locators where the spine begins and ends')
    pmc.button(l='Select Locators', c=pmc.Callback(selectAutoRigLocators))

    pmc.separator()
    pmc.separator()

    pmc.text(l='3 - With the locators place, go ahead and create the rig!')
    pmc.button(l='Create Squishy Spine', c=pmc.Callback(squishySplineIkCallback))

    pmc.separator()
    pmc.separator()

    pmc.text(l='4 - Select the joints to add to the skin cluster')
    pmc.button(l='Select Bind Joints', c=pmc.Callback(selectSquishyJointsCallback))

    win.show()
Exemplo n.º 4
0
	def __init__(self, baseUi, parent):
		BaseUi.__init__(self, parent)
		self.uiparent = parent
		self.baseUi = baseUi
		self.tmpJnts = []
		self.attrCtrl = None

		#ui
		try:
			pm.deleteUI(self.rigCol)
		except: pass

		with pm.columnLayout(adj=True, rs=3, parent=self.uiparent) as self.rigCol:
			with pm.rowColumnLayout(nc=2, co=[(1, 'left', 130), (2, 'left', 5)]):
				pm.text(l='Finger Name')
				with pm.optionMenu(w=60) as self.fingerNameMenu:
					pm.menuItem(l='index')
					pm.menuItem(l='middle')
					pm.menuItem(l='ring')
					pm.menuItem(l='pinky')
					pm.menuItem(l='thumb')
			with pm.rowColumnLayout(nc=3, co=[(1, 'left', 30), (2, 'left', 5), (3, 'left', 5)]):
				pm.text(l='attrCtrl')
				self.attrCtrlTxtFld = pm.textField(w=230, ed=False)
				self.loadAttrCtrlButt = pm.button(l='<<', c=pm.Callback(self.loadAttrCtrl))
				pm.text(l='tmpJnts')
				self.tmpJntsTxtFld = pm.textField(w=230, ed=False)
				self.loadTmpJntButt = pm.button(l='<<', c=pm.Callback(self.loadTmpJnts))

		self.baseUi.clearElemSideTxtFld()
Exemplo n.º 5
0
 def create(self):
     
     self.main_layout = pm.columnLayout(adjustableColumn= True, width= 400)
     main_frame = pm.frameLayout( label='%s' % (self.obj), collapsable= True)
     pm.columnLayout(adjustableColumn= False, width= 400)
     self.mapping_menu = pm.optionMenu( label='Mapping', width= 150,
             changeCommand= pm.Callback(self.mapping_type, self.obj))
     pm.menuItem( label='Spherical')
     pm.menuItem( label='Angular')
     
     pm.setParent(main_frame)
     self.type_menu = pm.optionMenu( label='Type', width= 150,
             changeCommand= pm.Callback(self.file_type, self.obj))
     pm.menuItem( label='Image File')
     pm.menuItem( label='Texture')
     
     self.image_field = pm.textFieldButtonGrp(label= 'Image Name', editable= False, columnWidth3= [100,200,100],
             buttonLabel= '<<<', buttonCommand= pm.Callback(self.load_image, self.obj))
     
     
     self.list_field = pm.textScrollList(allowMultiSelection= False ,
                 width= 100, height= 100)
     pm.attrColorSliderGrp( at='%s.color' % (self.obj),
                           columnWidth4= [100, 75, 175, 50])
     
     pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 200], [2, 200]))
     pm.button(label= 'List Ramps', command= pm.Callback(self.list_textures))
     pm.button(label= 'Link Ramps', command= pm.Callback(self.link_texture, self.obj))
     pm.button(label= 'Edit Ramps', command= pm.Callback(self.edit_ramp))
     pm.button(label= 'Create Ramps', command= pm.Callback(self.create_ramp))
def createUI( SWindowTitle, pApplyCallback ):
    
    windowID = 'vcgnWindowID'
    
    # If Window is Already Open, Delete it and Open a New One
    if pm.window( windowID, exists=True ):
        pm.deleteUI( windowID )
        
    # Init Window
    pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
        
    pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ])
        
    pm.text( label='Min Value:' )
        
    # Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Minimum Value, It Can't Go below 0.0 or above 1.0" )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Max Value:' )
        
    # Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Maximum Value, It Can't Go below 0.0 or above 1.0" )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )     
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Noise Type:' )
    
    # Noise Options - Enabled in 2.0    
    NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=True, annotation="Select Alternate Distributions and Generation Functions Here" )
    pm.menuItem( label='Simple', parent='NoiseFunctions', annotation="A Simple Psuedo Random Noise Function that generates Random Values Between Min and Max" )
    pm.menuItem( label='Perlin', parent='NoiseFunctions', annotation="Try Moving the Object Around for More Variety with Perlin Noise" )
    pm.menuItem( label='3D Weighted', parent='NoiseFunctions', annotation="This Function Uses a Mixed Up Vertex List Randomly Adjust the Appearance of a Psuedo Random Number Generation" )
    pm.menuItem( label='Triangular', parent='NoiseFunctions', annotation="This Function Uses a Psuedo Random Number Generator with a Triangular Distribution" )
    pm.menuItem( label='Gamma', parent='NoiseFunctions', annotation="This Function Uses the Gamma Distribution, Does Not Work Well with Low Min Values, Suggestion Minimum 0.1" )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    
    # Buttons 
    pm.separator( h=10, style='none' )   
    pm.button( label='Apply', command=functools.partial(pApplyCallback,
                                                        NoiseOption,
                                                        MaxValueField,
                                                        MinValueField) )
        
    def cancelCallback( *Args ):
        if pm.window( windowID, exists=True ):
            pm.deleteUI( windowID )
        
    pm.button( label='Cancel', command=cancelCallback )
        
    pm.showWindow()       
    def __init__(self):
        if pm.window('optionVarEditor', exists=True):
            pm.deleteUI('optionVarEditor')

        with pm.window(title='optionVarEditor', widthHeight=(502, 552), s=False) as window:
            with pm.columnLayout():
                with pm.rowColumnLayout(nc=2, cw=[(1, 250), (2, 250)]):
                    # List Column
                    with pm.columnLayout():
                        self.search = pm.textField(width=248, cc=self.refresh, ec=self.refresh)
                        self.scrollList = pm.textScrollList(height=500, width=250, selectCommand=self._select, ams=True)
                    # Attr Column
                    with pm.columnLayout():
                        pm.text(l='optionVar Name:')
                        self.name = pm.textField(tx='Name', ed=False, width=248)
                        pm.text(l='optionVar Value:')
                        self.value = pm.textField(tx='value', width=248)
                # Buttons
                with pm.rowColumnLayout(nc=3, cw=[(1, 166), (2, 166), (3, 166)]):
                    pm.button(label='Create', c=self._create)
                    pm.button(label='Edit', c=self._edit)
                    pm.button(label='Delete', c=self._delete)

        self.refresh()

        # Render Window
        window.show()
Exemplo n.º 8
0
 def create(self):
      
      
      self.main_layout = pm.columnLayout(adjustableColumn= True, width= 400)
     
      main_frame = pm.frameLayout( label='%s' % (self.light), collapsable= True)
      pm.frameLayout( label='Light Attributes', collapsable= True)
      pm.attrColorSliderGrp( at='%s.color' % (self.light), columnWidth4= [100, 75, 175, 50])
      pm.attrFieldSliderGrp( at='%s.intensity' % (self.light), columnWidth4= [100, 75, 175, 50])
      pm.attrFieldSliderGrp(at='%s.ambientShade' % (self.light), columnWidth4= [100, 75, 175, 50])
     
      
      pm.setParent(main_frame)
      pm.frameLayout(label= 'Shadows', collapsable= True)
      pm.attrColorSliderGrp( at='%s.shadowColor' % (self.light),
                            columnWidth4= [100, 75, 175, 50])
      self.check_box = pm.checkBox(label= 'Use Ray Trace Shadows',
                      changeCommand= pm.Callback(self.shadows))
      
      self.shadow_radius = pm.attrFieldSliderGrp( at='%s.shadowRadius' %(self.light),
                              enable= False, columnWidth4= [100, 75, 175, 50])
      
      self.shadow_rays = pm.attrFieldSliderGrp( at='%s.shadowRays' % (self.light),
                              enable= False, columnWidth4= [100, 75, 175, 50])
      
      self.ray_depth = pm.attrFieldSliderGrp( at='%s.rayDepthLimit' % (self.light),
                              enable= False, columnWidth4= [100, 75, 175, 50])
     
      pm.setParent(main_frame)
      pm.rowColumnLayout(numberOfColumns= 2, columnWidth= [200, 200])
      pm.button(label= 'Select Light', width= 200, command= pm.Callback(self.select))
      pm.button(label= 'Delete UI', width= 200, command= pm.Callback(self.delete))
      pm.button(label= 'Hide', command= pm.Callback(self.hide))
      pm.button(label= 'Show',  command= pm.Callback(self.show))
      return self.main_layout
Exemplo n.º 9
0
    def __init__(self, opts):
        self.opts = opts
        with pm.frameLayout('Export Meshes (.FBX)', collapsable=True, cl=False, bs='out'):
            with pm.columnLayout(width=250):
                pm.text(l='Export List:')
                pm.separator(height=4)
                self.meshList = pm.textScrollList(height=250, width=250, ams=True, dkc=self._remove)
                with pm.rowColumnLayout(nc=3, cw=[(1, 82), (2, 82), (3, 82)]):
                    pm.button(l='Add', c=self._add)
                    pm.button(l='Remove', c=self._remove)
                    pm.button(l='Clear', c=self._clear)

                with pm.rowColumnLayout(nc=2, cw=[(1, 124), (2,124)]):
                    self.prefix = pm.checkBox(label='Prefix', value=self.opts['prefix'], cc=self.save)
                    self.suffix = pm.checkBox(label='Suffix', value=self.opts['suffix'], cc=self.save)
                    self.prefix_text = pm.textField(en=self.prefix.getValue(), text=self.opts['prefix_text'], cc=self.save)
                    self.suffix_text = pm.textField(en=self.suffix.getValue(), text=self.opts['suffix_text'], cc=self.save)

                pm.text(l='Export Path:')
                with pm.rowColumnLayout(nc=2, cw=[(1, 215), (2, 32)]):
                    self.fbxPath = pm.textField(text=self.opts['fbxPath'], cc=self._pathRefreash)
                    pm.button(l='...', c=self._path)

                with pm.rowColumnLayout(nc=3):
                    self.center = pm.checkBox(label='Move to Orgin', v=self.opts['center'], cc=self.save)
                    self.child = pm.checkBox(label='Export Childern', v=self.opts['child'], cc=self.save)
                    pm.button(l='FBXPreset', c=self._fbxPreset)

                with pm.rowColumnLayout(nc=2, cw=[(1, 124), (2, 124)]):
                    pm.button(l='Selected', c=self._selected)
                    pm.button(l='All', c=self._all)

        self._refresh()
Exemplo n.º 10
0
 def __init__(self):
     
     self.parti_nodes = []
     self.scene_lights = []
     self.parti_lights = []
     
     self.parti_dict = {}
     self.parti_lights_dict = {}
     self.scene_lights_dict = {}
     
     pm.columnLayout(adjustableColumn= True)
     main = pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,180],
         [2, 180], [3,180]))
     pm.columnLayout(adjustableColumn= True)
     pm.text(label= 'Parti Volumes')
     self.parti_scroll = pm.textScrollList(width= 180, height= 125,
                         selectCommand = pm.Callback(self.get_input_lights))
     pm.button(label= 'Refresh', command= pm.Callback(self.refresh_nodes))
     
     pm.setParent('..')
     pm.columnLayout(adjustableColumn= True)
     pm.text(label= 'Parti Lights')
     self.parti_light_scroll = pm.textScrollList(width= 180, height= 125)
     pm.rowColumnLayout(numberOfColumns= 2, columnWidth= ([1, 90], [2, 90]))
     pm.button(label= '+', command= pm.Callback(self.add_light))
     pm.button(label= '-', command= pm.Callback(self.remove_light))
     
     pm.setParent(main)
     pm.columnLayout(adjustableColumn= True)
     pm.text(label= 'Scene Lights')
     self.light_scroll = pm.textScrollList(width= 180, height= 125)
     pm.button(label= 'Refresh', command= pm.Callback(self.refresh_lights))
     
     self.refresh_lights()
     self.refresh_nodes()
Exemplo n.º 11
0
def gui():
    '''
    # gui for the script
    '''
    win = 'rigid_body_win'
    if pm.window(win, exists= True):
        pm.deleteUI(win)
        
    if pm.windowPref(win, exists= True):
        pm.windowPref(win, remove= True)
    
    global obj_scroll_list, name_field, tab_layout
    
    my_win = pm.window(win, title= 'BAKE', toolbox= True, width= 300)
    tab_layout = pm.tabLayout()
    
    ui_creator = pm.columnLayout(adjustableColumn= False)
    name_field = pm.textFieldGrp(label = 'System Name', text= 'Name',
                                 columnWidth2= [145, 150])
    obj_scroll_list = pm.textScrollList(width= 300, height= 200,
                                    allowMultiSelection= True)
    pm.rowColumnLayout(nc=3, columnWidth= ([1,100], [2,100], [1,100]))
    pm.button(label= 'Load', command= pm.Callback(load_objects), width= 100)
    pm.button(label= '+', command= pm.Callback(add_objects), width= 100)
    pm.button(label= '-', command= pm.Callback(remove_objects), width= 100)
    
    pm.setParent('..')
    pm.button(label= 'Create Baking System', height= 50, width= 300,
              command= pm.Callback(create_baking_system))
    
    pm.tabLayout( tab_layout, edit=True, tabLabel=((ui_creator, 'Setup')))
    
    my_win.show()
Exemplo n.º 12
0
	def __init__(self, baseUi, parent):
		BaseUi.__init__(self, parent)
		self.uiparent = parent
		self.baseUi = baseUi
		self.tmpJnts = []
		self.defaultAxis = 'y'

		#ui
		try:
			pm.deleteUI(self.rigCol)
		except: pass

		with pm.columnLayout(adj=True, rs=3, parent=self.uiparent) as self.rigCol:
			with pm.rowColumnLayout(nc=2, co=[(1, 'left', 155), (2, 'left', 5)]):
				pm.text(l='axis')
				with pm.optionMenu(w=60) as self.axisMenu:
					pm.menuItem(l='x')
					pm.menuItem(l='y')
					pm.menuItem(l='z')
			with pm.columnLayout(adj=True, rs=2, co=['left', 165]):	
				self.ribbonChkBox = pm.checkBox(l='Ribbon Lo/Hi', v=False)
			with pm.rowColumnLayout(nc=3, co=[(1, 'left', 30), (2, 'left', 5), (3, 'left', 5)]):
				pm.text(l='tmpJnts')
				self.tmpJntsTxtFld = pm.textField(w=230, ed=False)
				self.loadTmpJntButt = pm.button(l='<<', c=pm.Callback(self.loadTmpJnts))

			

		self.axisMenu.setValue(self.defaultAxis)
		self.baseUi.clearElemSideTxtFld()
Exemplo n.º 13
0
    def create(self):
        '''
        this function creates the components
        '''
        self.layout = pm.frameLayout(label= str(self.node), width= 340, collapsable= True, collapse= True )
        pm.attrEnumOptionMenu( label='Pre Infinity ', attribute='%s.preInfinity' % (self.node) )
        pm.attrEnumOptionMenu( label='Post Infinity ', attribute='%s.postInfinity' % (self.node) )

        pm.rowColumnLayout(numberOfColumns= 5, columnWidth= ([1, 10], [2, 50], [3, 50], [4, 115], [5, 115]))
        pm.text(label= '')
        pm.text(label= 'Time')
        pm.text(label= 'Value')
        pm.text(label= 'inTan Type')
        pm.text(label= 'OutTan Type')
        
        # create components for each key
        for num in xrange(self.count):
            pm.text(label= str(num), annotation= 'Key Index')
            
            time = Time_int(index= num, node= self.node)
            time.create()
            
            value = Value_float(index= num, node= self.node)
            value.create()
            
            in_tan = In_Tangent(index= num, node= self.node)
            in_tan.create()
            
            out_tan = Out_Tangent(index= num, node= self.node)
            out_tan.create()
Exemplo n.º 14
0
def exportABCUI(*args):
    
    if pm.window('exportABC', q = 1, ex = 1):
        pm.deleteUI('exportABC')
    win = pm.window('exportABC', t= 'Export ANIMATION', rtf=True, w = 280 )
    with win:
        mainLayout = pm.columnLayout()              
        allLayout = pm.columnLayout(parent = mainLayout) 

        # Export <<  ALL ANIMATION  >>
        exportAll = pm.button(l = 'EXPORT ALL ANIMATION', w = 280, h= 50)
        exportAll.setCommand(pm.Callback (expAllABC, listChars,listCam,listAssets))
        pm.separator(h = 15)
        # Export <<  CAMERA  >> 
        exportCam = pm.button(l = 'EXPORT CAMERA', w = 280, h= 25) 
        exportCam.setCommand(pm.Callback (exportCamABC, listCam))
        pm.separator(h = 10)
        # Export <<  CHARACTERS  >>        
        charLayout = pm.rowColumnLayout(nc=2, parent = mainLayout) 
        if listChars:
           for char in listChars:
                exportChar = pm.button(l = char, w = 140, h= 25)
                exportChar.setCommand(pm.Callback (exportABC, char, 'CHR'))
        else:
            blank = pm.text(l = '     NO CHARACTERS IN SCENE' , h= 40)
        # Export <<  ALL CHARACTERS   >>
        charLayoutAll = pm.columnLayout( parent = mainLayout) 
        exportCharAll = pm.button(l = 'EXPORT ALL CHARACTERS', w = 280, h= 40)
        exportCharAll.setCommand(pm.Callback (expListABC, listChars, 'CHR'))
        # Export <<  ASSETS  >>
        pm.separator(h = 10) 
        assetLayout = pm.rowColumnLayout(nc= 2, parent = mainLayout) 
        if listAssets:
            for asset in listAssets:
                exportAss = pm.button(l = asset, w = 140, h= 25)
                exportAss.setCommand(pm.Callback (exportABC, asset, 'AST'))  
        else:
            a = pm.text(l = '     NO ASSETS IN SCENE', h= 20)               
        assetAllLayout = pm.columnLayout(parent = mainLayout) 
        # Export <<  ALL ASSETS  >>
        exportAssAll = pm.button(l = 'EXPORT ALL ASSETS', w = 280, h= 40)
        exportAssAll.setCommand(pm.Callback (expListABC, listAssets, 'AST'))
        pm.separator(h = 10)
        # Export <<  EDA  >>
        envLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) 
        if listAssetsEnv:
           for assetEnv in listAssetsEnv:
                exportEnv = pm.button(l = assetEnv, w = 140, h= 25)
                exportEnv.setCommand(pm.Callback (exportABC, assetEnv, 'EDA'))
                
        else:
            blank = pm.text(l = '     NO ANIM in ENVIRONMENT' , h= 40)
        envLayoutAll = pm.columnLayout( parent = mainLayout) # Export ALL EDA   
        exportEnvAll = pm.button(l = 'EXPORT ALL EDA', w = 280, h= 40)
        exportEnvAll.setCommand(pm.Callback (expListABC, listAssetsEnv, 'EDA' ))
        #pm.separator(h = 10)

        
    win.show()    
def createUI( SWindowTitle, pApplyCallback ):
    
    windowID = 'vcgnWindowID'
    
    # If Window is Already Open, Delete it and Open a New One
    if pm.window( windowID, exists=True ):
        pm.deleteUI( windowID )
        
    # Init Window
    pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
        
    pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ])
        
    pm.text( label='Min Value:' )
        
    # Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01 )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Max Value:' )
        
    # Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01 )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )     
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Noise Type:' )
    
    # Noise Options - Disabled For Version 1.0 Will Be Enabled in 2.0    
    NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=False )
    pm.menuItem( label='Simple', parent='NoiseFunctions' )
    pm.menuItem( label='Perlin', parent='NoiseFunctions' )
    pm.menuItem( label='OpenSimplex', parent='NoiseFunctions' )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    
    # Buttons 
    pm.separator( h=10, style='none' )   
    pm.button( label='Apply', command=functools.partial(pApplyCallback,
                                                        NoiseOption,
                                                        MaxValueField,
                                                        MinValueField) )
        
    def cancelCallback( *Args ):
        if pm.window( windowID, exists=True ):
            pm.deleteUI( windowID )
        
    pm.button( label='Cancel', command=cancelCallback )
        
    pm.showWindow()       
Exemplo n.º 16
0
 def __init__(self):
     self.main_layout = pm.columnLayout(adjustableColumn= True)
     self.layout01 = pm.rowColumnLayout(numberOfColumns= 3, columnWidth=([1,
                                                 150],[2, 150], [3, 250]))
     pm.columnLayout()
     pm.text(label= 'Shaders')
     self.shader_scroll_list01 = pm.textScrollList(width= 150, height= 200,
                    selectCommand= pm.Callback(self.get_output_geo))
     pm.button(label= 'Refresh', width= 150,
               command= pm.Callback(self.update_shaders_list))
     
     pm.setParent(self.layout01)
     pm.columnLayout()
     pm.text(label= 'Shader Geo')
     self.shader_geo_scroll_list = pm.textScrollList(width= 150, height= 200,
                                                 allowMultiSelection= True)
     #self.check_box = pm.checkBox(label= 'select node')
     
     pm.setParent(self.layout01)
     pm.columnLayout()
     pm.text(label= 'Scene Geo')
     self.scene_geo_scroll_list = pm.textScrollList(width= 250, height= 200,
                                                 allowMultiSelection= True)
     pm.button(label= 'Refresh', width= 275,
               command= pm.Callback(self.update_scene_geo_list))
     
     pm.setParent(self.main_layout)
     self.layout02 = pm.rowColumnLayout(numberOfColumns= 2, columnWidth=([1,
                                                 275],[2, 275]))
     pm.columnLayout(adjustableColumn= True)
     pm.text(label= 'Shaders')
     self.shader_scroll_list02 = pm.textScrollList(width= 275, height= 200)
     pm.button(label= 'Assign', width= 275,
               command= pm.Callback(self.assign_to_geometry))
     
     pm.setParent(self.layout02)
     pm.columnLayout(adjustableColumn= True)
     pm.text(label= 'Create Shaders')
     self.option_menu = pm.optionMenu( label='Material Type', width= 200)
     pm.menuItem( label='mia_material_x')
     pm.menuItem( label='blinn')
     pm.menuItem( label='lambert')
     pm.menuItem( label='phong')
     pm.menuItem( label='rampShader')
     pm.menuItem( label='anisotropic')
     pm.menuItem( label='phongE')
     pm.menuItem( label='useBackground')
     
     self.text_field = pm.textFieldGrp(label= 'Name',
                                       columnWidth2= [100, 150])
     
     
     pm.button(label= 'Create and Assign Shader',
               command= pm.Callback(self.create_and_assign_shader))
     
     self.update_scene_geo_list()
     self.update_shaders_list()
Exemplo n.º 17
0
def importABCUI(*args):
    
    if pm.window('importABC', q = 1, ex = 1):
        pm.deleteUI('importABC')
    win = pm.window('importABC', t= 'Import ANIMATION', rtf=True, w = 280 )
    with win:
        mainLayout = pm.columnLayout()
        # Import  <<  ALL ANIMATION  >>        
        allLayout = pm.columnLayout(parent = mainLayout) 
        importAll = pm.button(l = 'IMPORT ALL ANIMATION', w = 280, h= 50)
        importAll.setCommand(pm.Callback (impAllABC))
        pm.separator(h = 15)
        # Import <<  CAMERA  >> 
        importCam = pm.button(l = 'IMPORT CAMERA', w = 280, h= 25) 
        importCam.setCommand(pm.Callback (importCamABC))
        pm.separator(h = 10) 
        # Import <<  CHARACTERS  >>
        charLayout = pm.rowColumnLayout(nc=2, parent = mainLayout) 
        if listChars:
           for char in listChars:
                pathABC = buildPathABC(char, 'CHR_')
                importChar = pm.button(l = char, w = 140, h= 25)
                importChar.setCommand(pm.Callback (importABC, char, pathABC))
        else:
            blank = pm.text(l = '          NO CHARACTERS IN SCENE' , h= 40)
        charLayoutAll = pm.columnLayout( parent = mainLayout)
        # Import <<  ALL CHARACTERS  >> 
        importCharAll = pm.button(l = 'IMPORT ALL CHARACTERS', w = 280, h= 40)
        importCharAll.setCommand(pm.Callback (importCharList, listChars))
        pm.separator(h = 10)
        # Import << ASSETS >>
        assetLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) 
        if listAssets:
            for asset in listAssets:
                pathABC = buildPathABC(asset, 'AST_')
                importAss = pm.button(l = asset, w = 140, h= 25)
                importAss.setCommand(pm.Callback (importABC, asset, pathABC))
        else:
            pm.text(l = '          NO ASSETS IN SCENE' , h= 20) 
        assetAllLayout = pm.columnLayout(parent = mainLayout) # import <<  ALL ASSET >>  data
        importAssAll = pm.button(l = 'IMPORT ALL ASSETS', w = 280, h= 40)
        importAssAll.setCommand(pm.Callback (importAssetList, listAssets))
        pm.separator(h = 10)
        # Import << EDA >>
        edaLayout = pm.rowColumnLayout(nc = 2, parent = mainLayout) 
        if listAssetsEnv:
            for asset in listAssetsEnv:
                pathABC = buildPathABC(asset, 'EDA_')
                importAss = pm.button(l = asset, w = 140, h= 25)
                importAss.setCommand(pm.Callback (importABC, asset, pathABC))
        else:
            pm.text(l = '          NO ASSETS IN SCENE' , h= 20) 
        assetAllLayout = pm.columnLayout(parent = mainLayout) # import <<  ALL ASSET >>  data
        importAssAll = pm.button(l = 'IMPORT ALL ASSETS', w = 280, h= 40)
        importAssAll.setCommand(pm.Callback (importAssetList, listAssets))
    win.show()    
Exemplo n.º 18
0
    def initialize_modulesSettings(self):

        self.moduleListWidth = self.widthHeight[0] / 3
        self.moduleOptionsWidth = self.widthHeight[0] - self.moduleListWidth - 12
        self.moduleLayoutHeight = self.widthHeight[1] - 40
        # creates the list of modules from Blueprints folder on the left hand side
        modulesLayoutSpacing = self.widthHeight[0] - self.moduleListWidth - self.moduleOptionsWidth

        # initializes layouts for modules list and modules options
        self.UIwidgets["modules_mainLayout"] = pm.columnLayout(adj=True, parent=self.UIwidgets["ui_main_layout"])

        self.UIwidgets["modules_columnLayout"] = pm.rowColumnLayout(
            numberOfColumns=2, parent=self.UIwidgets["modules_mainLayout"]
        )
        pm.rowColumnLayout(
            self.UIwidgets["modules_columnLayout"],
            edit=True,
            columnAlign=([1, "center"], [2, "center"]),
            columnOffset=([1, "left", 0], [3, "right", 5]),
            columnSpacing=[2, modulesLayoutSpacing],
        )

        # self.UIwidgets['modulesList_scrollLayout'] = pm.scrollLayout(width = self.moduleListWidth, height = self.moduleLayoutHeight, hst = 6, vst = 6, parent = self.UIwidgets["modules_columnLayout"])
        self.UIwidgets["modulesList_frameLayout"] = pm.frameLayout(
            w=self.moduleListWidth - 12,
            l="Module List",
            font="boldLabelFont",
            collapsable=False,
            labelIndent=self.moduleListWidth / 3.5,
            marginWidth=0,
            marginHeight=3,
            parent=self.UIwidgets["modules_columnLayout"],
        )
        self.UIwidgets["modulesList_scrollLayout"] = pm.scrollLayout(
            width=self.moduleListWidth - 18,
            height=self.moduleLayoutHeight,
            hst=6,
            vst=6,
            parent=self.UIwidgets["modulesList_frameLayout"],
        )

        # self.UIwidgets['modulesOptionScrollLayout'] = pm.scrollLayout(width = self.moduleOptionsWidth, height = self.moduleLayoutHeight, hst = 6, vst = 6, parent = self.UIwidgets["modules_columnLayout"])
        self.UIwidgets["modulesOptions_frameLayout"] = pm.frameLayout(
            w=self.moduleOptionsWidth,
            l="Module Options",
            font="boldLabelFont",
            collapsable=False,
            labelIndent=self.moduleOptionsWidth / 3.35,
            marginWidth=3,
            marginHeight=3,
            parent=self.UIwidgets["modules_columnLayout"],
        )

        self.initialize_moduleSettings()

        self.initialize_listAllModules()
Exemplo n.º 19
0
 def create(self):
     '''
     # creates the actual ui
     '''
     self.layout = pm.columnLayout()
     pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1, 180],[2, 180], [3, 180]))
     pm.text(label='Fill Type')
     pm.separator()
     pm.separator()
     pm.separator()
Exemplo n.º 20
0
    def create(self):
        '''
        this creates the gui components for the node
        '''
        
        pm.setParent(self.layout)
        # layout for all other frame layouts
        self.temp_layout = pm.columnLayout(adjustableColumn= False, width= 340)
        
        # this will list all animCurve nodes associated with an object
        # because anim nodes are named object_attr
        # but if the object is renamed after it's been keyed the anim node
        # will still have it's old name
        # by listing the anim nodes of the object * naming wont be an issue
        
        
        anim_nodes = pm.keyframe( '%s' % (self.node), query=True, name=True )

        for anim_node in anim_nodes:
            
            pm.setParent(self.temp_layout)
            # getting the amount of keyframes for the curve node
            count = pm.keyframe( '%s' % (anim_node) , query=True,
                                    keyframeCount=True ) # translate U
        
            my_ui = Anim_UI(node= '%s' % (anim_node), count = count)
            my_ui.create()
            
            # creating a new string
            node = '%s' % (anim_node)
            # getting the attr the curve node is for
            # the insert and delete key methods need an attr to act on
            # all anim nodes are named object_attr
            # so i'm splitting to get just hte attr part
            node_attr = node.split('_')[-1] 
            
            # indsert key
            # this will build the section for key insertion
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.%s' % (self.node, node_attr), value= insert_field))
            
            # delete key
            # this will build the section for key deletion
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.%s' % (self.node, node_attr), index= delete_field))
Exemplo n.º 21
0
    def create(self):
        
        
        
        self.main_layout = pm.columnLayout(adjustableColumn= True, width= 400)
       
        main_frame = pm.frameLayout( label='%s' % (self.light), collapsable= True)
        pm.frameLayout( label='Light Attributes', collapsable= True)
        pm.attrColorSliderGrp( at='%s.color' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.intensity' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.coneAngle' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.penumbraAngle' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrFieldSliderGrp(at='%s.dropoff' % (self.light), columnWidth4= [100, 75, 175, 50])
        pm.attrEnumOptionMenu( label='Decay Rate', attribute='%s.decayRate' % (self.light) )
        
        pm.setParent(main_frame)
        pm.frameLayout(label= 'Shadows', collapsable= True)
        pm.attrColorSliderGrp( at='%s.shadowColor' % (self.light),
                              columnWidth4= [100, 75, 175, 50])
        self.check_box = pm.checkBox(label= 'Use Ray Trace Shadows',
                        changeCommand= pm.Callback(self.shadows))
        
        self.light_radius = pm.attrFieldSliderGrp( at='%s.lightRadius' % (self.light),
                                enable= False, columnWidth4= [100, 75, 175, 50])
        
        self.shadow_rays = pm.attrFieldSliderGrp( at='%s.shadowRays' % (self.light),
                                enable= False, columnWidth4= [100, 75, 175, 50])
        
        self.ray_depth = pm.attrFieldSliderGrp( at='%s.rayDepthLimit' % (self.light),
                                enable= False, columnWidth4= [100, 75, 175, 50])

        pm.setParent(main_frame)
        pm.frameLayout(label= 'Decay Regions', collapsable= True)
        # useDecayRegions
        decay_regions_value = pm.getAttr('%s.useDecayRegions' % (self.light))
        self.decay_check_box = pm.checkBox(label= 'Use Decay Regions',
                        value= decay_regions_value, 
                    changeCommand= pm.Callback(self.chane_decay_regions))

        pm.attrControlGrp(attribute= '%s.startDistance1' % (self.light))
        pm.attrControlGrp(attribute= '%s.endDistance1' % (self.light))

        pm.attrControlGrp(attribute= '%s.startDistance2' % (self.light))
        pm.attrControlGrp(attribute= '%s.endDistance2' % (self.light))

        pm.attrControlGrp(attribute= '%s.startDistance3' % (self.light))
        pm.attrControlGrp(attribute= '%s.endDistance3' % (self.light))
       
        pm.setParent(main_frame)
        pm.rowColumnLayout(numberOfColumns= 2, columnWidth= [200, 200])
        pm.button(label= 'Select Light', width= 200, command= pm.Callback(self.select))
        pm.button(label= 'Save Preset', width= 200, command= pm.Callback(self.preset))
        pm.button(label= 'Hide', command= pm.Callback(self.hide))
        pm.button(label= 'Show',  command= pm.Callback(self.show))
        return self.main_layout
Exemplo n.º 22
0
def multi_SpotLightSettings():
	# Spot Light Settings
	pm.rowColumnLayout(nc=2)
	pm.text(l='Spot Light Settings', w=102, al='left', en=False)
	pm.separator(w=marginWidth-102, h=14)
	pm.setParent(multiLight_layout)

	multi_coneAngle = pm.floatSliderGrp('hp3dConeAngleSlider', label='Cone Angle', field=True, min=0.0057, max=179.9943, v=40.000, pre=3, cw=[3, 20], dc=fun.partial(multi_floatChange, '.coneAngle', 'spotLight', 'hp3dConeAngleSlider'))
	multi_penumbraAngle = pm.floatSliderGrp('hp3dPenumbraAngleSlider', label='Penumbra Angle', field=True, min=-10.000, max=10.000, v=0.000, pre=3, cw=[3, 20], dc=fun.partial(multi_floatChange, '.penumbraAngle', 'spotLight', 'hp3dPenumbraAngleSlider'))
	multi_dropoff = pm.floatSliderGrp('hp3dDropoffSlider', label='Dropoff', field=True, min=0, max=255.000, v=0.000, pre=3, cw=[3, 20], dc=fun.partial(multi_floatChange, '.dropoff', 'spotLight', 'hp3dDropoffSlider'))
	pm.setParent(multiLight_layout)
Exemplo n.º 23
0
def gui():
    win = pm.window()
    main = pm.columnLayout()
    global tsl, filter_field, add_field
    tsl = TSL()
    pm.rowColumnLayout(nc=2, cw=[[1,125], [2,75]])
    add_field = pm.textField()
    pm.button(label='Add', c=pm.Callback(add_items))    
    filter_field = pm.textField(cc=pm.Callback(filter))
    pm.button(label='Clear', c=pm.Callback(tsl.limit,''))
    
    win.show()
Exemplo n.º 24
0
 def ShowUI(self):
     self.FindSelectionToGroup()
     
     if len(self.objectsToGroup) == 0:
         return
     
     self.UIElements = {}
     
     if pm.window("groupSelected_UI_window", exists = True):
         pm.deleteUI("groupSelected_UI_window")
     
     
     windowWidth = 300
     windowHeight = 150
     self.UIElements["window"] = pm.window("groupSelected_UI_window", width = windowWidth, height = windowHeight, title = "Group Selected", sizeable = False)
     
     self.UIElements["topLevelColumn"] = pm.columnLayout(adjustableColumn = True, columnAlign = 'center', rowSpacing = 3)
     self.UIElements["groupName_rowColumn"] = pm.rowColumnLayout(numberOfColumns = 2, columnAttach = (1, 'right', 0), columnWidth = [(1, 80), (2, windowWidth - 90)], parent = self.UIElements["topLevelColumn"])
     
     pm.text(label = "Group Name: ", parent = self.UIElements["groupName_rowColumn"])
     self.UIElements["groupName"] = pm.textField(text = "group", parent = self.UIElements["groupName_rowColumn"])
     
     self.UIElements["createAt_rowColumn"] = pm.rowColumnLayout(numberOfColumns = 3, rowOffset = [(1, 'top', 2), (2, 'both', 2), (3, 'both', 2)], columnWidth = [(1, 80), (2, windowWidth - 170), (3, 80)], parent = self.UIElements["topLevelColumn"])
     pm.text(label = "Position at: ", parent = self.UIElements["createAt_rowColumn"])
     pm.text(label = '', parent = self.UIElements["createAt_rowColumn"])
     pm.text(label = '', parent = self.UIElements["createAt_rowColumn"])
     
     pm.text(label = '', parent = self.UIElements["createAt_rowColumn"])
     self.UIElements["createAt_lastSelected"] = pm.button(label = "Last Selected", command = self.CreateAtLastSelected, parent = self.UIElements["createAt_rowColumn"])
     pm.text(label = '', parent = self.UIElements["createAt_rowColumn"])
     
     pm.text(label = '', parent = self.UIElements["createAt_rowColumn"])
     self.UIElements["createAt_averagePosition"] = pm.button(label = "Average Position", command = self.CreateAtAveragePosition, parent = self.UIElements["createAt_rowColumn"])
     pm.text(label = '', parent = self.UIElements["createAt_rowColumn"])
     
     pm.separator(style = 'in', parent = self.UIElements["topLevelColumn"])
     
     
     columnWidth = (windowWidth / 2) - 5
     self.UIElements["button_row"] = pm.rowLayout(numberOfColumns = 2, columnWidth = [(1, columnWidth), (2, columnWidth)], columnAttach = [(1, 'both', 10), (2, 'both', 10)], columnAlign = [(1, 'center'), (2, 'center')], parent = self.UIElements["topLevelColumn"])
     pm.button(label = "Accept", command = self.AcceptWindow, parent = self.UIElements["button_row"])
     pm.button(label = "Cancel", command = self.CancelWindow, parent = self.UIElements["button_row"])
     
     
     pm.showWindow(self.UIElements["window"])
     
     
     self.CreateTemporaryGroupRepresentation()
     
     self.CreateAtAveragePosition()
     
     pm.select(self.tempGroupTransform, replace = True)
     pm.setToolTo("moveSuperContext")
Exemplo n.º 25
0
def multi_ShadowSettings():
	# Shadow Settings
	pm.rowColumnLayout(nc=2)
	pm.text(l='Shadow Settings', w=90, al='left', en=False)
	pm.separator(w=marginWidth-90, h=14)
	pm.setParent(multiLight_layout)

	multi_lightRadius = pm.floatSliderGrp('hp3dLightRadiusSlider', label='Light Radius', field=True, max=10.000, v=1.000, pre=3, cw=[3, 20], dc=fun.partial(multi_floatChange, '.lightRadius', 'spot & point', 'hp3dLightRadiusSlider'))
	multi_lightAngle = pm.floatSliderGrp('hp3dLightAngleSlider', label='Light Angle', field=True, max=10.000, v=1.000, pre=3, cw=[3, 20], dc=fun.partial(multi_floatChange, '.lightAngle', 'directionalLight', 'hp3dLightAngleSlider'))
	multi_shadowRays = pm.intSliderGrp('hp3dShadowRaysSlider', label='Shadow Rays', field=True, max=64, v=1, cw=[3, 20], dc=fun.partial(multi_intChange, '.shadowRays', 'all', 'hp3dShadowRaysSlider'))
	multi_rayDepth = pm.intSliderGrp('hp3dRayDepthSlider', label='Ray Depth Limit', field=True, max=15, v=3, cw=[3, 20], dc=fun.partial(multi_intChange, '.rayDepthLimit', 'all', 'hp3dRayDepthSlider'))
	pm.setParent(multiLight_layout)
Exemplo n.º 26
0
 def initialiseLayout(self):
     """ define the layout of the ui,
         also find every module under the TOOL_FOLDER, create a button for each module found"""
     
     #=======================================================================
     #DEFINE LAYOUT
     #=======================================================================
     self.widgets["toplevel_column"] = pm.columnLayout(adj=True)
     
     # ASSET LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Asset', collapsable=False, labelVisible=False)
     h = pm.horizontalLayout(ratios=[1,5])
     pm.text("Search :")
     self.widgets['assets_searchFilter_textField'] = pm.textField(cc=self.refresh_asset_textScroll)
     h.redistribute()
     pm.setParent("..")
     self.widgets['assets_textScroll'] = pm.textScrollList(ams=True, h=200, selectCommand=self.select_asset_callback)
     
     # IMAGE LAYOUT
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Image', collapsable=True, labelVisible=True)
     pm.scrollLayout(h=130)
     pm.popupMenu()        
     pm.menuItem(label='Open Thumbnail Directory', c=self.thumbnail_directory_open_callback)
     self.widgets['thumbnails_brower'] = pm.horizontalLayout()
     self.widgets['thumbnails_brower'].redistribute()
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.frameLayout(label='Settings', collapsable=True, labelVisible=True)
     pm.rowColumnLayout(numberOfColumns=4)
     pm.text(label='Zoom', w=100)
     self.widgets['zoom_field'] = pm.floatField(minValue=1, value=1, precision=2, w=100)
     pm.separator(style='none')
     pm.separator(style='none')
     pm.text(label='Width', w=100)
     self.widgets['width_field'] = pm.intField(value=100, w=100)
     pm.text(label='Height', w=100)
     self.widgets['height_field'] = pm.intField(value=100, w=100)
     pm.text(label='Offset W', w=100)
     self.widgets['shiftWidth_field'] = pm.floatField( value=0, precision=2, w=100)
     pm.text(label='Offset H', w=100)
     self.widgets['shiftHeight_field'] = pm.floatField( value=0, precision=2, w=100)
     
     
     #
     pm.setParent(self.widgets["toplevel_column"])
     pm.button(label='Generate Thumbnails', c=self.generate_thumbnail)
     
     #INITIAL
     self.refresh_asset_textScroll()
Exemplo n.º 27
0
	def __init__(self, lightTransform, lightType, lightShape):
		super(DirectionalLight, self).__init__(lightTransform, lightType, lightShape)
		pm.setParent(self.indivLight_layout)
		
		pm.rowColumnLayout(nc=2)
		pm.text(l='Shadow Settings', w=90, al='left', en=False)
		pm.separator(w=marginWidth-90, h=14)
		pm.setParent(self.indivLight_layout)

		pm.attrFieldSliderGrp(at=lightShape+'.lightAngle', cw=[[2, 75], [3, 120]], hmb=False)
		self.shadowRays_slide = pm.attrFieldSliderGrp(at=lightShape+'.shadowRays', cw=[[2, 75], [3, 120]], hmb=False)
		pm.attrFieldSliderGrp(at=lightShape+'.rayDepthLimit', cw=[[2, 75], [3, 120]], hmb=False)

		pm.setParent(lights_layout)
Exemplo n.º 28
0
def multi_BasicSettings():
	# Basic Settings
	pm.text(l='', h=5)
	multi_nameField = pm.textFieldGrp('hp3dNameField', l='Name', text='', cw=[2, 150], cc=fun.partial(multi_nameChange, 'hp3dNameField'), fcc=True)

	pm.rowColumnLayout(nc=2)
	pm.text(l='Basic Settings', w=75, al='left', en=False)
	pm.separator(w=marginWidth-75, h=14)
	pm.setParent(multiLight_layout)

	multi_color = pm.colorSliderGrp('hp3dColorSlider', label='Color', rgb=(1, 1, 1), cw=[3, 20], dc=fun.partial(multi_colorChange, '.color', 'all', 'hp3dColorSlider'))
	multi_intensity = pm.floatSliderGrp('hp3dIntensitySlider', label='Intensity', field=True, v=1.000, fmx=1000000000, pre=3, cw=[3, 20], dc=fun.partial(multi_floatChange, '.intensity', 'all', 'hp3dIntensitySlider'))

	# pm.text(l='', h=3) # GUI SPACER
	pm.rowColumnLayout(nc=2)
	pm.text(l='', w=142) # GUI SPACER
	global multi_illDefault_box
	multi_illDefault_box = pm.checkBox(l='Illuminates by Default', v=1, cc=multi_illDefault)
	pm.setParent(multiLight_layout)

	pm.rowColumnLayout(nc=3)
	pm.text(l='', w=142) # GUI SPACER
	multi_emitDiff_box = pm.checkBox('hp3dEmitDiffCheckbox', l='Emit Diffuse', v=1, w=120, cc=fun.partial(multi_checkboxChange, '.emitDiffuse', 'all', 'hp3dEmitDiffCheckbox'))
	multi_emitSpec_box = pm.checkBox('hp3dEmitSpecCheckbox', l='Emit Specular', v=1, cc=fun.partial(multi_checkboxChange, '.emitSpecular', 'all', 'hp3dEmitSpecCheckbox'))
	pm.setParent(multiLight_layout)

	pm.rowColumnLayout(nc=3)
	pm.text(l='Decay Rate', w=140, al='right')
	pm.text(l='', w=3)
	multi_decayRate_menu = pm.optionMenu('hp3dDecayRateMenu', bgc=primary_componentColor, cc=fun.partial(multi_menuChange, '.decayRate', 'not directional', 'hp3dDecayRateMenu'))
	pm.menuItem(l='No Decay', da=0)
	pm.menuItem(l='Linear', da=1)
	pm.menuItem(l='Quadratic', da=2)
	pm.menuItem(l='Cubic', da=3)
	pm.setParent(multiLight_layout)
Exemplo n.º 29
0
    def __init__(self):
        self._window    = pm.window(title='Vibrate', widthHeight=VibrateWindow._size, sizeable=False, maximizeButton=False)
        self._wrapper   = pm.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, VibrateWindow._size[0]), (2, VibrateWindow._size[0])], height=VibrateWindow._size[1])
        self._form      = pm.formLayout(parent=self._wrapper, height=470)
        self._execBtn   = pm.button(label='Set Vibration', parent=self._wrapper, command=State.setVibration)
        self._clearBtn  = pm.button(label='Clear Vibration', parent=self._wrapper, command=State.clearVibration)
        self._tabs      = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5)
        self._subform   = pm.formLayout(self._form, edit=True, attachForm=((self._tabs, 'top', 0), (self._tabs, 'left', 0), (self._tabs, 'bottom', 0), (self._tabs, 'right', 0)))

        self._tabObjects = pm.rowColumnLayout(numberOfColumns=1)
        pm.button(label='Add selected from scene', command=State.addSelectedObjectsFromScene)
        pm.button(label='Remove selected in scene', command=State.removeSelectedObjectInScene)
        pm.button(label='Remove selected in list', command=State.removeSelectedObjectsInList)
        pm.button(label='Remove all', command=State.removeAllObjects)
        self.selectedObjectsList = pm.iconTextScrollList(allowMultiSelection=True, height=(VibrateWindow._size[1] - 150))
        pm.setParent('..')

        self._tabVibration = pm.rowColumnLayout(numberOfColumns=1)

        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Start frame:')
        self.startField = pm.intField(minValue=-999999, maxValue=999999, step=1, value=0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='End frame:')
        self.endField = pm.intField(minValue=-999999, maxValue=999999, step=1, value=1)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='X Force:')
        self.xForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Y Force:')
        self.yForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Z Force:')
        self.zForceField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.1, value=1.0)
        pm.setParent('..')
        
        pm.rowLayout(numberOfColumns=2, columnWidth=[(1, 60), (2, 190)])
        pm.text(label='Speed:')
        self.speedField = pm.floatField(minValue=0.0, maxValue=999999.9, step=0.2, value=1.0)
        pm.setParent('..')
        
        pm.tabLayout(self._tabs, edit=True, tabLabel=((self._tabObjects, 'Objects'), (self._tabVibration, 'Vibration')))
Exemplo n.º 30
0
def bdFrogIKFKUI():
    bdFrogWin = "FrogIKFK"
    if pm.window(bdFrogWin,q=True,ex=True):
	    pm.deleteUI(bdFrogWin)

    pm.window(bdFrogWin,title = "Frog IK <=> FK Switch", widthHeight = [280,80],sizeable=False)
    pm.scrollLayout(horizontalScrollBarThickness=16)
    mainCL = pm.columnLayout(columnAttach=("both",5),rowSpacing=10,columnWidth=280)
    pm.rowColumnLayout(nc=2,cw=[(1,138),(2,138)],p=mainCL)
    pm.button(l="Left Arm",c=bdSwitchLeftArm)
    pm.button(l="Right Arm",c=bdSwitchRightArm)
    pm.button(l="Left Leg",c=bdSwitchLeftLeg)
    pm.button(l="Right Leg",c=bdSwitchRightLeg)
    pm.text(l='Remeber to have a controller selected',p=mainCL)
    pm.showWindow(bdFrogWin)
Exemplo n.º 31
0
    ##Make Iksolver(if mirror is on, mirror joint chain)
    if mirrorEnable == True:
        mirrorJnt(revjntnamelist, sfx, sfx_r)
        applyIK(sfx)
        applyIK(sfx_r)
    else:
        sfx = ""
        applyIK(sfx)


##Create UI
Window = pm.window(title="RevFoot_Tool_Ver1.0",
                   iconName="Short Name",
                   widthHeight=(300, 400))
pm.rowColumnLayout(numberOfColumns=1,
                   columnAttach=(1, 'both', 0),
                   columnWidth=(300, 300))
pm.text(label="Joint name for Thigh")
thigh = pm.textField(tx="Thigh")
pm.text(label="Joint name for Leg")
leg = pm.textField(tx="Leg")
pm.text(label="Joint name for Ancle")
ancle = pm.textField(tx="Ancle")
pm.text(label="Joint name for Heel")
heel = pm.textField(tx="Heel")
pm.text(label="Joint name for Foot")
foot = pm.textField(tx="Foot")
pm.text(label="Joint name for Toe")
toe = pm.textField(tx="Toe")

pm.button(label="Make locators",
Exemplo n.º 32
0
def makeHairUI():
    shapeType = ['circle', 'triangle', 'square']
    axisType = ['x', 'y', 'z']
    mirrorType = ['world', 'local']
    if pm.window('MakeHairUI', ex=True):
        pm.deleteUI('MakeHairUI', window=True)
        pm.windowPref('MakeHairUI', remove=True)
    pm.window('MakeHairUI', t="MakeHairUI")
    pm.frameLayout(label="Create Hair Parameters")
    pm.columnLayout(adjustableColumn=1)
    pm.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 90), (2, 100)])
    pm.text(label="Name: ", align='right')
    hairNameUI = pm.textField(text="HairMesh#")
    pm.text(label="Material: ", align='right')
    matNameUI = pm.textField(text="SY_mtl_hairSG")
    pm.text(label="CreaseSet: ", align='right')
    hsSetNameUI = pm.textField(text="hairCrease")
    #pm.text(label="PointCreaseSet: ",align='right')
    #hpSetNameUI=pm.textField(text="hairPointCrease")
    pm.text(label="Length Divs: ", align='right')
    LDivsValUI = pm.intField(value=7, min=4)
    pm.text(label="Width Divs: ", align='right')
    WDivsValUI = pm.intField(value=4, min=4)
    pm.text(label="Segments: ", align='right')
    segmentValUI = pm.intField(value=4, min=2)
    pm.text(label="Width: ", align='right')
    segmentWidthUI = pm.floatField(value=1, min=0.01)
    pm.text(label="Delete Curves: ", align='right')
    DelCurveUI = pm.checkBox(label="   ", value=False)
    pm.text(label="Reverse: ", align='right')
    RevCurveUI = pm.checkBox(label="   ", value=False)
    pm.text(label="Control Type: ", align='right')
    cShapeOpUI = pm.optionMenu()
    for st in shapeType:
        pm.menuItem(label=st)
    pm.text(label="Mirror Type: ", align='right')
    mirrorOpUI = pm.optionMenu()
    for mt in mirrorType:
        pm.menuItem(label=mt)
    pm.text(label="Mirror Axis: ", align='right')
    axisOpUI = pm.optionMenu()
    for ax in axisType:
        pm.menuItem(label=ax)
    pm.button(label="SelectCtr", c=lambda *arg: selHair())
    pm.popupMenu()
    pm.menuItem(label='Set pivot to root',
                c=lambda *arg: selHair(setPivot=True))
    pm.menuItem(label='Set pivot to tip',
                c=lambda *arg: selHair(pivot=-1, setPivot=True))
    pm.menuItem(label='Show all controls',
                c=lambda *arg: ToggleHairCtrlVis(state='show'))
    pm.menuItem(label='Hide all controls',
                c=lambda *arg: ToggleHairCtrlVis(state='hide'))
    pm.button(label="Create",
              c=lambda *arg: makeHairMesh(name=hairNameUI.getText(),
                                          mat=matNameUI.getText(),
                                          cSet=hsSetNameUI.getText(),
                                          reverse=RevCurveUI.getValue(),
                                          lengthDivs=LDivsValUI.getValue(),
                                          widthDivs=WDivsValUI.getValue(),
                                          Segments=segmentValUI.getValue(),
                                          width=segmentWidthUI.getValue(),
                                          curveDel=DelCurveUI.getValue(),
                                          cShape=cShapeOpUI.getValue()))
    pm.popupMenu()
    pm.menuItem(
        label='Rebuild',
        c=lambda *arg: selHair(
            rebuild=[True, LDivsValUI.getValue(),
                     WDivsValUI.getValue()]))
    pm.menuItem(
        label='Rebuild also controls',
        c=lambda *arg: selHair(
            rebuild=[True, LDivsValUI.getValue(),
                     WDivsValUI.getValue()],
            cShape=(True, cShapeOpUI.getValue(), segmentWidthUI.getValue())))
    pm.button(label="Duplicate", c=lambda *arg: dupHairMesh())
    pm.popupMenu()
    pm.menuItem(label='Mirror',
                c=lambda *arg: dupHairMesh(mirror=True,
                                           axis=axisOpUI.getValue(),
                                           space=mirrorOpUI.getValue()))
    pm.button(label="RemoveHair", c=lambda *arg: delHair())
    pm.popupMenu()
    pm.menuItem(label='RemoveControl', c=lambda *arg: delHair(keepHair=True))
    pm.menuItem(label='RemoveAllControl', c=lambda *arg: cleanHairMesh())
    pm.setParent('..')
    pm.showWindow()
Exemplo n.º 33
0
        ph_displayWindow(displayWindow, displayMessage)

    #select original selection
    py.select(clear=True)
    for i in range(len(storeSelection)):
        py.select(storeSelection[i], add=True)


global win
try:
    win.delete()
except:
    pass

win = py.window(title="Instance objects", mxb=False, s=False)
win_layout1 = py.rowColumnLayout(numberOfColumns=1)
py.text(
    label=
    "This will generate multiple instances of geometry to place on an object. Possible uses could include designing<br> a forest or field.<br><font size='2' color = 'grey'>Note: Due to current limitations of the code, pivots are reset when instancing. If using paint effects, please draw them at<br/> the centre of the scene to make sure they are accurately placed.",
    align="left")
win_layout = py.rowColumnLayout(numberOfColumns=4)
py.text(label='  ')
py.text(label=' ')
py.text(label='      ')
py.text(label=' ')
py.text(label=' ')
py.text(label="   Select object(s) to be instanced ", align="left")
py.text(label=' ')
py.text(label='Maximum duplicate object count  ', align="right")
py.text(label=' ')
win_storeObj = py.button(label="Store object(s)",
def lcMoveImagePlaneUI(dockable=False, *args, **kwargs):
    ''' '''
    ci = 0  #color index iterator
    windowName = 'lcMoveImagePlane'
    shelfCommand = 'import lct.src.lcMoveImagePlane.lcMoveImagePlane as lcMIP\nreload(lcMIP)\nlcMIP.lcMoveImagePlaneUI()'
    icon = basePath + 'lcMoveImagePlane.png'
    winWidth = 204
    winHeight = 103

    mainWindow = lcWindow(windowName=windowName,
                          width=winWidth,
                          height=winHeight,
                          icon=icon,
                          shelfCommand=shelfCommand,
                          annotation=annotation,
                          dockable=dockable,
                          menuBar=True)
    mainWindow.create()

    #
    pm.columnLayout(prefix + '_columLayout_main')

    #
    pm.rowColumnLayout(nc=3, cw=([1, 66], [2, 66], [3, 66]))
    pm.button(
        l='Front',
        bgc=colorWheel.getColorRGB(ci),
        w=66,
        h=25,
        annotation='Create an image plane for the front camera',
        command=lambda *args: mip_make_image_plane('front', imageListDropdown))
    ci += 1
    pm.button(
        l='Side',
        bgc=colorWheel.getColorRGB(ci),
        w=66,
        h=25,
        annotation='Create an image plane for the side camera',
        command=lambda *args: mip_make_image_plane('side', imageListDropdown))
    ci += 1
    pm.button(
        l='Top',
        bgc=colorWheel.getColorRGB(ci),
        w=66,
        h=25,
        annotation='Create an image plane for the top camera',
        command=lambda *args: mip_make_image_plane('top', imageListDropdown))
    ci += 1
    pm.setParent(prefix + '_columLayout_main')

    #
    pm.rowColumnLayout(nc=2, cw=([1, 25], [2, 175]))
    pm.iconTextButton(
        w=25,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'reloadList.png',
        annotation='Reload the image planes list',
        command=lambda *args: mip_populate_image_list(imageListDropdown))
    imageListDropdown = pm.optionMenu(
        prefix + '_optionMenu_image_plane_list',
        w=175,
        h=25,
        annotation='List of orthographic image planes')
    pm.setParent(prefix + '_columLayout_main')

    #
    pm.button(
        l='Make Image Plane Move Control',
        bgc=colorWheel.getColorRGB(ci),
        w=200,
        h=25,
        annotation='Create control curve for image plane from drop down list',
        command=lambda *args: mip_make_ctrl(imageListDropdown))
    ci += 1

    #
    mainWindow.show()

    mip_populate_image_list(imageListDropdown)
Exemplo n.º 35
0
def lcBatchBakeUI(dockable=False, asChildLayout=False, *args, **kwargs):
    ''' '''
    global lct_cfg
    global prefix
    global defaultPath

    windowName = 'lcBatchBake'
    shelfCommand = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI()'.format(
        windowName, prefix)
    commandString = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI(asChildLayout=True)'.format(
        windowName, prefix)
    icon = basePath + 'lcBatchBake.png'
    winWidth = 205
    winHeight = 243

    if pm.window(windowName, ex=True):
        pm.deleteUI(windowName)

    if not asChildLayout:
        lcUI.UI.lcToolbox_child_popout(prefix + '_columnLayout_main',
                                       windowName, height, commandString,
                                       iconPath, lct_cfg)
        mainWindow = lcUI.lcWindow(prefix=prefix,
                                   windowName=windowName,
                                   width=winWidth,
                                   height=winHeight,
                                   icon=icon,
                                   shelfCommand=shelfCommand,
                                   annotation=annotation,
                                   dockable=dockable,
                                   menuBar=True)
        mainWindow.create()

    #
    pm.columnLayout(prefix + '_columnLayout_main')

    # check for mental ray plugin
    mental_ray_available = lcPlugin.Plugin.reload_plugin(plugin='Mayatomr',
                                                         autoload=True)

    if mental_ray_available:
        #
        pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
        pm.button(l='Make Texture Set',
                  bgc=colorWheel.getPrev(),
                  w=100,
                  h=35,
                  annotation='Create a Texture bake set',
                  command=lambda *args: lcBake_make_new_bake_set(
                      bakeSetListDropdown, 'texture'))
        pm.button(l='Make Vertex Set',
                  bgc=colorWheel.getPrev(),
                  w=100,
                  h=35,
                  annotation='Create a Texture bake set',
                  command=lambda *args: lcBake_make_new_bake_set(
                      bakeSetListDropdown, 'vertex'))
        pm.setParent(prefix + '_columnLayout_main')

        #
        pm.rowColumnLayout(nc=3, cw=([1, 25], [2, 150], [3, 25]))
        pm.symbolButton(h=25,
                        image=os.path.join(iconPath, 'reloadList.png'),
                        annotation='Reload the bake set list',
                        command=lambda *args: lcBake_populate_bake_set_list(
                            bakeSetListDropdown))
        bakeSetListDropdown = pm.optionMenu(prefix +
                                            '_optionMenu_bake_set_list',
                                            w=150,
                                            h=25,
                                            annotation='List of bake sets')
        bakeSetListDropdown.changeCommand(
            lambda *args: lcBake_choose_active(bakeSetListDropdown))
        button_delete_sets = pm.symbolButton(
            h=25,
            image=os.path.join(iconPath, 'deleteItem.png'),
            annotation='Delete this bake set',
            command=lambda *args: lcBake_delete_current_bake_set(
                bakeSetListDropdown))
        popup_delete_sets = pm.popupMenu(parent=button_delete_sets)
        pm.menuItem(l='Delete all bake sets',
                    parent=popup_delete_sets,
                    command=lambda *args: lcBake_delete_all_bake_sets(
                        bakeSetListDropdown))
        pm.setParent(prefix + '_columnLayout_main')

        #
        pm.rowColumnLayout(nc=2,
                           cw=([1, 100],
                               [2,
                                100]))  #nc=3, cw=([1,50], [2,50], [3,100] ) )
        pm.button(l='+ Add',
                  bgc=colorWheel.getPrev(),
                  w=100,
                  h=25,
                  annotation='Add geometry to bake set',
                  command=lambda *args: lcBake_add_to_current_bake_set(
                      bakeSetListDropdown))
        # pm.button(l='- Rem', bgc=colorWheel.getPrev(), w=50, h=25, annotation='Remove geometry from bake set', command=lambda *args: lcBake_fake_command() )
        # ci+=1
        pm.button(l='Edit Options',
                  bgc=colorWheel.getPrev(),
                  w=100,
                  h=25,
                  annotation='Edit the bake set options',
                  command=lambda *args: lcBake_show_bake_set_attrs(
                      bakeSetListDropdown))
        pm.setParent(prefix + '_columnLayout_main')

        #
        pm.rowColumnLayout(nc=2, cw=([1, 75], [2, 125]))
        pm.text(l='Bake Camera: ', al='right')
        cameraListDropdown = pm.optionMenu(prefix + '_optionMenu_camera_list',
                                           w=125,
                                           h=25,
                                           annotation='List of cameras')
        cameraListDropdown.changeCommand(lambda *args: lct_cfg.set(
            'lcBatchBakeCamList', cameraListDropdown.getSelect()))
        pm.text(l='')
        pm.checkBox(
            prefix + '_checkBox_shadows',
            w=125,
            h=25,
            value=True,
            label='Shadows and AO?',
            annotation='Turn on to bake shadows and ambient occlusion',
            changeCommand=lambda *args: lct_cfg.set(
                'lcBatchBakeShadows',
                pm.checkBox(prefix + '_checkBox_shadows', query=True, v=True)))
        pm.setParent(prefix + '_columnLayout_main')

        #
        pm.separator(style='none', h=10)
        lcUI.UI.lc_browse_field_button(width=200,
                                       textFieldName=prefix +
                                       '_textField_texture_path',
                                       lct_cfg=lct_cfg,
                                       configAttr='lcBatchBakePath',
                                       placeholderText=defaultPath,
                                       annotation='Choose an export directory')

        # pm.rowColumnLayout(nc=2, cw=([1,150], [2,50]) )
        # pm.textField(prefix+'_textField_texture_path', tx=defaultPath, annotation='Output directory path', w=150, changeCommand=lambda *args: lct_cfg.set('lcBatchBakePath', pm.textField(prefix+'_textField_texture_path', query=True, tx=True)))
        # pm.button(prefix+'_button_browse_path', l='Browse', bgc=colorWheel.getPrev(), annotation='Choose a directory', w=50, command=lambda *args: lcBake_setExportPath() )
        # ci+=1
        pm.setParent(prefix + '_columnLayout_main')

        #
        pm.rowColumnLayout(nc=2, cw=([1, 150], [2, 50]))
        pm.button(l='Bake It !!',
                  bgc=colorWheel.getPrev(),
                  w=150,
                  h=40,
                  annotation='Bake to texture or vertex',
                  command=lambda *args: lcBake_convert_lightmap(
                      bakeSetListDropdown, cameraListDropdown))
        pm.symbolButton(prefix + '_button_open_folder',
                        bgc=(0.18, 0.18, 0.18),
                        image=os.path.join(srcPath, 'icons', 'folder_med.png'),
                        annotation='Open the export folder',
                        command=lambda *args: lcBake_openExportPath())

    # mental ray was not found!
    else:
        pm.text(l="Mental Ray plug-in not found",
                al='center',
                w=200,
                h=215,
                font='boldLabelFont')

    #
    if not asChildLayout:
        mainWindow.show()
        pm.window(mainWindow.mainWindow, edit=True, h=winHeight, w=winWidth)
    else:
        pm.setParent('..')
        pm.setParent('..')

    #
    if mental_ray_available:
        #edit menus
        optionsMenu, helpMenu = lcUI.UI.lcToolbox_child_menu_edit(
            asChildLayout, windowName)

        pm.menuItem(parent=optionsMenu, divider=True, dividerLabel=windowName)
        pm.menuItem(parent=optionsMenu,
                    l='Delete All Bake Sets',
                    command=lambda *args: lcBake_delete_all_bake_sets(
                        bakeSetListDropdown))

        #populate lists
        lcBake_populate_bake_set_list(bakeSetListDropdown)
        lcBake_populate_camera_list(cameraListDropdown)

        #Restore Interface Selections
        bakeSetListDropdown.setSelect(lct_cfg.get('lcBatchBakeSetList'))
        cameraListDropdown.setSelect(lct_cfg.get('lcBatchBakeCamList'))
        pm.checkBox(prefix + '_checkBox_shadows',
                    edit=True,
                    value=lct_cfg.get('lcBatchBakeShadows'))
        pm.textField(prefix + '_textField_texture_path',
                     edit=True,
                     text=lct_cfg.get('lcBatchBakePath'))

        #update interface highlighting
        if lct_cfg.get('lcBatchBakeSetList') > 1:
            lcBake_glow(bakeSetListDropdown)

        # validate export directory
        lcPath.Path.validatePathTextField(prefix + '_textField_texture_path',
                                          lct_cfg, 'lcBatchBakePath',
                                          defaultPath)
Exemplo n.º 36
0
    def run(self):

        self.logger.debug('--- run()')


        #get namespaces
        self.get_scene_namespaces()

        global win

        if pm.window(self.window_name, q = True, ex = True):
            pm.deleteUI(self.window_name)

        if pm.windowPref(self.window_name, q = True, ex = True):
            pm.windowPref(self.window_name, r = True)

        win = pm.window(self.window_name, title = self.window_name, w = 150, h = 100,
                        te = 210, le = 70)

        layout1 = pm.rowColumnLayout(numberOfColumns = 1, cw = [(1,150)])

        '''
        character namespaces
        '''

        pm.optionMenu('optionMenu_ns_ulfbert', label = ' Ulfbert:')
        pm.menuItem( label = self.optionMenu_default_value)
        for obj in self.ns_ulfbert:
            pm.menuItem( label = obj)
        pm.optionMenu('optionMenu_ns_snorri', label = ' Snorri:')
        pm.menuItem( label = self.optionMenu_default_value)
        for obj in self.ns_snorri:
            pm.menuItem( label = obj)
        pm.optionMenu('optionMenu_ns_helga', label = ' Helga:')
        pm.menuItem( label = self.optionMenu_default_value)
        for obj in self.ns_helga:
            pm.menuItem( label = obj)

        pm.text(label = '')

        '''
        TANKARD
        '''
        pm.text(label = '--TANKARD--')
        pm.button('b_initialize_tankard', label = "Initialize", c = self.initialize_tankard,
                   annotation = 'Select tankard root and press >Initialize> button')
        pm.text(label = '')

        pm.text(label = 'Select Parent Space:')
        pm.text(label = '')
        pm.optionMenu('optionMenu_tankard', enable = False)

        pm.menuItem( label = self.optionMenu_default_value)
        for obj in self.follow_values:
            pm.menuItem( label = obj)
        pm.text(label = '')

        pm.button('b_switch_PS_tankard', label = "-", c = self.switch_PS_tankard, enable = False)
        pm.text(label = '')

        pm.button('b_select_switch_obj_tankard', label = "-", c = self.select_switch_obj_tankard, enable = False)
        pm.text(label = '')

        win.show()
Exemplo n.º 37
0
    def TheaTranslatorCreateTab(self):
        log.debug("TheaTranslatorCreateTab()")
        self.createGlobalsNode()
        parentForm = pm.setParent(query=True)
        pm.setUITemplate("attributeEditorTemplate", pushTemplate=True)
        scLo = self.rendererName + "TrScrollLayout"

        with pm.scrollLayout(scLo, horizontalScrollBarThickness=0):
            with pm.columnLayout(self.rendererName + "TrColumnLayout",
                                 adjustableColumn=True,
                                 width=400):
                with pm.frameLayout(label="Translator",
                                    collapsable=True,
                                    collapse=False):
                    attr = pm.Attribute(self.renderGlobalsNodeName +
                                        ".translatorVerbosity")
                    ui = pm.attrEnumOptionMenuGrp(
                        label="Translator Verbosity",
                        at=self.renderGlobalsNodeName + ".translatorVerbosity",
                        ei=self.getEnumList(attr))
                with pm.frameLayout(label="Thea XML export",
                                    collapsable=True,
                                    collapse=False):
                    ui = pm.checkBoxGrp(label="Export scene XML file:",
                                        value1=False)
                    pm.connectControl(ui,
                                      self.renderGlobalsNodeName +
                                      ".exportXMLFile",
                                      index=2)
                    xmlDict = {}
                    self.rendererTabUiDict['xml'] = xmlDict
                    with pm.rowColumnLayout(nc=3, width=120):
                        pm.text(label="XMLFileName:", width=60, align="right")
                        defaultXMLPath = pm.workspace.path + "/" + pm.sceneName(
                        ).basename().split(".")[0] + ".Thea"
                        xmlDict['xmlFile'] = pm.textField(text=defaultXMLPath,
                                                          width=60)
                        pm.symbolButton(image="navButtonBrowse.png",
                                        c=self.xmlFileBrowse)
                        pm.connectControl(xmlDict['xmlFile'],
                                          self.renderGlobalsNodeName +
                                          ".exportXMLFileName",
                                          index=2)
                with pm.frameLayout(label="Optimize Textures",
                                    collapsable=True,
                                    collapse=False):
                    with pm.rowColumnLayout(nc=3, width=120):
                        optiDict = {}
                        pm.text(label="OptimizedTex Dir:",
                                width=60,
                                align="right")
                        self.rendererTabUiDict['opti'] = optiDict
                        pm.symbolButton(image="navButtonBrowse.png",
                                        c=self.dirBrowse)
                        optiDict['optiField'] = pm.textField(
                            text=self.renderGlobalsNode.optimizedTexturePath.
                            get(),
                            width=60)
                        pm.connectControl(optiDict['optiField'],
                                          self.renderGlobalsNodeName +
                                          ".optimizedTexturePath",
                                          index=2)
                with pm.frameLayout(label="Additional Settings",
                                    collapsable=True,
                                    collapse=False):
                    ui = pm.floatFieldGrp(label="Scene scale:",
                                          value1=1.0,
                                          numberOfFields=1)
                    pm.connectControl(ui,
                                      self.renderGlobalsNodeName +
                                      ".sceneScale",
                                      index=2)

        pm.setUITemplate("attributeEditorTemplate", popTemplate=True)
        pm.formLayout(parentForm,
                      edit=True,
                      attachForm=[(scLo, "top", 0), (scLo, "bottom", 0),
                                  (scLo, "left", 0), (scLo, "right", 0)])
Exemplo n.º 38
0
    def create(self):
        '''
        this creates the gui components for the node
        '''
        
        # getting the amount of keys for each attr
        self.count_TU = pm.keyframe( '%s.translateU' % (self.node) , query=True,
                                    keyframeCount=True ) # translate U
        
        self.count_TV = pm.keyframe( '%s.translateV' % (self.node) , query=True,
                                    keyframeCount=True ) # translate V
        
        self.count_PU = pm.keyframe( '%s.pivotU' % (self.node) , query=True,
                                    keyframeCount=True ) # pivot U
        
        self.count_PV = pm.keyframe( '%s.pivotV' % (self.node) , query=True,
                                    keyframeCount=True ) # pivot V
        
        self.count_SU = pm.keyframe( '%s.scaleU' % (self.node) , query=True,
                                    keyframeCount=True ) # scale U
        
        self.count_SV = pm.keyframe( '%s.scaleV' % (self.node) , query=True,
                                    keyframeCount=True ) # scale V
        
        self.count_R = pm.keyframe( '%s.random' % (self.node) , query=True,
                                   keyframeCount=True ) # random
        
        self.count_RA = pm.keyframe( '%s.rotationAngle' % (self.node) , query=True,
                                    keyframeCount=True ) # rotation Angle
        
        
        pm.setParent(self.layout)
        self.temp_layout = pm.columnLayout(adjustableColumn= False, width= 340)
        
        # if the counts < 1 than the Anim curve node doesnt exist
        # the if statements just check which nodes exist
        
        if self.count_TU >= 1:
            pm.setParent(self.temp_layout)
            TU = Anim_UI(node= '%s_translateU' % (self.node), count = self.count_TU)
            TU.create()
            
            # insert key
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.translateU' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.translateU' % (self.node), index= delete_field))

        if self.count_TV >= 1:
            pm.setParent(self.temp_layout)
            TV = Anim_UI(node= '%s_translateV' % (self.node), count = self.count_TV)
            TV.create()
            
            # insert key
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.translateV' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.translateV' % (self.node), index= delete_field))

        if self.count_RA >= 1:
            pm.setParent(self.temp_layout)
            RA = Anim_UI(node= '%s_rotationAngle' % (self.node), count = self.count_RA)
            RA.create()
            
            # insert key
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.rotationAngle' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.rotationAngle' % (self.node), index= delete_field))

        if self.count_PU >= 1:
            pm.setParent(self.temp_layout)
            PU = Anim_UI(node= '%s_pivotU' % (self.node), count = self.count_PU)
            PU.create()
            
            # insertkey
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.pivotU' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.pivotU' % (self.node), index= delete_field))
            
        if self.count_PV >= 1:
            pm.setParent(self.temp_layout)
            PV = Anim_UI(node= '%s_pivotV' % (self.node), count = self.count_PV)
            PV.create()
            
            # insert key
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.pivotV' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.pivotV' % (self.node), index= delete_field))
            
        if self.count_SU >= 1:
            pm.setParent(self.temp_layout)
            SU = Anim_UI(node= '%s_scaleU' % (self.node), count = self.count_SU)
            SU.create()
            
            # insert key
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.scaleU' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.scaleU' % (self.node), index= delete_field))
            
        if self.count_SV >= 1:
            pm.setParent(self.temp_layout)
            SV = Anim_UI(node= '%s_scaleV' % (self.node), count = self.count_SV)
            SV.create()
            
            # insert key
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.scaleV' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.scaleV' % (self.node), index= delete_field))
            
        if self.count_R >= 1:
            pm.setParent(self.temp_layout)
            random = Anim_UI(node= '%s_random' % (self.node), count = self.count_R)
            random.create()
            
            # index key
            pm.setParent('..')
            pm.text(label= 'Insert Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Position')
            insert_field = pm.intField()
            pm.button(label= 'Insert', command= pm.Callback(self.insert_key,
               attr= '%s.random' % (self.node), value= insert_field))
            
            # delete key
            pm.setParent('..')
            pm.text(label= 'Delete Key')
            pm.rowColumnLayout(numberOfColumns= 3, columnWidth= ([1,113], [2,113], [3,113]))
            pm.text(label= 'Key Index')
            delete_field = pm.intField()
            pm.button(label= 'Delete', command= pm.Callback(self.delete_key,
               attr= '%s.random' % (self.node), index= delete_field))
def lcRetopoBasicUI(dockable=False, *args, **kwargs):
    """ """
    ci = 0  #color index iterator
    windowName = 'lcRetopoBasic'
    shelfCommand = 'import lct.src.lcRetopoBasic.lcRetopoBasic as lcRtB\nreload(lcRtB)\nlcRtB.lcRetopoBasicUI()'
    icon = basePath + 'lcRetopoBasic.png'
    winWidth = 204
    winHeight = 180

    mainWindow = lcWindow(windowName=windowName,
                          width=winWidth,
                          height=winHeight,
                          icon=icon,
                          shelfCommand=shelfCommand,
                          annotation=annotation,
                          dockable=dockable,
                          menuBar=True)
    mainWindow.create()

    #
    pm.columnLayout(prefix + '_columLayout_main')

    pm.button(l='Setup for Retopo',
              bgc=colorWheel.getColorRGB(ci),
              w=200,
              h=25,
              annotation='Setup a high res mesh for retopology',
              command=lambda *args: rtb_setup_live_mesh(highresListDropdown))
    ci += 1

    #
    pm.rowColumnLayout(nc=3, cw=([1, 25], [2, 150], [3, 25]))
    pm.iconTextButton(
        w=25,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'reloadMeshList.png',
        annotation='Reload the list of high res meshes',
        command=lambda *args: rtb_highres_list_populate(highresListDropdown))
    highresListDropdown = pm.optionMenu(
        prefix + '_optionMenu_highres_list',
        w=150,
        h=25,
        bgc=[0.5, 0.5, 0.5],
        annotation='List of high res meshes in the scene')
    highresListDropdown.changeCommand(
        lambda *args: rtb_choose_active(highresListDropdown))
    pm.iconTextButton(
        w=25,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'removeMeshFromList.png',
        annotation=
        'Remove current high res mesh from the list and return it to a normal state',
        command=lambda *args: rtb_remove(highresListDropdown))
    pm.setParent(prefix + '_columLayout_main')

    #
    pm.rowColumnLayout(nc=4, cw=([1, 50], [2, 100], [3, 25], [4, 25]))
    pm.iconTextStaticLabel(w=50,
                           h=25,
                           style='iconOnly',
                           image=iconBasePath + 'meshLayering.png',
                           annotation='Drag slider to change mesh layering')
    pm.floatSlider(
        prefix + '_floatSlider_layer_mesh',
        step=0.01,
        min=0,
        max=1,
        v=0,
        h=25,
        dragCommand=lambda *args: rtb_scale_layer_mesh(highresListDropdown))
    pm.iconTextButton(
        w=25,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'toggleXray.png',
        annotation='Toggle current high res mesh X-Ray',
        command=lambda *args: rtb_toggle_xray(highresListDropdown))
    pm.iconTextButton(
        w=25,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'hideMesh.png',
        annotation='Hide the high-res mesh',
        command=lambda *args: rtb_toggle_hide(highresListDropdown))
    pm.setParent(prefix + '_columLayout_main')

    #
    pm.rowColumnLayout(nc=3, cw=([1, 50], [2, 100], [3, 50]))
    pm.iconTextStaticLabel(
        w=50,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'shaderOpacity.png',
        annotation='Drag slider to change shader transparency')
    pm.floatSlider(prefix + '_floatSlider_topo_trans',
                   step=0.1,
                   min=0,
                   max=1,
                   v=0.5,
                   h=25,
                   dragCommand=lambda *args: rtb_update_topo_transparency())
    pm.iconTextButton(
        w=50,
        h=25,
        style='iconOnly',
        image=iconBasePath + 'assignShader.png',
        annotation=
        'Create and/or assign a semi-transparent shader to selected low res mesh',
        command=lambda *args: rtb_create_retopo_shader())
    pm.setParent(prefix + '_columLayout_main')

    #
    pm.separator(style='in', h=5,
                 hr=True)  #this doesn't seem to be working right

    pm.rowColumnLayout(nc=2)
    pm.button(
        l='Relax',
        bgc=colorWheel.getColorRGB(ci),
        w=100,
        h=25,
        annotation='Relax selected verts and shrink-wrap them to the live mesh',
        command=lambda *args: rtb_relax_verts(highresListDropdown))
    ci += 1
    pm.button(l='Shrink-Wrap',
              bgc=colorWheel.getColorRGB(ci),
              w=100,
              h=25,
              annotation='Shrink-wrap selected verts to the live mesh',
              command=lambda *args: rtb_shrink_wrap_verts(highresListDropdown))
    ci += 1
    pm.setParent(prefix + '_columLayout_main')

    #
    pm.progressBar(prefix + '_progress_control', vis=False, w=202)

    #
    mainWindow.show()

    rtb_highres_list_populate(highresListDropdown)

    #vertex animation cache in viewport 2.0 must be disabled or the mesh will not update properly
    if pm.objExists('hardwareRenderingGlobals'):
        pm.PyNode('hardwareRenderingGlobals').vertexAnimationCache.set(0)
Exemplo n.º 40
0
def win(*args):

    win = 'bsCorrectiveWindow'

    if pm.window(win, q=True, exists=True):
        pm.deleteUI(win)
        if pm.window(win, q=True, exists=True):
            pm.deleteUI(win)

    win = pm.window(win,
                    t='Corrective Blendshape Model Helper',
                    sizeable=False,
                    rtf=True)

    mainLwt = pm.columnLayout(w=350)

    #Sculpt Frame
    pm.frameLayout('Sculpt', bgc=[0, 0, 0], bs='out', w=350)
    pm.text(
        'To start, simply select the base mesh you wish to sculpt.\nPress "Start Sculpt". Once done, press "Extract Shape"'
    )

    pm.rowColumnLayout(nc=2, cw=[(1, 175), (2, 170)])
    pm.separator(h=3, st='none')
    pm.separator(h=3, st='none')

    pm.button('Start Sculpt', c=na_bsCorrectiveSculpt.cbsStart)
    pm.button('Extract Shape', c=na_bsCorrectiveSculpt.cbsTrans)
    pm.separator(st='none', h=10)

    #Utilities Frame
    pm.frameLayout('Other Utilities',
                   bgc=[0, 0, 0],
                   p=mainLwt,
                   cll=True,
                   cl=True,
                   bs='in',
                   w=350)
    colLwt = pm.columnLayout(rs=5, adj=True)

    #Clear Tweaks Sub-frame
    pm.frameLayout('Clear Tweaks', p=colLwt, cll=True, cl=True)
    pm.separator(h=2, st='none')
    pm.button('Run', c=na_bsCorrectiveSculpt.clearTweaks)
    pm.separator(st='none')

    #Mirror Shape Sub-frame
    mirFrmLwt = pm.frameLayout('Mirror Shape', p=colLwt, cll=True, cl=True)
    pm.separator(h=2, st='none')
    mirRcLwt = pm.rowColumnLayout(nc=2, cw=[(1, 170), (2, 170)], cs=(2, 10))

    pm.columnLayout(rs=1, adj=True, p=mirRcLwt)
    pm.text('Target', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1, 25), (2, 140)])
    mirTargBtn = pm.button(l=' + ')
    mirTargTf = pm.textField()
    mirTargBtn.setCommand(partial(populateFromSel, mirTargTf))

    pm.columnLayout(rs=1, adj=True, p=mirRcLwt)
    pm.text('Base', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1, 25), (2, 130)])
    mirBaseBtn = pm.button(l=' + ')
    mirBaseTf = pm.textField()
    mirBaseBtn.setCommand(partial(populateFromSel, mirBaseTf))

    pm.button('Run', p=mirFrmLwt, c=partial(mirrorRun, mirTargTf, mirBaseTf))
    pm.separator(st='none', p=mirFrmLwt)

    #Hook Up Sub-frame
    huFrmLwt = pm.frameLayout('Hook Up Shapes', p=colLwt, cll=True, cl=True)
    pm.separator(h=2, st='none')
    pm.text(
        'To use this tool, fill out the lower section, \nselect the mesh you wish to add as a target, then run\n'
    )
    huRcLwt = pm.rowColumnLayout(nc=2, cw=[(1, 170), (2, 160)], cs=(2, 10))

    huCol1 = pm.columnLayout(rs=1, adj=True, p=huRcLwt)
    pm.text('Base', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1, 20), (2, 145)])
    huBaseBtn = pm.button(l=' + ')
    huBaseTf = pm.textField()

    pm.setParent(huCol1)
    pm.separator(h=10, st='none')
    pm.text('Driver', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1, 20), (2, 145)])
    huDriverBtn = pm.button(l=' + ')
    huDriverTf = pm.textField()
    huDriverBtn.setCommand(partial(populateFromSel, huDriverTf))

    huCol2 = pm.columnLayout(rs=1, adj=True, p=huRcLwt)
    pm.text('Blendshape Deformer', al='center')
    bsOpt = pm.optionMenu(l='')
    pm.menuItem(l='<Create New>')

    huBaseTf.changeCommand(partial(populateBsMen, huBaseTf.getText(), bsOpt))
    huBaseTf.enterCommand(partial(populateBsMen, huBaseTf.getText(), bsOpt))
    huBaseBtn.setCommand(partial(populateFromSel, huBaseTf, bsOpt))

    pm.setParent(huCol2)
    pm.separator(h=15, st='none')
    pm.text('     Attribute (RMB for Options)', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1, 20), (2, 135)])
    pm.text(l='.   ')
    huAttrTf = pm.textField()
    attrPop = pm.popupMenu(button=3)
    pm.menuItem('Enter Driver First')
    attrPop.postMenuCommand(
        partial(populateAttrMen, huDriverTf, attrPop, huAttrTf))

    pm.setParent(huFrmLwt)
    pm.separator()
    pm.text('Key Info')

    kiRcLwt = pm.rowColumnLayout(nc=2, cw=[(1, 165), (2, 165)], cs=(2, 10))

    pm.columnLayout(rs=1, adj=True, p=kiRcLwt)
    pm.text('Driver value for weight=0:', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1, 25), (2, 137)])
    kiZeroBtn = pm.button(l=' > ')
    kiZeroFf = pm.floatField(v=0)
    kiZeroBtn.setCommand(
        partial(floatFieldFromDriver, huDriverTf, huAttrTf, kiZeroFf))

    pm.columnLayout(rs=1, adj=True, p=kiRcLwt)
    pm.text('Driver value for weight=1:', al='center')
    pm.rowColumnLayout(nc=2, cw=[(1, 25), (2, 130)])
    kiOneBtn = pm.button(l=' > ')
    kiOneFf = pm.floatField(v=90)
    kiOneBtn.setCommand(
        partial(floatFieldFromDriver, huDriverTf, huAttrTf, kiOneFf))

    pm.setParent(kiRcLwt)
    pm.separator(h=7, st='none')
    pm.separator(h=7, st='none')
    kiZeroTan = pm.optionMenu()
    pm.menuItem(l='spline')
    pm.menuItem(l='linear')
    pm.menuItem(l='clamped')
    pm.menuItem(l='stepped')
    pm.menuItem(l='flat')
    pm.menuItem(l='plateau')
    pm.menuItem(l='auto')
    kiOneTan = pm.optionMenu()
    pm.menuItem(l='spline')
    pm.menuItem(l='linear')
    pm.menuItem(l='clamped')
    pm.menuItem(l='stepped')
    pm.menuItem(l='flat')
    pm.menuItem(l='plateau')
    pm.menuItem(l='auto')
    pm.separator(h=7, st='none')
    pm.separator(h=7, st='none')
    priCb = pm.checkBox('Pre Infinity')
    poiCb = pm.checkBox('Post Infinity')

    pm.button(l='Run',
              p=huFrmLwt,
              c=partial(hookupRun, huBaseTf, bsOpt, huDriverTf, huAttrTf,
                        kiZeroFf, kiOneFf, kiZeroTan, kiOneTan, priCb, poiCb))
    pm.separator(st='none', p=mirFrmLwt)

    #Info Sub-frame
    pm.frameLayout('Information', p=colLwt, cll=True, cl=True)
    pm.separator(st='none')
    pm.button('About', w=340, c=aboutWin)
    pm.separator(st='none')

    pm.showWindow(win)
Exemplo n.º 41
0
    def lcToolbox_first_launch_window(cls, force_show=False, *args, **kwargs):
        '''
            show a window with first lauch settings
        '''
        # settings
        global_cfg = lcConfiguration.GlobalSettingsDictionary(verbose=False)

        windowName = 'lct_first_launch'
        if pm.control(windowName, exists=True):
            pm.deleteUI(windowName)

        show_window = global_cfg.get('g_first_launch')

        if force_show:
            show_window = True

        if show_window:
            w = 300
            h = 262
            margins = 8
            middle = w - (margins * 2)

            updateWindow = pm.window(windowName, t="LCToolbox - Welcome", widthHeight=[w, h], rtf=False, mnb=False,
                                     mxb=False, s=False, toolbox=True)

            pm.rowColumnLayout(nc=3, cw=([1, margins], [2, middle], [3, margins + 2]))
            # first column
            pm.text(l='', w=margins)

            # middle column
            pm.columnLayout()

            pm.text(l='Welcome to LCToolbox', al='center', w=middle, h=50, font='boldLabelFont')

            pm.text(l='Please read the License and Privacy Policy', al='center', w=middle, h=25)

            pm.button(l='License', al='center', w=middle,
                      command=lambda *args: webbrowser.open('http://lct.leocov.com/license', new=2))
            pm.text(l='', w=middle, h=8)
            pm.button(l='Privacy Policy', al='center', w=middle,
                      command=lambda *args: webbrowser.open('http://lct.leocov.com/privacy', new=2))
            pm.text(l='', w=middle, h=8)
            pm.button(l='Release Notes', w=middle, bgc=(0.5, 0.3, 0.3),
                      command=lambda *args: webbrowser.open('http://lct.leocov.com/release_notes', new=2))
            pm.text(l='', w=middle, h=8)

            pm.checkBox('checkBox_errors', l='Do you consent to automatically send error logs?', w=middle, h=25,
                        al='center', v=global_cfg.get('g_send_errors'),
                        annotation="Send error logs for critical excepton to the developer, some personal information is logged. See Privacy Policy for details.",
                        bgc=(0.5, 0.3, 0.3), changeCommand=lambda *args: global_cfg.set('g_send_errors',
                                                                                        pm.checkBox('checkBox_errors',
                                                                                                    query=True,
                                                                                                    v=True)))

            # pm.checkBox('checkBox_scene_settings', l='Save tool settings in Maya scene node?', w=middle, h=25, al='center', v=global_cfg.get('g_scene_settings'), annotation="Settings can be saved globally or as unique to each scene file in a script node.", changeCommand=lambda *args: global_cfg.set('g_scene_settings', pm.checkBox('checkBox_scene_settings', query=True, v=True)))

            pm.text(l='', w=middle, h=15)

            pm.checkBox('checkBox_first_launch', l='Show this window at launch?', w=middle, h=25, al='center',
                        v=global_cfg.get('g_first_launch'), annotation="Hide this window until after an update.",
                        bgc=(0.3, 0.5, 0.3), changeCommand=lambda *args: global_cfg.set('g_first_launch', pm.checkBox(
                    'checkBox_first_launch', query=True, v=True)))

            pm.setParent('..')

            # last column
            pm.text(l='', w=margins)

            updateWindow.show()
            pm.window(updateWindow, edit=True, h=h, w=(w + 2))
Exemplo n.º 42
0
    def create_layout(self):
        self.win = pm.window(title="Cluster Weight Interpolation")
        layout = pm.rowColumnLayout(numberOfColumns=2,
                                    columnAttach=(1, 'right', 0),
                                    columnWidth=[(1, 150), (2, 250)],
                                    rowOffset=(6, "bottom", 15),
                                    rowSpacing=(1, 10),
                                    columnSpacing=(2, 15))
        #chkBox = pm.checkBox(label = "My Checkbox", value=True, parent=layout)

        #Set up weight inputs
        pm.text(label="Min Weight")
        self.minWeight = pm.textField()
        pm.text(label="Max Weight")
        self.maxWeight = pm.textField()

        #Set up cluster Menu
        pm.text(label='Cluster')
        self.clusterMenu = pm.optionMenu()
        clusterList = hybridClusterList(self.vertList)
        for c in clusterList:
            pm.menuItem(label=str(c))

        #Set up Equation Menu
        pm.text(label='Equation')
        self.functionMenu = pm.optionMenu()
        pm.menuItem(label='Ramp')
        pm.menuItem(label='Linear')
        pm.menuItem(label='Quadratic')

        #Set up Ramp
        #TODO is there a way that we can hide or disable this thing if the user should select to use the Linear or Quadratic options?
        pm.text(label='Ramp Value')
        pm.optionVar(stringValueAppend=['falloffCurveOptionVar', '0,1,2'])
        pm.optionVar(stringValueAppend=['falloffCurveOptionVar', '1,0,2'])
        pm.gradientControlNoAttr('falloffCurve', h=90)
        self.ramp = pm.gradientControlNoAttr('falloffCurve',
                                             e=True,
                                             optionVar='falloffCurveOptionVar')

        pm.text(label='Invert')
        self.invert = pm.optionMenu()
        pm.menuItem(label='Yes')
        pm.menuItem(label='No')

        #Set up Axis Menu
        pm.text(label='Axies for Dist Measurement')
        self.interpolationAxis = pm.optionMenu()
        pm.menuItem(label='xyz')
        pm.menuItem(label='x')
        pm.menuItem(label='y')
        pm.menuItem(label='z')
        pm.menuItem(label='xy')
        pm.menuItem(label='xz')
        pm.menuItem(label='yz')
        pm.menuItem(label='Point Number')

        #Set up Buttons
        closeBtn = pm.button(label="Close", parent=layout)
        interpolateBtn = pm.button(label="Interpolate", parent=layout)

        interpolateBtn.setCommand(lambda *args: self.interpolate())
        closeBtn.setCommand(lambda *args: self.close_dialog())
Exemplo n.º 43
0
def rcl(nc):
	pm.rowColumnLayout(nc = nc)
Exemplo n.º 44
0
    def list_shots(*args):
        shot_num = pm.intFieldGrp('shotNum', q=1, v1=1)
        start_frame = pm.intFieldGrp('startFrame', q=1, v1=1)
        shot_count = pm.intFieldGrp('shotCount', q=1, v1=1)

        if len(str(shot_num)) < 2:
            raise RuntimeError('First Shot Number must be at east 2 digits.')

        for shot in pm.ls(type='shot'):
            try:
                cam = shot.get_camera()
                if cam.name() not in ['persp', 'top', 'front', 'side']:
                    pm.delete(cam)
            except:
                pm.delete(shot)

        for shot in pm.ls(type='shot'):
            pm.delete(shot)

        window_name = 'shot_creator_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        window_name = 'shot_list_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        shot_list_win = pm.window(window_name,
                                  title='Shot Creator',
                                  s=0,
                                  rtf=1)

        with pm.columnLayout():
            with pm.rowColumnLayout(nc=6,
                                    cw=[(1, 20), (2, 70), (3, 70), (4, 70),
                                        (5, 70), (6, 70)]):
                pm.text(l='')
                pm.text(l='Shot Num')
                pm.text(l='Length')
                pm.text(l='Start Frame')
                pm.text(l='End Frame')
                pm.text(l='Shot Name')

                for i in range(0, shot_count):

                    def checkbox_state(*args):
                        check_cnt = 0
                        while pm.checkBox('%s%s' %
                                          ('shotCheckBox', str(check_cnt)),
                                          ex=1):
                            check_cnt += 1

                        for k in range(0, check_cnt):
                            state = pm.checkBox('shotCheckBox%s' % str(k),
                                                q=1,
                                                v=1)
                            if not state:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=0)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=0)
                            else:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=1)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=1)

                    pm.checkBox('shotCheckBox%s' % str(i),
                                onc=checkbox_state,
                                ofc=checkbox_state)

                    shot_number = ''
                    for j in range(0, 4):
                        digit = len(str(shot_num))
                        if digit == 1:
                            shot_number = '000%s' % str(shot_num)
                        if digit == 2:
                            shot_number = '00%s' % str(shot_num)
                        if digit == 3:
                            shot_number = '0%s' % str(shot_num)
                        if digit == 4:
                            shot_number = '%s' % str(shot_num)

                    pm.textField('%s%s' % (shot_num_name, str(i)),
                                 text=str(shot_number),
                                 en=0)
                    shot_num += 10

                    pm.intField('%s%s' % (shot_length_name, str(i)),
                                cc=set_parameters_from_length,
                                v=1)

                    pm.intField('%s%s' % (start_frame_name, str(i)), en=0, v=1)
                    if i == 0:
                        pm.intField('%s%s' % (start_frame_name, str(i)),
                                    e=1,
                                    v=start_frame)

                    pm.intField('%s%s' % (end_frame_name, str(i)), en=0, v=1)

                    shot_node_name = 'shot%s' % str(i + 1)
                    pm.textField('%s%s' % (shot_name_name, str(i)),
                                 text=shot_node_name,
                                 en=0)

        with pm.columnLayout():

            def exec_create_shots(*args):
                state = pm.checkBox('camera_checkbox_name', q=1, v=1)
                if not state:
                    create_shots(False)
                else:
                    create_shots(True)

            pm.button(l='CREATE SHOTS', w=370, c=exec_create_shots)

        with pm.rowColumnLayout(nc=3,
                                cs=(3, 10),
                                cw=[(1, 60), (2, 120), (3, 100)]):
            pm.text(l='camPrefix')
            pm.textField('camera_prefix_name', text='camera__shotExp_', en=0)

            def checkbox_cameras(*args):
                state = pm.textField('camera_prefix_name', q=1, en=1)
                if not state:
                    pm.textField('camera_prefix_name', e=1, en=1)
                else:
                    pm.textField('camera_prefix_name', e=1, en=0)

            pm.checkBox('camera_checkbox_name',
                        l='create Cameras',
                        onc=checkbox_cameras,
                        ofc=checkbox_cameras)

        pm.showWindow(shot_list_win)
Exemplo n.º 45
0
    def create(self, windowName, windowWidth, windowHeight):

        if pm.objExists('ROOT_enviroment_01'):
            self.rootObject = 'ROOT_enviroment_01'
        else:
            pm.group(n='ROOT_enviroment_01', em=True)
            pm.select(cl=True)
            self.rootObject = 'ROOT_enviroment_01'

        # delete window if it exsists
        if pm.window("window", exists=True):
            pm.deleteUI("window")

        #define window
        self.widgets['window'] = pm.window("window",
                                           t=windowName,
                                           w=windowWidth,
                                           h=windowHeight,
                                           menuBar=True,
                                           titleBarMenu=True,
                                           bgc=[0.18, 0.18, 0.18],
                                           maximizeButton=False)

        pm.menu(label='File', tearOff=True)
        pm.menuItem(label='Quit', c=partial(self.quit, "AutoRig_JT"))
        pm.menu(label='Help', helpMenu=True)
        pm.menuItem('Application..."', label='About Creator', c=self.about)
        pm.menuItem('Instructions', label='Instructions', c=self.instructions)

        self.widgets['mainLayout'] = pm.columnLayout(adj=True)

        pm.frameLayout('Import/Export tools', cll=True, bgc=[0.25, 0.25, 0.25])

        #pm.button(l='Browse >>>', c= self.fileBrowser,bgc=[0.1,0.1,0.1],h=50)

        pm.separator(h=15)
        FilePathText = pm.text('FilePathText',
                               l=self.FilePath,
                               bgc=[0.1, 0.1, 0.1],
                               h=50)
        pm.separator(h=15)
        projectsOptionMenu = pm.optionMenu("library_Menu",
                                           w=300,
                                           label="Choose a Folder:   ",
                                           cc=partial(self.populateObjects),
                                           bgc=[0.1, 0.1, 0.1])
        pm.separator(h=15)

        #create character option
        characterOptionMenu = pm.optionMenu("Contents_Menu",
                                            w=300,
                                            label="Choose a Object:",
                                            bgc=[0.1, 0.1, 0.1])

        self.populateFolders()
        self.populateObjects()
        pm.separator(h=15)
        CreateCharacterButton = pm.button(l="Build",
                                          w=300,
                                          h=50,
                                          c=self.build,
                                          bgc=[0.1, 0.1, 0.1])

        exportSelectionButton = pm.button(l="Export_Selection",
                                          w=300,
                                          h=50,
                                          c=self.ExportSelection,
                                          bgc=[0.1, 0.1, 0.1])
        pm.setParent(u=True)
        pm.separator(style='none', h=10)

        pm.frameLayout('Placement tools', cll=True, bgc=[0.25, 0.25, 0.25])

        pm.text(l='Randomize Placement:')
        pm.separator(style='none', h=10)

        pm.rowColumnLayout(nc=2)
        pm.text(l='                               number of instances here:')
        self.widgets['numberOfInstances'] = pm.intField('numberOfInstances',
                                                        v=5,
                                                        w=50,
                                                        bgc=[0.1, 0.1, 0.1])

        pm.text(l='                 randomize radius:')
        self.widgets['randomizeRadius'] = pm.intField('randomizeRadius',
                                                      v=5,
                                                      w=50,
                                                      bgc=[0.1, 0.1, 0.1])

        pm.text(l='                     randomize scale max:')
        self.widgets['randomizeScaleMAX'] = pm.floatField('randomizeScaleMAX',
                                                          v=1,
                                                          bgc=[0.1, 0.1, 0.1])

        pm.text(l='                     randomize scale min:')
        self.widgets['randomizeScaleMIN'] = pm.floatField('randomizeScaleMIN',
                                                          v=-1,
                                                          bgc=[0.1, 0.1, 0.1])

        pm.separator(style='none', h=10)
        pm.separator(style='none', h=10)
        pm.setParent(u=True)
        pm.button(l='Randomize', c=self.randomize)
        pm.separator(style='none', h=10)

        pm.text(l='Attach along path:')
        pm.separator(style='none', h=10)
        pm.rowColumnLayout(nc=2)

        pm.text(l='numberOfDuplicates:')
        self.widgets['numberOfDuplicates'] = pm.intField('numberOfDuplicates',
                                                         v=5,
                                                         w=50,
                                                         bgc=[0.1, 0.1, 0.1])
        pm.text(l='set curve to duplicate along:')
        self.widgets['curvePath'] = pm.textFieldButtonGrp('curvePath',
                                                          bl='<<<',
                                                          bc=self.addCurve)
        pm.text(l='Randomize:')
        self.widgets['RandomPathDistance'] = pm.checkBox(l='')
        pm.text(l='                     randomize scale max:')
        self.widgets['randomizeScaleMINPath'] = pm.floatField(
            'randomizeScaleMINPath', v=-1, bgc=[0.1, 0.1, 0.1])
        pm.text(l='                     randomize scale min:')
        self.widgets['randomizeScaleMAXPath'] = pm.floatField(
            'randomizeScaleMAXPath', v=1, bgc=[0.1, 0.1, 0.1])

        pm.setParent(u=True)
        pm.button(l='Attach to path', c=self.duplicateAlongPath)

        pm.rowColumnLayout(nc=2)
        pm.text(l='             set ground plane :')
        self.widgets['groundplaneTextField'] = pm.textFieldButtonGrp(
            'groundPlaneTextField', bl='<<<', bc=self.addGroundPlane)
        pm.setParent(u=True)
        pm.button(l='Snap to ground', c=self.snapToGround)

        pm.setParent(u=True)
        pm.separator(style='none', h=10)
        pm.frameLayout('Renaming tools', cll=True, bgc=[0.25, 0.25, 0.25])

        self.widgets["replaceOptions"] = pm.radioButtonGrp(
            numberOfRadioButtons=3,
            label='replace options:',
            labelArray3=['replace search', 'replace before', 'replace after'],
            sl=1)

        self.widgets["selectionOptions"] = pm.radioButtonGrp(
            numberOfRadioButtons=3,
            label='selection options:',
            labelArray3=['hierarchy', 'selected', 'all'],
            sl=2)

        self.widgets["rowLayout"] = pm.rowColumnLayout(numberOfColumns=2,
                                                       columnAttach=(1,
                                                                     'right',
                                                                     0),
                                                       columnWidth=[(1, 100),
                                                                    (2, 250)])

        pm.text(label='search for:')
        self.widgets["searchField"] = pm.textField()

        pm.text(label='replace for:')
        self.widgets["replaceField"] = pm.textField()

        pm.separator(h=20, style='none')
        pm.button(l='GO', c=self.GO)
        pm.separator(h=20, style='none')
        pm.separator(h=20, style='none')
        pm.separator(h=20, style='none')
        pm.button(l='Increment Chain', c=self.renameChain)

        # create window
        pm.showWindow(self.widgets['window'])
        pm.window(self.widgets['window'],
                  e=True,
                  w=windowWidth,
                  h=windowHeight,
                  s=False)
Exemplo n.º 46
0
    def create(self):
        '''
        this creates the gui components for the node
        '''

        pm.setParent(self.layout)
        # layout for all other frame layouts
        self.temp_layout = pm.columnLayout(adjustableColumn=False, width=340)

        # this will list all animCurve nodes associated with an object
        # because anim nodes are named object_attr
        # but if the object is renamed after it's been keyed the anim node
        # will still have it's old name
        # by listing the anim nodes of the object * naming wont be an issue

        anim_nodes = pm.keyframe('%s' % (self.node), query=True, name=True)

        for anim_node in anim_nodes:

            pm.setParent(self.temp_layout)
            # getting the amount of keyframes for the curve node
            count = pm.keyframe('%s' % (anim_node),
                                query=True,
                                keyframeCount=True)  # translate U

            my_ui = Anim_UI(node='%s' % (anim_node), count=count)
            my_ui.create()

            # creating a new string
            node = '%s' % (anim_node)
            # getting the attr the curve node is for
            # the insert and delete key methods need an attr to act on
            # all anim nodes are named object_attr
            # so i'm splitting to get just hte attr part
            node_attr = node.split('_')[-1]

            # indsert key
            # this will build the section for key insertion
            pm.setParent('..')
            pm.text(label='Insert Key')
            pm.rowColumnLayout(numberOfColumns=3,
                               columnWidth=([1, 113], [2, 113], [3, 113]))
            pm.text(label='Key Position')
            insert_field = pm.intField()
            pm.button(label='Insert',
                      command=pm.Callback(self.insert_key,
                                          attr='%s.%s' %
                                          (self.node, node_attr),
                                          value=insert_field))

            # delete key
            # this will build the section for key deletion
            pm.setParent('..')
            pm.text(label='Delete Key')
            pm.rowColumnLayout(numberOfColumns=3,
                               columnWidth=([1, 113], [2, 113], [3, 113]))
            pm.text(label='Key Index')
            delete_field = pm.intField()
            pm.button(label='Delete',
                      command=pm.Callback(self.delete_key,
                                          attr='%s.%s' %
                                          (self.node, node_attr),
                                          index=delete_field))
Exemplo n.º 47
0
def lcTextureToolsUI(dockable=False, asChildLayout=False, *args, **kwargs):
    ''' '''
    global lct_cfg
    global prefix
    global height
    global defaultPath
    global defaultPrefix

    ci = 0  # color index iterator
    windowName = 'lcTextureTools'
    shelfCommand = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI()'.format(windowName, prefix)
    commandString = 'import lct.src.{0}.{0} as {1}\nreload({1})\n{1}.{0}UI(asChildLayout=True)'.format(windowName,
                                                                                                       prefix)
    icon = os.path.join(basePath, 'lcTextureTools.png')
    winWidth = 205
    winHeight = height

    if pm.window(windowName, ex=True):
        pm.deleteUI(windowName)

    if not asChildLayout:
        lcUI.UI.lcToolbox_child_popout(prefix + '_columnLayout_main', windowName, height, commandString, iconPath,
                                       lct_cfg)
        mainWindow = lcUI.lcWindow(prefix=prefix, windowName=windowName, width=winWidth, height=winHeight, icon=icon,
                                   shelfCommand=shelfCommand, annotation=annotation, dockable=dockable, menuBar=True)
        mainWindow.create()

    #
    pm.columnLayout(prefix + '_columnLayout_main')

    # RENAME TEXTURE NODES
    pm.text(l='- Rename File Texture Nodes -', font='boldLabelFont', al='center', w=200, h=20, bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    pm.rowColumnLayout(nc=3, cw=([1, 40], [2, 110], [3, 50]))
    pm.textField(prefix + '_textField_prefix', placeholderText=defaultPrefix,
                 changeCommand=lambda *args: lct_cfg.set('lcTextureToolsPrefix',
                                                         pm.textField(prefix + '_textField_prefix', query=True,
                                                                      tx=True)),
                 receiveFocusCommand=lambda *args: lcTxT_rename_focus())
    pm.text(l="_'texture_file_name'")
    pm.button(prefix + '_button_rename', l='Rename', bgc=colorWheel.getColorRGB(ci),
              annotation='rename all file texture nodes', w=50,
              command=lambda *args: lcTxT_rename_textures(pm.textField(prefix + '_textField_prefix', q=True, tx=True)))
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    pm.separator(style='in', h=8, w=200)

    # REPATH TEXTURE NODES
    pm.text(l='- Set new path for File Textures -', font='boldLabelFont', al='center', w=200, h=25,
            bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    lcUI.UI.lc_browse_field_button(width=200, textFieldName=prefix + '_textField_new_path', lct_cfg=lct_cfg,
                                   configAttr='lcTextureToolsRepath', placeholderText=defaultPath,
                                   annotation='Choose a new texture directory')
    pm.setParent(prefix + '_columnLayout_main')

    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Repath All', flat=False,
                      image=os.path.join(iconPath, 'repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath all file texture nodes to exact path given',
                      command=lambda *args: lcTxT_repath_all())
    ci += 1
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False,
                      image=os.path.join(iconPath, 'repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath selected file texture nodes to exact path given',
                      command=lambda *args: lcTxT_repath_selected())
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.button(w=100, h=25, label='Intelli-All', bgc=colorWheel.getColorRGB(ci),
              annotation='Recursive search given path to repath all file texture nodes',
              command=lambda *args: lcTxT_intelligent_repath_all())
    ci += 1
    pm.button(w=100, h=25, label='Intelli-Selected', bgc=colorWheel.getColorRGB(ci),
              annotation='Recursive search given path to repath selected file texture nodes',
              command=lambda *args: lcTxT_intelligent_repath_selected())
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    pm.separator(style='in', h=8, w=200)

    # REPATH SHADERS (dx11 only)
    pm.text(l='- Set new path for DX11 Shaders -', font='boldLabelFont', al='center', w=200, h=25,
            bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    lcUI.UI.lc_browse_field_button(width=200, textFieldName=prefix + '_textField_new_shader_path', lct_cfg=lct_cfg,
                                   configAttr='lcTextureToolsShaderRepath', placeholderText=defaultPath,
                                   annotation='Choose a new shader directory')
    pm.setParent(prefix + '_columnLayout_main')

    #
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Repath All', flat=False,
                      image=os.path.join(iconPath, 'shader_repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath all dx11Shader nodes to exact path given',
                      command=lambda *args: lcTxT_shader_repath_all())
    ci += 1
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False,
                      image=os.path.join(iconPath, 'shader_repath.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Repath selected dx11Shader nodes to exact path given',
                      command=lambda *args: lcTxT_shader_repath_selected())
    ci += 1
    pm.setParent(prefix + '_columnLayout_main')
    pm.separator(style='in', h=8, w=200)

    # OPEN TEXTURES
    # a=170
    # b=200-a
    # pm.rowColumnLayout(nc=2, cw=([1,a], [2,b]))
    pm.text(l='- Open File Texture Nodes -', font='boldLabelFont', al='center', w=200, h=25, bgc=colorWheel.darkgrey)
    pm.separator(style='none', h=3, w=200)

    # pm.symbolButton(prefix+'_button_check_editors', visible=False, image=os.path.join(srcPath,'icons','hint.png'), annotation='Setup Image File Editors', command=lambda *args: lcTxT_update_maya_prefs(prefix+'_button_check_editors') )
    pm.setParent(prefix + '_columnLayout_main')
    pm.rowColumnLayout(nc=2, cw=([1, 100], [2, 100]))
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Open All', flat=False,
                      image=os.path.join(iconPath, 'open.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Open all file texture nodes in default associated program',
                      command=lambda *args: lcTxT_open_textures('all'))
    ci += 1
    pm.iconTextButton(w=100, h=25, style='iconAndTextHorizontal', label='Selected', flat=False,
                      image=os.path.join(iconPath, 'open.png'), bgc=colorWheel.getColorRGB(ci),
                      annotation='Open selected file texture nodes in default associated program',
                      command=lambda *args: lcTxT_open_textures('selected'))
    ci += 1
    pm.separator(style='none', h=8, w=200)

    #
    if not asChildLayout:
        mainWindow.show()
        pm.window(mainWindow.mainWindow, edit=True, height=winHeight, width=winWidth)
    else:
        pm.setParent('..')
        pm.setParent('..')

    # edit menus
    optionsMenu, helpMenu = lcUI.UI.lcToolbox_child_menu_edit(asChildLayout, windowName)

    # restore interface selections
    pm.textField(prefix + '_textField_new_path', edit=True, text=lct_cfg.get('lcTextureToolsRepath'))
    pm.textField(prefix + '_textField_prefix', edit=True, text=lct_cfg.get('lcTextureToolsPrefix'))
    pm.textField(prefix + '_textField_new_shader_path', edit=True, text=lct_cfg.get('lcTextureToolsShaderRepath'))

    # run extra stuff
    pm.setFocus(prefix + '_button_rename')

    # validate export directory
    lcPath.Path.validatePathTextField(prefix + '_textField_new_path', lct_cfg, 'lcTextureToolsRepath', defaultPath)
    lcPath.Path.validatePathTextField(prefix + '_textField_new_shader_path', lct_cfg, 'lcTextureToolsShaderRepath',
                                      defaultPath)
Exemplo n.º 48
0
def move_all_anim_curves():
    def check_overlapping(anim_curves, choice, current_time, offset_val):
        for anim_curve in anim_curves:
            key_cnt = anim_curve.numKeys()
            message = 'Some Keys are overlapping within Offset Value\n'
            message += 'Do you want continue on Moving other Keys ?\n'
            for i in range(0, key_cnt):
                key_time = anim_curve.getTime(i)
                if choice == 'forward':
                    if key_time <= current_time + offset_val:
                        range_dialog = pm.confirmDialog(title='Error',
                                                        message=message,
                                                        button=['Yes', 'No'],
                                                        cancelButton='No',
                                                        dismissString='No')
                        if range_dialog == 'Yes':
                            return 1
                        else:
                            raise RuntimeError(
                                'Move Keys process interrupted by User.')

                if choice == 'back':
                    if key_time >= current_time + offset_val:
                        range_dialog = pm.confirmDialog(title='Error',
                                                        message=message,
                                                        button=['Yes', 'No'],
                                                        cancelButton='No',
                                                        dismissString='No')
                        if range_dialog == 'Yes':
                            return 1
                        else:
                            raise RuntimeError(
                                'Move Keys process interrupted by User.')

    def move_all_keys(choice):
        offset_val = offset_intfield.getValue()

        if offset_val < 1:
            raise RuntimeError('Enter an Offset Value greater than 0.')

        if choice == 'back':
            offset_val = offset_intfield.getValue() * -1

        unlock_val = unlock_state.getValue1()

        current_time = pm.currentTime()

        anim_curves = pm.ls(type='animCurve')
        non_moved_curves = []

        if choice == 'back':
            check_overlapping(anim_curves, choice, current_time, offset_val)

        for anim_curve in anim_curves:
            try:
                if unlock_val is True and anim_curve.isLocked():
                    anim_curve.setLocked(0)

                key_cnt = anim_curve.numKeys()
                for i in range(1, key_cnt + 1):

                    if choice == 'forward':
                        ind = key_cnt - i
                    if choice == 'back':
                        ind = i - 1

                    if anim_curve.getTime(ind) >= current_time:
                        pm.keyframe(anim_curve,
                                    index=ind,
                                    iub=False,
                                    animation='objects',
                                    relative=True,
                                    option='move',
                                    tc=offset_val)
            except:
                if anim_curve not in non_moved_curves:
                    non_moved_curves.append(anim_curve)
                continue

        if not non_moved_curves:
            pm.confirmDialog(title='Info',
                             message='Keys Moved Successfully.',
                             button='OK')
        else:
            message = 'Anim Curves can NOT be moved:\r\n'
            message += '\r'
            for i in range(0, len(non_moved_curves)):
                message += '%s\n' % non_moved_curves[i]
                if i > 30:
                    message += '+ More...\n'
                    break
            print(non_moved_curves)
            pm.confirmDialog(title='Error', message=message, button='OK')

        # pdm.close()

    window_name = 'move_keys_window'

    if pm.window(window_name, q=True, ex=True):
        pm.deleteUI(window_name, wnd=True)

    move_keys_win = pm.window(window_name, title='Move Keys', s=0, rtf=1)

    with pm.columnLayout(rs=5, cal='center'):
        pm.text(l='                      MOVE ALL KEYS')
        pm.text(l='             relatively from currentTime')
        pm.text(l='    (overlapping Keys will NOT be moved)')
        with pm.rowColumnLayout(nc=3, cw=[(1, 70), (2, 70), (3, 70)]):

            def exec_move_all_keys_back(*args):
                move_all_keys('back')

            pm.button(l='-', c=exec_move_all_keys_back)
            offset_intfield = pm.intField()

            def exec_move_all_keys_forward(*args):
                move_all_keys('forward')

            pm.button(l='+', c=exec_move_all_keys_forward)

    with pm.columnLayout():
        unlock_state = pm.checkBoxGrp(l='Unlock & Move', v1=1)

    pm.showWindow(move_keys_win)
Exemplo n.º 49
0
    def __init__(self):
        if window(self.name, ex=True):
            deleteUI(self.name)

        window(self.name)

        ass = formLayout()

        with tabLayout() as tab:
            tabLayout(tab,
                      e=True,
                      sc=lambda *args: setattr(self.settings, 'activeTab',
                                               tab.getSelectTabIndex()))
            with formLayout() as switcher:

                def setMode(modeName):
                    self.settings.mode = modeName

                self.rangeInput = radioButtonGrp(
                    nrb=4,
                    la4=[m.title() for m in self.MODES],
                    on1=Callback(setMode, self.MODES[0]),  # noqa e128
                    on2=Callback(setMode, self.MODES[1]),
                    on3=Callback(setMode, self.MODES[2]),
                    on4=Callback(setMode, self.MODES[3]),
                )

                self.rangeInput.setSelect(
                    self.MODES.index(self.settings.mode) + 1)

                with scrollLayout() as utilities:
                    with columnLayout(adj=True):

                        # Fk / Ik Switching
                        with frameLayout(l='Ik/Fk Switching',
                                         cll=True) as ikFkFrame:
                            self.settings.frameLayoutSetup(
                                ikFkFrame, 'ikfkCollapsed')
                            with rowColumnLayout(nc=3,
                                                 cw=[(1, 200), (2, 50),
                                                     (3, 50)]):
                                for card in core.findNode.allCards():
                                    for side in ['Center', 'Left', 'Right']:
                                        try:
                                            ik = card.getSide(side).ik
                                            fk = card.getSide(side).fk

                                            if ik and fk:
                                                text(l=ik.shortName())
                                                button(l='Ik',
                                                       c=Callback(
                                                           self.doIkFkSwitch,
                                                           fk, True))
                                                button(l='Fk',
                                                       c=Callback(
                                                           self.doIkFkSwitch,
                                                           ik, False))

                                        except Exception:
                                            print(traceback.format_exc())
                        """
                        # Space Switching
                        with frameLayout(l='Space Switching', cll=True) as spaceFrame:
                            self.settings.frameLayoutSetup(spaceFrame, 'spaceCollapsed')
                            with columnLayout() as self.main:
                                with rowColumnLayout( nc=2 ):
                                    
                                    button( l='Switch', c=Callback(self.switch) )
                                
                                text(l='Control')
                                self.targets = textScrollList(h=200)
                                scriptJob( e=('SelectionChanged', Callback(self.update)), p=self.main )
                                
                                text(l='')
                                
                                self.presetFileChooser = optionMenu(l='Presets', cc=Callback(self.loadSpace))
                                self.presetFiles = []
                                for folder in spacePresets.SpacePresets.folders:
                                    folder = os.path.expandvars(folder)
                                    
                                    if not os.path.exists(folder):
                                        continue
                                    
                                    for f in os.listdir(folder):
                                        if f.lower().endswith('.json'):
                                            cmds.menuItem(l=f[:-5])
                                            self.presetFiles.append( folder + '/' + f )
                                    
                                self.spacePresetList = textScrollList(h=100)
                                button(l='Apply', c=Callback(self.applySpacePreset))
                                
                                self.update()
                        """
                        """
                        # Main zeroing
                        with frameLayout(l='Zero Main Controller', cll=True) as zeroFrame:
                            self.settings.frameLayoutSetup(zeroFrame, 'zeroMainCollapsed')
                            with rowColumnLayout(nc=3):
                                with gridLayout(nrc=(2, 3)):
                                    toggles = []
                                    for attr in [t + a for t in 'tr' for a in 'xyz']:
                                        toggles.append( checkBox(l=attr) )
                                        self.settings.checkBoxSetup(toggles[-1], attr + '0')
                                    
                                    def setVal(val):
                                        for check in toggles:
                                            check.setValue(val)
                                        for attr in [t + a for t in 'tr' for a in 'xyz']:
                                            self.settings[attr + '0'] = val
                                        
                                with columnLayout(adj=True):
                                    button(l='All', c=Callback(setVal, True))
                                    button(l='Clear', c=Callback(setVal, False))

                                with columnLayout(adj=True):
                                    button(l='Apply', c=Callback(self.zeroMain))
                        """

                formLayout(
                    switcher,
                    e=True,
                    af=[  # noqa e128
                        (self.rangeInput, 'left', 0),
                        (self.rangeInput, 'top', 0),
                        (self.rangeInput, 'right', 0),
                        (utilities, 'left', 0),
                        (utilities, 'bottom', 0),
                        (utilities, 'right', 0),
                    ],
                    ac=(utilities, 'top', 0, self.rangeInput),
                )
            """
            with formLayout() as spaceTab:
                space = spacePresets.SpacePresets()
                
                formLayout(spaceTab, e=True,
                    af=[
                        (space.mainForm, 'top', 0),
                        (space.mainForm, 'bottom', 0),
                    ]
                )
                
                #button(save, e=True, c=Callback(space.save))
                #button(load, e=True, c=Callback(space.load))
            """

        #tabLayout(tab, e=True, tl=[(switcher, 'Switching'), (spaceTab, 'Spaces')] )
        tabLayout(tab, e=True, tl=[(switcher, 'Switching')])

        tabLayout(tab, e=True, sti=self.settings.activeTab)

        formLayout(
            ass,
            e=True,
            af=[  # noqa e128
                (tab, 'top', 0),
                (tab, 'left', 0),
                (tab, 'right', 0),
                (tab, 'bottom', 0),
            ])

        showWindow()
Exemplo n.º 50
0
    def __init__(self, questions_file):

        dir_name = os.path.dirname(__file__)
        file_path = os.path.join(dir_name, 'Startup', 'start.path')
        f = open(file_path, 'r')
        pickle_data = pickle.load(f)
        f.close()

        self.file = open(questions_file, 'r')
        self.questions = self.file.readlines()
        self.file.close()
        self.main_layout = pm.columnLayout()
        self.path_field = pm.textFieldButtonGrp(label='Quiz Path',
                                                buttonCommand=pm.Callback(
                                                    self.get_path),
                                                buttonLabel='<<<',
                                                text=pickle_data)
        self.name_field = pm.textFieldGrp(label='Quiz Name', text='Lab01')
        self.layout = pm.rowColumnLayout(numberOfColumns=2,
                                         columnWidth=([1, 100], [2, 450]))
        pm.columnLayout()
        pm.text(label='Questions')
        self.question_scroll_list = pm.textScrollList(
            width=95,
            height=300,
            selectCommand=pm.Callback(self.read_questions),
            allowMultiSelection=True)

        pm.setParent(self.layout)
        pm.columnLayout()
        pm.text(label='Questions Info')
        self.question_scroll_field = pm.scrollField(wordWrap=True,
                                                    height=300,
                                                    width=440)

        pm.setParent(self.main_layout)
        self.lower_layout = pm.rowColumnLayout(numberOfColumns=3,
                                               columnWidth=([1, 100], [2, 100],
                                                            [3, 350]))
        pm.columnLayout()
        pm.text(label='Core')
        self.core_list = pm.textScrollList(width=95,
                                           height=300,
                                           allowMultiSelection=True)
        pm.rowColumnLayout(numberOfColumns=2)
        #columnWidth= ([1, 50], [2, 50]))
        pm.button(label='+', width=45, command=pm.Callback(self.add_core))
        pm.button(label='-', width=45, command=pm.Callback(self.remove_core))
        pm.setParent(self.lower_layout)
        pm.columnLayout()
        pm.text(label='Random')
        self.random_list = pm.textScrollList(width=95,
                                             height=300,
                                             allowMultiSelection=True)
        pm.rowColumnLayout(numberOfColumns=2)
        #columnWidth= ([1, 50], [2, 50]))
        pm.button(label='+', width=45, command=pm.Callback(self.add_random))
        pm.button(label='-', width=45, command=pm.Callback(self.remove_random))
        pm.setParent(self.lower_layout)
        pm.columnLayout()
        pm.text(label='Quiz Info')
        self.preview_scroll_field = pm.scrollField(wordWrap=True,
                                                   height=300,
                                                   width=340)
        pm.rowColumnLayout(numberOfColumns=2)
        pm.text(label='Random Amount', width=200)
        self.random_int_field = pm.intField(min=1, value=1, width=50)

        pm.setParent(self.main_layout)
        pm.button(label='Create Quiz',
                  command=pm.Callback(self.create_quiz),
                  width=550,
                  height=50)

        self.list_questions()
Exemplo n.º 51
0
    def __init__(self):
        self.main_layout = pm.columnLayout(adjustableColumn=True)
        self.layout01 = pm.rowColumnLayout(numberOfColumns=3,
                                           columnWidth=([1,
                                                         150], [2,
                                                                150], [3,
                                                                       250]))
        pm.columnLayout()
        pm.text(label='Shaders')
        self.shader_scroll_list01 = pm.textScrollList(
            width=150,
            height=200,
            selectCommand=pm.Callback(self.get_output_geo))
        pm.button(label='Refresh',
                  width=150,
                  command=pm.Callback(self.update_shaders_list))

        pm.setParent(self.layout01)
        pm.columnLayout()
        pm.text(label='Shader Geo')
        self.shader_geo_scroll_list = pm.textScrollList(
            width=150, height=200, allowMultiSelection=True)
        #self.check_box = pm.checkBox(label= 'select node')

        pm.setParent(self.layout01)
        pm.columnLayout()
        pm.text(label='Scene Geo')
        self.scene_geo_scroll_list = pm.textScrollList(
            width=250, height=200, allowMultiSelection=True)
        pm.button(label='Refresh',
                  width=275,
                  command=pm.Callback(self.update_scene_geo_list))

        pm.setParent(self.main_layout)
        self.layout02 = pm.rowColumnLayout(numberOfColumns=2,
                                           columnWidth=([1, 275], [2, 275]))
        pm.columnLayout(adjustableColumn=True)
        pm.text(label='Shaders')
        self.shader_scroll_list02 = pm.textScrollList(width=275, height=200)
        pm.button(label='Assign',
                  width=275,
                  command=pm.Callback(self.assign_to_geometry))

        pm.setParent(self.layout02)
        pm.columnLayout(adjustableColumn=True)
        pm.text(label='Create Shaders')
        self.option_menu = pm.optionMenu(label='Material Type', width=200)
        pm.menuItem(label='mia_material_x')
        pm.menuItem(label='blinn')
        pm.menuItem(label='lambert')
        pm.menuItem(label='phong')
        pm.menuItem(label='rampShader')
        pm.menuItem(label='anisotropic')
        pm.menuItem(label='phongE')
        pm.menuItem(label='useBackground')

        self.text_field = pm.textFieldGrp(label='Name',
                                          columnWidth2=[100, 150])

        pm.button(label='Create and Assign Shader',
                  command=pm.Callback(self.create_and_assign_shader))

        self.update_scene_geo_list()
        self.update_shaders_list()
Exemplo n.º 52
0
def makeSpringUI():
    global springButtonID
    global dynHairMagicFrameID
    global dynSpringMagicFrameID
    global dynHairMagicRadioID
    global dynSpringMagicRadioID
    #global progressControlID
    if pm.window('makeSpringWin',ex=True):
        pm.deleteUI('makeSpringWin',window=True)
        pm.windowPref('makeSpringWin',remove=True)
    pm.window('makeSpringWin',menuBar=True,t="Spring Magic Maya %s" % version)
    pm.menu(tearOff=False,l="Edit")
    pm.menuItem(l="Reset Settings",ann="Reset all",c=lambda *arg:makeSpringUI())
    pm.scrollLayout('scrollLayout')
    pm.frameLayout(lv=False)
    pm.columnLayout(adjustableColumn=1)
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,90),(2,90),(3,90)])
    pm.text(label="Pick Method: ")
    dynPickMethodID = pm.radioCollection()
    pm.radioButton(label="Hierachy",select=True,onc=lambda *arg:changeMethodVal(1))
    pm.radioButton(label="Selection",onc=lambda *arg:changeMethodVal(0))
    pm.text(label="Spring Method: ")
    dynSpringMethodID = pm.radioCollection()
    dynHairMagicRadioID= pm.radioButton(label="Hair Magic",select=True,onc=lambda *arg:changeSpringMethodVal(1))
    dynSpringMagicRadioID= pm.radioButton(label="Spring Magic",onc=lambda *arg:changeSpringMethodVal(0))
    pm.setParent('..')
    pm.separator(style='in')
    pm.rowColumnLayout(numberOfColumns=6,columnWidth=[(1,90),(2,60),(3,55),(4,45),(5,30),(6,45)],bgc=(0.5,0.5,0.5))
    pm.text(label="Key Range: ")
    dynkeyRange = pm.radioCollection()
    pm.radioButton(label="Active",select=True,onc=lambda *arg:changeTRangeVal(1))
    pm.radioButton(label="From: ",onc=lambda *arg:changeTRangeVal(0))
    pm.intField(value=startFrame,cc=changeSFVal)
    pm.text(label="To: ")
    pm.intField(value=endFrame,cc=changeEFVal)
    pm.setParent('..')
    pm.separator(style='out')
    pm.setParent('..')
    dynHairMagicFrameID=pm.frameLayout(label='Hair Magic',borderStyle='in')
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,90),(2,180)])
    pm.text(label="Hair Damping: ",align='right')
    pm.floatField(min=0.0, max=1, value=dampValue, step=0.1, cc=changeDaVal)
    pm.text(label="Hair Stiffness: ",align='right')
    pm.floatField(min=0.0, max=1, value=stiffValue, step=0.1, cc=changeStiffVal)
    pm.setParent('..')
    pm.rowColumnLayout(numberOfColumns=4,columnWidth=[(1,90),(2,60),(3,60),(4,85)])
    pm.text(label="Hair Stiffness : ",align='right')
    dynJointFalloffID = pm.radioCollection()
    pm.radioButton(label="Normal",select=True,onc=lambda *arg:changeFVal(0))
    pm.radioButton(label="Quick",onc=lambda *arg:changeFVal(1))
    pm.radioButton(label="Slow",onc=lambda *arg:changeFVal(2))
    pm.text(label="Hair Detail : ",align='right')
    dynJointDetailID = pm.radioCollection()
    pm.radioButton(label="Low",onc=lambda *arg:changeDVal(0))
    pm.radioButton(label="Medium",select=True,onc=lambda *arg:changeDVal(1))
    pm.radioButton(label="High",onc=lambda *arg:changeDVal(2))
    pm.setParent('..')
    pm.setParent('..')
    dynSpringMagicFrameID=pm.frameLayout(label='Spring Magic',borderStyle='in',vis=False)
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,120),(2,140),(3,60)])
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,60),(2,60)])
    pm.text(label="Spring : ",align='right')
    pm.floatField(minValue=0, maxValue=1, value=0.3,editable=True,cc=changeSprVal)
    pm.setParent('..')
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,60),(2,60)])
    pm.text(label="Twist : ",align='right')
    pm.floatField(minValue=0, maxValue=1, value=0.3,editable=True,cc=changeTwsVal)
    pm.setParent('..')
    pm.checkBox(label="Loop",cc=changeLoopVal)
    pm.setParent('..')
    pm.setParent('..')
    pm.separator(style='in')
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,112),(2,112),(3,112)])
    springButtonID= pm.button(label="Do",c="springIt(springMethod); pm.deleteUI('makeSpringWin',window=True)")
    pm.button(label= "Apply",c='springIt(springMethod)')
    pm.button(label= "Clear",c='clearAnim()')
    pm.setParent('..')
    #progressControlID=pm.textField(tx="...",ed=False,bgc=(0,.5,0.15),fn='boldLabelFont',h=20)
    pm.showWindow()
Exemplo n.º 53
0
def ph_mainCode(extraHeight, particleRate, getInitialInfo, minSlope,
                minSlopeVariance, setBoundingBox, maxTilt, objectScale,
                objectScaleVariance, objectHeightVariance):

    displayWindow = True
    windowError = py.window(title="Notice", mxb=False, s=False)
    errorLayout = py.rowColumnLayout(numberOfColumns=3, parent=windowError)

    #initialise varibables
    originalTime = py.currentTime(query=True)
    deleteCount = 0
    decimalPoints = 2

    #file validation
    storeSelection = py.ls(selection=True)

    try:
        validFile = True
        myfile = open('storedobjects.txt')
        objectList = myfile.readlines()
        myfile.close()
        py.select(clear=True)
        for i in range(len(objectList)):
            py.select(objectList[i], add=True)
        1 / len(objectList)

    except:
        validFile = False

    #get original selection
    py.select(clear=True)
    for i in range(len(storeSelection)):
        py.select(storeSelection[i], add=True)

        #deselect non polygons
        if type(storeSelection[i]) != py.nodetypes.Transform:
            py.select(storeSelection[i], deselect=True)

        #deselect objects in the text file
        if getInitialInfo == False:
            for j in range(len(objectList)):
                selectionEdit = storeSelection[i] + objectList[j][
                    -2] + objectList[j][-1]
                if objectList[j] == selectionEdit:
                    py.select(storeSelection[i], deselect=True)

    storeSelection = py.ls(selection=True)

    startTime = time()
    listOfPoints = []
    totalNum = 0

    if len(storeSelection) == 0:
        displayMessage = "Nothing is selected. Please select an object and try again."
        ph_displayWindow(displayWindow, displayMessage)

    elif getInitialInfo == True:

        #write to file
        selection = py.ls(selection=True)
        myfile = open('storedobjects.txt', 'w')
        for i in range(len(selection)):
            myfile.write("" + selection[i] + "\r\n")
        myfile.close()
        if len(selection) > 0:
            print str(len(selection)) + " object(s) successfully stored."
            if displayWindow == True:
                py.text(label="  ")
                py.text(label="  ")
                py.text(label="  ")
                py.text(label="  ")
                py.text(label=str(len(selection)) +
                        " object(s) successfully stored.",
                        align="center")
                py.text(label="  ")
                py.text(label="  ")
                py.text(label="  ")
                py.text(label="  ")
                py.showWindow()

        else:
            displayMessage = "Please select the objects you wish to store."
            ph_displayWindow(displayWindow, displayMessage)

        for i in range(len(storeSelection)):
            py.select(storeSelection[i], add=True)

    elif validFile == False:
        displayMessage = "Error with stored list. Please choose new object(s) to duplicate."
        ph_displayWindow(displayWindow, displayMessage)

    elif len(objectList) == 0:
        displayMessage = "No objects stored. Please choose new object(s) to duplicate."
        ph_displayWindow(displayWindow, displayMessage)

    else:
        for loops in range(len(storeSelection)):

            particleID = []
            particleLoc = []
            particleVelocity = []

            #get information about selected object
            py.select(storeSelection[loops], r=True)
            originalObj = py.ls(selection=True)
            originalObjLoc = originalObj[0].getTranslation()
            originalObjX = originalObjLoc.x
            originalObjY = originalObjLoc.y
            originalObjZ = originalObjLoc.z

            #duplicate object to work on
            tempObj = py.instance(originalObj)

            #make emitter
            particleEmitter = py.emitter(n='tempEmitter',
                                         type='surface',
                                         r=particleRate * 24,
                                         sro=0,
                                         speed=0.0001)
            particles = py.particle(n='emittedParticles')
            py.connectDynamic('emittedParticles', em='tempEmitter')
            py.setAttr(particles[1] + '.seed[0]', rd.randint(0, sys.maxint))

            #get list from file
            myfile = open('storedobjects.txt')
            objectList = myfile.readlines()
            objectListCopy = []
            myfile.close()

            for i in range(len(objectList)):
                copyObj = py.duplicate(objectList[i])
                objectListCopy.append(copyObj)

            #fixes the seed always being 0
            py.currentTime(originalTime + 1, edit=True, update=True)
            py.currentTime(originalTime, edit=True, update=True)
            py.currentTime(originalTime + 1, edit=True, update=True)
            numOfParticles = particles[1].num()

            for i in range(numOfParticles):

                #get particle info
                particleInfo = particles[1].Point('emittedParticles', i)
                particleID.append(particleInfo)
                particleLoc.append(particleInfo.position)
                particleVelocity.append(particleInfo.velocity)

            for i in range(len(particleID)):

                #place objects
                randomNum = rd.randint(0, len(objectListCopy) - 1)
                instanceObj = objectListCopy[randomNum]
                dupObj = py.instance(instanceObj)
                yDir = particleVelocity[i][1] * 10000

                #get height of object
                py.select(instanceObj, r=True)
                py.scale(1, 1, 1)
                height = py.ls(selection=True)[0].getBoundingBox().height()

                #reselect instance
                py.select(dupObj[0], r=True)
                py.move(dupObj[0], particleLoc[i][0],
                        particleLoc[i][1] + extraHeight, particleLoc[i][2])
                py.rotate(dupObj[0],
                          rd.uniform(-maxTilt, maxTilt),
                          rd.randint(0, 360),
                          rd.uniform(-maxTilt, maxTilt),
                          os=True)
                scaleX = rd.uniform(objectScale - objectScaleVariance,
                                    objectScale + objectScaleVariance)
                scaleY = rd.uniform(objectScale - (objectHeightVariance / 2),
                                    objectScale + objectHeightVariance)
                scaleZ = rd.uniform(objectScale - objectScaleVariance,
                                    objectScale + objectScaleVariance)
                py.scale(dupObj[0], scaleX, scaleY, scaleZ)

                if yDir <= rd.uniform(minSlope - minSlopeVariance,
                                      minSlope + minSlopeVariance):
                    py.delete(dupObj)
                    deleteCount = deleteCount + 1
                else:
                    listOfPoints.append(dupObj)

                #display percent completed
                maxValue = int(pow(len(particleID), 0.5))
                if float(i / maxValue) == float(i) / maxValue:
                    print str(
                        int((float(i) * 100 / len(particleID)) * 100.0) /
                        100.0) + "% completed"

            totalNum = totalNum + numOfParticles

            #delete temp objects
            py.select(tempObj, 'tempEmitter', 'emittedParticles')
            py.delete()
            py.currentTime(originalTime, edit=True, update=True)
            for i in range(len(objectListCopy)):
                py.delete(objectListCopy[i][0])

    #place objects in display layer
    py.select(clear=True)
    if len(listOfPoints) > 0:
        if setBoundingBox == True:
            displayLayerName = 'duplicatedObjectsBB'
        else:
            displayLayerName = 'duplicatedObjectsMesh'

        #add to display layer
        try:
            for i in range(len(listOfPoints)):
                py.editDisplayLayerMembers(displayLayerName, listOfPoints[i])

        #create display layer first
        except:
            py.createDisplayLayer(noRecurse=True, name=displayLayerName)
            for i in range(len(listOfPoints)):
                py.editDisplayLayerMembers(displayLayerName, listOfPoints[i])

            #display objects as bounding box
            if setBoundingBox == True:
                py.setAttr(displayLayerName + '.levelOfDetail', 1)
            py.setAttr(displayLayerName + '.color', 17)

        #add to group
        for i in range(len(listOfPoints)):
            py.select(listOfPoints[i][0], add=True)
        py.group(n='duplicatedObjectsGroup')

        #output time taken
        endTime = time()
        ph_timeOutput(startTime, endTime, decimalPoints)
        secondsDecimal, sec = ph_timeOutput(startTime, endTime, decimalPoints)
        displayMessage = str(totalNum -
                             deleteCount) + " objects created in " + str(
                                 secondsDecimal) + str(sec)
        ph_displayWindow(displayWindow, displayMessage)

    #select original selection
    py.select(clear=True)
    for i in range(len(storeSelection)):
        py.select(storeSelection[i], add=True)
Exemplo n.º 54
0
    def update_confirm_window(cls, release, version, scriptPath, updatePath,
                              *args, **kwargs):
        '''
            show a window with update info and user confirm button
        '''
        # settings
        global_cfg = lcConfiguration.GlobalSettingsDictionary(verbose=False)

        # format scriptPath to fit
        scriptPathNice = scriptPath
        if len(scriptPath) > 36:
            scriptPathNice = '....' + scriptPath[-32:]
        # updateURLNice = updatePath.replace('http://', '')
        updateURLNice = updatePath[-24:]

        windowName = 'lct_update'
        if pm.control(windowName, exists=True):
            pm.deleteUI(windowName)

        w = 300
        wB = (w - 200) / 3
        wC = (w - 100) / 2
        h = 280
        updateWindow = pm.window(windowName,
                                 t="LCToolbox - Update",
                                 widthHeight=[w, h],
                                 rtf=False,
                                 mnb=False,
                                 mxb=False,
                                 s=False,
                                 toolbox=True)

        pm.columnLayout()
        pm.text(l='', al='center', w=w)
        pm.text('update_heading', l='*****', al='center', w=w)
        pm.text(l='', al='center', w=w)
        pm.text(l='Release: {}'.format(release), al='center', w=w)
        pm.text(l='', al='center', w=w)
        pm.text(l='Current Version: {}'.format(version), al='center', w=w)

        if updatePath:
            pm.text('update_heading',
                    edit=True,
                    l='UPDATE AVAILABLE',
                    font='boldLabelFont')
            pm.text(l='Update Version: {}'.format(
                updatePath.split('lct_')[1].split('.zip')[0]),
                    al='center',
                    w=w)
            pm.text(l='', al='center', w=w)
            pm.text(l='Install Path:\n{}'.format(
                os.path.join(scriptPathNice, 'lct')),
                    al='center',
                    w=w)
            pm.text(l='', al='center', w=w)
            pm.text(l='Update File:\n{}'.format(updateURLNice),
                    al='center',
                    w=w)
            pm.text(l='', al='center', w=w)
            pm.rowColumnLayout(nc=3, cw=([1, 100], [2, 100], [3, 100]))
            pm.text(l='', al='center', w=w)
            pm.button(l='Release Notes',
                      w=100,
                      h=25,
                      command=lambda *args: webbrowser.open(
                          'http://lct.leocov.com/release_notes', new=2))
            # pm.text(l='http://lct.leocov.com/release_notes', al='center', hyperlink=True)
            pm.text(l='', al='center', w=w)
            pm.setParent('..')

            pm.text(l='', al='center', w=w)
            pm.rowColumnLayout(nc=5,
                               cw=([1, wB], [2, 100], [3, wB], [4,
                                                                100], [5, wB]))
            pm.text(l='', al='center', w=wB)
            pm.button(l='Update',
                      w=100,
                      h=25,
                      command=lambda *args: cls.update_unpack_files(
                          scriptPath, updatePath))
            pm.text(l='', al='center', w=wB)
            pm.button(l='Cancel',
                      w=100,
                      h=25,
                      command=lambda *args: pm.deleteUI(updateWindow))
            pm.text(l='', al='center', w=wB)
        else:
            h = 135
            pm.text('update_heading',
                    edit=True,
                    l='NO UPDATE AVAILABLE',
                    font='boldLabelFont')

            pm.text(l='', al='center', w=w)
            pm.rowColumnLayout(nc=3, cw=([1, wC], [2, 100], [3, wC]))
            pm.text(l='', al='center', w=wC)
            pm.button(l='Close',
                      w=100,
                      h=25,
                      command=lambda *args: pm.deleteUI(updateWindow))
            pm.text(l='', al='center', w=wC)

        pm.setParent('..')
        pm.rowColumnLayout(nc=3, cw=([1, 40], [2, 200]))
        pm.text(l='', w=40)
        pm.checkBox(
            'checkBox_periodic',
            l='Periodically check for updates?',
            w=w,
            h=25,
            al='center',
            v=global_cfg.get('g_update_check'),
            annotation=
            "Periodic update will check for a new version about every 7 days and prompt you to install it.",
            changeCommand=lambda *args: global_cfg.set(
                'g_update_check',
                pm.checkBox('checkBox_periodic', query=True, v=True)))

        updateWindow.show()
        pm.window(updateWindow, edit=True, h=h, w=(w + 2))
Exemplo n.º 55
0
def reposeDeal():
    from pymel.core import window, rowColumnLayout, text, button, checkBox, showWindow, Callback, scrollLayout
    
    roots = getReposeRoots()

    allRepose = roots[:]
    for root in roots:
        allRepose += listRelatives(root, ad=True, type='transform')

    checks = {
        'origRot': [],
        'origTrans': [],
        'prevRot': [],
        'prevTrans': [],
        'prevRotWorld': [],
        'prevTransWorld': [],
    }

    attrs = {
        'origR': [ 'origRot', 'r' ],
        'origT': [ 'origTrans', 't' ],
        'prevR': [ 'prevRot', 'r' ],
        'prevT': [ 'prevTrans', 't' ],
        'prevRW': [ 'prevRotWorld', 'prevRW' ],
        'prevTW': [ 'prevTransWorld', 'prevTW' ],
    }

    def setValues(objs, checks, column):
        
        targets = [obj for obj, check in zip(objs, checks[column]) if check.getValue()]

        setValueHelper( column, targets )
        
        '''
        print(targets)
        for target in targets:
            print(target)
            if column == 'origR':
                target.r.set( target.origR.get() )
            elif column == 'origT':
                target.t.set( target.origTrans.get() )
                
            elif column == 'prevR':
                target.r.set( target.prevRot.get() )
            elif column == 'prevT':
                target.t.set( target.prevTrans.get() )
                
            else:
                raise Exception('IMPELEMNT WORLKD')
        '''

    window()
    with scrollLayout():
        with rowColumnLayout(nc=7):
            text(l='')

            button(l='origR', c=Callback( setValues, allRepose, checks, 'origRot') )
            button(l='origT', c=Callback( setValues, allRepose, checks, 'origTrans') )

            button(l='prevR', c=Callback( setValues, allRepose, checks, 'prevRot') )
            button(l='prevT', c=Callback( setValues, allRepose, checks, 'prevTrans') )

            button(l='prevRW', c=Callback( setValues, allRepose, checks, 'prevRW') )
            button(l='prevTW', c=Callback( setValues, allRepose, checks, 'prevTW') )
            
            for obj in allRepose:
                text(l=obj.name())
                checks['origRot'].append( checkBox(l='') )
                checks['origTrans'].append( checkBox(l='') )
                
                checks['prevRot'].append( checkBox(l='', v=not obj.origRot.get() == obj.prevRot.get() ) )
                checks['prevTrans'].append( checkBox(l='', v=not obj.origTrans.get() == obj.prevTrans.get() ) )

                checks['prevRotWorld'].append( checkBox(l='') )
                checks['prevTransWorld'].append( checkBox(l='') )

    showWindow()
Exemplo n.º 56
0
    INT = pm.floatField(ffrINT, q=True, value=True)
    print(int(cantidad), int(radio), p1, p2, p3, r1, r2, r3, cbV, cbC, EXP,
          INT)

    ringLight(int(radio), int(cantidad), (p1, p2, p3), (r1, r2, r3), cbV, cbC,
              EXP, INT)


wname1 = 'LIT_RING'

if pm.window(wname1, ex=True):
    pm.deleteUI(wname1)

wname1 = pm.window(wname1, title='LIT RING')
c = pm.columnLayout(adjustableColumn=True)
pm.rowColumnLayout(numberOfColumns=4, columnWidth=[(2, 100), (2, 100)])
cant = pm.textFieldGrp(label='Cantidad',
                       text='20',
                       columnWidth=[(1, 50), (2, 60)])
rad = pm.textFieldGrp(label='Radio', text='60', columnWidth=[(1, 40), (2, 70)])
pm.setParent(c)
pm.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 60), (2, 80), (3, 80)])
pm.text('Position')
ffp1 = pm.floatField(precision=2)
ffp2 = pm.floatField(precision=2)
ffp3 = pm.floatField(precision=2)
pm.setParent(c)
pm.rowColumnLayout(numberOfColumns=4, columnWidth=[(1, 60), (2, 80), (3, 80)])
pm.text('Rotacion')
ffr1 = pm.floatField(minValue=-360, maxValue=360, precision=2)
ffr2 = pm.floatField(minValue=-360, maxValue=360, precision=2)
Exemplo n.º 57
0
    def __init__(self):

        ui_labelWidth = 140
        ui_inputWidth = 240

        if pm.window(WIN_NAME, exists=True):
            pm.deleteUI(WIN_NAME, window=True)

        with pm.window(WIN_NAME,
                       title=WIN_TITLE,
                       maximizeButton=False,
                       menuBar=True,
                       menuBarVisible=True) as self.window:

            pm.setUITemplate('DefaultTemplate', pushTemplate=True)

            pm.menu(label='Edit', tearOff=False)
            pm.menuItem(label='Reset Settings', command=self.ui_resetSettings)
            pm.menu(label='Options', tearOff=False)
            pm.radioMenuItemCollection()
            self.ui_RADBTN_spaceLocal = pm.menuItem(label='Use Local Space',
                                                    radioButton=True)
            self.ui_RADBTN_spaceLocal.space = SPACE_LOCAL
            self.ui_RADBTN_spaceObject = pm.menuItem(label='Use Object Space',
                                                     radioButton=False)
            self.ui_RADBTN_spaceObject.space = SPACE_OBJECT
            self.ui_RADBTN_spaceWorld = pm.menuItem(label='Use World Space',
                                                    radioButton=False)
            self.ui_RADBTN_spaceWorld.space = SPACE_WORLD
            self.spaceRadioList = [
                self.ui_RADBTN_spaceLocal, self.ui_RADBTN_spaceObject,
                self.ui_RADBTN_spaceWorld
            ]

            self.ui_setSpace(SPACE_OBJECT)
            pm.menu(label='Help', tearOff=False)
            pm.menuItem(label='Help on ' + WIN_TITLE, command=self.ui_showHelp)

            with pm.formLayout() as self.ui_LAY_mainForm:

                with pm.tabLayout(tabsVisible=False) as self.ui_TAB_top:
                    pm.tabLayout(self.ui_TAB_top, e=True, height=1)

                    with pm.formLayout() as self.ui_LAY_attachForm:

                        with pm.tabLayout(
                                tabsVisible=False,
                                scrollable=True,
                                innerMarginWidth=4) as self.ui_TAB_inner:

                            with pm.columnLayout(adjustableColumn=True
                                                 ) as self.ui_LAY_mainColumn:

                                with pm.frameLayout(
                                        label='Control Panel',
                                        collapsable=True,
                                        collapse=False,
                                        marginHeight=3
                                ) as self.ui_LAY_frameControlPanel:

                                    with pm.rowColumnLayout(
                                            numberOfColumns=12,
                                            columnSpacing=([3, 2], [4, 2],
                                                           [5, 2], [6, 2]),
                                            rowSpacing=[1, 5],
                                            #            Label       X       Y         Z       XYZ      Mag     Sep      Reset     Bias      Sep       Min       Max
                                            columnWidth=[
                                                (1, 60),
                                                (2, 20),
                                                (3, 20),
                                                (4, 20),
                                                (5, 80),
                                                (6, 60),
                                                (7, 20),
                                                (8, 20),
                                                (9, 120), (10, 20), (11, 60),
                                                (12, 60)
                                            ]) as self.ui_LAY_mainRowColumn:

                                        # ----- Header Row -----

                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='Magnitude', )
                                        pm.text(label='')
                                        pm.text(label='')
                                        pm.text(label='Bias', )
                                        pm.text(label='')
                                        pm.text(label='Min', )
                                        pm.text(label='Max', )

                                        # ----- Translate Row -----

                                        pm.text(label='Translate ',
                                                align='right')
                                        pm.button(label='X',
                                                  command=pm.Callback(
                                                      self.randomizeTranslate,
                                                      ['tx']))
                                        pm.button(label='Y',
                                                  command=pm.Callback(
                                                      self.randomizeTranslate,
                                                      ['ty']))
                                        pm.button(label='Z',
                                                  command=pm.Callback(
                                                      self.randomizeTranslate,
                                                      ['tz']))
                                        pm.button(label='XYZ',
                                                  command=pm.Callback(
                                                      self.randomizeTranslate,
                                                      ['tx', 'ty', 'tz']))
                                        self.ui_FLTFLD_translateMagnitude = pm.floatField(
                                            'ui_FLTFLD_translateMagnitude',
                                            changeCommand=self.ui_refresh,
                                            value=10)
                                        pm.text(label='')
                                        self.ui_BTN_translateBiasReset = pm.button(
                                            label='0')
                                        pm.setUITemplate(
                                            'DefaultTemplate',
                                            popTemplate=True
                                        )  # strange slider group visual with default template
                                        self.ui_INTSLGRP_translateBias = pm.intSliderGrp(
                                            'ui_INTSLGRP_translateBias',
                                            columnWidth=[1, 30],
                                            field=True,
                                            minValue=-100,
                                            maxValue=100,
                                            fieldMinValue=-100,
                                            fieldMaxValue=100,
                                            value=0,
                                            step=1,
                                            fieldStep=1,
                                            sliderStep=1,
                                            changeCommand=self.ui_refresh,
                                            dragCommand=self.ui_refresh)
                                        pm.setUITemplate('DefaultTemplate',
                                                         pushTemplate=True)
                                        pm.button(
                                            self.ui_BTN_translateBiasReset,
                                            edit=True,
                                            command=pm.Callback(
                                                self.ui_resetBias, self.
                                                ui_INTSLGRP_translateBias))
                                        pm.text(label='=')
                                        self.ui_FLTFLD_translateMin = pm.floatField(
                                            enable=False, value=-5)
                                        self.ui_FLTFLD_translateMax = pm.floatField(
                                            enable=False, value=95)

                                        # ----- Rotate Row -----

                                        pm.text(label='Rotate ', align='right')
                                        pm.button(label='X',
                                                  command=pm.Callback(
                                                      self.randomizeRotate,
                                                      ['rx']))
                                        pm.button(label='Y',
                                                  command=pm.Callback(
                                                      self.randomizeRotate,
                                                      ['ry']))
                                        pm.button(label='Z',
                                                  command=pm.Callback(
                                                      self.randomizeRotate,
                                                      ['rz']))
                                        pm.button(label='XYZ',
                                                  command=pm.Callback(
                                                      self.randomizeRotate,
                                                      ['rx', 'ry', 'rz']))
                                        self.ui_FLTFLD_rotateMagnitude = pm.floatField(
                                            'ui_FLTFLD_rotateMagnitude',
                                            changeCommand=self.ui_refresh,
                                            value=90)
                                        pm.text(label='')
                                        self.ui_BTN_rotateBiasReset = pm.button(
                                            label='0')
                                        pm.setUITemplate(
                                            'DefaultTemplate',
                                            popTemplate=True
                                        )  # strange slider group visual with default template
                                        self.ui_INTSLGRP_rotateBias = pm.intSliderGrp(
                                            'ui_INTSLGRP_rotateBias',
                                            columnWidth=[1, 30],
                                            field=True,
                                            minValue=-100,
                                            maxValue=100,
                                            fieldMinValue=-100,
                                            fieldMaxValue=100,
                                            value=0,
                                            step=1,
                                            fieldStep=1,
                                            sliderStep=1,
                                            changeCommand=self.ui_refresh,
                                            dragCommand=self.ui_refresh)
                                        pm.setUITemplate('DefaultTemplate',
                                                         pushTemplate=True)
                                        pm.button(
                                            self.ui_BTN_rotateBiasReset,
                                            edit=True,
                                            command=pm.Callback(
                                                self.ui_resetBias,
                                                self.ui_INTSLGRP_rotateBias))
                                        pm.text(label='=')
                                        self.ui_FLTFLD_rotateMin = pm.floatField(
                                            enable=False, value=-5)
                                        self.ui_FLTFLD_rotateMax = pm.floatField(
                                            enable=False, value=95)

                                        # ----- Scale Row -----

                                        pm.text(label='Scale ', align='right')
                                        pm.button(label='X',
                                                  command=pm.Callback(
                                                      self.randomizeScale,
                                                      ['sx']))
                                        pm.button(label='Y',
                                                  command=pm.Callback(
                                                      self.randomizeScale,
                                                      ['sy']))
                                        pm.button(label='Z',
                                                  command=pm.Callback(
                                                      self.randomizeScale,
                                                      ['sz']))

                                        pm.flowLayout(columnSpacing=2)
                                        pm.button(label='XYZ',
                                                  command=pm.Callback(
                                                      self.randomizeScale,
                                                      ['sx', 'sy', 'sz']))
                                        pm.button(label='Uniform',
                                                  command=pm.Callback(
                                                      self.randomizeScale,
                                                      ['uniform']))
                                        pm.setParent('..')

                                        self.ui_FLTFLD_scaleMagnitude = pm.floatField(
                                            'ui_FLTFLD_scaleMagnitude',
                                            changeCommand=self.ui_refresh,
                                            value=2)
                                        pm.text(label='')
                                        self.ui_BTN_scaleBiasReset = pm.button(
                                            label='0')
                                        pm.setUITemplate(
                                            'DefaultTemplate',
                                            popTemplate=True
                                        )  # strange slider group visual with default template
                                        self.ui_INTSLGRP_scaleBias = pm.intSliderGrp(
                                            'ui_INTSLGRP_scaleBias',
                                            columnWidth=[1, 30],
                                            field=True,
                                            minValue=-100,
                                            maxValue=100,
                                            fieldMinValue=-100,
                                            fieldMaxValue=100,
                                            value=0,
                                            step=1,
                                            fieldStep=1,
                                            sliderStep=1,
                                            changeCommand=self.ui_refresh,
                                            dragCommand=self.ui_refresh)
                                        pm.setUITemplate('DefaultTemplate',
                                                         pushTemplate=True)
                                        pm.button(
                                            self.ui_BTN_scaleBiasReset,
                                            edit=True,
                                            command=pm.Callback(
                                                self.ui_resetBias,
                                                self.ui_INTSLGRP_scaleBias))
                                        pm.text(label='=')
                                        self.ui_FLTFLD_scaleMin = pm.floatField(
                                            enable=False, value=-5)
                                        self.ui_FLTFLD_scaleMax = pm.floatField(
                                            enable=False, value=95)

                                with pm.frameLayout(
                                        label='Seed Control',
                                        collapsable=True,
                                        collapse=False,
                                        marginHeight=3
                                ) as self.ui_LAY_frameSeedControl:

                                    with pm.columnLayout(
                                            adjustableColumn=False):

                                        with pm.rowLayout(
                                                numberOfColumns=2,
                                                columnWidth2=[
                                                    ui_labelWidth,
                                                    ui_inputWidth
                                                ],
                                                columnAttach=[1, 'right', 5]):
                                            pm.text(label='Use Seed')
                                            self.ui_CHK_useSeed = pm.checkBox(
                                                'ui_CHK_useSeed',
                                                value=True,
                                                label='',
                                                changeCommand=self.ui_refresh)

                                        with pm.rowLayout(
                                                numberOfColumns=2,
                                                columnWidth2=[
                                                    ui_labelWidth,
                                                    ui_inputWidth
                                                ],
                                                columnAttach=[1, 'right', 5]):
                                            pm.text(label='Seed')

                                            pm.setUITemplate(
                                                'DefaultTemplate',
                                                popTemplate=True
                                            )  # strange slider group visual with default template
                                            self.ui_INTSLGRP_seedValue = pm.intSliderGrp(
                                                'ui_INTSLGRP_seedValue',
                                                field=True,
                                                minValue=1,
                                                maxValue=10000,
                                                fieldMinValue=1,
                                                fieldMaxValue=10000,
                                                value=1234,
                                                step=1,
                                                fieldStep=1,
                                                sliderStep=1)
                                            pm.setUITemplate('DefaultTemplate',
                                                             pushTemplate=True)

                # pm.setParent(self.ui_mainForm)

                self.ui_BTN_close = pm.button(label='Close',
                                              command=self.ui_close)

        pm.setUITemplate('DefaultTemplate', popTemplate=True)

        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'top', 0)
        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'left', 0)
        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'right', 0)
        self.ui_LAY_attachForm.attachForm(self.ui_TAB_inner, 'bottom', 0)

        self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'top', 0)
        self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'left', 0)
        self.ui_LAY_mainForm.attachForm(self.ui_TAB_top, 'right', 0)
        self.ui_LAY_mainForm.attachControl(self.ui_TAB_top, 'bottom', 5,
                                           self.ui_BTN_close)

        self.ui_LAY_mainForm.attachNone(self.ui_BTN_close, 'top')
        self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'left', 5)
        self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'bottom', 5)
        self.ui_LAY_mainForm.attachForm(self.ui_BTN_close, 'right', 5)

        self.prefSaver = prefsaver.PrefSaver(
            serializers.SerializerOptVar(OPT_VAR_NAME))
        self.ui_initSettings()
        self.ui_loadSettings()

        self.window.show()
        pm.refresh()
Exemplo n.º 58
0
def createUI(pWindowTitle):
    windowID = 'myWindowID'

    globalGender[0] = getGender()

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

    cmds.window(windowID, title=pWindowTitle, width=440)

    # root column layout
    cmds.rowColumnLayout()

    cmds.image(image='icons\EqualReality\PolyMorphTitle.jpg')

    cmds.button(label='Load Base Model',
                command=importCallback,
                height=50,
                backgroundColor=(0.066, 0.447, 0.443))

    cmds.separator(h=4, style='none', backgroundColor=(0.07, 0.121, 0.152))

    cmds.button(label='Load Photogrammetry Reference',
                command=importReferenceCallback,
                height=35,
                backgroundColor=(0.109, 0.227, 0.29))

    #cmds.separator(h = 20, style='none', backgroundColor = (0.133,0.164,0.239))

    #cmds.button(label='Edit', command=editCallback, backgroundColor = (0.109,0.458,0.16))
    cmds.separator(h=4, style='none', backgroundColor=(0.07, 0.121, 0.152))

    if pm.ls('Trace'):

        #populate my fields by reading the files
        nameKey = []
        nameRead = open(
            'EqualRealityData\SelectionData%s.txt' % (globalGender[0]), 'r+')
        vertexRead = open(
            'EqualRealityData\SelectedVerticies%s.txt' % (globalGender[0]),
            'r+')
        eyeRead = open(
            'EqualRealityData\SavedVertexPositions%sEye.txt' %
            (globalGender[0]), 'r+')
        for line in nameRead.readlines():
            mySelName = re.sub('\r\n', '', line)
            nameKey.append(mySelName)
            if globalNameKey.count(mySelName) < 1:
                globalNameKey.append(mySelName)
        for line in vertexRead.read().split('\r\n\r\n'):
            if line not in globalVertexKey:
                globalVertexKey.append(line)

        for line in eyeRead.read().split('\r\n\r\n'):
            if line != None and line not in globalEyeKey:
                globalEyeKey.append(line)

        eyeRead.close()
        nameRead.close()
        vertexRead.close()

        pm.softSelect(softSelectEnabled=True)
        pm.symmetricModelling(s=True)

        cmds.separator(h=8, style='none', backgroundColor=(0.07, 0.121, 0.152))
        pm.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 120), (2, 325)])
        pm.separator(style='none', backgroundColor=(0.27, 0.345, 0.376))
        pm.checkBox('GuidesVisible',
                    label='Show Guides for Reference Alignment',
                    height=25,
                    backgroundColor=(0.27, 0.345, 0.376),
                    onCommand=referenceLines,
                    offCommand=referenceLines)
        pm.setParent('..')
        cmds.separator(h=4, style='none', backgroundColor=(0.07, 0.121, 0.152))

        global OnStart
        if OnStart == 1:
            print('this is the first time ive run')
            moveJaw('Away')
            OnStart = 0

        myState = rolloutParameters(name='modellingToolkit', query=True)
        cmds.frameLayout(backgroundColor=(0.301, 0.423, 0.513),
                         collapsable=True,
                         collapse=myState,
                         label='Modelling Toolkit')

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

        #Pick Eye Shape
        createImageButtonGroup('Eye')
        cmds.setParent('..')

        myState = rolloutParameters(name='bodypartSelection', query=True)
        cmds.frameLayout(backgroundColor=(0.25, 0.349, 0.423),
                         collapsable=True,
                         collapse=myState,
                         label='Bodypart Selection')
        cmds.rowColumnLayout(numberOfColumns=3,
                             columnWidth=[(1, 380), (2, 30), (3, 30)])

        cmds.rowColumnLayout(numberOfColumns=3,
                             columnWidth=[(1, 80), (2, 180), (3, 115)])
        cmds.text(label='   Soft Select:  ', align='left')
        cmds.floatSlider("SoftSelectSlider",
                         changeCommand=sliderChangeCommand,
                         min=0,
                         max=8)
        cmds.text(label='     Move Jaw Away     ', align='right')

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

        cmds.checkBox(value=jawIsAway,
                      label='',
                      onCommand=functools.partial(moveJaw, 'Away'),
                      offCommand=functools.partial(moveJaw, 'Back'))

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

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

        global lockedGroups

        for pSelection in nameKey:
            bodypartSelection(pSelection)
            cmds.separator(h=20, style='none')
            #lock perminant entries
            if pSelection in lockedGroups:
                cmds.separator(h=20, style='none')
            else:
                cmds.button('DeleteButton%s' % (pSelection),
                            label='X',
                            backgroundColor=(0.815, 0.098, 0.098),
                            command=functools.partial(removeButtonCallback,
                                                      pSelection))

        cmds.setParent('..')

        pm.separator(h=5, style='none')
        pm.textFieldButtonGrp("addingNewFields",
                              label='New Type:   ',
                              placeholderText='  selection name...',
                              buttonLabel='Add',
                              buttonCommand=addButtonCallback)

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

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

        myState = rolloutParameters(name='bakeModel', query=True)
        cmds.frameLayout(backgroundColor=(0.329, 0.482, 0.431),
                         collapsable=True,
                         collapse=myState,
                         label='Bake Model')
        cmds.separator(h=4, style='none')
        cmds.button(backgroundColor=(0.235, 0.388, 0.349),
                    label='Place Eyes',
                    command=eyesCallback)
        #cmds.separator(h = 4, style = 'none')
        cmds.button(backgroundColor=(0.235, 0.388, 0.349),
                    label='Bake',
                    command=bakeCallback)
        cmds.setParent('..')
    cmds.showWindow()
            attrType = typeMappings[rawType]
            shape.addAttr(attrFullName, keyable=1, attributeType=attrType)

        if attrVal:
            shape.attr(attrFullName).set(int(attrVal))

        sys.stdout.write("Added %s to %s\n" % (attrFullName, str(shape)))


windowID = "aiAttrWin"
if pm.window(windowID, exists=True):
    pm.deleteUI(windowID)

window = pm.window(windowID, title="Add aiUserData Attribute")
pm.rowColumnLayout(numberOfColumns=2,
                   columnWidth=(2, 300),
                   columnSpacing=[(1, 10), (2, 10)],
                   rowSpacing=(10, 10))

pm.text(label="*Attribute Name")
name = pm.textField()
pm.text(label="Attribute Value")
value = pm.textField()
pm.text(label="Attribute Type")
type = pm.optionMenu()
pm.menuItem(label="Color")
pm.menuItem(label="Float")
pm.menuItem(label="Integer")
pm.menuItem(label="Boolean")
pm.menuItem(label="String")

pm.button(label="Cancel", command="pm.deleteUI('" + window + "', window=True)")
Exemplo n.º 60
0
def gui():
    '''
    # the gui for the tool
    '''
    load_mr()  # loading mental ray drawing guis for all mental ray tabs

    win = 'lightingtools'
    if pm.window(win, exists=True):
        pm.deleteUI(win)

    if pm.windowPref(win, exists=True):
        pm.windowPref(win, remove=True)

    my_win = pm.window(win,
                       title='Lighting',
                       width=550,
                       height=600,
                       sizeable=True)
    pm.scrollLayout(width=550)
    tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5, width=550)
    global scroll_list, light_row, text_field, light_type, sroll_list, lights_layout, ui_row, ibl_layout, presets_layout
    lights_layout = pm.columnLayout(width=550)

    light_type = pm.optionMenu(label='Light Type', width=200)
    pm.menuItem(label='Spot')
    pm.menuItem(label='Area')
    pm.menuItem(label='Directional')
    pm.menuItem(label='Point')
    pm.menuItem(label='Ambient')
    pm.menuItem(label='Volume')

    text_field = pm.textFieldButtonGrp(label='Light Name',
                                       buttonLabel='Create Light',
                                       buttonCommand=pm.Callback(create_light),
                                       columnWidth3=[100, 250, 200])

    light_row = pm.rowColumnLayout(numberOfColumns=2, columnWidth=[150, 400])
    pm.columnLayout(width=150, adjustableColumn=False)
    scroll_list = pm.textScrollList(width=150,
                                    height=200,
                                    selectCommand=pm.Callback(create_ui),
                                    allowMultiSelection=True)
    pm.button(label='List Lights', command=pm.Callback(list_lights), width=150)
    pm.setParent(light_row)
    ui_row = pm.columnLayout(width=400)

    pm.setParent(tabs)
    light_utils = pm.columnLayout(adjustableColumn=True)
    pm.frameLayout(label='Duplicate Lights')
    duplicator_ui = duplicator()

    pm.setParent('..')
    pm.frameLayout(label='Fog Editor')
    fog_editor_ui = Fog_editor()

    # pm.button(label= 'Duplicate Selected Lights', command= duplicate_light)

    pm.setParent(tabs)
    ibl_layout = pm.columnLayout(adjustableColumn=True)
    # pm.button(label= 'Create IBL', command= create_ibl)
    ibls_ui = IBL_section()

    pm.setParent(tabs)
    rigs_layout = pm.columnLayout(adjustableColumn=True)
    pm.frameLayout(label='Three Point System')
    pm.text(label='')
    three_point = Three_Point_Rig()
    pm.text(label='')
    pm.setParent(rigs_layout)
    pm.frameLayout(label='Simple Outdoor System')
    pm.text(label='')
    pm.button(label='Simple Outdoor', command=simple_outdoor)
    pm.text(label='')
    pm.setParent(rigs_layout)
    pm.frameLayout(label='Complex Outdoor System')
    pm.text(label='')
    pm.button(label='Complex Outdoor', command=complex_outdoor)
    pm.text(label='')
    pm.setParent(rigs_layout)
    pm.frameLayout(label=u'Smoke & Fog')
    pm.text(label='')
    smoke_fog = Fog_creator()
    pm.text(label='')

    pm.setParent(tabs)
    presets_layout = pm.columnLayout(adjustableColumn=True)
    pm.rowColumnLayout(numberOfColumns=2, columnWidth=([1, 275], [2, 275]))
    pm.button(label='new preset', command=create_preset)
    pm.button(label='refresh', command=preset_ui)

    pm.tabLayout(tabs,
                 edit=True,
                 tabLabel=((lights_layout, 'Lights'), (ibl_layout, 'IBL'),
                           (light_utils, 'Utilities'), (rigs_layout, 'Rigs'),
                           (presets_layout, 'Presets')))

    list_lights()
    #list_ibls()

    preset_ui()

    my_win.show()