本文整理汇总了Python中maya.cmds.polyPlane函数的典型用法代码示例。如果您正苦于以下问题:Python polyPlane函数的具体用法?Python polyPlane怎么用?Python polyPlane使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了polyPlane函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_shape
def make_shape(type, name, divisions):
"""
Creates shape based on argument passed
Args:
type: {cube, cone, cylinder, plane, torus, sphere}
name: name of the object
divisions: number of subdivisions we want to apply in x,y and z axis.
Same value will be taken in all axis.
Return:
None
"""
if type == 'cube':
mc.polyCube(n=name, sx=divisions, sy=divisions, sz=divisions)
elif type == 'cone':
mc.polyCone(n=name, sx=divisions, sy=divisions, sz=divisions)
elif type == 'cylinder':
mc.polyCylinder(n=name, sx=divisions, sy=divisions, sz=divisions)
elif type == 'plane':
mc.polyPlane(n=name, sx=divisions, sy=divisions)
elif type == 'torus':
mc.polyTorus(n=name, sx=divisions, sy=divisions)
elif type == 'sphere':
mc.polySphere(n=name, sx=divisions, sy=divisions)
else:
mc.polySphere()
示例2: setUp
def setUp(self):
MayaCmds.file(new=True, force=True)
self.__files = []
# write out an animated Alembic file
createAnimatedSolarSystem()
self.__files.append(util.expandFileName("testAnimatedSolarSystem.abc"))
MayaCmds.AbcExport(j="-fr 1 24 -root group1 -root group2 -file " + self.__files[-1])
# write out a static Alembic file that's different than the static scene
# created by createStaticSolarSystem()
MayaCmds.currentTime(12, update=True)
self.__files.append(util.expandFileName("testStaticSolarSystem.abc"))
MayaCmds.AbcExport(j="-fr 12 12 -root group1 -root group2 -file " + self.__files[-1])
# write out an animated mesh with animated parent transform node
MayaCmds.polyPlane(sx=2, sy=2, w=1, h=1, ch=0, n="polyMesh")
MayaCmds.createNode("transform", n="group")
MayaCmds.parent("polyMesh", "group")
# key the transform node
MayaCmds.setKeyframe("group", attribute="translate", t=[1, 4])
MayaCmds.move(0.36, 0.72, 0.36)
MayaCmds.setKeyframe("group", attribute="translate", t=2)
# key the mesh node
MayaCmds.select("polyMesh.vtx[0:8]")
MayaCmds.setKeyframe(t=[1, 4])
MayaCmds.scale(0.1, 0.1, 0.1, r=True)
MayaCmds.setKeyframe(t=2)
self.__files.append(util.expandFileName("testAnimatedMesh.abc"))
MayaCmds.AbcExport(j="-fr 1 4 -root group -file " + self.__files[-1])
MayaCmds.file(new=True, force=True)
示例3: GenTerrain
def GenTerrain(DATA_SIZE, SEED, h, j):
createTerrainData(DATA_SIZE, SEED, h, j)
name = 'Terrain'
totalPoints=(DATA_SIZE)*(DATA_SIZE)
if (cmds.objExists(name) == True):
cmds.delete(name)
cmds.polyPlane( n=name, sx=(DATA_SIZE-1), sy=(DATA_SIZE-1), h=20, w=20)
count = 0
cmds.progressWindow(title='Setting Points', progress=count, max = totalPoints, status='Setting: 0/'+str(totalPoints))
for i in xrange(DATA_SIZE):
if True: cmds.refresh()
cmds.delete(name, ch = True)
for j in xrange(DATA_SIZE):
offset = dataArray[i][j]
cmds.polyMoveVertex( name+'.vtx['+str(count)+']', ws = True, ty = offset, cch=True)
cmds.progressWindow(edit=True, progress=count, status='Setting: '+str(count))
count+=1
cmds.progressWindow(endProgress=1)
#cmds.polySmooth(n=name, cch = True)
cmds.delete(name, ch = True)
示例4: createHoneyPiece
def createHoneyPiece(n):
planeName = 'plane'+str(n)
print planeName
cmds.polyPlane(w=20, h=20, sx=12, sy=12, n=planeName)
edgeNum = 26
modVal = 1;
edgeArray = []
for i in range(52):
edgeArray.append(planeName+'.e['+str(edgeNum)+']');
edgeNum += 2
if(edgeNum == 51):
edgeNum = 101
if(edgeNum==50):
edgeNum = 49
if(edgeNum == 126):
edgeNum = 176
if(edgeNum==125):
edgeNum = 124
if(edgeNum==201):
edgeNum = 251
if(edgeNum==200):
edgeNum = 199
if(edgeNum==275):
edgeNum = 274
cmds.polyBevel(edgeArray, offset=1,offsetAsFraction=1,autoFit=1,segments=1,worldSpace=1,uvAssignment=0,fillNgons=1,mergeVertices=1,mergeVertexTolerance=0.0001,smoothingAngle=30,miteringAngle=180,angleTolerance=180,ch=1)
cmds.select( clear=True)
print len(edgeArray)
del edgeArray[:]
print len(edgeArray)
for i in range(532, 620):
cmds.select(planeName+'.e['+str(i)+']', toggle=True);
size = 36;
edgeNum = 31
counter = 0
for i in range(size):
cmds.select(planeName+'.e['+str(edgeNum)+']', toggle=True);
edgeNum += 2
counter += 1
if(counter == 12):
counter = 0
edgeNum += 7;
cmds.delete();
for i in range(12):
cmds.select(planeName+'.f['+str(i)+']', toggle=True);
for i in range(96, 108):
cmds.select(planeName+'.f['+str(i)+']', toggle=True);
for i in range(1,8):
cmds.select(planeName+'.f['+str(i*12)+']', toggle=True);
for i in range(1,8):
cmds.select(planeName+'.f['+str(i*12+11)+']', toggle=True);
cmds.delete();
cmds.scale(1, 1, 0.5, planeName);
#cmds.select(planeName+'.f[0:113]')
cmds.polyExtrudeFacet(planeName+'.f[0:113]', constructionHistory=1, keepFacesTogether=0, pvx=4.7, pvy=-1.058, pvz=2.38, divisions=1, twist=0, taper=1, off=0, thickness=0, smoothingAngle=30)
cmds.setAttr("polyExtrudeFace"+str(n*2+1)+".localScale", 0.833333, 0.833333, 0.829938, type="double3")
cmds.delete();
cmds.select(planeName+'.f[0:723]')
cmds.polyExtrudeFacet(constructionHistory=1, keepFacesTogether=1, pvx=-4.7, pvy=-1.058, pvz=2.38, divisions=1, twist=0, taper=1, off=0, thickness=0, smoothingAngle=30)
cmds.setAttr("polyExtrudeFace"+str(n*2+2)+".localTranslate", 0, 0, 1, type="double3")
示例5: setUpModel
def setUpModel(self):
#c.file('C:/Users/Sebastian/Documents/maya/projects/default/data/Cobblestones3/Files/untitled.fbx', type='FBX', ra=True, mergeNamespacesOnClash=False, namespace='untitled', options='fbx', i=True);
#name = 'C:\Users\Sebastian\Documents\maya\projects\default\sourceimages\exr\Location_1_1_hdr.exr';
#sphere = c.polySphere(n='worldSphere', ax=[0, 0, 0], r=80);
#shader = c.shadingNode('surfaceShader', asShader=True);
#SG = c.sets(empty=True, renderable=True, noSurfaceShader=True, name=shader+"SG");
#c.connectAttr(shader+'.outColor', SG+".surfaceShader", force=True);
#img = c.shadingNode('file', asTexture=True);
#c.setAttr(img+'.fileTextureName', name, type='string');
#c.connectAttr(img+'.outColor', shader+'.outColor', force=True);
#c.sets(sphere[0], edit=True, forceElement=SG);
#c.setAttr(img+'.hdrMapping', 2);
#c.setAttr(img+'.hdrExposure', 3);
ground = c.polyPlane(h=100,w=120, n='groundPlane');
c.move(37,-13, -15, 'groundPlane');
c.rotate(0, -20, -5,'groundPlane');
alphaShader = c.shadingNode('lambert', asShader=True, n='alphaShader')
SG2 = c.sets(empty=True, renderable=True, noSurfaceShader=True, name=alphaShader+"SG2");
c.setAttr(alphaShader+'.transparency', 1, 1, 1, type="double3");
c.select( 'groundPlane' );
c.hyperShade( assign=alphaShader);
if not (c.pluginInfo("Mayatomr",q=True,loaded=True)):
c.loadPlugin("Mayatomr")
else:
pass
"""
To load the hdr image from path
"""
HDR_Path = c.optionVar(q="WeatherViz_HDR_Path")
if HDR_Path:
if os.path.exists(HDR_Path):
print HDR_Path;
_setUpIBL();
return True
else:
mel.eval("error(\"WeatherViz | hdr image doesnt exist!\");")
else:
mel.eval("warning(\"WeatherViz | No hdr image found!\");")
#c.confirmDialog(title="sIBL_GUI | Warning", message="No Loader Script found!\nPlease define one in preferences!", button=["Ok"], defaultButton="Ok")
ground = c.polyPlane(h=100,w=120, n='groundPlane');
c.move(37,-13, -15, 'groundPlane');
c.rotate(0, -20, -5,'groundPlane');
alphaShader = c.shadingNode('lambert', asShader=True, n='alphaShader');
SG2 = c.sets(empty=True, renderable=True, noSurfaceShader=True, name=alphaShader+"SG2");
c.setAttr(alphaShader+'.transparency', 1, 1, 1, type="double3");
c.select( 'groundPlane' );
c.hyperShade( assign=alphaShader);
示例6: CreateImagePlane
def CreateImagePlane(self):
print self.ChildSelection
print self.ParentSelection
Texture = self.Path + self.ParentSelection + "/" + self.ChildSelection + ".png"
if os.path.exists(Texture):
if cmds.objExists("RWSPlane"):
cmds.delete("RWSPlane")
if cmds.objExists("RWSTexture"):
cmds.delete("RWSTexture")
if cmds.objExists("RWSTexturePlacer"):
cmds.delete("RWSTexturePlacer")
if cmds.objExists("RWSShader"):
cmds.delete("RWSShader")
if cmds.objExists("RWSShaderSG"):
cmds.delete("RWSShaderSG")
cmds.polyPlane(name = "RWSPlane",width = cmds.floatField("RWSYfield", query = True, v = True), height = cmds.floatField("RWSZfield", query = True, v = True) , subdivisionsX = 1, subdivisionsY = 1 )
cmds.rotate(90, 0, 0, "RWSPlane" )
cmds.setAttr("RWSPlaneShape.castsShadows", 0)
cmds.setAttr("RWSPlaneShape.receiveShadows", 0)
cmds.setAttr("RWSPlaneShape.motionBlur", 0)
cmds.setAttr("RWSPlaneShape.primaryVisibility", 0)
cmds.setAttr("RWSPlaneShape.smoothShading", 0)
cmds.setAttr("RWSPlaneShape.visibleInReflections", 0)
cmds.setAttr("RWSPlaneShape.visibleInRefractions", 0)
cmds.setAttr("RWSPlaneShape.doubleSided", 0)
if cmds.objExists("CMSettings"):
ModelName = cmds.getAttr("CMSettings.ModelName")
else:
ModelName = cmds.ls(sl = True)
bbx = cmds.xform(ModelName, bb = True, q = True)
zMove = -(bbx[5]-bbx[2])/2
yMove = cmds.floatField("RWSZfield", query = True, v = True)/20
cmds.move(0, yMove, zMove ,"RWSPlane")
material = cmds.shadingNode('lambert', asShader=1, name='RWSShader')
SG = cmds.sets(renderable=1, noSurfaceShader=1, empty=1, name = 'RWSShaderSG')
cmds.connectAttr((material + '.outColor'),(SG + '.surfaceShader'),f=1)
cmds.shadingNode("file", asTexture = True, name = "RWSTexture" )
cmds.setAttr("RWSTexture.fileTextureName", Texture, type = "string")
cmds.shadingNode("place2dTexture", asUtility = True, name = "RWSTexturePlacer")
cmds.connectAttr( "RWSTexturePlacer.outUV", "RWSTexture.uv")
cmds.connectAttr( "RWSTexturePlacer.outUvFilterSize", "RWSTexture.uvFilterSize")
cmds.connectAttr( "RWSTexture.outColor", "RWSShader.color", force = True)
try:
cmds.select("RWSPlane")
cmds.sets(cmds.ls(selection = True), forceElement = 'RWSShaderSG', e = True)
except:
print "Failed to assign shader"
cmds.select(None)
示例7: doIt
def doIt(self,argList):
cmds.polyPlane(n='myPlane', h=5, w=2)
cmds.polySphere(n='mySphere', r=5)
cmds.select('mySphere')
cmds.move(0,5,0)
cmds.rigidBody( n='myRigidBody', active=True, b=0.5, sf=0.4 )
cmds.select(cl=True)
cmds.gravity(n='myGravity')
cmds.connectDynamic('mySphere', fields='myGravity')
示例8: testRenderableOnly
def testRenderableOnly(self):
MayaCmds.polyPlane(name='potato')
MayaCmds.polyPlane(name='hidden')
MayaCmds.setAttr("hidden.visibility", 0)
self.__files.append(util.expandFileName('renderableOnlyTest.abc'))
MayaCmds.AbcExport(j='-renderableOnly -file ' + self.__files[-1])
MayaCmds.AbcImport(self.__files[-1], m='open')
self.failUnless(MayaCmds.objExists('potato'))
self.failIf(MayaCmds.objExists('hidden'))
示例9: demo
def demo():
cmds.file(f=1, new=1)
cmds.polyPlane(w=50, h=50)
cmds.rotate(1.555, -6.203, 6.393, r=1, os=1, fo=1)
cmds.spotLight()
cmds.move(14.142, 26.414, 18.0)
cmds.rotate(-54, 36.4, 0, r=1, os=1, fo=1)
if cmds.objExists('arrows'):
cmds.delete('arrows')
cmds.select(['pPlane1', 'spotLight1'])
intersect()
示例10: initializeRibbon
def initializeRibbon(initWidth):
mc.polyPlane(sx = 240, sy = 2.0, n = "ribbonTemp", w = initWidth, h = 0.165)
mc.rename("polyPlane1", "ribbonTempHistory")
mc.polySoftEdge( a = 180)
mc.lattice( n = 'ribbon', cp = True, dv = (2, 4, 2), objectDentered = True, ldv = (2, 3, 2), outsideLattice = True )
mc.hide()
mc.select('ribbonTempHistory.vtx[1]', r=True )
mc.ChamferVertex()
mc.rename( "polyChamfer1", "tempChamfer" )
mc.seAttr( 'tempChamfer.width', 1)
mc.delete( 'ribbonTemp.vtx[72]' )
return
示例11: construct_surface
def construct_surface():
status = True
global sizeX, sizeY, Height
widthPlaneX = mc.floatSliderGrp(widthX,q=True,value = True)
widthPlaneZ = mc.floatSliderGrp(widthZ,q=True,value = True)
if status == True:
mc.polyPlane(sx=widthPlaneX, sy=widthPlaneZ)
mc.scale(scaleX,0.0,scaleZ)
mc.rename("pPlane1", "Landscape_0")
#Freeze scale transformation
mc.makeIdentity(s=True, a=True)
return sizeX, sizeY
示例12: newScene
def newScene():
cmds.polyPlane(n="floor", h=30, w=30, sx=1, sy=1)
cmds.polyCylinder(n="src", h=5, r=0.2)
cmds.move(0,2.5,0, 'src', a = True)
cmds.duplicate("src", n="temp")
cmds.duplicate("src", n="dest")
cmds.move(-8,0,0, "src", r=True)
cmds.move(8,0,0, "dest", r=True)
assignNewMaterial('floorMaterial', [0.3, 0.2, 0], 'floor')
assignNewMaterial('pegMaterial', [0,0,0], 'src')
assignMaterial('pegMaterial', 'temp')
assignMaterial('pegMaterial', 'dest')
示例13: createHoneyPiece
def createHoneyPiece(n):
planeName = 'plane'+str(n)
cmds.polyPlane(w=20, h=20, sx=12, sy=12, n=planeName)
edgeNum = 26
modVal = 1;
edgeArray = []
for i in range(52):
edgeArray.append(planeName+'.e['+str(edgeNum)+']');
edgeNum += 2
if(edgeNum == 51):
edgeNum = 101
if(edgeNum==50):
edgeNum = 49
if(edgeNum == 126):
edgeNum = 176
if(edgeNum==125):
edgeNum = 124
if(edgeNum==201):
edgeNum = 251
if(edgeNum==200):
edgeNum = 199
if(edgeNum==275):
edgeNum = 274
cmds.polyBevel(edgeArray, offset=1,offsetAsFraction=1,autoFit=1,segments=1,worldSpace=1,uvAssignment=0,fillNgons=1,mergeVertices=1,mergeVertexTolerance=0.0001,smoothingAngle=30,miteringAngle=180,angleTolerance=180,ch=1)
cmds.select( clear=True)
del edgeArray[:]
for i in range(532, 620):
cmds.select(planeName+'.e['+str(i)+']', toggle=True);
size = 36;
edgeNum = 31
counter = 0
for i in range(size):
cmds.select(planeName+'.e['+str(edgeNum)+']', toggle=True);
edgeNum += 2
counter += 1
if(counter == 12):
counter = 0
edgeNum += 7;
cmds.delete();
for i in range(12):
cmds.select(planeName+'.f['+str(i)+']', toggle=True);
for i in range(96, 108):
cmds.select(planeName+'.f['+str(i)+']', toggle=True);
for i in range(1,8):
cmds.select(planeName+'.f['+str(i*12)+']', toggle=True);
for i in range(1,8):
cmds.select(planeName+'.f['+str(i*12+11)+']', toggle=True);
cmds.delete();
cmds.select(planeName);
示例14: testStaticVisibility
def testStaticVisibility(self):
poly1 = MayaCmds.polyPlane(sx=2, sy=2, w=1, h=1, ch=0)[0]
group1 = MayaCmds.group()
group2 = MayaCmds.createNode("transform")
MayaCmds.select(group1, group2)
group3 = MayaCmds.group()
group4 = (MayaCmds.duplicate(group1, rr=1))[0]
group5 = MayaCmds.group()
MayaCmds.select(group3, group5)
root = MayaCmds.group(name='root')
MayaCmds.setAttr(group1 + '.visibility', 0)
MayaCmds.setAttr(group2 + '.visibility', 0)
MayaCmds.setAttr(group5 + '.visibility', 0)
self.__files.append(util.expandFileName('staticVisibilityTest.abc'))
MayaCmds.AbcExport(j='-wv -root %s -file %s' % (root, self.__files[-1]))
MayaCmds.AbcImport(self.__files[-1], m='open')
self.failIf(MayaCmds.getAttr(group1+'.visibility'))
self.failIf(MayaCmds.getAttr(group2+'.visibility'))
self.failIf(MayaCmds.getAttr(group5+'.visibility'))
self.failUnless(MayaCmds.getAttr(group1+'|'+poly1+'.visibility'))
self.failUnless(MayaCmds.getAttr(group4+'|'+poly1+'.visibility'))
self.failUnless(MayaCmds.getAttr(group3+'.visibility'))
self.failUnless(MayaCmds.getAttr(group4+'.visibility'))
self.failUnless(MayaCmds.getAttr(root+'.visibility'))
示例15: bestFitPlaneCreate
def bestFitPlaneCreate(ptList,upVector=(0,1,0)):
'''
Create a best fit plane from a specified set of points.
@param ptList: List of points to calculate best fit plane from.
@type ptList: list
@param upVector: Up vector for orientation reference.
@type upVector: tuple or list
'''
# Calculate Plane Center and Normal
p = glTools.tools.center.centerPoint_average(ptList)
pt = OpenMaya.MVector(p[0],p[1],p[2])
n = bestFitPlaneNormal(ptList)
norm = OpenMaya.MVector(n[0],n[1],n[2])
# Build rotation matrix
mat = glTools.utils.matrix.buildRotation(norm,upVector,'y','x')
rot = glTools.utils.matrix.getRotation(mat,'xyz')
# Create Plane
plane = mc.polyPlane(w=1,h=1,sx=1,sy=1,ax=[0,1,0],cuv=2,ch=False)[0]
# Position Plane
mc.rotate(rot[0],rot[1],rot[2],plane,os=True,a=True)
mc.move(pt[0],pt[1],pt[2],plane,ws=True,a=True)
# Return result
return plane