예제 #1
0
def RandomPyramid():    
    cmds.polyPyramid(ns = random.randrange(1,50), w = random.randrange(1,50), sh = 4, sc = 4 )
    cmds.select()
    Transforms()
    cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
    created.append(cmds.ls(selection=True))
    
    cmds.duplicate()
    cmds.scale(-1,1,1)
    created.append(cmds.ls(selection=True))
예제 #2
0
def RandomPyramid():
    cmds.polyPyramid(ns=random.randrange(1, 50),
                     w=random.randrange(1, 50),
                     sh=4,
                     sc=4)
    cmds.select()
    Transforms()
    cmds.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
    created.append(cmds.ls(selection=True))

    cmds.duplicate()
    cmds.scale(-1, 1, 1)
    created.append(cmds.ls(selection=True))
예제 #3
0
def pagoda(numStory):
	for i in range(0,numStory):
		#build a level of the pagoda
		cmds.polyCube(name='pagoda_story' + str(i), d=5, h=3, w=5)
		cmds.move(0,i*3, 0)
		
		if i == numStory-1:
			cmds.polyPyramid(name='pagoda_finalRoof', w=6)
			cmds.move(0,2.5+3*i,0)
			cmds.rotate(0,45,0)
			cmds.scale(1.15,0.655,1.15)
			cmds.polyBevel()
			cmds.select('pagoda_finalRoof.f[5]', 'pagoda_finalRoof.f[8]', 'pagoda_finalRoof.f[10]', 'pagoda_finalRoof.f[12]', 'pagoda_finalRoof.f[17]')
			cmds.polyExtrudeFacet(kft=True, translateY=.1607)
			cmds.select('pagoda_finalRoof.f[18]', 'pagoda_finalRoof.f[21]', 'pagoda_finalRoof.f[24]', 'pagoda_finalRoof.f[27]')
			cmds.polyExtrudeFacet(kft=True, localTranslateZ=0.65, translateY=0.3)
			cmds.polyExtrudeFacet(kft=True, localScale=(0.7, 0.8, 1))
			cmds.polyExtrudeFacet(kft=True, localTranslateZ=0.43)
			cmds.select('pagoda_finalRoof.f[17]')
			cmds.polyExtrudeFacet(kft=True, translateY = numStory, divisions=12)
			#cmds.select('pagoda_finalRoof.f[0]', 'pagoda_finalRoof.f[2]', 'pagoda_finalRoof.f[3]', 'pagoda_finalRoof.f[4]')
			
		else:
			n='pagoda_roof' + str(i)
			cmds.polyCube(name=n, d=7, h=1, w=7)
			cmds.move(0,1.5 + 3*i,0)
			#faces 0,2,4,5
			cmds.select(n+'.f[0]', n+'.f[2]', n+'.f[4:5]')
			cmds.polyExtrudeFacet(kft=True, localScaleY = 0.397, localTranslateZ=0.873108)
			cmds.move(0, -.204, 0, r=True)
			cmds.polyExtrudeFacet(kft=True, localScaleY = 0.397, localTranslateZ = 0.9)
			cmds.move(0, -.4, 0, r=True)
			cmds.select(n)
			#cmds.polyBevel()
			#cmds.select([n+'.f[27]', n+'.f[30]', n+'.f[32]', n+'.f[34]', n+'.f[43]', n+'.f[46]', n+'.f[48]', n+'.f[50]', n+'.f[56]', n+'.f[58]', n+'.f[63:64]', n+'.f[76:79]', n+'.f[84:87]'])
			#cmds.polyExtrudeFacet(kft=True, translateY=.12)

			
	cmds.select([node for node in cmds.ls() if 'pagoda' in node and 'Shape' not in node])
	cmds.group(name='pagoda_' + str(numStory) + 'stories')
예제 #4
0
 def _polyPyramid(self):
     cmds.polyPyramid()
예제 #5
0
	def createHouse(self,scaleX, scaleY, scaleZ, r,g,b, numOfHouses):
		
		# Create new scene every time program runs
		mc.file(new = True, force = True) 
		"""
                Below, we create the roof for the house
                """
                # Roof
                roof = mc.polyPyramid(n='roof')
                mc.scale(28.147,12.410,28.373)
                mc.move(1.167, 32.273, 0)
                mc.setAttr('roof.ry', 45)
                colorLambert = mc.shadingNode('lambert', asShader=True) 
                mc.select(roof)
                
                # ColorLambert and HyperShade are for setting color of the object
                mc.setAttr((colorLambert + '.color'), 0.5725, 0.1686, 0.129, type = 'double3')
                mc.hyperShade(assign=colorLambert)
                mc.polyMoveVertex('roof.vtx[0:1]', tx=-25.3)
                mc.polyMoveVertex('roof.vtx[4]', tx=-10.3)
                
                # Roof 2
                roof2 = mc.polyPyramid(n='roof2')
                mc.scale(28.147,12.410,28.373)
                mc.move(1.167, 28.601, -28.944)
                mc.setAttr('roof2.rx', -20.000)
                mc.setAttr('roof2.ry', 43.000)
                mc.setAttr('roof2.rz', -13.500)
                colorLambert = mc.shadingNode('lambert', asShader=True) 
                mc.select(roof2)
                mc.setAttr((colorLambert + '.color'), 0.5725, 0.1686, 0.129, type = 'double3')
                mc.hyperShade(assign=colorLambert)
                mc.polyMoveVertex('roof2.vtx[0:1]', tx=-25.3)
                mc.polyMoveVertex('roof2.vtx[4]', tx=-10.3)
                
                """
                Below, we create the windows for the house
                """
                # Windows
                
                # Front top above garage
                for i in range(1):
                        windows = mc.polyCube(n='windowsFrontTop')
                        mc.scale(0.420, 5.886, 9.002)
                        mc.move(11.975, 23.622, -10.279 * -i)
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(windows)
                        mc.setAttr((colorLambert + '.color'), 0, 0, 0, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
                
                # Left Side on 2nd story
                for i in range(0,2):
                        windows = mc.polyCube(n='windowsRightSideBottom')
                        mc.scale(0.420, 3.325, 5.290)
                        mc.rotate(0,90,0)
                        mc.move(-15.612 * i, 23.622, 13.253)
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(windows)
                        mc.setAttr((colorLambert + '.color'), 0, 0, 0, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
                
                # Rear windows on 2nd story
                for i in range(-1,1):
                        windows = mc.polyCube(n='windowsFrontBottom')
                        mc.scale(0.420, 3, 2.940)
                        mc.move(-33.978, 23.622, 8.921 * -i)
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(windows)
                        mc.setAttr((colorLambert + '.color'), 0, 0, 0, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
                        
                # 2 end windows near Front Door
                for i in range(2):
                        frontDoorEndWindow = mc.polyCube(n='frontDoorEndWindow')
                        mc.scale(0.627, 4.665, 2.428)
                        mc.move(-4.546, 13.984, -27.740 - (10*i))
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(frontDoorEndWindow)
                        mc.setAttr((colorLambert + '.color'), 0, 0, 0, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
                
                # Window near Front Door
                for i in range(1):
                        frontDoorWindow = mc.polyCube(n='frontDoorWindow')
                        mc.scale(0.627, 4.665, 7.094)
                        mc.move(-4.546, 13.984, -32.742)
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(frontDoorWindow)
                        mc.setAttr((colorLambert + '.color'), 0.412, 0.412, 0.412, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
                        
                                
                # Rear window near ground floor bedroom
                for i in range(1):
                        windowsRearBottomNearBedroom = mc.polyCube(n='windowsRearBottomNearBedroom')
                        mc.scale(0.420, 3, 6.388)
                        mc.move(-33.978, 14.686, -19.139)
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(windowsRearBottomNearBedroom)
                        mc.setAttr((colorLambert + '.color'), 0, 0, 0, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
                
                # Rear window near kitchen
                for i in range(1):
                        windowsRearBottomNearKitchen = mc.polyCube(n='windowsRearBottomNearKitchen')
                        mc.scale(0.420, 7.818, 4.556)
                        mc.move(-33.978, 10.546, -36.449)
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(windowsRearBottomNearKitchen)
                        mc.setAttr((colorLambert + '.color'), 0, 0, 0, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
        
                """
                Below, we create the main and right side of the building for the house
                """
                # main building
                building = mc.polyCube(n='building')
                mc.scale(25.963, 26.190, 45.551)
                mc.move(-10.958, 14.810, 0)
                mc.setAttr('building.ry', 90)
                colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                mc.select(building)
                mc.setAttr((colorLambert + '.color'), r, g, b, type = 'double3' )
                mc.hyperShade(assign=colorLambert)
                mc.polySplitVertex('building.vtx[2:5]')
                
                # Right side of building
                rightSide = mc.polyCube(n='rightSide')
                mc.scale(28.082, 7.793, 29.276)
                mc.rotate(0,90,0)
                mc.move(-19.041, 5.623, -26.999)
                colorLambert = mc.shadingNode('lambert', asShader=True) 
                mc.select(rightSide)
                mc.setAttr((colorLambert + '.color'), r, g, b, type = 'double3' )
                mc.hyperShade(assign=colorLambert)
                mc.polyMoveVertex('rightSide.vtx[2]', 'rightSide.vtx[4]', ty=18.4)
                mc.polyMoveVertex('rightSide.vtx[3]', 'rightSide.vtx[5]', ty=10)
                mc.polyMoveVertex('rightSide.vtx[3]', ty=1)
                mc.polyMoveVertex('rightSide.vtx[5]', ty=1)
                
                """
                Below, we create the front doors and the garage door
                """
                # 2 Front Doors
                for i in range(2):
                        frontDoor = mc.polyCube(n='frontDoor')
                        mc.scale(0.627, 8.678, 4.392)
                        mc.move(-4.546, 6.086, -15.466 - (4.5*i))
                        colorLambert = mc.shadingNode( 'lambert', asShader=True ) 
                        mc.select(frontDoor)
                        mc.setAttr((colorLambert + '.color'), 0.5, 0, 0, type = 'double3' )
                        mc.hyperShade(assign=colorLambert)
                
                # Garage Door
                for i in range(1):	
                        garageDoor = mc.polyCube(n='garageDoor')
                        mc.move(11.982,6.060 + (2.35*i),0)
                        mc.scale(0.277, 8.664, 18.652)
                        mc.select(garageDoor)
                        
                
                # polyUnite() will gather the objects and will merge all of them together. This allows to scale the entire house without having to worry about modifying the coordinates of the windows, roof, and other components of the house
                house = mc.polyUnite('rightSide', 'building','garageDoor', 'windowsRightSideBottom', 'windowsRightSideBottom1', 'windowsFrontBottom1', 'windowsFrontTop', 'frontDoorEndWindow1', 'roof', 'frontDoor1', 'frontDoor', 'roof2','windowsFrontBottom','windowsRearBottomNearKitchen','windowsRearBottomNearBedroom','frontDoorWindow','frontDoorEndWindow', n='house')
                
                # Scale the house from the random x,y,z sizes
                mc.scale(scaleX,scaleY,scaleZ, house)
                
                """for i in range(numOfHouses):
                	mc.duplicate('house', smartTransform=True)
                	mc.xform(house, translation=[i * 10, i, i * 5])"""
                return house # Now we return the object
def PolyPyramids(\
x = random.uniform(-10,10),\
x_r = 1,\
y = random.uniform(0,20),\
y_r = 1,\
z = random.uniform(-10,10),\
z_r = 1,\
xRot = random.uniform( 0, 360 ),\
xRot_r = 10,\
yRot = random.uniform( 0, 360 ),\
yRot_r = 10,\
zRot = random.uniform( 0, 360 ),\
zRot_r = 10,\
r = random.uniform(0,2),\
r_r = .1,\
g = random.uniform(0,2),\
g_r = .1,\
b = random.randint(0,2),\
b_r = .1,\
scaleF = random.uniform( 0.3, 1.5 ),\
scaleF_r = .1,\
):
    
    def change(start,min,max,rate):
    	if random.randint(0,5) == 0:
    		rate = (-1 * rate)
    	start += rate
    	if start < min or start > max:
    		rate = (-1 * rate)
    		start += rate
    	return start,rate
    
    
    for i in range( 0, 50 ):
       
       #create cube
    	cmds.polyPyramid( sc=1, sh=1, ns=1, w=1, n='pyramid{}'.format(i))
    	
    	#vary location
    	x = change(x,-10,10,x_r)[0]
    	x_r = change(x,-10,10,x_r)[1]
    	y = change(y,0,20,y_r)[0]
    	y_r = change(y,0,20,y_r)[1]
    	z = change(z,-10,10,z_r)[0]
    	z_r = change(z,-10,10,z_r)[1]
    	
    	#vary rotation
    	xRot = change(xRot,1,360,xRot_r)[0]
    	xRot_r = change(xRot,1,360,xRot_r)[1]
    	yRot = change(yRot,1,360,yRot_r)[0]
    	yRot_r = change(yRot,1,360,yRot_r)[1]
    	zRot = change(zRot,1,360,zRot_r)[0]
    	zRot_r = change(zRot,1,360,zRot_r)[1]
    	
    	#vary color
    	r = change(r,0,2,r_r)[0]
    	r_r = change(r,0,2,r_r)[1]
    	g = change(g,0,2,g_r)[0]
    	g_r = change(g,0,2,g_r)[1]
    	b = change(b,0,2,b_r)[0]
    	b_r = change(b,0,2,b_r)[1]
    	
    	#vary scale
    	scaleF = change(scaleF,0.3,1.5,scaleF_r)[0]
    	scaleF_r = change(scaleF,0.3,1.5,scaleF_r)[1]
    	
    	#apply variabels
    	cmds.rotate( xRot, yRot, zRot, 'pyramid{}'.format(i))
    	
    	cmds.scale(scaleF, scaleF, scaleF, 'pyramid{}'.format(i))
    	
    	cmds.move( x, y, z, 'pyramid{}'.format(i))
    	
    	cmds.sets( name='PyramidMaterial{}'.format(i), renderable=True, empty=True )
    	cmds.shadingNode( 'phong', name='PyramidShader{}'.format(i), asShader=True )
    	cmds.setAttr( 'PyramidShader{}'.format(i)+'.color', r, g, b, type='double3' )
    	cmds.surfaceShaderList( 'PyramidShader{}'.format(i), add='PyramidMaterial{}'.format(i))
    	cmds.sets( 'pyramid{}'.format(i), forceElement='PyramidMaterial{}'.format(i))
예제 #7
0
def polyPyramid(*args, **kwargs):
    res = cmds.polyPyramid(*args, **kwargs)
    if not kwargs.get('query', kwargs.get('q', False)):
        res = _factories.maybeConvert(res, _general.PyNode)
    return res
예제 #8
0
    def createCamHUD_Fn(self):

        cmds.setAttr('%s.v' % self.selCam[0], lock=False)
        cmds.setAttr('%s.v' % self.selCam[0], 1)
        self.camShape = cmds.listRelatives(self.selCam, s=1)

        # Create HUD Annotation
        cmds.select(cl=1)
        self.sceneInfoLoc = cmds.spaceLocator(n='%s.sceneInfoLocator' %
                                              self.selCam[0])
        cmds.setAttr('%sShape.lodVisibility' % self.sceneInfoLoc[0], 0)
        labelList = [('%s_sceneName' % self.selCam[0]),
                     ('%s_userInfo' % self.selCam[0]),
                     ('%s_cameraName' % self.selCam[0]),
                     ('%s_sceneInfo' % self.selCam[0])]
        anntList = []
        anntGrpList = []
        for i, each in enumerate(range(1, 5)):
            ant = cmds.annotate(self.sceneInfoLoc)
            annt = cmds.rename('annotation1', labelList[i])
            cmds.setAttr('%s.tx' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.ty' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.tz' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.rx' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.ry' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.rz' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.sx' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.sy' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.sz' % annt, l=1, k=0, cb=0)
            cmds.setAttr('%s.displayArrow' % annt, 0)
            anntGrp = cmds.group(n='label_%s' % labelList[i], em=0)
            anntGrpList.append(anntGrp)
            cmds.parent(anntGrp, self.sceneInfoLoc)
            anntList.append(annt)
        # Create Expression for each Annotation
        if cmds.objExists('CAM_Ex_displayFrameCount'):
            cmds.select(cl=1)
            cmds.select('%sShape' % anntList[3])
            newSceneInfoAnnt = cmds.ls(sl=1)
            cmds.select(cl=1)
            cmds.select('*_sceneInfoShape', add=1)
            sceneInfoAnntList = cmds.ls(sl=1)
            sceneInfoAnntList.remove(newSceneInfoAnnt[0])
            cmds.connectAttr('%s.text' % sceneInfoAnntList[0],
                             '%s.text' % newSceneInfoAnnt[0])
            cmds.select(cl=1)
        else:
            cmds.expression(
                s=
                "//-------set timecode seconds padding--------- \nglobal proc string secondsPadding(int $num)\n{\nstring $tmp;\nint $pad;\n\n$tmp = $num;\n$pad = size($tmp);\n\nif($pad == 1)\n{\nreturn (\"0\" + $tmp);\n}\nelse\n{\nreturn $tmp;\n}\n}\n\n//-------set timecode frames padding\nglobal proc string framesPadding(int $num)\n{\nstring $tmp;\nint $pad;\n\n$tmp = $num;\n$pad = size($tmp);\n\nif($pad == 1)\n{\nreturn (\"0\" + $tmp);\n}\nelse\n{\nreturn $tmp;\n}\n}\n\n$ct = `currentTime -q`;\n$fps = `currentTimeUnitToFPS`;\n$s = ($ct % (60 * $fps)) / $fps;\n$f = ($ct % $fps);\nif ($f == 0)\n{ \n$f = 25;\n$s = $s - 1;\n}\n$ss = secondsPadding($s);\n$ff = framesPadding($f);\n\nstring $sequence = .I[0];\nstring $seqpad = substring(\"-0000\",1,4-size($sequence));\nstring $sq = $seqpad + $sequence;\n\nstring $scene = .I[1];\nstring $scpad = substring(\"-0000\",1,4-size($scene));\nstring $sc = $scpad + $scene;\n\nint $sceneindex = .I[2];\nstring $sceneletter = \"\";\nif ($sceneindex > 0)\n{\n$sceneletter = substring(\"ABCDEFGHIJKLMNOPQRSTUVWXYZ\", $sceneindex, $sceneindex);\n}\nstring $sclabel = $sc + $sceneletter;\n\nstring $cTxt = \"sq\" + $sq + \" sc\" + $sclabel + \" | fr-\";\n\n// get the global frame number as a string\n//string $annotation1Text = `file -q -sn -shn` + \" | \" + frame + (\" / \" + `playbackOptions -q -maxTime`) + \" | \" + ($ss + \":\" + $ff);\nstring $annotation1Text = frame + (\" / \" + `playbackOptions -q -maxTime`) + \" | \" + ($ss + \":\" + $ff);\n\n// set it to annotationShape1.text attribute \nstring $prefix[] = `ls -s \"*sceneInfoShape\"`;\nstring $frameLabel = $prefix[0] +  \".text\" ;\nsetAttr -type \"string\"  $frameLabel $annotation1Text;",
                o='%sShape' % str(anntList[0]),
                n='CAM_Ex_displayFrameCount',
                ae=1,
                uc='none')
        # Modify Annotions Location
        cmds.xform(anntGrpList[0], t=[1.724, 0.01, 0])
        cmds.xform(anntGrpList[1], t=[4.014, 0.01, 0])
        cmds.xform(anntGrpList[2], t=[1.724, -1.268, 0])
        cmds.xform(anntGrpList[3], t=[3.974, -1.268, 0])
        cmds.xform(self.sceneInfoLoc,
                   t=[-0.250, 0.205, -0.005],
                   s=[0.146, 0.336, 0.336])
        # Lock Attributes
        for each in anntGrpList:
            cmds.setAttr('%s.tx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ty' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.tz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ry' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sy' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.overrideEnabled' % each, 1)
        # Set Labels Color
        cmds.setAttr('%s.overrideColor' % anntGrpList[0], 18)
        cmds.setAttr('%s.overrideColor' % anntGrpList[1], 18)
        cmds.setAttr('%s.overrideColor' % anntGrpList[2], 18)
        cmds.setAttr('%s.overrideColor' % anntGrpList[3], 17)
        # Set Label Name
        fileName = cmds.file(q=1, sn=1, shn=1)
        userName = os.getenv("user")
        cmds.setAttr('%sShape.text' % anntList[0], fileName, type="string")
        cmds.setAttr('%sShape.text' % anntList[1], userName, type="string")
        cmds.setAttr('%sShape.text' % anntList[2],
                     self.selCam[0],
                     type="string")

        # Create Film Gates and Fulcrum
        self.prism = cmds.polyPyramid(n='%s_fulcrum' % self.selCam[0], ch=0)
        cmds.xform(self.prism,
                   ro=[90, 0, 45],
                   sp=[0, 0.353553, 0],
                   rp=[0, 0.353553, 0])
        tmpCnst = cmds.pointConstraint(self.selCam, self.prism, mo=0)
        cmds.delete(tmpCnst)
        cmds.makeIdentity(self.prism, a=1, t=1, r=1, s=1)
        cmds.xform(self.prism, t=[0, 0, 0.662], s=[0.86, 0.49, 1])
        cmds.makeIdentity(self.prism, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.prism[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.prism[0], 1)
        self.TVsafe = cmds.polyPlane(n='%s_TVsafe_4x3' % self.selCam[0],
                                     sx=1,
                                     sy=1,
                                     ch=0)
        cmds.xform(self.TVsafe, ro=[90, 0, 0], s=[0.554, 0.410, 0.410])
        cmds.makeIdentity(self.TVsafe, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.TVsafe[0], 1)
        cmds.setAttr('%sShape.overrideLevelOfDetail' % self.TVsafe[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.TVsafe[0], 1)
        self.filmGateA = cmds.polyPlane(n='%s_Filmgate_4x3' % self.selCam[0],
                                        sx=1,
                                        sy=1,
                                        ch=0)
        cmds.xform(self.filmGateA, ro=[90, 0, 0], s=[0.613, 0.4, 0.454])
        cmds.makeIdentity(self.filmGateA, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.filmGateA[0], 1)
        cmds.setAttr('%sShape.overrideLevelOfDetail' % self.filmGateA[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.filmGateA[0], 1)
        self.tvGateGrp = cmds.group(n='%s_TV_4x3_adjust' % self.selCam[0],
                                    em=0)
        cmds.parent(self.TVsafe, self.tvGateGrp)
        self.filmGateB = cmds.polyPlane(n='%s_Filmgate_16x9' % self.selCam[0],
                                        sx=1,
                                        sy=1,
                                        ch=0)
        cmds.xform(self.filmGateB, ro=[90, 0, 0], s=[0.806, 0.453, 0.453])
        cmds.makeIdentity(self.filmGateB, a=1, t=1, r=1, s=1)
        cmds.setAttr('%sShape.overrideEnabled' % self.filmGateB[0], 1)
        cmds.setAttr('%sShape.overrideLevelOfDetail' % self.filmGateB[0], 1)
        cmds.setAttr('%sShape.overrideDisplayType' % self.filmGateB[0], 1)
        self.clipGrp = cmds.group(n='%s_lock_to_clipping' % self.selCam[0],
                                  em=0)
        cmds.parent(self.sceneInfoLoc, self.tvGateGrp, self.filmGateB)
        cmds.xform(self.clipGrp, t=[0, 0, -0.345], s=[6.1, 4.56, 4.56])
        self.guideGrp = cmds.group(n='%s_GUIDES' % self.selCam[0], em=1)
        cmds.parent(self.clipGrp, self.guideGrp)
        cmds.xform(self.guideGrp, t=[0, 0, -0.662], s=[0.875, 0.875, 1])
        gates = [
            '%s_TVsafe_4x3' % self.selCam[0],
            '%s_Filmgate_4x3' % self.selCam[0]
        ]
        for each in gates:
            cmds.setAttr('%s.tx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ty' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.tz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.ry' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.rz' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sx' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sy' % each, l=1, k=0, cb=0)
            cmds.setAttr('%s.sz' % each, l=1, k=0, cb=0)

        # Setup Camera
        cmds.modelEditor('modelPanel4', e=1, dim=1)
        cmds.setAttr('%s.nearClipPlane' % self.camShape[0], lock=False)
        cmds.setAttr('%s.nearClipPlane' % self.camShape[0], 1)
        cmds.setAttr('%s.farClipPlane' % self.camShape[0], lock=False)
        cmds.setAttr('%s.farClipPlane' % self.camShape[0], 100000)
        cmds.setAttr('%s.filmFit' % self.camShape[0], lock=False)
        cmds.setAttr('%s.filmFit' % self.camShape[0], 3)
        self.guideSdk = cmds.group(n='%s_GUIDE_sdk' % self.selCam[0], em=1)
        self.guideAlign = cmds.group(n='%s_GUIDE_align' % self.selCam[0], em=0)
        self.guideSpace = cmds.group(n='%s_GUIDE_space' % self.selCam[0], em=0)
        cmds.parent(self.guideGrp, self.guideSdk)
        tmpScale = cmds.scaleConstraint(self.selCam, self.guideSpace, mo=0)
        tmpCnst = cmds.parentConstraint(self.selCam, self.guideSpace, mo=0)
        cmds.delete(tmpCnst, tmpScale)
        tmpScale = cmds.scaleConstraint(self.selCam, self.prism, mo=0)
        tmpCnst = cmds.parentConstraint(self.selCam, self.prism, mo=0)
        cmds.delete(tmpCnst, tmpScale)
        cmds.parent(self.prism, self.guideGrp)
        cmds.parentConstraint(self.selCam, self.guideSpace, mo=0)
        cmds.scaleConstraint(self.selCam, self.guideSpace, mo=0)
        # Hide All Default Maya HUD
        defaultHUD = cmds.headsUpDisplay(lv=0)
        # setUp Camera Attributes
        cmds.addAttr(self.selCam[0], ln='EXTRA', at='enum', en='-')
        cmds.setAttr('%s.EXTRA' % self.selCam[0],
                     e=1,
                     l=False,
                     k=False,
                     cb=True)
        cmds.addAttr(self.camShape[0], ln='type', dt='string')
        cmds.setAttr('%s.type' % self.camShape[0], e=1, k=True)
        cmds.setAttr('%s.type' % self.camShape[0], 'shotCam', type="string")
        # TV Adjust Attributes
        cmds.addAttr(self.selCam[0], ln='TVGateVis', at='enum', en='Off:On:')
        cmds.setAttr('%s.TVGateVis' % self.selCam[0], e=1, k=True)
        cmds.connectAttr('%s.TVGateVis' % self.selCam[0],
                         '%s.v' % self.tvGateGrp)
        cmds.addAttr(self.selCam[0],
                     ln='TVsafeActionAdjust',
                     at='float',
                     hnv=1,
                     hxv=1,
                     max=1,
                     min=-1)
        cmds.setAttr('%s.TVsafeActionAdjust' % self.selCam[0], e=1, k=True)
        self.tvAdjustMD = cmds.createNode('multiplyDivide',
                                          n='CAM_tvAdjust_multiplier')
        cmds.connectAttr('%s.TVsafeActionAdjust' % self.selCam[0],
                         '%s.input1X' % self.tvAdjustMD)
        cmds.setAttr('%s.input2X' % self.tvAdjustMD, 0.025)
        cmds.connectAttr('%s.outputX' % self.tvAdjustMD,
                         '%s.translateX' % self.tvGateGrp)
        # fulcrum Attributes
        cmds.addAttr(self.selCam[0], ln='fulcrumVis', at='enum', en='Off:On:')
        cmds.setAttr('%s.fulcrumVis' % self.selCam[0], e=1, k=True)
        cmds.connectAttr('%s.fulcrumVis' % self.selCam[0],
                         '%s.v' % self.prism[0])
        cmds.addAttr(self.selCam[0],
                     ln='fulcrumSize',
                     at='float',
                     hnv=1,
                     min=1)
        cmds.setAttr('%s.fulcrumSize' % self.selCam[0], 3)
        cmds.setAttr('%s.fulcrumSize' % self.selCam[0], e=1, k=True)
        self.prismScalerMD = cmds.createNode('multiplyDivide',
                                             n='CAM_fulcrumScaler')
        cmds.connectAttr('%s.fulcrumSize' % self.selCam[0],
                         '%s.input1X' % self.prismScalerMD)
        cmds.connectAttr('%s.fulcrumSize' % self.selCam[0],
                         '%s.input1Y' % self.prismScalerMD)
        cmds.connectAttr('%s.fulcrumSize' % self.selCam[0],
                         '%s.input1Z' % self.prismScalerMD)
        cmds.setAttr('%s.input2X' % self.prismScalerMD, 10)
        cmds.setAttr('%s.input2Y' % self.prismScalerMD, 10)
        cmds.setAttr('%s.input2Z' % self.prismScalerMD, 10)
        cmds.connectAttr('%s.outputX' % self.prismScalerMD,
                         '%s.sx' % self.prism[0])
        cmds.connectAttr('%s.outputY' % self.prismScalerMD,
                         '%s.sy' % self.prism[0])
        cmds.connectAttr('%s.outputZ' % self.prismScalerMD,
                         '%s.sz' % self.prism[0])
        # FOV Setup
        self.focalMD = cmds.createNode('multiplyDivide', n='CAM_guides_to_FOV')
        cmds.setAttr('%s.operation' % self.focalMD, 2)
        cmds.setAttr('%s.input1X' % self.focalMD, 35)
        cmds.connectAttr('%s.focalLength' % self.camShape[0],
                         '%s.input2X' % self.focalMD)
        cmds.connectAttr('%s.outputX' % self.focalMD, '%s.sx' % self.guideGrp)
        cmds.connectAttr('%s.outputX' % self.focalMD, '%s.sy' % self.guideGrp)
        # clipping Setup
        cmds.addAttr(self.selCam[0], ln='nearClip', at='float', hnv=1, min=0)
        cmds.setAttr('%s.nearClip' % self.selCam[0], e=1, k=True)
        cmds.setAttr('%s.nearClip' % self.selCam[0], 1)
        cmds.addAttr(self.selCam[0], ln='farClip', at='float')
        cmds.setAttr('%s.farClip' % self.selCam[0], e=1, k=True)
        cmds.setAttr('%s.farClip' % self.selCam[0], 1000000)
        cmds.connectAttr('%s.nearClip' % self.selCam[0],
                         '%s.nearClipPlane' % self.camShape[0])
        cmds.connectAttr('%s.farClip' % self.selCam[0],
                         '%s.farClipPlane' % self.camShape[0])
        self.nearClipMD = cmds.createNode('multiplyDivide',
                                          n='CAM_clippingControl01')
        cmds.setAttr('%s.input2X' % self.nearClipMD, -1)
        cmds.setAttr('%s.input2Y' % self.nearClipMD, 1.51)
        cmds.setAttr('%s.input1Z' % self.nearClipMD, 1)
        cmds.connectAttr('%s.nearClip' % self.selCam[0],
                         '%s.input1X' % self.nearClipMD)
        cmds.connectAttr('%s.nearClip' % self.selCam[0],
                         '%s.input1Y' % self.nearClipMD)
        cmds.connectAttr('%s.outputX' % self.nearClipMD,
                         '%s.tz' % self.clipGrp)
        self.nearClipPMA = cmds.createNode('plusMinusAverage',
                                           n='CAM_clippingControl02')
        cmds.connectAttr('%s.outputY' % self.nearClipMD,
                         '%s.input1D[1]' % self.nearClipPMA)
        cmds.connectAttr('%s.outputZ' % self.nearClipMD,
                         '%s.input1D[0]' % self.nearClipPMA)
        cmds.connectAttr('%s.output1D' % self.nearClipPMA,
                         '%s.sx' % self.clipGrp)
        cmds.connectAttr('%s.output1D' % self.nearClipPMA,
                         '%s.sy' % self.clipGrp)
        cmds.connectAttr('%s.output1D' % self.nearClipPMA,
                         '%s.sz' % self.clipGrp)
        # AperTure Setup
        self.honMD01 = cmds.createNode('multiplyDivide',
                                       n='horizontalApperture_MD01')
        cmds.setAttr('%s.operation' % self.honMD01, 2)
        cmds.setAttr('%s.input2X' % self.honMD01, 2)
        self.honMD02 = cmds.createNode('multiplyDivide',
                                       n='horizontalApperture_MD02')
        cmds.setAttr('%s.operation' % self.honMD02, 2)
        cmds.setAttr('%s.input2X' % self.honMD02, 0.843)
        cmds.connectAttr('%s.horizontalFilmAperture' % self.camShape[0],
                         '%s.input1X' % self.honMD01)
        cmds.connectAttr('%s.outputX' % self.honMD01,
                         '%s.input1X' % self.honMD02)
        cmds.connectAttr('%s.outputX' % self.honMD02,
                         '%s.sx' % self.guideAlign)
        self.vertMD01 = cmds.createNode('multiplyDivide',
                                        n='verticalApperture_MD01')
        cmds.setAttr('%s.operation' % self.vertMD01, 2)
        cmds.setAttr('%s.input2X' % self.vertMD01, 0.945)
        self.vertMD02 = cmds.createNode('multiplyDivide',
                                        n='verticalApperture_MD02')
        cmds.setAttr('%s.operation' % self.vertMD02, 2)
        cmds.setAttr('%s.operation' % self.vertMD02, 1)
        cmds.connectAttr('%s.verticalFilmAperture' % self.camShape[0],
                         '%s.input1X' % self.vertMD01)
        cmds.connectAttr('%s.outputX' % self.vertMD01,
                         '%s.input1X' % self.vertMD02)
        cmds.connectAttr('%s.outputX' % self.vertMD02,
                         '%s.sy' % self.guideAlign)
        # Counter Resolution Setup
        darMD = cmds.createNode('multiplyDivide', n='deviceAspectRatio_MD01')
        cmds.setAttr('%s.operation' % darMD, 2)
        cmds.setAttr('%s.input1X' % darMD, 1.5)
        cmds.connectAttr('defaultResolution.deviceAspectRatio',
                         '%s.input2X' % darMD)
        darCon = cmds.createNode('condition', n='deviceAspectRatio_CON01')
        cmds.setAttr('%s.operation' % darCon, 4)
        cmds.setAttr('%s.secondTerm' % darCon, 1.7)
        cmds.setAttr('%s.colorIfTrueG' % darCon, 1)
        cmds.setAttr('%s.colorIfFalseG' % darCon, 1.19)
        cmds.setAttr('%s.colorIfTrueR' % darCon, 1)
        cmds.connectAttr('%s.input2X' % darMD, '%s.firstTerm' % darCon)
        cmds.connectAttr('%s.outputX' % darMD, '%s.colorIfTrueR' % darCon)
        cmds.connectAttr('%s.outColorG' % darCon, '%s.sx' % self.filmGateB[0])
        cmds.connectAttr('%s.outColorR' % darCon, '%s.sy' % self.filmGateB[0])
        #  Camera Scale Setup
        cmds.addAttr(self.selCam[0],
                     ln='matchGuide',
                     at='float',
                     hnv=1,
                     min=-10,
                     hxv=1,
                     max=10)
        cmds.setAttr('%s.matchGuide' % self.selCam[0], e=1, k=True)
        camScaleMD = cmds.createNode('multiplyDivide',
                                     n='cameraScaleCounter_MD01')
        cmds.connectAttr('%s.matchGuide' % self.selCam[0],
                         '%s.input1X' % camScaleMD)
        cmds.setAttr('%s.input2X' % camScaleMD, 1)
        cmds.connectAttr('%s.outputX' % camScaleMD, '%s.tz' % self.guideSdk)
        # Lock Attributes
        lockList = [
            self.sceneInfoLoc[0], self.prism[0], self.tvGateGrp, self.clipGrp,
            self.guideGrp, self.guideAlign
        ]
        for each in lockList:
            cmds.setAttr('%s.tx' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.ty' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.tz' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.rx' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.ry' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.rz' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.sx' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.sy' % each, l=1, k=1, cb=1)
            cmds.setAttr('%s.sz' % each, l=1, k=1, cb=1)
        # Camera Label Group
        cmds.select(cl=1)
        if cmds.objExists('CameraLabel_grp'):
            cmds.select('CameraLabel_grp')
            self.mainCamGrp = cmds.ls(sl=1)
            cmds.parent(self.guideSpace, self.mainCamGrp)
        else:
            self.mainCamGrp = cmds.group(n='CameraLabel_grp', em=1)
            cmds.parent(self.guideSpace, self.mainCamGrp)
        cmds.select(cl=1)
        cmds.select(self.selCam)

        # Help Window
        cHelpWin = 'CamHUD Help Window'

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

        if cmds.windowPref(cHelpWin, ex=True):
            cmds.windowPref(cHelpWin, remove=True)

        cHelpWin = cmds.window(title='CamHUD v.1.0 Help', s=0, w=400, h=150)
        cmds.frameLayout('User Guide',
                         borderStyle='etchedOut',
                         collapsable=1,
                         collapse=0)
        form = cmds.formLayout()
        content = (
            'CamHUD is Setup when this window pop-up. ' + '\n\n' +
            'If CamHUD not showing up/matching with grey gate on playblast panel.Try the following steps.'
            + '\n\n' +
            '1. Change view port from Film Gate to Resolution Gate.' + '\n\n' +
            '2. Select playblast camera.' + '\n\n' +
            '3. Tweak the value of the Match Guide attribute until the CamHUD show up and match with the Resolution Gate.'
            + '\n\n' +
            '4. Call for help from rigger if the CamHUD still not showing up.'
            + '\n\n' +
            'The Match Guide attributes is corresponding with value of Camera Scale( under cameraShape node. Open Attribute Editor to locate it. Under Focal Length. Default value is 1. )'
            + '\n\n' + 'Camera Scale= 0.5, Match Guide= -6' + '\n\n' +
            'Camera Scale= 1, Match Guide= 0' + '\n\n' +
            'Camera Scale= 2, Match Guide= 3' + '\n\n' +
            'Camera Scale= 3, Match Guide= 4' + '\n\n' +
            'Close This window if CamHUD is Set up properly. Thanks.')

        cmds.scrollField(wordWrap=True,
                         editable=False,
                         text=content,
                         w=400,
                         h=460)
        cmds.showWindow(cHelpWin)
예제 #9
0
파일: Create.py 프로젝트: tiantianhan/rush
def polyPyramid():
    cmds.polyPyramid()
예제 #10
0

pathOfFiles = "/Users/Emily/Desktop/"
fileType = "obj"

files = cmds.getFileList(folder=pathOfFiles, filespec='*.%s' % fileType)
if len(files) == 0:
    cmds.warning("No files found")
else:

    #initializes global numPheromones
    global totalNumPheromones
    totalNumPheromones = 0

    #"home" pyramid is the origin (0,0,0) (it glows gold)
    cmds.polyPyramid()
    cmds.move(0, 0.3, 0)
    cmds.sets(e=True, forceElement='blinn2SG')

    #food piles at corners (each has 10 food)
    cmds.polyPyramid()
    cmds.scale(.50, .50, .50)
    cmds.move(9, .25, 9)
    cmds.sets(e=True, forceElement='blinn3SG')
    food1 = Food("pPyramid2")

    cmds.polyPyramid()
    cmds.scale(.50, .50, .50)
    cmds.move(-9, .25, 9)
    cmds.sets(e=True, forceElement='blinn3SG')
    food2 = Food("pPyramid3")
예제 #11
0
파일: mayaNode.py 프로젝트: K240/miExecutor
 def _polyPyramid(self):
     cmds.polyPyramid()
예제 #12
0
cmds.select(all=True)
cmds.delete()

cmds.polySphere(n='Sphere')
cmds.polyCube(n='Cube')
cmds.move(0, 0, 5)
cmds.polyCylinder(n='Cylinder')
cmds.move(0, 0, 10)
cmds.polyCone(n='Cone')
cmds.move(0, 0, 15)
cmds.polyTorus(n='Torus')
cmds.move(0, 0, 20)
cmds.polyPlane(n='Plane')
cmds.move(0, 0, 25)
#cmds.polyDisc(n='Disc')
#cmds.move( 0, 0, 30 )
cmds.polyPyramid(n='Pyramid')
cmds.move(0, 0, 30)
cmds.polyPlatonicSolid(n='Platonic')
cmds.move(0, 0, 35)
cmds.polyPrism(n='Prism')
cmds.move(0, 0, 40)
cmds.polyPipe(n='Pipe')
cmds.move(0, 0, 45)
cmds.polyHelix(n='Helix')
cmds.move(0, 0, 50)
#cmds.polyGear(n='Gear')
#cmds.move( 0, 0, 60 )
cmds.polyPrimitive(r=1, l=0.4036, pt=0, n='SoccerBall')
cmds.move(0, 0, 55)
예제 #13
0
cone = mc.polyCone(r=1, h=2, sx=20, sy=1, sz=0, ax=(0, 1, 0), rcp=0, cuv=3, ch=1)
mc.scale(2, 3, 2, cone, r=True)
mc.move(6, 0, 6, cone, r=True)
mc.rotate(12, 11, 5, cone, r=True, os=True)

torus = mc.polyTorus(r=1, sr=0.5, tx=0, sx=20, sy=0, ax=(0, 1, 0), cuv=3, ch=1)
mc.scale(2, 2, 2, torus, r=True)
mc.move(-6, 0, 6, torus, r=True)
mc.rotate(1, 23, 5, torus, r=True, os=True)

prism = mc.polyPrism(w=1, ns=3, sh=1, sc=0, ax=(0, 1, 0), cuv=3, ch=1)
mc.scale(2, 2, 2, prism, r=True)
mc.move(0, 0, 6, prism, r=True)
mc.rotate(1, 4, 30, prism, r=True, os=True)

pyramid = mc.polyPyramid(w=1, ns=4, sh=0, sc=0, ax=(0, 1, 0), cuv=3, ch=1)
mc.scale(4, 5, 4, pyramid, r=True)
mc.move(6, 0, -6, pyramid, r=True)

pipe = mc.polyPipe(r=1, h=3, t=0.5, sa=20, sh=1, sc=0, ax=(0, 1, 0), cuv=3, rcp=0, ch=1)
mc.scale(2, 2, 2, pipe, r=True)
mc.move(-6, 0, -6, pipe, r=True)
mc.rotate(14, 32, 30, pipe, r=True, os=True)

helix = mc.polyHelix(c=3, h=2, w=2, r=0.4, sa=8, sco=50, sc=0, d=1, ax=(0, 1, 0), cuv=3, rcp=0, ch=1)
mc.scale(2, 2, 2, helix, r=True)
mc.move(0, 0, 0, helix, r=True)
mc.rotate(14, 32, 90, helix, r=True, os=True)

# Deselect all 
mc.select(clear=True)
mx.polyPrism(n='pp3',w=5,l=10,ax=(-1,0,0))
mx.move(0,5,0)

mx.polyCube(h=4)
mx.move(0,2,0)

mx.polyPrism(n='pp4',w=5,l=10,ns=8,ax=(-1,0,0),sh=2,sc=5)

PolyPyramid


Don’t have a height in pyramid (can’t set height)
EX.	import maya.cmds as mx 

mx.file(f=1,new=1)
mx.polyPyramid(n='ppm1')
mx.polyPyramid(n='ppm2',ns=3,ax=(0,-1,0))
mx.polyPyramid(n='ppm3',ns=4,w=5,ax=(0,-1,0),sh=4)
mx.polyPyramid(n='ppm4',ns=5,w=5,ax=(0,-1,0),sh=4)
mx.polyPyramid(n='ppm5',ns=6,w=5,ax=(0,-1,0),sh=4)
PolySphere

EX.	import maya.cmds as mx 

mx.file(f=1,new=1)
mx.polySphere(r=2) 
mx.polySphere(r=2,sx=3,sy=3)


PolyTorus