def rh_dynamicJoint():
    #Create a variable for the window name
    winName = 'DynamicJoint'
    winTitle = 'rh_DynamicJoint_prototype_v0.23'
    #Delete the window if it exists
    if pm.window(winName, exists = True):
        pm.deleteUI(winName, window = True)
    #Build the main window
    pm.window(winName, title = winTitle, sizeable = True)
    #name field
    pm.textFieldGrp('NameTFG',label = 'Set up name:', text = 'Ribbon45hp', ed = True)
    pm.columnLayout(adjustableColumn = True)
    #side
    pm.radioButtonGrp('ColSel',nrb = 3,label = 'Side:',la3 = ['l','m','r'],sl = 1)    
    pm.columnLayout(adjustableColumn = True)
    #axis
    pm.radioButtonGrp('AxisSel',nrb = 3,label = 'Axis:',la3 = ['x','y','z'],sl = 1)    
    pm.columnLayout(adjustableColumn = True)
    #ccSize
    pm.floatSliderGrp('Cc_Size',label = 'Control Size:',f = True,min = 1,max = 10,fmn = 1,fmx = 100,v = 1)
    pm.columnLayout(adjustableColumn = True)
    #joint number
    pm.intSliderGrp('Joint_Num',label = 'Number Of Joints:',f = True,min = 4,max = 49,fmn = 1,fmx = 100,v = 4)
    pm.columnLayout(adjustableColumn = True)
    
    #inbound
    pm.button(label = 'Ready For Tasking', command = 'inbound()')
    pm.columnLayout(adjustableColumn = True)
    #bringTheRain
    pm.button(label = 'Target Acquire', command = 'bringTheRain()')
    pm.columnLayout(adjustableColumn = True)    
    
    #Show the window
    pm.showWindow(winName)
    pm.window(winName, edit = True, width = 378, height = 210)
Exemple #2
0
def ContrlUI():
	if pm.window( u'MeshPreviewUI',q=1,exists=1):
		pm.deleteUI(u'MeshPreviewUI')
	pm.window(u'MeshPreviewUI',t=u'Mesh预览--渲染细分Tool v1.0')
	pm.columnLayout(cal='left')
	pm.rowLayout(nc=2)
	pm.intSliderGrp( 'intDis',field=True, label='Display Ctrl',ann=u'物体的显示精度控制',cw=[(1,80),(2,50),(3,100)],cal=[(1,'left'),(2,'left'),(3,'left')], minValue=0, maxValue=7, fieldMinValue=0, fieldMaxValue=7, value=2 )
	pm.setParent('..')
	pm.rowLayout(nc=2)
	pm.intSliderGrp( 'intRen',field=True, label='Render Ctrl',ann=u'物体的渲染精度控制',cw=[(1,80),(2,50),(3,100)],cal=[(1,'left'),(2,'left'),(3,'left')], minValue=0, maxValue=7, fieldMinValue=0, fieldMaxValue=7, value=2,en=0 )
	pm.checkBox('checkMod', l=u'关联预览',ann=u'渲染精度与显示精度关联',v=1,cc=lambda *args:changelink())
	pm.setParent('..')
	pm.rowLayout( nc=3,cw=[(1,75),(2,75),(3,75)])
	pm.button(l=u'按1',w=74,bgc=[0.4,0.2,0.2],ann=u'就是按1啦!!!',c=lambda *args:run(0,0))
	pm.button(l=u'按2',w=74,bgc=[0.2,0.2,0.4],ann=u'就是按2啦!!!',c=lambda *args:run(0,1))
	pm.button(l=u'按3',w=74,bgc=[0.2,0.4,0.2],ann=u'就是按3啦!!!',c=lambda *args:run(0,2))
	pm.setParent('..')
	pm.rowLayout( nc=3,cw=[(1,75),(2,75),(3,75)])
	pm.button(l=u'所有按1',w=74,bgc=[0.4,0.2,0.2],ann=u'就是所有按1啦!!!',c=lambda *args:run(1,0))
	pm.button(l=u'所有按2',w=74,bgc=[0.2,0.2,0.4],ann=u'就是所有按2啦!!!',c=lambda *args:run(1,1))
	pm.button(l=u'所有按3',w=74,bgc=[0.2,0.4,0.2],ann=u'就是所有按3啦!!!',c=lambda *args:run(1,2))
	pm.setParent('..')
	pm.text('designed by jiaguobao',ann=u'作者就是我')
	pm.showWindow(u'MeshPreviewUI')
	pm.window( u'MeshPreviewUI',e=1,w=320,h=120,sizeable=False)
    def Pr(self,*args):
        #Read Parameters:
	    subx = pm.intSliderGrp(self.GlobalVars["SubX"], q = True, value = True)
	    suby = pm.intSliderGrp(self.GlobalVars["SubY"], q = True, value = True)
	    grav = pm.floatSliderGrp(self.GlobalVars["GraV"], q = True, value = True)
	
	    print subx
	    print suby
	    print grav
Exemple #4
0
def extrudeTrail(poly,crv):
    edge = pm.ls(poly+'.e[0]')
    pm.xform(poly,cp=1)
    polyPos = pm.xform(poly,q=1,rp=1,ws=1)
    
    divisions = pm.intSliderGrp('trailDivisions', q=1,v=1)
    pm.polyExtrudeEdge(edge,ch=1,kft=1,pvx=polyPos[0],pvy=polyPos[1],pvz=polyPos[2],divisions=divisions,inputCurve = crv)
    deleteFace = pm.ls(poly+'.f[0]')
    pm.delete(deleteFace)
    trailName = crv.replace('trail_crv','trail')
    pm.rename(poly,trailName)
    pm.intSliderGrp('trailDivisions',e=1,cc=changeTrailDivisions)
Exemple #5
0
def __calculate(ui, *args):
    """calculates the number of samples per-pixel and per-trace of a particular
       combination of DMC Sampler settings and component secondary subdivs.
      
       ui 
         : a dictionary of the current UI settings. """

    # protecting from garbage input.  min cannot be more than max.
    if ui['dmc_min_subdivs'] > ui['dmc_max_subdivs']:
        pm.intSliderGrp('max_subdivs_in', e=True, v=ui['dmc_min_subdivs'])
        __uiUpdate()

    # # CALCULATIONS
    # # FORMULAS FROM http://www.cggallery.com/tutorials/dmc_calculator/

    # converting max primary subdivs to samples
    max_primary_pp = ui['dmc_max_subdivs']**2
    min_primary_pp = ui['dmc_min_subdivs']**2

    ### max secondary samples per trace = ( secondary subdivs * samples multiplier / total max samples )
    max_samp_trace = math.ceil(
        ((ui['subdivs']**2) * ui['subdivs_mult']) / max_primary_pp)
    #max secondary sample traces cannot be less than the adaptive minimum
    if max_samp_trace < ui['adaptive_min']:
        max_samp_trace = ui['adaptive_min']
    '''elif adaptive_amt < 1: Can't remember what this was for
        if max_samp_trace < 1:
            max_samp_trace = 1'''
    ### max secondary samples per pixel = (max secondary samples per trace * total max samples )
    max_samp_pixel = max_samp_trace * max_primary_pp

    ### min secondary samples per trace = ( max secondary samples per trace * non-adaptive weight component )
    min_samp_trace = math.ceil(max_samp_trace * (1 - ui['adaptive_amt']))
    # if fully adaptive, use the adaptive minimum instead of the non-adaptive weight component
    if min_samp_trace < ui['adaptive_min']:
        min_samp_trace = ui['adaptive_min']

    ### min secondary samples per pixel = (minimum samples per trace * minimum primary samples per pixel)
    min_samp_pixel = min_samp_trace * min_primary_pp

    ### adaptive samples available per trace
    adaptive_samp_trace = max_samp_trace - min_samp_trace

    results = {}
    results.setdefault('min_primary_pp', min_primary_pp)
    results.setdefault('max_primary_pp', max_primary_pp)
    results.setdefault('min_samp_pixel', min_samp_pixel)
    results.setdefault('max_samp_pixel', max_samp_pixel)
    results.setdefault('min_samp_trace', min_samp_trace)
    results.setdefault('max_samp_trace', max_samp_trace)
    results.setdefault('adaptive_samp_trace', adaptive_samp_trace)

    return results
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)
Exemple #7
0
def __uiGrok():
    """UI parser"""

    ui = {}
    ui['subdivs_mult'] = pm.floatFieldGrp('subdivs_mult_in', q=True, v=True)[0]
    #ui['mode_select'] = pm.radioButtonGrp( 'mode_sel_in', q=True, sl=True )
    ui['dmc_min_subdivs'] = pm.intSliderGrp('min_subdivs_in', q=True, v=True)
    ui['dmc_max_subdivs'] = pm.intSliderGrp('max_subdivs_in', q=True, v=True)
    ui['dmc_threshold'] = pm.floatSliderGrp('thresh_val_in', q=True, v=True)
    ui['adaptive_amt'] = pm.floatSliderGrp('adapt_amt_in', q=True, v=True)
    ui['adaptive_min'] = pm.intSliderGrp('adapt_min_in', q=True, v=True)
    ui['subdivs'] = pm.intSliderGrp('subdivs_in', q=True, v=True)

    return ui
Exemple #8
0
def run(mode,level):
	check =pm.checkBox('checkMod',q=1,v=1)
	intDis = pm.intSliderGrp('intDis',q=1,v=1)
	if check ==False:
		intRen = pm.intSliderGrp('intRen',q=1,v=1)
	else:
		intRen = intDis
	meshs = getMesh(mode)
	for m in meshs:
		m.displaySmoothMesh.set(level)
		m.smoothLevel.set(intDis)
		if check==False:
			m.useSmoothPreviewForRender.set(0)
			print m,intRen
		m.renderSmoothLevel.set(intRen)
Exemple #9
0
def render(*args):
    global size, material_dir, textures_dir
    size = pm.intSliderGrp("baker_size", q=True, v=True)
    material_dir = pm.textField("baker_mat_dir", q=True, tx=True)
    textures_dir = pm.textField("baker_out_dir", tx=True, q=True)
    redshift_dir = os.path.join(pm.workspace(fn=True), "images")

    os.chdir(textures_dir)
    settings()

    selected = pm.selected(type="transform") or pm.ls(type="transform")
    selected = [sl for sl in selected if sl.listRelatives(type="mesh")]
    names = [mesh.name().split("|")[-1] for mesh in selected]
    pm.showHidden(selected)

    if pm.checkBox("baker_id", q=True, v=True):
        for mesh, mesh_name in zip(selected, names):
            bakeID(mesh, mesh_name + "_id")

    if pm.checkBox("baker_ao", q=True, v=True):
        pm.select(pm.ls(type="mesh"))
        pm.hyperShade(a="ao_material")
        for mesh, mesh_name in zip(selected, names):
            bake(mesh, mesh_name + "_ao.png")

    if pm.checkBox("baker_shadow", q=True, v=True):
        pm.select(pm.ls(type="mesh"))
        pm.hyperShade(a="shadow_material")
        for mesh, mesh_name in zip(selected, names):
            bake(mesh, mesh_name + "_shadow.png")

    if pm.checkBox("baker_mat", q=True, v=True):
        for mesh_name in names:
            bakeMaterials(mesh_name)
    pm.warning("finished")
Exemple #10
0
	def spine_init ( self, size=5.0, limbName='spine', mode='biped', numOfJnts=4 , *args ):
		
		self.spine_initJnts=[]
		self.tmpCrv = None
		
		try:# if in UI mode, get number of joints from UI
			size = pm.floatSliderGrp( self.spineSizeF, q=True, value=True)
			limbName = pm.textField( self.limbNameTF, q=True, text=True)
			selectedMode = pm.radioCollection( self.characterModeRC, q=True, select=True)
			mode = pm.radioButton( selectedMode, q=True, label=True ).lower()
			numOfJnts = pm.intSliderGrp( self.numOfInitJntsIS, q=True, value=True)
		except:
			pass

		curveCVs=[]
		curveCVsCount=[]
		for i in range(numOfJnts):
			pm.select (clear=True)

			if mode=='biped':
				jntPos = ( 0, size+(size*1.0/(numOfJnts-1)*i), 0 )
			elif mode=='quadruped':
				jntPos = ( 0, size, (size*1.0/(numOfJnts-1)*i)-size/2.0 )
			else:
				pm.error('ehm_tools...Spine: mode arg accepts "biped" or "quadruped" only!')

			self.spine_initJnts.append(  pm.joint ( p = jntPos , name = "%s_%s_initJnt"%(limbName,i+1) )  )
			curveCVs.append( jntPos )
			curveCVsCount.append( i )

		self.tmpCrv = pm.curve( d=1, p=curveCVs , k=curveCVsCount )
		self.tmpCrv.getShape().template.set(True)
		pm.skinCluster( self.spine_initJnts,self.tmpCrv)	
 def GUI(self):
     self._win = pmc.window(self.WINDOW_NAME, title=self.WINDOW_TITLE)
     pmc.columnLayout(adjustableColumn=True)
     self._slider = pmc.intSliderGrp(label='Segments', field=True, min=2, max=100, value=2)
     pmc.button(label='Okay', c=pmc.Callback(self._callback))
     pmc.button(label='Cancel', c=pmc.Callback(pmc.deleteUI, self._win))
     self._win.show()
 def __init__(self, debug=0):
     title="TransferBlendShapes"
     if(pm.windowPref(title, q=True, ex=True)):
         pm.windowPref(title, remove=True)
     if(pm.window(title, q=True, ex=True)):
         pm.deleteUI(title)
         
     self.win = pm.window(title, title="Transfer BlendShapes Tool")
     self.rowColumnLayoutA = pm.rowColumnLayout()
     self.intro = pm.text( label='complete the following steps in order' )
     self.frameLayoutA = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 1   Load Target Mesh', borderStyle='in' )
     self.columnlayoutA = pm.columnLayout()
     self.frameLayoutB = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 2   Import Mask', borderStyle='in' )
     self.columnlayoutA = pm.columnLayout()
     self.frameLayoutC = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True,  label='Step 3   Manipulate Match Mesh', borderStyle='in' )
     self.columnlayoutB = pm.columnLayout()
     self.frameLayoutD = pm.frameLayout(parent=self.rowColumnLayoutA, cl=True, cll=True, label='Step 4   Transfer Blends', borderStyle='in' )
     self.columnlayoutC = pm.columnLayout()
     #self.dockControl = pm.dockControl(label=title, area='right', content=title, allowedArea=['right', 'left'], sizeable=True)
     
     # fameA content
     self.names = {'Target':None}
     
     # Generating x number of fields based on dictionary keys of self.names
     for name in self.names:
         self.names[name] = pm.textFieldButtonGrp(cw = ((1, 76), (2, 176)), parent=self.frameLayoutA,
                                                  label = name, 
                                                  placeholderText = 'Enter Name Here   or   >>>> ',
                                                  buttonLabel = 'load selected', tcc= self.prepTargetMeshOn,
                                                  buttonCommand = pm.Callback(self.nameField_load, name))
     self.btn_prepTgt = pm.button(parent=self.frameLayoutA, enable=False, w=40, h=20, label="Prep Target", command=self.prepTargetMesh)
     self.fA_fillText = pm.text(parent=self.frameLayoutA, label='    ' )
         
     # fameB content
     self.importText = pm.text(parent=self.frameLayoutB, label='Import the desired facial mask' )
     self.manipulateText = pm.text(parent=self.frameLayoutB, label='Use the avalable controls to manipulate the mask' )
     self.fitText = pm.text(parent=self.frameLayoutB, label='Roughly fit the mask to the target mesh' )
     self.btn_trueHuman = pm.button(parent=self.frameLayoutB, enable=True, w=40, h=20, label="Human Anatomy", command=self.humanAnatomyImport)  
     self.btn_trueMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Anatomy", command=self.muzzleAnatomyImport)
     self.btn_toonHuman = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Human Toon", command=self.humanToonImport)  
     self.btn_toonMuzzle = pm.button(parent=self.frameLayoutB, enable=False, w=40, h=20, label="Muzzle Toon", command=self.muzzleToonImport)
     self.fB_fillText = pm.text(parent=self.frameLayoutB, label='    ' )
     
     # fameC content
     self.matchMeshText = pm.text(parent=self.frameLayoutC, label='activate match mesh and refine your geometry to better match the target' )
     self.btn_trueHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="Activate Match Mesh", command=self.matchMesh)
     self.btn_templateHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="template Target Mesh", command=self.tempTgt)
     self.btn_referenceHuman = pm.button(parent=self.frameLayoutC, enable=True, w=40, h=20, label="reference Target Mesh", command=self.refTgt)
     self.sldr_smooth = pm.intSliderGrp(parent=self.frameLayoutC, field=True, label='Match Mesh Divisions', minValue=-0, maxValue=4, fieldMinValue=-0, fieldMaxValue=4, value=0, cc=self.div_Slider_change)
     self.fC_fillText = pm.text(parent=self.frameLayoutC, label='    ' )
     
     # fameD content
     self.btn_go = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="Transfer Shapes", command=self.execute)  
     self.btn_no = pm.button(parent=self.frameLayoutD, enable=True, w=40, h=20, label="NO DONT DO IT!", command=self.close)
     self.fE_fillText = pm.text(parent=self.frameLayoutD, label='    ' )
     self.win.show()
     if debug:
         test = ['mask_blendPipe_GEO', 'mask_hiRes_GEO']
         for name, test_val in zip(self.names, test):
             self.names[name].setText(test_val)
def inbound():
    
    global jointGuides,setUpName,jointGuidesGrp,side
    setUpName = pm.textFieldGrp('NameTFG', tx = True,q = True)
    colorSel = pm.radioButtonGrp('ColSel',q = True,sl = True) 
    
    if colorSel == 1:
        side = 'l'
    elif colorSel == 2:    
        side = 'm'
    elif colorSel == 3:    
        side = 'r'
        
    numOfJoints = pm.intSliderGrp('Joint_Num',q = True,v = True)   
    jointGuidesGrp = pm.group(em = 1,n = getUniqueName(side,setUpName + 'Gud', 'grp'))                
        
    for num in range(numOfJoints):
        loc = pm.spaceLocator(n = getUniqueName(side,setUpName,'loc'))
        pm.move(0,num * 2,0,loc)
        jointGuides.append(loc)
        loc.setParent(jointGuidesGrp)
    
    jointGuides.reverse()
    for num,loc in enumerate(jointGuides):
        if num < (len(jointGuides) - 1):
            jointGuides[num].setParent(jointGuides[num + 1])
    jointGuides.reverse()   
Exemple #14
0
 def __splitJointButton(self,*args):
     
     sel = pm.ls(sl = 1)
     splitJoint = sel[0] 
     num = pm.intSliderGrp(self.splitNum,q = 1,v = 1)
     splitJoint =  SplitJoint(splitJoint,num,box = 1,type = 'tool')
     splitJoint.splitJointTool()
def multi_intChange(attr, lightType, component, *args):
	value = pm.intSliderGrp(component, q=True, v=True)
	sel_lights = pm.ls(sl=True, lights=True, dag=True)
	new_list = sortBy_type(sel_lights, lightType)
	
	for each in new_list:
		pm.setAttr(each+attr, value)
	def shuffleSlice(self,*args):
		getSel = pm.ls(sl=1,fl=1)
		cols = pm.intSliderGrp("colsSlider",q=1,v=1)
		if len(getSel)>=1 and len(getSel)>=cols:
			array = getSel
			self.result = randomSplitList().randListFunc(array,cols)
			if pm.radioButtonGrp("radioBtnGrp",q=1,sl=1) == 1:
				pm.text("warningText",e=1,l="---===List All Parts===---")
				pm.textScrollList("listScroll",e=1,ra=1)
				for i in range(0,len(self.result)):
					pm.textScrollList("listScroll",e=1,append="{0}{1}".format("ShuffledPart_",(i+1)))
			elif pm.radioButtonGrp("radioBtnGrp",q=1,sl=1) == 2:
				pm.textScrollList("listScroll",e=1,ra=1)
				allGrps=[]
				for i in range(0,len(self.result)):
					grp = pm.group(n=("{0}{1}".format("ShuffledPart_",(i+1))),em=1)
					pm.parent(self.result[i],grp)
					allGrps.append(grp)
				pm.select(allGrps,r=1)
		elif len(getSel)==0:
			pm.textScrollList("listScroll",e=1,ra=1)
			pm.text("warningText",e=1,l="---===Select Something!!!===---")
		elif len(getSel)>0 and len(getSel)<cols:
			pm.textScrollList("listScroll",e=1,ra=1)
			pm.text("warningText",e=1,l="---===Too Much Parts!!!===---")
Exemple #17
0
    def __init__(self):
        self.menu_item_list = []
        self.light_types = {
            1: 'spotLight',
            2: 'areaLight',
            3: 'directionalLight',
            4: 'pointLight',
            5: 'ambientLight',
            6: 'volumeLight'
        }

        self.layout = pm.columnLayout(adjustableColumn=False)
        self.checkBox = pm.checkBox(label='Use Physical Light')
        self.slider = pm.intSliderGrp(label='Number Of lights',
                                      field=True,
                                      min=0,
                                      max=20,
                                      columnWidth3=[200, 75, 200],
                                      changeCommand=pm.Callback(
                                          self.create_menu_items))
        self.menu_layout = pm.columnLayout()
        pm.setParent('..')

        pm.button(label='Create Fog System',
                  width=500,
                  command=pm.Callback(self.create_system01))
def createCurveFromPoints(vert1, vert2):
    startFrame = pm.intSliderGrp('startFrameSlider', q=1, v=1)
    endFrame = pm.intSliderGrp('endFrameSlider', q=1, v=1)

    points = []
    tempPos = [0, 0, 0]
    sample = pm.floatSliderGrp('sampleSlider', q=1, v=1)
    for f in drange(startFrame, endFrame + 1, sample):
        pm.currentTime(f)
        pos = getMidPointPos(vert1, vert2)
        if pos != tempPos:
            points.append(pos)
        tempPos = pos

    crvName = vert1.name().split('.')[0] + '_trail_crv'
    crv = pm.curve(name=crvName, ep=points)
    pm.currentTime(startFrame)
    return crv
Exemple #19
0
def createCurveFromPoints(vert1,vert2):
    startFrame = pm.intSliderGrp('startFrameSlider',q=1,v=1)
    endFrame  = pm.intSliderGrp('endFrameSlider',q=1,v=1)
    
    points = []
    tempPos = [0,0,0]
    sample = pm.floatSliderGrp('sampleSlider',q=1,v=1)
    for f in drange(startFrame,endFrame+1,sample):
        pm.currentTime(f)
        pos = getMidPointPos(vert1, vert2)
        if pos != tempPos:
            points.append(pos)
        tempPos = pos
    
    crvName = vert1.name().split('.')[0] + '_trail_crv'
    crv = pm.curve(name = crvName, ep=points)
    pm.currentTime(startFrame)
    return crv
Exemple #20
0
    def create(self):
        if pm.window(self.window, exists=True):
            pm.deleteUI(self.window)
        pm.window(self.window, t=self.title)

        # source & targets
        pm.rowColumnLayout(nc=3,cal=[(1,'right')], cw=[(1,80),(2,200),(3,100)])
        pm.text(l='Source: ')
        self.sourceObjTf = pm.textField()
        pm.button(l='Select', c=self.selectSource)
        pm.text(l='Target(s): ')
        self.targetObjsTf = pm.textField()
        pm.button(l='Select', c=self.selectTarget)
        pm.setParent('..')

        # number
        pm.rowColumnLayout(w=self.size[0])
        self.copyNum = pm.intSliderGrp(l='Copies: ', v=10, cw3=[80,80,220],
                                       min=1, max=500, fmx=5000, f=True)
        pm.separator(h=10, st='in')

        # rotation
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Rotation: ')
        self.rotationModeRC = pm.radioCollection()
        self.rotBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.rotBtnAlign = pm.radioButton(l='Align with Target')
        pm.text(l='')
        self.rotBtnRand = pm.radioButton(l='Random',
                                         onc=lambda *args: self.rotationRange.setEnable(True),
                                         ofc=lambda *args: self.rotationRange.setEnable(False))
        pm.setParent('..')
        self.rotationRange = pm.floatFieldGrp(l='Range: ', nf=3, v1=30, v2=30, v3=30,
                                              cw4=[80,100,100,100], en=False)
        pm.separator(h=10, st='in')

        # scale
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Scale: ')
        self.scaleModeRC = pm.radioCollection()
        self.scaleBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.scaleBtnRand = pm.radioButton(l='Random',
                                           onc=lambda *args: self.scaleRange.setEnable(True),
                                           ofc=lambda *args: self.scaleRange.setEnable(False))
        pm.setParent( '..' )
        self.scaleRange = pm.floatFieldGrp(l='Min Max: ', nf=2, v1=1, v2=1,
                                           cw3=[80,100,100], en=False)
        pm.separator(h=10, st='in')

        # disperse button
        pm.button(l='Disperse', c=self.disperse, w=380, al='center')

        pm.showWindow(self.window)
Exemple #21
0
 def build(self):
     #splineIK UI
     self.win = pm.window(self.title, title=self.title)
     self.layout = pm.rowColumnLayout()
     self.control_scheme_options = ['fk', 'ik', '...something else']
     self.tf_obj_start       = self._build_name_input(label='Load Start Object', parent=self.layout)
     self.tf_obj_end         = self._build_name_input(label='Load End Object', parent=self.layout)
     self.tf_obj_aim         = self._build_name_input(label='Load Aim Object', parent=self.layout)
     self.tf_obj_parent      = self._build_name_input(label='Load Parent Transform', parent=self.layout)
     
     self.slider_joints      = pm.intSliderGrp(enable=True, field=True, label='number of joints', minValue=3, fieldMinValue=3, fieldMaxValue=50, value=5, parent=self.layout)
     self.slider_controls    = pm.intSliderGrp(enable=True, field=True, label='number of controls', minValue=3, fieldMinValue=2, fieldMaxValue=20, value=3, parent=self.layout)
     self.tfg_ribbon_name    = pm.textFieldGrp(enable=True, label='ribbon', placeholderText='name of ribbon', editable=True, tcc=self._on_change_tfg_ribbon_name, parent=self.layout)
     self.rbg_control_scheme = pm.radioButtonGrp(label='Control Scheme', labelArray3=self.control_scheme_options, numberOfRadioButtons=3)
     self.rbg_control_scheme.setSelect(2)
     
     self.btn_execute        = pm.button(parent=self.layout, enable=False,w = 100, h = 24, label="Build", command=self._build_ribbon)  
     self.btn_cancel         = pm.button(parent=self.layout, enable=False,w = 100, h = 24, label="Cancel", command=self.close)   
     pm.setFocus(self.btn_execute)
     self.win.show()
Exemple #22
0
 def GUI(self):
     self._win = pmc.window(self.WINDOW_NAME, title=self.WINDOW_TITLE)
     pmc.columnLayout(adjustableColumn=True)
     self._slider = pmc.intSliderGrp(label='Segments',
                                     field=True,
                                     min=2,
                                     max=100,
                                     value=2)
     pmc.button(label='Okay', c=pmc.Callback(self._callback))
     pmc.button(label='Cancel', c=pmc.Callback(pmc.deleteUI, self._win))
     self._win.show()
	def _UI(self):
		if pm.window("mainWin",exists=1):
			pm.deleteUI("mainWin",window=1)
		
		w=280
		
		window=pm.window("mainWin",t="Shuffle Slice Tool",s=0,mb=1,mnb=0,mxb=0,rtf=1,w=w)
		pm.columnLayout("mainColumn",p="mainWin",columnAttach=('both', 2), rowSpacing=10, columnWidth=w)
		pm.text("warningText",p="mainColumn",l="---===Select something to slice===---",al="center")
		pm.intSliderGrp("colsSlider",p="mainColumn",cw3=(30,45,50),field=True,label='Parts',minValue=1,fieldMinValue=1,value=1,fs=1,ss=1)
		pm.radioButtonGrp("radioBtnGrp",l=" ",labelArray2=['List', 'Group'],cw3=[60,90,80],numberOfRadioButtons=2,sl=1)
		
		pm.textScrollList("listScroll",p="mainColumn",numberOfRows=5, allowMultiSelection=False,sc=self.selPart)
		pm.popupMenu("listPopUp",p="listScroll")
		pm.menuItem(p="listPopUp",l="Create Group for the parts",c=self.groupPartsFunc)
		
		pm.button(p="mainColumn",l="Shuffle Slice",c=self.shuffleSlice)
		

		pm.showWindow("mainWin")
 def div_Slider_change(self, btn,):
     """ This function can execute all functions related to changing the smooth mesh division levels
     Args:
         None
     Returns (None)
     """
     sldrVal = pm.intSliderGrp(self.sldr_smooth, query=True, value=True)
     smooth_node = self.get_smooth_node()
     pm.setAttr(smooth_node+'.divisions', sldrVal)
     print smooth_node
     print 'Slide those divisions'  
Exemple #25
0
 def __init__(self, opts):
     self.opts = opts
     with pm.frameLayout('Physics', collapsable=True, cl=False, bs='out'):
         with pm.columnLayout(width=250):
             pm.text(l='Collision Type:')
             self.phyType = pm.radioButtonGrp(labelArray3=['Convex Hull', 'Box', 'Sphere'],
                                              sl=self.opts['phyType'], nrb=3, cc=self.save,
                                              cw3=[94, 64, 64], width=250)
             self.maxVerts = pm.intSliderGrp(field=True, l='Max Vertices:', v=self.opts['maxVerts'],
                                             cl3=['left', 'left', 'left'], cw3=[64, 48, 128], cc=self.save)
             pm.button(l='Add Hull', w=250, c=self._addHull)
     self.save()
    def __init__(self, value=0, minValue=0, maxValue=32, name=None, obj=None, type_='int', en=False, fmx=10000, fmn=-10000):
        self.name = name
        self.obj = obj

        self.undoState = False

        if type_ == 'float':
            self.attr_ = pm.floatSliderGrp(field=True, l=self.name, value=value, minValue=minValue, maxValue=maxValue,
                                           cc=self.set, dc=self.set, pre=5, cw3=[72, 64, 128], en=en, fmx=fmx, fmn=fmn)
        elif type_ == 'int':
            self.attr_ = pm.intSliderGrp(field=True, l=self.name, value=value, minValue=minValue, maxValue=maxValue,
                                         cc=self.set, dc=self.set, cw3=[72, 64, 128], en=en, fmn=fmn, fmx=fmx)
Exemple #27
0
def createTrail():
    if pm.window('trailUI',ex=1):
        pm.deleteUI('trailUI')
    
    pm.window('trailUI')
    pm.columnLayout(adj=1)
    fsSample = pm.floatSliderGrp('sampleSlider', label='Sample by', cw=(1,70), adj=1, en=1,minValue=0.01, maxValue=100, fieldMinValue=0.01, fieldMaxValue=100,pre=2, field=1, v=1)
    pm.separator (height=4,style="in")
    startFrame = pm.playbackOptions(q=1,min=1)
    currentFrame = pm.currentTime(q=1)
    if currentFrame > startFrame:
        startFrame = currentFrame
    pm.intSliderGrp('startFrameSlider', label='Start frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'start'))
    pm.intSliderGrp('endFrameSlider', label='End frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame+30)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'end'))
    pm.intSliderGrp('trailDivisions', label='Trail divisions', cw=(1,70), adj=1, en=1,minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=10000, field=1, v=40)
    pm.separator (height=4,style="in")
    cbUvDistorted = pm.checkBox('cbUV',l='UV distorted',v=1)
    pm.separator (height=4,style="in")
    
    rowBtn = pm.rowColumnLayout(numberOfRows=1)
    pm.button(l='Create Trail',command=functools.partial(createTrailMesh))
    pm.button(l='Rebuil uvs',c=functools.partial(createTrailUv,''))
    pm.button(l='ELP !!!',c=openHelpPage)
    pm.showWindow('trailUI')
Exemple #28
0
def __sceneToCalc(*args):
    """ Copies the DMC-related V-Ray globals settings to the calculator UI."""

    # V-ray globals
    globals = pm.PyNode('vraySettings')
    # V-ray scene settings to dictionary
    settings = {
        'dmc_min_subdiv': globals.dmcMinSubdivs.get(),
        'dmc_max_subdiv': globals.dmcMaxSubdivs.get(),
        'dmc_threshold': globals.dmcs_adaptiveThreshold.get(),
        'adaptive_min': globals.dmcs_adaptiveMinSamples.get(),
        'adaptive_amt': globals.dmcs_adaptiveAmount.get(),
        'subdivs_mult': globals.dmcs_subdivsMult.get()
    }

    # Transfer scene settings to UI
    pm.intSliderGrp('min_subdivs_in', e=True, v=settings['dmc_min_subdiv'])
    pm.intSliderGrp('max_subdivs_in', e=True, v=settings['dmc_max_subdiv'])
    pm.floatSliderGrp('thresh_val_in', e=True, v=settings['dmc_threshold'])
    pm.intSliderGrp('adapt_min_in', e=True, v=settings['adaptive_min'])
    pm.floatSliderGrp('adapt_amt_in', e=True, v=settings['adaptive_amt'])
    pm.floatFieldGrp('subdivs_mult_in',
                     e=True,
                     v=(settings['subdivs_mult'], 0, 0, 0))

    # .. and refresh
    __uiUpdate()

    return True
Exemple #29
0
    def jntOnCrv(self, numOfJnts=5, crv=None, *args):

        try:  # if in UI mode, get number of joints from UI
            numOfJnts = pm.intSliderGrp(self.slider, q=True, value=True)
        except:
            pass

        if crv == None:
            try:
                crv = pm.ls(sl=True)[0]
            except:
                pm.warning(
                    'ehm_tools...JntOnCrv: Select a curve to create joints on it.'
                )
                return None
        if numOfJnts < 2:
            pm.warning("number of joints must be greater than 1.")
            return None
        try:
            curveShape = crv.getShape().type()
        except:
            pm.warning("specified object is not a curve.")
            return None

        if curveShape != 'nurbsCurve':
            pm.warning("specified object is not a curve.")
            return None

        crv = pm.duplicate(crv)[0]
        pm.rebuildCurve(crv,
                        ch=False,
                        rpo=True,
                        rt=0,
                        end=1,
                        kr=0,
                        kcp=False,
                        kep=True,
                        kt=0,
                        s=200,
                        d=1,
                        tol=0.01)
        crvShape = crv.getShape()

        pm.select(clear=True)
        segSize = 1.0 / (numOfJnts - 1)

        for i in range(numOfJnts):
            pos = crvShape.getPointAtParam(segSize * i, 'world')
            self.newJnts.append(pm.joint(p=pos))

        pm.delete(crv)
Exemple #30
0
    def UI(self):

        # create window
        if pm.window('ehm_DivideJnt_UI', exists=True):
            pm.deleteUI('ehm_DivideJnt_UI')
        pm.window('ehm_DivideJnt_UI',
                  title='Divide Joint',
                  w=250,
                  h=100,
                  mxb=False,
                  mnb=False,
                  sizeable=False)

        # main layout
        mainLayout = pm.columnLayout(w=250, h=100)
        formLayout = pm.formLayout(w=250, h=100)

        # num of joints slider
        self.slider = pm.intSliderGrp(label='num of joints: ',
                                      value=6,
                                      minValue=2,
                                      maxValue=20,
                                      fieldMaxValue=10000,
                                      h=50,
                                      field=True,
                                      columnWidth=([1, 70], [2, 50], [3, 70]))

        # button
        button = pm.button(label='apply',
                           w=200,
                           h=40,
                           c=partial(self.divideJnt, None, 5))

        # place controls
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(self.slider, 'left', 10))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(self.slider, 'right', 10))

        pm.formLayout(formLayout, edit=True, attachForm=(button, 'left', 10))
        pm.formLayout(formLayout, edit=True, attachForm=(button, 'right', 10))
        pm.formLayout(formLayout, edit=True, attachForm=(button, 'bottom', 10))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(button, 'top', 0, self.slider))

        # show window
        pm.showWindow('ehm_DivideJnt_UI')
Exemple #31
0
def settings():
    """setup vray before baking"""
    global size
    size = pm.intSliderGrp("baker_size", q=True, v=True)

    pm.optionVar(intValue=("vrayBakeType", 2))
    pm.optionVar(intValue=("vraySkipNodesWithoutBakeOptions", 0))
    pm.optionVar(intValue=("vrayAssignBakedTextures", 0))
    pm.optionVar(stringValue=("vrayBakeOutputPath", textures_dir))
    pm.optionVar(intValue=("vrayBakeType", 2))

    try:
        options = nt.VRayBakeOptions("vrayDefaultBakeOptions")
    except pm.MayaNodeError:
        options = pm.createNode("VRayBakeOptions", n="vrayDefaultBakeOptions")
    options.setAttr("resolutionX", size)
    options.setAttr("outputTexturePath", textures_dir, type="string")
    options.setAttr("filenamePrefix", "")

    # ao material
    if not pm.objExists("ao_material"):
        material = pm.createNode("VRayMtl", n="ao_material")
        texture = pm.createNode("VRayDirt", n="ao_texture")
        texture.connectAttr("outColor", material.attr("color"))
        texture.connectAttr("outColor", material.attr("illumColor"))
    else:
        texture = nt.DependNode("ao_texture")
    texture.setAttr("radius", pm.floatSliderGrp("baker_radius", q=True,
                                                v=True))
    texture.setAttr("falloff",
                    pm.floatSliderGrp("baker_falloff", q=True, v=True))
    texture.setAttr("subdivs", pm.intSliderGrp("baker_sub", q=True, v=True))

    # shadows catch material
    if not pm.objExists("shadow_material"):
        material = pm.createNode("VRayMtl", n="shadow_material")
        material.setAttr("color", (1, 1, 1))
Exemple #32
0
def splitSelJointUI():
    """
	Script:     splitSelJointUI
	Descr:      Interface to rigg_tools.splitJnt
	Req:        rigg_tools.splitJnt
	"""

    segmentOpt = 2

    win = "splitSelJointWin"
    # Builds the interface for the splitSelJointUI
    if pm.window(win, exists=1):
        pm.deleteUI(win)

    pm.window(win, t="Split Selected Joints", w=100, h=100)
    f = pm.formLayout(nd=100)
    segments = pm.intSliderGrp(field=True, max=100, l="Segments", min=2)
    b1 = pm.button(l="Okay")
    b2 = pm.button(l="Cancel")
    pm.formLayout(f,
                  ap=[(b1, 'right', 0, 47), (b2, 'left', 0, 52)],
                  e=1,
                  af=[(segments, 'top', 5), (segments, 'left', 5),
                      (segments, 'right', 5), (b1, 'left', 5),
                      (b1, 'bottom', 5), (b2, 'right', 5), (b2, 'bottom', 5)])
    # set up callbacks
    pm.button(b2, e=1, c=lambda *args: pm.deleteUI(win))
    pm.button(b1,
              e=1,
              c=lambda *args: mo_riggUtils.splitJnt(
                  pm.intSliderGrp(segments, q=1, v=1)))
    # set up defaults

    # now set the item
    pm.intSliderGrp(segments, e=1, value=segmentOpt)
    pm.showWindow(win)
    def CreateClothWindow(self,*args):
	    if pm.window("cloth", exists = True):
	        pm.deleteUI("cloth")

	    cloth = pm.window("Create Cloth", t = "Create Cloth", w = 400, h = 600)
	    pm.columnLayout(adj = True, cal = "center", columnAttach=('both', 25))
	    pm.separator(h = 30)
	    pm.text("Cloth Simulation with PBD and exact CCD", font = "boldLabelFont")
	    pm.separator(h = 30)
	    pm.frameLayout(label = "Cloth Subdivisions", collapsable = True, borderStyle = "etchedIn")
	    self.GlobalVars["SubX"] = pm.intSliderGrp(l = "Subdivision X", min = 1, max = 20, value = 10, field = True)
	    self.GlobalVars["SubY"] = pm.intSliderGrp(l = "Subdivision Y", min = 1, max = 20, value = 10, field = True)
	    pm.setParent("..")
	    pm.frameLayout(label = "Position Constraints", collapsable = True, borderStyle = "etchedIn")
	    pm.gridLayout(numberOfColumns = 2, cellWidthHeight = (180,20))
	    self.GlobalVars["Locator_LeftTopCorner"] = pm.checkBox(label = "Locator_LeftTopCorner")
	    self.GlobalVars["Locator_RightTopCorner"] = pm.checkBox(label = "Locator_RightTopCorner")
	    self.GlobalVars["Locator_RightBottomCorner"] = pm.checkBox(label = "Locator_RightBottomCorner")
	    self.GlobalVars["Locator_LeftBottomCorner"] = pm.checkBox(label = "Locator_LeftBottomCorner")
	    self.GlobalVars["Locator_Middle"] = pm.checkBox(label = "Locator_Middle")
	    pm.setParent("..")
	    pm.setParent("..")
	    pm.frameLayout(label = "Gravity", collapsable = True, borderStyle = "etchedIn")
	    self.GlobalVars["GraV"] = pm.floatSliderGrp(l = "Gravity", min = 0.0, max = 9.8, field = True)
	    pm.setParent("..")
	    pm.frameLayout(label = "Wind Force", collapsable = True, borderStyle = "etchedIn")
	    self.GlobalVars["Wind_X"] = pm.floatSliderGrp(l = "Wind Force_X", min = -10.0, max = 10, value = 0.0, field = True)
	    self.GlobalVars["Wind_Y"] = pm.floatSliderGrp(l = "Wind Force_Y", min = -10.0, max = 10, value = 0.0, field = True)
	    self.GlobalVars["Wind_Z"] = pm.floatSliderGrp(l = "Wind Force_Z", min = -10.0, max = 10, value = 0.0, field = True)
	    self.GlobalVars["Noise"] = pm.floatSliderGrp(l = "Noise", min = 0.0, max = 2, value = 0.0, field = True)
	    pm.setParent("..")
	    pm.separator(h = 10)
	    self.GlobalVars["DefaultText"] = pm.checkBox(label = "Default Texture")
	    pm.separator(h = 10)
	    pm.button(l = "Create", c = self.CreateCloth)
	    pm.showWindow(cloth)
Exemple #34
0
 def __init__(self):
     title="flexi_plane"
     if(pm.windowPref(title, q=True, ex=True)):
         pm.windowPref(title, remove=True)
     if(pm.window(title, q=True, ex=True)):
         pm.deleteUI(title)
     # flexi plane UI
     self.win = pm.window(title, title="flexi plane")
     self.layout = pm.rowColumnLayout()
     self.flexiPlaneNumSlider = pm.intSliderGrp(enable=True, field=True, label='number of joints', minValue=3, maxValue=100, fieldMinValue=3, fieldMaxValue=100, value=5,)
     self.flexiPlaneNameField = pm.textFieldGrp(parent=self.layout,enable=True, label='Name Flexi Plane Module', placeholderText="name your flexi plane", editable=True, tcc=self.flexiPlaneNameField_change)
     self.goBtn = pm.button(parent=self.layout, enable=False,w = 100, h = 24, label="GO!", command=self.execute)  
     self.noBtn = pm.button(parent=self.layout, enable=False,w = 100, h = 24, label="NO DONT DO IT!", command=self.close)   
     self.format_string = "{PREFIX}_{INDEX}_{SUFFIX}"
     self.delete = []
     self.win.show()
Exemple #35
0
 def __init__(self):
     self.menu_item_list = []
     self.light_types = {1: 'spotLight', 2: 'areaLight',
                         3: 'directionalLight',4: 'pointLight',
                         5: 'ambientLight', 6: 'volumeLight'}
     
     self.layout = pm.columnLayout(adjustableColumn= False)
     self.checkBox = pm.checkBox(label= 'Use Physical Light')
     self.slider = pm.intSliderGrp(label= 'Number Of lights', field= True,
                             min= 0,max= 20,columnWidth3 = [200,75,200],
                         changeCommand=pm.Callback(self.create_menu_items))
     self.menu_layout = pm.columnLayout()
     pm.setParent('..')
     
     pm.button(label= 'Create Fog System', width= 500,
               command= pm.Callback(self.create_system01))
Exemple #36
0
    def spine_init(self,
                   size=5.0,
                   limbName='spine',
                   mode='biped',
                   numOfJnts=4,
                   *args):

        self.spine_initJnts = []
        self.tmpCrv = None

        try:  # if in UI mode, get number of joints from UI
            size = pm.floatSliderGrp(self.spineSizeF, q=True, value=True)
            limbName = pm.textField(self.limbNameTF, q=True, text=True)
            selectedMode = pm.radioCollection(self.characterModeRC,
                                              q=True,
                                              select=True)
            mode = pm.radioButton(selectedMode, q=True, label=True).lower()
            numOfJnts = pm.intSliderGrp(self.numOfInitJntsIS,
                                        q=True,
                                        value=True)
        except:
            pass

        curveCVs = []
        curveCVsCount = []
        for i in range(numOfJnts):
            pm.select(clear=True)

            if mode == 'biped':
                jntPos = (0, size + (size * 1.0 / (numOfJnts - 1) * i), 0)
            elif mode == 'quadruped':
                jntPos = (0, size,
                          (size * 1.0 / (numOfJnts - 1) * i) - size / 2.0)
            else:
                pm.error(
                    'ehm_tools...Spine: mode arg accepts "biped" or "quadruped" only!'
                )

            self.spine_initJnts.append(
                pm.joint(p=jntPos, name="%s_%s_initJnt" % (limbName, i + 1)))
            curveCVs.append(jntPos)
            curveCVsCount.append(i)

        self.tmpCrv = pm.curve(d=1, p=curveCVs, k=curveCVsCount)
        self.tmpCrv.getShape().template.set(True)
        pm.skinCluster(self.spine_initJnts, self.tmpCrv)
def changeTrailDivisions(*args):
    selection = pm.ls(sl=1)
    trail = ''
    if selection:
        trail = selection[0]
    else:
        pm.warning('Select a trail to change divisions')
        return

    try:
        extrudeNode = pm.listHistory(trail, exactType='polyExtrudeEdge')[0]
        divisions = pm.intSliderGrp('trailDivisions', q=1, v=1)
        pm.setAttr(extrudeNode + '.divisions', divisions)
        createTrailUv(trail)

    except:
        pm.warning('Couild not find an extrude in the history')
Exemple #38
0
def changeTrailDivisions(*args):
    selection = pm.ls(sl=1)
    trail = ''
    if selection:
        trail = selection[0]
    else:
        pm.warning('Select a trail to change divisions')
        return
    
    try:
        extrudeNode = pm.listHistory(trail,exactType = 'polyExtrudeEdge')[0]
        divisions = pm.intSliderGrp('trailDivisions', q=1,v=1)
        pm.setAttr(extrudeNode + '.divisions',divisions)
        createTrailUv(trail)
        
    except:
        pm.warning('Couild not find an extrude in the history')
Exemple #39
0
def prepareBatch(transfert, *args):

    # Retrieving values from UI
    subdivType = pc.radioButtonGrp(uiWidgets["subdivType"], q=1, sl=1)
    subdivIt = pc.intSliderGrp(uiWidgets["subdivIterations"], q=1, value=1)
    autobump = pc.checkBox(uiWidgets["autobump"], q=1, value=1)

    # Get the selected objects
    selections = pc.ls(sl=1)

    # If none, execution stops here
    if len(selections) == 0:
        pc.confirmDialog(t="Error", message="Nothing selected.", icon="critical")
    # Else, we batch set the primary visibility
    else:
        print "BATCH SET SMOOTH"

        for sel in selections:
            applySmooth(sel, subdivType, subdivIt, autobump, transfert)
Exemple #40
0
 def __init__(self, opts):
     self.opts = opts
     with pm.frameLayout('Physics', collapsable=True, cl=False, bs='out'):
         with pm.columnLayout(width=250):
             pm.text(l='Collision Type:')
             self.phyType = pm.radioButtonGrp(
                 labelArray3=['Convex Hull', 'Box', 'Sphere'],
                 sl=self.opts['phyType'],
                 nrb=3,
                 cc=self.save,
                 cw3=[94, 64, 64],
                 width=250)
             self.maxVerts = pm.intSliderGrp(field=True,
                                             l='Max Vertices:',
                                             v=self.opts['maxVerts'],
                                             cl3=['left', 'left', 'left'],
                                             cw3=[64, 48, 128],
                                             cc=self.save)
             pm.button(l='Add Hull', w=250, c=self._addHull)
     self.save()
Exemple #41
0
 def __init__(self):
     '''
     # the duplicate light class
     # has options for the replication of lights
     '''
     self.layout = pm.columnLayout(adjustableColumn= True)
     pm.rowColumnLayout(numberOfColumns= 2,columnWidth= ([1, 250], [2, 250]),
                        columnAlign= ([1, 'center'], [2, 'center']))
     
     self.override_intensity = pm.checkBox(label= 'Override Intensity',
                                     changeCommand= self.override_intensity)
     self.int_slider = pm.intSliderGrp(field= True, enable= False,
                                       min=-500, max=500)
     
     self.override_color = pm.checkBox(label= 'Override Color',
                                     changeCommand= self.override_color)
     self.color_slider = pm.colorSliderGrp(rgb=(0, 0, 1), enable= False)
     
     self.xform = pm.checkBox(label= 'Apply Transforms')
     pm.button(label= 'Duplicate', command= self.duplicate)
Exemple #42
0
 def __init__(self):
     title="joints_on_curve"
     if(pm.windowPref(title, q=True, ex=True)):
         pm.windowPref(title, remove=True)
     if(pm.window(title, q=True, ex=True)):
         pm.deleteUI(title)
     #splineIK UI
     self.win = pm.window(title, title="Joints on Curve")
     self.layout = pm.rowColumnLayout()
     self.jntPlaceBtn = pm.radioButtonGrp(parent=self.layout, numberOfRadioButtons=2, label="Joint Placement", labelArray2=("CV's", "Even"), cc=self.jntPlaceBtn_change)
     self.jntSnapBtn = pm.radioButtonGrp(parent=self.layout, enable=False, numberOfRadioButtons=2, sl = 1,  label="Snap To", labelArray2=("CV", "Closest Point On Curve"))
     self.jntLayoutBtn = pm.radioButtonGrp(parent=self.layout, enable=False, numberOfRadioButtons=2, sl = 1,  label="Joint Layout", labelArray2=("Solo", "Hierarchy"), on1 = self.jntLayoutBtn_on)
     self.jntNumSlider = pm.intSliderGrp(enable=False, field=True, label='number of joints', minValue=4, maxValue=100, fieldMinValue=4, fieldMaxValue=100, value=0)
     self.crvNameField = pm.textFieldButtonGrp(enable=False, label='Target Curve', placeholderText='Enter Curve Name Here', buttonLabel='load selected', buttonCommand=self.crvNameField_load)
     self.jntNameFeild = pm.textFieldGrp(parent=self.layout,enable=False, label='Joint Base Name', placeholderText="name your joints", editable=True, tcc=self.jntNameFeild_change)
     self.chkboxGrp = pm.checkBoxGrp(enable=False, numberOfCheckBoxes=3, label='Add', labelArray3=['splineIK', 'CTRLs', 'stretchy'])
     self.goBtn = pm.button(parent=self.layout, enable=False,w = 100, h = 24, label="GO!", command=self.execute)  
     self.noBtn = pm.button(parent=self.layout, enable=False,w = 100, h = 24, label="NO DONT DO IT!", command=self.close)   
     self.format_string = "{PREFIX}_{INDEX}_{SUFFIX}"
     self.delete = []
     self.win.show()
Exemple #43
0
    def divideJnt(self, jnt=None, numOfDivisions=5, *args, **kwargs):

        if jnt == None:
            jnt = pm.ls(sl=True)[0]

        try:  # if in UI mode, get number of joints from UI
            numOfDivisions = pm.intSliderGrp(self.slider, q=True, value=True)
        except:
            pass

        if jnt.type() != 'joint':
            pm.error("%s is not a joint." % (jnt.name()))

        if numOfDivisions <= 0:
            pm.error("numOfDivisions must be bigger than zero.")

        self.newJnts.append(jnt)

        radi = jnt.radius.get()

        children = jnt.getChildren()
        if len(children) < 1:
            pm.error("Selected joint must have a child joint.")
        else:
            child = children[0]

        percentage = 0.0
        incrementPercent = 100.0 / numOfDivisions

        pm.select(jnt)
        for i in (range(numOfDivisions - 1)):
            percentage += incrementPercent
            pos = FindPosBetween(percent=percentage, base=jnt, tip=child)

            currentJnt = pm.joint(p=pos)
            pm.setAttr(currentJnt.radius, radi)
            self.newJnts.append(currentJnt)

        pm.parent(child, self.newJnts[-1])
        self.newJnts.append(child)
Exemple #44
0
    def __init__(self,
                 value=0,
                 minValue=0,
                 maxValue=32,
                 name=None,
                 obj=None,
                 type_='int',
                 en=False,
                 fmx=10000,
                 fmn=-10000):
        self.name = name
        self.obj = obj

        self.undoState = False

        if type_ == 'float':
            self.attr_ = pm.floatSliderGrp(field=True,
                                           l=self.name,
                                           value=value,
                                           minValue=minValue,
                                           maxValue=maxValue,
                                           cc=self.set,
                                           dc=self.set,
                                           pre=5,
                                           cw3=[72, 64, 128],
                                           en=en,
                                           fmx=fmx,
                                           fmn=fmn)
        elif type_ == 'int':
            self.attr_ = pm.intSliderGrp(field=True,
                                         l=self.name,
                                         value=value,
                                         minValue=minValue,
                                         maxValue=maxValue,
                                         cc=self.set,
                                         dc=self.set,
                                         cw3=[72, 64, 128],
                                         en=en,
                                         fmn=fmn,
                                         fmx=fmx)
Exemple #45
0
    def resetMeshAB(self):
        pm.textScrollList(self.outputWin, e=1, removeAll=True)
        pm.textScrollList(self.outputWin, e=1, append=['Calculation .  .  .'])
        axisInput = ''
        if pm.checkBox(self.inputXchbx, q=1, value=1):
            axisInput += 'x'

        if pm.checkBox(self.inputYchbx, q=1, value=1):
            axisInput += 'y'

        if pm.checkBox(self.inputZchbx, q=1, value=1):
            axisInput += 'z'

        percentageInput = pm.intSliderGrp(self.percentageSlider, q=1, value=1)
        percentageInput /= 100.0

        positiveInput = pm.radioButton(self.posInput, q=1, sl=1)

        if not pm.selected():
            mc.resetDelta(str(self.baseGeo),
                          str(self.targetGeo),
                          percentage=percentageInput,
                          axis=axisInput,
                          positive=positiveInput)
        else:
            sel_type = type(pm.selected()[0])
            if str(sel_type) == "<class 'pymel.core.general.MeshVertex'>":
                mc.resetDelta(str(self.baseGeo),
                              percentage=percentageInput,
                              axis=axisInput,
                              positive=positiveInput)
            else:
                mc.resetDelta(str(self.baseGeo),
                              str(self.targetGeo),
                              percentage=percentageInput,
                              axis=axisInput,
                              positive=positiveInput)
        self.progressBarCalculation()
Exemple #46
0
    def __init__(self):
        title = 'curvyEdges'
        version = '1.01'

        self.ceObj = spline(self)

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

        with pm.window('curvyEdgesWin', title='{0} | {1}'.format(title, version),
                       mnb=False, mxb=False, sizeable=False) as window:
            with pm.columnLayout():

                # curve Frame
                with pm.frameLayout(l='Curve Settings', cll=True, cl=False, bs='out'):
                    with pm.columnLayout():
                        self.curveType = pm.radioButtonGrp(l='Curve Type:', sl=0, nrb=2, cw3=[96, 96, 128],
                                                           labelArray2=['BezierCurve', 'NurbsCurve'])
                        self.spans = pm.intSliderGrp(field=True, l='Curve Spans:', minValue=2, maxValue=24,
                                                     fieldMinValue=2, fieldMaxValue=128, value=2, cw3=[96, 64, 128])
                        with pm.rowColumnLayout(nc=2, cw=[1, 96], co=[1, 'right', 1]):
                            self.selOnly = pm.checkBox(v=False, l='Selection Only')
                            pm.button(l='Create Curve', c=self._create, width=201)

                # Deformer Frame
                with pm.frameLayout(l='Deformer Settings', bs='out', cl=False, cll=True):
                    with pm.columnLayout():
                        self.currentCrv = pm.textFieldGrp(editable=False, l='Current Curve:', cw2=[96, 195])

                        self.deformers = [attrSlider(1, 0, 1, 'envelope', self.ceObj),
                                          attrSlider(1, -10, 10, 'tension', self.ceObj),
                                          attrSlider(0, 0, 256, 'dropoffDistance[0]', self.ceObj),
                                          attrSlider(1, 0, 2, 'scale[0]', self.ceObj),
                                          attrSlider(1, 0, 1, 'rotation', self.ceObj)]

            window.show()
            pm.scriptJob(event=['SelectionChanged', self.select], protected=True, p=window)
            self.select()
Exemple #47
0
    def __init__(self):
        '''
        # the duplicate light class
        # has options for the replication of lights
        '''
        self.layout = pm.columnLayout(adjustableColumn=True)
        pm.rowColumnLayout(numberOfColumns=2,
                           columnWidth=([1, 250], [2, 250]),
                           columnAlign=([1, 'center'], [2, 'center']))

        self.override_intensity = pm.checkBox(
            label='Override Intensity', changeCommand=self.override_intensity)
        self.int_slider = pm.intSliderGrp(field=True,
                                          enable=False,
                                          min=-500,
                                          max=500)

        self.override_color = pm.checkBox(label='Override Color',
                                          changeCommand=self.override_color)
        self.color_slider = pm.colorSliderGrp(rgb=(0, 0, 1), enable=False)

        self.xform = pm.checkBox(label='Apply Transforms')
        pm.button(label='Duplicate', command=self.duplicate)
Exemple #48
0
	def __init__(self):
		try:
			pm.deleteUI( 'PipeGenWin' )
		except: pass

		win = pm.window('PipeGenWin')
		with win:
			with pm.columnLayout():
				with pm.frameLayout( l='Creation', labelVisible=False):
					with pm.columnLayout():
						with pm.rowLayout( nc=3, cw3=[80, 80, 240], cal=([1,'center'], [2,'right'])):
							pm.button( l='Create', w=80, c= lambda *args: self.newPipeCB())
							pm.text( l='Name' )
							self.createGrp = pm.textField( text='pipe', w=90)
						pm.separator(w=400)

						with pm.rowLayout( nc=2, cw2=[80, 320], cal=[1,'center']):
							#text( l='Segments' )
							pm.button( l='Extend', w=80, c = lambda *args: self.extendPipeCB() )
							self.numSegments = pm.intSliderGrp(
								cw3=[80,40,50],
								l='Segments',
								value=1,
								field=1,
								min=1, max=20 )

				with pm.frameLayout( l='Pipe Properties', labelVisible=True):
					with pm.columnLayout():
						self.pipeRadius = pm.floatSliderGrp( l='Radius',
							value=.22,
							field=True,
							precision = 3,
							min=.0001, max=10 )
						self.subdivAxis = pm.intSliderGrp( l='Axis Segments',
							value=16,
							field=True,
							min=3, max=80 )

				with pm.frameLayout( l='Connector Properties', labelVisible=True):
					with pm.columnLayout():
						self.connectorRadius = pm.floatSliderGrp( l='Connector Radius',
							value=.1,
							field=True,
							precision = 3,
							min=0, max=10 )
						self.connectorThickness = pm.floatSliderGrp( l='Connector Height',
							value=.2,
							field=True,
							precision = 3,
							min=.001, max=10 )
						self.connectorOffset = pm.floatSliderGrp( l='Connector Offset',
							value=.001,
							field=True,
							precision = 3,
							min=0, max=4 )

				with pm.frameLayout( l='Joint Properties', labelVisible=True):
					with pm.columnLayout():
						self.jointRadius = pm.floatSliderGrp( l='Radius',
							value=0,
							field=True,
							precision = 3,
							min=0, max=10 )
						self.subdivJoint = pm.intSliderGrp( l='Joint Segments',
							value=8,
							field=True,
							min=1, max=80 )
						self.jointLength = pm.floatSliderGrp( l='Joint Length',
							value=1.2,
							field=True,
							precision = 3,
							min=0.0001, max=10 )
Exemple #49
0
def mermaidUI():
    if(pm.window(mainWin, ex=1)):
        pm.deleteUI(mainWin)
    pm.window(mainWin, t='mermaidMainWindow', widthHeight=(380,500))
    pm.scrollLayout( h=700,w=380, vis=1)
    #load active agent Name
    pm.separator(h=10,style='none',w=380)
    mainUI=pm.columnLayout(w=380,cal='center',adj=1)
    pm.separator(h=5,style='none',w=380)

    ###################content#############################
    ##########################################
    #1. import puppet
    pm.text(l='STEP 1.',al='center')
    pm.button(c=lambda x:  mermaid.importRigPuppet(),l='import puppet',h=25)

    ##########################################
    #2. create path
    pm.separator(h=5,style='single',w=380)
    pm.text(l='STEP 2.',al='center')

    sectionsInput = pm.intSliderGrp('numCtrls',fmx=20,
        min=1,
        max=20,
        cw3=(110, 40, 165),
        value=4,
        label='  numCtrl',
        fmn=1,
        field=True,
        cal=(1, 'left'),
        adj=3)

    directionInput = pm.textFieldGrp('direction',cw=[(1, 110), (2, 70), (3, 70)],
        cal=(1, 'left'),
        text="+x",
        adj=3,
        label=' start frame:')
    pm.button(c=lambda motionCurve: mermaid.createMotionTrail(sections=sectionsInput.getValue(), direction=directionInput.getText()),l='create path',h=25)
   
    ##########################################
    #3. rebuild path
    pm.separator(h=10,style='single',w=380)
    pm.text(l='STEP 3.',al='center')

    pm.intSliderGrp('rebuildCtrls',fmx=20,
        min=1,
        max=20,
        cw3=(110, 40, 165),
        value=4,
        label='  numCtrl',
        fmn=1,
        field=True,
        cal=(1, 'left'),
        adj=3)
    motionCurve = ""
    attachObj = ""
    pm.button(c=lambda attachObj: mermaid.importRigPuppet(),l='rebuild path',h=25)
    pm.button(c=lambda attachObj: mermaid.resetMotionTrail(),l='reset path',h=25)
    
    ##########################################
    #4. connect puppet to path
    pm.separator(h=5,style='single',w=380)
    pm.text(l='STEP 4.',al='center')

    startframeInput = pm.intFieldGrp('start',cw=[(1, 110), (2, 70), (3, 70)],
        cal=(1, 'left'),
        value1=970,
        adj=3,
        label=' start frame:')
    endframeInput = pm.intFieldGrp('end',cw=[(1, 110), (2, 70), (3, 70)],
        cal=(1, 'left'),
        value1=1500,
        adj=3,
        label=' end frame:')
    
    pm.button(c=lambda x: mermaid.motionpathConformObject(motionCurve, attachObj, starttime=startframeInput.getValue(),endtime=endframeInput.getValue()),l='connect to path',h=25)

    ##########################################
    #5. snap rit to puppet
    pm.separator(h=5,style='single',w=380)
    pm.text(l='STEP 5.',al='center')

    pm.button(c=lambda x:  mermaid.snapMermaid(),l='snap rigg to puppet',h=25)

    pm.showWindow(mainWin)
Exemple #50
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.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.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= 'Mental Ray', collapsable= True)
        pm.frameLayout(label= 'Area Light', collapsable= True)
        
        pm.setAttr('%s.areaLight' % (self.light), 1)
        print 'yeah so far so good 01'
        
        self.checkbox_shape = pm.checkBox(label= 'Use Light Shape',value= 1,
                        changeCommand= pm.Callback(self.use_shape))
        
        # setAttr "areaLightShape1.areaType" 1; areaHiSamples areaHiSampleLimit areaLoSamples
        pm.attrEnumOptionMenu( label='Type', attribute='%s.areaType' % (self.light))
        print 'yeah so far so good 02'
        # areaVisible
        value = pm.getAttr('%s.areaHiSamples' % (self.light))
        pm.intSliderGrp(label='High Samples', field= True, value= value,
                       changeCommand= pm.Callback(self.change_hisamples))
        print 'yeah so far so good 03'
        value = pm.getAttr('%s.areaHiSampleLimit' % (self.light))
        pm.intSliderGrp(label='High Sample Limit', field= True, value= value,
                       changeCommand= pm.Callback(self.change_hisample_limit))
        
        value = pm.getAttr('%s.areaLoSamples' % (self.light))
        pm.intSliderGrp(label='Low Samples', field= True, value= value,
                       changeCommand= pm.Callback(self.change_losamples))
        # areaShapeIntensity
        self.checkbox_vis = pm.checkBox(label= 'Visible',
                        changeCommand= pm.Callback(self.visibility))
        
        pm.attrFieldSliderGrp( at='%s.areaShapeIntensity' % (self.light),
                                enable= True, 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= '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
Exemple #51
0
	def UI(self):
		width = 570
		height = 280
		# create window
		if pm.window( 'ehm_BipedLimb_UI', exists=True ):
			pm.deleteUI( 'ehm_BipedLimb_UI' )
		pm.window( 'ehm_BipedLimb_UI', title='Rig Biped Limbs', w=width, h=height, mxb=False, mnb=False, sizeable=True )
		
		# main layout
		baseForm = pm.formLayout()
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'left', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'right', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'top', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'bottom', 38) )
		# pm.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
		formLayout = pm.formLayout(w=width, h=height)
		
		
		# spine size
		self.BipedLimbSizeT = pm.text( label="Limb Size: ")	
		self.BipedLimbSizeF = pm.floatSliderGrp(adjustableColumn=4,min=0, max=20, fieldMaxValue=10000, value=5, field=True )

		
		# character mode radio buttons
		self.limbModeText = pm.text(label='Limb Mode: ', align='right')
		self.limbModeRC = pm.radioCollection()
		self.armRB = pm.radioButton(label="Arm", select=True )
		self.legRB = pm.radioButton(label="Leg")

		
		# number of joints
		self.numOfJntsText = pm.text( label='Number of joints: ', align='right')		
		self.numOfJntsIS = pm.intSliderGrp( field=True, value=6, maxValue=20, fieldMaxValue=1000 )		
		
		
		# extras check boxes
		self.extrasText = pm.text( label='Extras: ', align='right' )		
		self.bendyCB = pm.checkBox( label="Bendy", value=True )
		
		
		# buttons
		self.initButton = pm.button( label='Place joints',  h=30,  c=partial( self.bipedLimb_init, 10, 'arm', 'L' ), parent=baseForm  )
		self.packButton = pm.button( label='Finish Rig', h=30,  c=partial( self.bipedLimb_pack, 1.0, 'FKIK', True, 6, True, 'arm' ), parent=baseForm    )		
		self.closeButton = pm.button( label='Close', h=30,  c= self.closeUI , parent=baseForm    )		

		
		# place spine size
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BipedLimbSizeT,'right', 0, 28 ) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BipedLimbSizeT,'top', 17 ) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.BipedLimbSizeF,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BipedLimbSizeF,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BipedLimbSizeF,'top', 15 ) )	
		
		# place character mode
		pm.formLayout( formLayout, edit=True, attachPosition=(self.limbModeText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.limbModeText,'top', 17, self.BipedLimbSizeT) )
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.armRB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.armRB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.armRB,'top', 15, self.BipedLimbSizeT) )		

		pm.formLayout( formLayout, edit=True, attachPosition=(self.legRB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.legRB,'right', 15, 100 ) )
		
		pm.formLayout( formLayout, edit=True, attachControl=(self.legRB,'top', 35, self.BipedLimbSizeT) )	
		
		
		# place number of joints
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfJntsText,'top', 17, self.legRB) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsIS,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsIS,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfJntsIS,'top', 12, self.legRB ) )	

				
		
		# place check boxes
		pm.formLayout( formLayout, edit=True, attachPosition=(self.extrasText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.extrasText,'top', 17, self.numOfJntsIS) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bendyCB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bendyCB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.bendyCB,'top', 15, self.numOfJntsIS ) )	
		

		# place buttons		
		pm.formLayout( baseForm, edit=True, attachPosition=(self.initButton,'left', 3, 0) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.initButton,'right', 1, 33) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.initButton,'bottom', 3) )	

		pm.formLayout( baseForm, edit=True, attachPosition=(self.packButton,'left', 1, 33) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.packButton,'right', 3, 66) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.packButton,'bottom', 3) )	

		pm.formLayout( baseForm, edit=True, attachPosition=(self.closeButton,'left', 1, 66) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.closeButton,'right', 3, 100) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.closeButton,'bottom', 3) )	

		# show window
		pm.showWindow( 'ehm_BipedLimb_UI' )
Exemple #52
0
    def __init__(self):
        title = 'curvyEdges'
        version = '1.01'

        self.ceObj = spline(self)

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

        with pm.window('curvyEdgesWin',
                       title='{0} | {1}'.format(title, version),
                       mnb=False,
                       mxb=False,
                       sizeable=False) as window:
            with pm.columnLayout():

                # curve Frame
                with pm.frameLayout(l='Curve Settings',
                                    cll=True,
                                    cl=False,
                                    bs='out'):
                    with pm.columnLayout():
                        self.curveType = pm.radioButtonGrp(
                            l='Curve Type:',
                            sl=0,
                            nrb=2,
                            cw3=[96, 96, 128],
                            labelArray2=['BezierCurve', 'NurbsCurve'])
                        self.spans = pm.intSliderGrp(field=True,
                                                     l='Curve Spans:',
                                                     minValue=2,
                                                     maxValue=24,
                                                     fieldMinValue=2,
                                                     fieldMaxValue=128,
                                                     value=2,
                                                     cw3=[96, 64, 128])
                        with pm.rowColumnLayout(nc=2,
                                                cw=[1, 96],
                                                co=[1, 'right', 1]):
                            self.selOnly = pm.checkBox(v=False,
                                                       l='Selection Only')
                            pm.button(l='Create Curve',
                                      c=self._create,
                                      width=201)

                # Deformer Frame
                with pm.frameLayout(l='Deformer Settings',
                                    bs='out',
                                    cl=False,
                                    cll=True):
                    with pm.columnLayout():
                        self.currentCrv = pm.textFieldGrp(editable=False,
                                                          l='Current Curve:',
                                                          cw2=[96, 195])

                        self.deformers = [
                            attrSlider(1, 0, 1, 'envelope', self.ceObj),
                            attrSlider(1, -10, 10, 'tension', self.ceObj),
                            attrSlider(0, 0, 256, 'dropoffDistance[0]',
                                       self.ceObj),
                            attrSlider(1, 0, 2, 'scale[0]', self.ceObj),
                            attrSlider(1, 0, 1, 'rotation', self.ceObj)
                        ]

            window.show()
            pm.scriptJob(event=['SelectionChanged', self.select],
                         protected=True,
                         p=window)
            self.select()
Exemple #53
0
    def uiCreate(self):

        self.onCloseClicked()

        self.window = pm.window(
            WIN_NAME,
            title='PyMel Window',
            maximizeButton=False
        )

        with self.window:
            with pm.formLayout() as uiLAY_mainForm:
                with pm.scrollLayout('uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll:
                    with pm.columnLayout(adjustableColumn=True):

                        with self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') as self.uiLAY_frameCheckBoxes:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiCHK_test1 = pm.checkBox('uiCHK_test1', label='test1')
                                    self.uiCHK_test2 = pm.checkBox('uiCHK_test2', label='test2')

                        with self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') as self.uiLAY_frameCheckBoxGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCHKGRP_test1 = pm.checkBoxGrp(
                                    'uiCHKGRP_test1',
                                    numberOfCheckBoxes=1,
                                    label='PMCheckBoxGrp1',
                                    label1='test1'
                                )
                                self.uiCHKGRP_test2 = pm.checkBoxGrp(
                                    'uiCHKGRP_test2',
                                    numberOfCheckBoxes=2,
                                    label='PMCheckBoxGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiCHKGRP_test3 = pm.checkBoxGrp(
                                    'uiCHKGRP_test3',
                                    numberOfCheckBoxes=3,
                                    label='PMCheckBoxGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiCHKGRP_test4 = pm.checkBoxGrp(
                                    'uiCHKGRP_test4',
                                    numberOfCheckBoxes=4,
                                    label='PMCheckBoxGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') as self.uiLAY_frameColorSliders:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCLRGRP_test1 = pm.colorSliderGrp(
                                    'uiCLRGRP_test1',
                                    label='test1'
                                )
                                self.uiCLRGRP_test2 = pm.colorSliderGrp(
                                    'uiCLRGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') as self.uiLAY_frameFloatFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiFLF_test1 = pm.floatField('uiFLF_test1')
                                    self.uiFLF_test2 = pm.floatField('uiFLF_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') as self.uiLAY_frameFloatFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLFGRP_test1 = pm.floatFieldGrp(
                                    'uiFLFGRP_test1',
                                    numberOfFields=1,
                                    label='PMFloatFieldGrp1'
                                )
                                self.uiFLFGRP_test2 = pm.floatFieldGrp(
                                    'uiFLFGRP_test2',
                                    numberOfFields=2,
                                    label='PMFloatFieldGrp2'
                                )
                                self.uiFLFGRP_test3 = pm.floatFieldGrp(
                                    'uiFLFGRP_test3',
                                    numberOfFields=3,
                                    label='PMFloatFieldGrp3'
                                )
                                self.uiFLFGRP_test4 = pm.floatFieldGrp(
                                    'uiFLFGRP_test4',
                                    numberOfFields=4,
                                    label='PMFloatFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') as self.uiLAY_frameFloatScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLSCRL_test1 = pm.floatScrollBar('uiFLSCRL_test1')
                                self.uiFLSCRL_test2 = pm.floatScrollBar('uiFLSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') as self.uiLAY_frameFloatSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLTSLD_test1 = pm.floatSlider('uiFLTSLD_test1')
                                self.uiFLTSLD_test2 = pm.floatSlider('uiFLTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') as self.uiLAY_frameFloatSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLSGRP_test1 = pm.floatSliderGrp(
                                    'uiFLSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiFLSGRP_test2 = pm.floatSliderGrp(
                                    'uiFLSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') as self.uiLAY_frameIconTextCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITCHK_test1 = pm.iconTextCheckBox(
                                        'uiITCHK_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITCHK_test2 = pm.iconTextCheckBox(
                                        'uiITCHK_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') as self.uiLAY_frameIconTextRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.iconTextRadioCollection()
                                    self.uiITRAD_test1 = pm.iconTextRadioButton(
                                        'uiITRAD_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITRAD_test2 = pm.iconTextRadioButton(
                                        'uiITRAD_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )
                                    self.uiITRAD_test3 = pm.iconTextRadioButton(
                                        'uiITRAD_test3',
                                        style='iconAndTextHorizontal',
                                        label='torus',
                                        image1='torus'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') as self.uiLAY_frameIconTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITSLST_test1 = pm.iconTextScrollList(
                                        'uiITSLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiITSLST_test2 = pm.iconTextScrollList(
                                        'uiITSLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

                        with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') as self.uiLAY_frameIntFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiINF_test1 = pm.intField('uiINF_test1')
                                    self.uiINF_test2 = pm.intField('uiINF_test2')

                        with self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') as self.uiLAY_frameIntFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINFGRP_test1 = pm.intFieldGrp(
                                    'uiINFGRP_test1',
                                    numberOfFields=1,
                                    label='PMIntFieldGrp1'
                                )
                                self.uiINFGRP_test2 = pm.intFieldGrp(
                                    'uiINFGRP_test2',
                                    numberOfFields=2,
                                    label='PMIntFieldGrp2'
                                )
                                self.uiINFGRP_test3 = pm.intFieldGrp(
                                    'uiINFGRP_test3',
                                    numberOfFields=3,
                                    label='PMIntFieldGrp3'
                                )
                                self.uiINFGRP_test4 = pm.intFieldGrp(
                                    'uiINFGRP_test4',
                                    numberOfFields=4,
                                    label='PMIntFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') as self.uiLAY_frameIntScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINSCRL_test1 = pm.intScrollBar('uiINSCRL_test1')
                                self.uiINSCRL_test2 = pm.intScrollBar('uiINSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') as self.uiLAY_frameIntSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINTSLD_test1 = pm.intSlider('uiINTSLD_test1')
                                self.uiINTSLD_test2 = pm.intSlider('uiINTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') as self.uiLAY_frameIntSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINSGRP_test1 = pm.intSliderGrp(
                                    'uiINSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiINSGRP_test2 = pm.intSliderGrp(
                                    'uiINSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') as self.uiLAY_frameOptionMenus:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=110, style='none')
                                    self.uiOPTMNU_test1 = pm.optionMenu('uiOPTMNU_test1', label='test1')
                                    pm.menuItem(label='one')
                                    pm.menuItem(label='two')
                                    pm.menuItem(label='three')
                                    self.uiOPTMNU_test2 = pm.optionMenu('uiOPTMNU_test2', label='test2')
                                    pm.menuItem(label='four')
                                    pm.menuItem(label='five')
                                    pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') as self.uiLAY_frameOptionMenuGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiOPMGRP_test1 = pm.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel')
                                pm.menuItem(label='one')
                                pm.menuItem(label='two')
                                pm.menuItem(label='three')
                                self.uiOPMGRP_test2 = pm.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel')
                                pm.menuItem(label='four')
                                pm.menuItem(label='five')
                                pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') as self.uiLAY_frameRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.radioCollection()
                                    self.uiRAD_test1 = pm.radioButton('uiRAD_test1', label='test1')
                                    self.uiRAD_test2 = pm.radioButton('uiRAD_test2', label='test2')
                                    self.uiRAD_test3 = pm.radioButton('uiRAD_test3', label='test3')

                        with self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') as self.uiLAY_frameRadioButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiRADGRP_test1 = pm.radioButtonGrp(
                                    'uiRADGRP_test1',
                                    numberOfRadioButtons=1,
                                    label='PMRadioButtonGrp1',
                                    label1='test1'
                                )
                                self.uiRADGRP_test2 = pm.radioButtonGrp(
                                    'uiRADGRP_test2',
                                    numberOfRadioButtons=2,
                                    label='PMRadioButtonGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiRADGRP_test3 = pm.radioButtonGrp(
                                    'uiRADGRP_test3',
                                    numberOfRadioButtons=3,
                                    label='PMRadioButtonGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiRADGRP_test4 = pm.radioButtonGrp(
                                    'uiRADGRP_test4',
                                    numberOfRadioButtons=4,
                                    label='PMRadioButtonGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') as self.uiLAY_frameSymbolCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSYMCHK_test1 = pm.symbolCheckBox(
                                        'uiSYMCHK_test1',
                                        image='polyCube'
                                    )
                                    self.uiSYMCHK_test2 = pm.symbolCheckBox(
                                        'uiSYMCHK_test2',
                                        image='polyCone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') as self.uiLAY_frameScriptTables:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRTBL_test1 = pm.scriptTable(
                                        'uiSCRTBL_test1',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )
                                    self.uiSCRTBL_test2 = pm.scriptTable(
                                        'uiSCRTBL_test2',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )

                        with self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') as self.uiLAY_frameScrollField:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRFLD_test1 = pm.scrollField(
                                        'uiSCRFLD_test1',
                                        wordWrap=True
                                    )
                                    self.uiSCRFLD_test2 = pm.scrollField(
                                        'uiSCRFLD_test2',
                                        wordWrap=True
                                    )

                        with self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') as self.uiLAY_frameShelfTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.shelfTabLayout('uiSHLTAB_test1') as self.uiSHLTAB_test1:
                                    with pm.shelfLayout('test1'):
                                        pass
                                    with pm.shelfLayout('test2'):
                                        pass
                                    with pm.shelfLayout('test3'):
                                        pass
                                with pm.shelfTabLayout('uiSHLTAB_test2') as self.uiSHLTAB_test2:
                                    with pm.shelfLayout('test4'):
                                        pass
                                    with pm.shelfLayout('test5'):
                                        pass
                                    with pm.shelfLayout('test6'):
                                        pass

                        with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') as self.uiLAY_frameTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.tabLayout('uiTAB_test1') as self.uiTAB_test1:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow1:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow2:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow3:
                                        pass

                                pm.tabLayout(
                                    self.uiTAB_test1,
                                    edit=True,
                                    tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),)
                                )

                                with pm.tabLayout('uiTAB_test2') as self.uiTAB_test2:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow4:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow5:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow6:
                                        pass

                                pm.tabLayout(
                                    self.uiTAB_test2,
                                    edit=True,
                                    tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),)
                                )

                        with self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') as self.uiLAY_frameTextFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiTXT_test1 = pm.textField('uiTXT_test1')
                                    self.uiTXT_test2 = pm.textField('uiTXT_test2')

                        with self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') as self.uiLAY_frameTextFieldButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXBTGR_test1 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test1',
                                    label='test1',
                                    buttonLabel='button1'
                                )
                                self.uiTXBTGR_test2 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test2',
                                    label='test2',
                                    buttonLabel='button2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') as self.uiLAY_frameTextFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXTGRP_test1 = pm.textFieldGrp(
                                    'uiTXTGRP_test1',
                                    label='test1'
                                )
                                self.uiTXTGRP_test2 = pm.textFieldGrp(
                                    'uiTXTGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') as self.uiLAY_frameTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiTXTLST_test1 = pm.textScrollList(
                                        'uiTXTLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiTXTLST_test2 = pm.textScrollList(
                                        'uiTXTLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

                self.uiBTN_savePrefs = pm.button(
                    label='Save Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onSavePrefsClicked
                )

                self.uiBTN_loadPrefs = pm.button(
                    label='Load Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onLoadPrefsClicked
                )

                self.uiBTN_resetPrefs = pm.button(
                    label='Reset Prefs',
                    height=MAIN_BUTTONS_HEIGHT,
                    command=self.onResetPrefsClicked
                )

                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2)
                uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)

                uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top')
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2)
                uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33)
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33)
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2)

        self.window.setTitle(self.window.__class__)
Exemple #54
0
placedButton = pm.button(label='List placed',
                         command=listPlacedMeshes,
                         width=100)

row12 = pm.rowColumnLayout(numberOfColumns=3,
                           columnSpacing=[(1, 10), (2, 10), (3, 10)],
                           parent=row2)
placeableList = pm.textScrollList(numberOfRows=18, parent=row12, width=150)
wallsList = pm.textScrollList(numberOfRows=18, parent=row12, width=150)
placedList = pm.textScrollList(numberOfRows=18, parent=row12, width=150)

formSlider = pm.formLayout(numberOfDivisions=100, parent=row1)
slider = pm.intSliderGrp(field=True,
                         label='Nr of objects to place:',
                         minValue=1,
                         maxValue=50,
                         fieldMinValue=1,
                         fieldMaxValue=50,
                         step=1,
                         changeCommand=sliderNr)
pm.formLayout(formSlider, edit=True, attachForm=[(slider, 'top', 10)])

form = pm.formLayout(numberOfDivisions=100, parent=row1)
scriptButton = pm.button(label='Place random', width=100, command=placeRandom)
pm.formLayout(form,
              edit=True,
              attachForm=[(scriptButton, 'top', 20),
                          (scriptButton, 'left', 200)])

pm.showWindow()
def setTime(time, *args):
    pm.intSliderGrp(time + 'FrameSlider', e=1, v=pm.currentTime(q=1))
    def uIGenerator(self):

        if pm.window(self.myWinName, query=True, exists=True):
            pm.deleteUI(self.myWinName)

        try:
            if pm.windowPref(self.myWinName, query=True,
                             exists=True) and self.window_development:
                pm.windowPref(self.myWinName, remove=True)
        except RuntimeError:
            pass

        myWindow = pm.window(self.myWinName,
                             title='Object Instancer',
                             widthHeight=[600, 300])

        base = pm.verticalLayout()

        with base:
            with pm.verticalLayout() as header:

                title = pm.text(label='Object Instancer'.upper())
                pm.separator()

            with pm.verticalLayout() as target:

                self.targetInstances = pm.intSliderGrp(
                    label="Target Instances",
                    field=True,
                    minValue=0,
                    maxValue=1000,
                    changeCommand=self.storeTargetInstances)

                pm.separator()

            with pm.verticalLayout() as randomization:

                title3 = pm.text(label='Randomization')
                self.rotation = pm.checkBoxGrp(
                    numberOfCheckBoxes=3,
                    label="Rotation    ",
                    labelArray3=("RotateX", "RotateY", "RotateZ"),
                    changeCommand=self.storeRotations)
                self.translation = pm.checkBoxGrp(
                    numberOfCheckBoxes=3,
                    label="Translation    ",
                    labelArray3=("TransX", "TransY", "TransZ"),
                    changeCommand=self.storeTranslation)
                pm.separator()

            with pm.verticalLayout() as Randomness:

                self.rRPecentage = pm.floatSliderGrp(
                    label="Rotation Randomness",
                    field=True,
                    minValue=0,
                    maxValue=100)
                self.tRPecentage = pm.floatSliderGrp(
                    label="Translation Randomness",
                    field=True,
                    minValue=0,
                    maxValue=100)

            with pm.horizontalLayout() as Button:

                pm.button(label='Generate',
                          backgroundColor=[0, 1, 0.5],
                          align='left',
                          command=self.generate)

        base.redistribute(.4)

        header.redistribute(1, .1)

        myWindow.show()
Exemple #57
0
	def bipedLimb_pack( self, ctrlSize=1.0, FKIKMode='FKIK', mirror=True, numOfSegs=6, bendy=True, mode='arm', *args ):

		try:# if in UI mode, get number of joints from UI
			ctrlSize = pm.floatSliderGrp( self.spineSizeF, q=True, value=True)
			selectedMode = pm.radioCollection( self.characterModeRC, q=True, select=True)
			mode = pm.radioButton( selectedMode, q=True, label=True ).lower()
			numOfSegs = pm.intSliderGrp( self.numOfJntsIS, q=True, value=True)
			bendy = pm.checkBox( self.bendyCB, q=True, value=True )		
		except:
			pass
		
		bipedLimbJnts = []
		FKIKstuff = []
		OSbipedLimbJnts = []	
		OSFKIKstuff = []	
		
		#============================================================================
		# find some info for naming and control sizes

		side = self.BipedLimbInitJnts[0].name()[0]
		limbLen = Dist( self.BipedLimbInitJnts[0] , self.BipedLimbInitJnts[1] )
		
		otherSide = 'R'
		if side == 'R':
			otherSide = 'L'	
		
		
		#============================================================================
		# getting info from selected objects
		if mode == 'arm':
			firstInitJnt 	= 	self.BipedLimbInitJnts[0]
			secondInitJnt 	= 	self.BipedLimbInitJnts[1]
			thirdInitJnt 	=	self.BipedLimbInitJnts[2]
			forthInitJnt 	= 	self.BipedLimbInitJnts[3]

			armPos 		= 	self.worldPos( firstInitJnt )
			elbowPos  	= 	self.worldPos( secondInitJnt )
			handPos  	= 	self.worldPos( thirdInitJnt )
			handEndPos  = 	self.worldPos( forthInitJnt )

		elif mode == 'leg':
			firstInitJnt 		= 	self.BipedLimbInitJnts[0]
			secondInitJnt 		= 	self.BipedLimbInitJnts[1]
			thirdInitJnt 		=	self.BipedLimbInitJnts[2]
			heelInitJnt 	    = 	self.BipedLimbInitJnts[3]
			forthInitJnt 	    = 	self.BipedLimbInitJnts[4]
			toeEndInitJnt 	    = 	self.BipedLimbInitJnts[5]
			outsideInitJnt 	    = 	self.BipedLimbInitJnts[6]
			insideInitJnt 	    = 	self.BipedLimbInitJnts[7]
			
			upLegPos 			= 	self.worldPos( firstInitJnt )
			kneePos      		= 	self.worldPos( secondInitJnt )
			anklePos      		= 	self.worldPos( thirdInitJnt )
			ballPos         	= 	self.worldPos( forthInitJnt )
			toeEndPos      	 	= 	self.worldPos( toeEndInitJnt )
			heelPos        	 	= 	self.worldPos( heelInitJnt )
			outsidePos      	= 	self.worldPos( outsideInitJnt )
			insidePos       	= 	self.worldPos( insideInitJnt )

			


		#============================================================================
		# create arm or leg joints
		if mode == 'arm':
			pm.select ( cl = True )
			upLimbJnt =pm.joint ( p = armPos  , name = ( side + "_upArm_jnt" ) )

			midLimbJnt = pm.joint ( p = elbowPos , name = ( side + "_elbow_jnt" ) )
			pm.joint( upLimbJnt, e=True, zso=True, oj='xyz', sao='yup')

			butLimbJnt = pm.joint ( p = handPos , name = ( side + "_hand_jnt" ) )
			pm.joint( midLimbJnt,  e=True, zso=True, oj='xyz', sao='yup')

			handEndJnt = pm.joint ( p = handEndPos , name = ( side + "_hand_end_jnt" ) )
			pm.joint( butLimbJnt,  e=True, zso=True, oj='xyz', sao='yup')

			bipedLimbJnts = [ upLimbJnt, midLimbJnt, butLimbJnt, handEndJnt ]

		elif mode == 'leg':
			pm.select ( cl = True )
			upLimbJnt =pm.joint ( p = upLegPos  , name = ( side + "_upLeg_jnt" ) )

			midLimbJnt = pm.joint ( p = kneePos , name = ( side + "_knee_jnt" ) )
			pm.joint( upLimbJnt, e=True, zso=True, oj='xzy', sao='xup')

			butLimbJnt = pm.joint ( p = anklePos , name = ( side + "_ankle_jnt" ) )
			pm.joint( midLimbJnt,  e=True, zso=True, oj='xzy', sao='xup')

			ballJnt = pm.joint ( p = ballPos , name = ( side + "_ball_jnt" ) )
			pm.joint( butLimbJnt,  e=True, zso=True, oj='xzy', sao='xup')
			
			toeEndJnt = pm.joint ( p = toeEndPos , name = ( side + "_toeEnd_jnt" ) )
			pm.joint( ballJnt,  e=True, zso=True, oj='xzy', sao='xup')
			
			pm.select(clear=True)
			heelJnt = pm.joint ( p = heelPos , name = ( side + "_heel_jnt" ) )

			pm.select(clear=True)
			outsideJnt = pm.joint ( p = outsidePos , name = ( side + "_outside_jnt" ) )

			pm.select(clear=True)
			insideJnt = pm.joint ( p = insidePos , name = ( side + "_inside_jnt" ) )
			
			bipedLimbJnts = [ upLimbJnt, midLimbJnt, butLimbJnt, ballJnt, toeEndJnt, heelJnt,outsideJnt,insideJnt ]


				
		#============================================================================
		# find the pole vector position
		# orient joints and set preferred angle
		
		# find pole vector position
		PVposition = FindPVposition( objs= (upLimbJnt, midLimbJnt, butLimbJnt) )

		if mode == 'arm': # arm mode .................................................
			
			if PVposition: # arm is bent!
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				PVposition = FindPVposition( objs= (upLimbJnt, midLimbJnt, butLimbJnt) )
				aimLoc.translate.set( PVposition )
			
			else: # arm is not bent!
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				pm.parent( aimLoc, midLimbJnt )
				pm.makeIdentity( aimLoc, t=True, r=True, s=True )
				aimLoc.translateZ.set( -limbLen*1.5 )
				pm.parent( aimLoc, w=True)
				aimLoc.rotate.set( 0,0,0 )

			# rotate the aim to match the rotation of the arm
			pm.delete( pm.aimConstraint( midLimbJnt, aimLoc, worldUpType="object", aimVector=(1,0,0), upVector=(0,1,0), worldUpObject= butLimbJnt  ) )

			# orient joints according to aim locator
			for jnt in ( upLimbJnt, midLimbJnt, butLimbJnt ):
				OriJnt( jnt=jnt, upAim=aimLoc , aimAxis='-z' )
				
			# set preferred angle
			midLimbJnt.preferredAngleY.set( -90 )
			
			poleVectorTransform = None
			footRotate = None
			

			

		elif mode == 'leg': # leg mode .................................................
			
			if PVposition: # leg is bent!
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				PVposition = FindPVposition( objs= (upLimbJnt, midLimbJnt, butLimbJnt) )
				aimLoc.translate.set( PVposition )
				
			else: # leg is not bent!
				PVposition = self.PVbyToeJnt( upLimbJnt, midLimbJnt, toeEndJnt )
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				aimLoc.translate.set( PVposition ) # position aim in front of the foot
				
			# rotate the aim to match the rotation of the arm
			pm.delete( pm.aimConstraint( midLimbJnt, aimLoc, worldUpType="object", aimVector=(1,0,0), upVector=(0,1,0), worldUpObject= butLimbJnt  ) )

			# orient joints according to aim locator
			for jnt in bipedLimbJnts[:-4]:
				OriJnt( jnt=jnt, upAim=aimLoc , aimAxis='-y' )

			# set preferred angle
			midLimbJnt.preferredAngleZ.set( 90 )
			
			# find foot Y rotation to pass to rigIK and rigFKIK
			footRotateY = ProjectedAim( objs=( butLimbJnt , toeEndJnt ) )
			footRotate = ( 0, footRotateY, 0 )					

		# pole vector transformations to be passed to rigIK and rigFKIK
		PVposition = pm.xform( aimLoc, q=True, ws=True, t=True )
		PVrotation = pm.xform( aimLoc, q=True, ws=True, ro=True )
		poleVectorTransform = ( PVposition, PVrotation )
		
		

		#============================================================================
		# If mirror is ON
		if mirror == True:
			# mirror joints
			OSjnts =  pm.mirrorJoint( upLimbJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) )
			if mode=='leg':
				OSjnts.append( pm.mirrorJoint( heelJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) ) )
				OSjnts.append( pm.mirrorJoint( outsideJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) ) )
				OSjnts.append( pm.mirrorJoint( insideJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) ) )
			OSbipedLimbJnts = pm.ls( OSjnts )

			# transforms of mirrored pole vector
			OSaimLoc = MirrorObjLikeJnt( aimLoc )[0]
			OSPVposition = pm.xform( OSaimLoc, q=True, ws=True, t=True )
			OSPVrotation = pm.xform( OSaimLoc, q=True, ws=True, ro=True )
			OSpoleVectorTransform = ( OSPVposition, OSPVrotation )
			
			# transforms of mirrored hand or foot control
			footNull = pm.group(em=True)
			if mode=='leg':
				footNull.translate.set( anklePos )
				footNull.rotate.set( footRotate )
			elif mode=='arm':
				footNull.translate.set( handPos )
			
			OShandTransforms = MirrorObjLikeJnt( objs=footNull, returnValue=True )
			OSfootRotate = OShandTransforms[0][1]
			pm.delete( footNull )


		#============================================================================
		# create IK, FK rigs and blend them
		
		
		# FK mode =============
		if FKIKMode == 'FK':
			RigFK( jnts = OSbipedLimbJnts, side = side )
			# other side
			if mirror:
				RigFK( jnts = OSbipedLimbJnts, side=otherSide )

			

		# IK mode =============
		elif FKIKMode == 'IK':
			armRigStuff = RigIK( 		  jnts=bipedLimbJnts
										, mode=mode
										, side = side
										, poleVectorTransform=poleVectorTransform
										, footRotate=footRotate
										, rigHandOrFoot=True
										, ctrlSize = ctrlSize )
			
			
			# other side
			if mirror:
				OSarmRigStuff = RigIK( 		  jnts=OSbipedLimbJnts 
											, mode=mode
											, side=otherSide
											, poleVectorTransform=OSpoleVectorTransform
											, mirrorMode=True
											, footRotate=OSfootRotate
											, rigHandOrFoot=True
											, ctrlSize = ctrlSize )
				

		# FKIK mode =============
		elif FKIKMode == 'FKIK':
			# for i in ( bipedLimbJnts, mode, side, poleVectorTransform, footRotate ):
				# print i
			# return None			
			FKIKstuff = RigFKIK( 		  jnts=bipedLimbJnts
										, mode=mode
										, side=side
										, poleVectorTransform=poleVectorTransform
										, footRotate=footRotate
										, rigHandOrFoot=True
										, ctrlSize = ctrlSize )
			
			# other side
			if mirror:
				OSFKIKstuff = RigFKIK( 		  jnts=OSbipedLimbJnts
											, mode=mode
											, side=otherSide
											, poleVectorTransform=OSpoleVectorTransform
											, mirrorMode=True
											, footRotate=(0,0,0)
											, rigHandOrFoot=True )
				
				'''
				OSFKIKstuff = RigFKIK( 		  jnts=OSbipedLimbJnts
											, mode=mode
											, side=otherSide
											, poleVectorTransform=OSpoleVectorTransform
											, mirrorMode=True
											, footRotate=OSfootRotate
											, rigHandOrFoot=True )
				'''
		
		
		#============================================================================
		# rig bendy limbs
		bendies = RigBendyLimb( jnts=bipedLimbJnts[:3]
								, bendyCtrl=FKIKstuff[3]
								, numOfSegs= numOfSegs
								, side=side )
		if mirror:
			OSbendies = RigBendyLimb( jnts=OSbipedLimbJnts[:3]
									, bendyCtrl=OSFKIKstuff[3]
									, numOfSegs= numOfSegs
									, isMirroredJoint=True
									, side=otherSide )
		
		# clean up
		pm.delete( self.BipedLimbInitJnts, aimLoc )
		bendies[-1].setParent( FKIKstuff[-1] )
		if mirror:
			pm.delete( OSaimLoc )
			OSbendies[-1].setParent( OSFKIKstuff[-1] )