本文整理汇总了Python中maya.cmds.polyPlane函数的典型用法代码示例。如果您正苦于以下问题:Python polyPlane函数的具体用法?Python polyPlane怎么用?Python polyPlane使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了polyPlane函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()
开发者ID:lbmk27,项目名称:maya_python,代码行数:27,代码来源:base_shapes.py
示例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)
开发者ID:keithbcg,项目名称:alembic,代码行数:34,代码来源:AbcImport_connect_test.py
示例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)
开发者ID:Gmadges,项目名称:PastWork,代码行数:28,代码来源:TerrainLib.py
示例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")
开发者ID:chalmersgit,项目名称:Maya_GenerativeArtSamples,代码行数:60,代码来源:create+random+pieces+in+the+sky.py
示例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);
开发者ID:sebra729,项目名称:WeatherViz,代码行数:58,代码来源:WeatherViz.py
示例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)
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:58,代码来源:RWSToolFile.py
示例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')
开发者ID:lixXxor,项目名称:Maya-Feather,代码行数:9,代码来源:BulletPlugin.py
示例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'))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:9,代码来源:AbcExport_renderableOnly_test.py
示例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()
开发者ID:mackst,项目名称:myRandomStuff,代码行数:11,代码来源:intersectCmd.py
示例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
开发者ID:radvfx,项目名称:py,代码行数:12,代码来源:jimboRibbon.py
示例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
开发者ID:PaulElmo,项目名称:Landscape_Generator,代码行数:13,代码来源:TerrainGen.py
示例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')
开发者ID:mainConfetti,项目名称:hanoi,代码行数:13,代码来源:hanoi.py
示例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);
开发者ID:chalmersgit,项目名称:Maya_GenerativeArtSamples,代码行数:49,代码来源:honeystuff.py
示例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'))
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:30,代码来源:visibility_test.py
示例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
开发者ID:auqeyjf,项目名称:glTools,代码行数:28,代码来源:bestFitPlane.py
示例16: bestFitPlane
def bestFitPlane(ptList,upVector=(0,1,0)):
'''
'''
# Initialize plane normal
norm = OpenMaya.MVector()
pt = OpenMaya.MVector()
# Calculate plane
for i in range(len(ptList)):
prev = OpenMaya.MVector(ptList[i-1][0],ptList[i-1][1],ptList[i-1][2])
curr = OpenMaya.MVector(ptList[i][0],ptList[i][1],ptList[i][2])
norm += OpenMaya.MVector((prev.z + curr.z) * (prev.y - curr.y), (prev.x + curr.x) * (prev.z - curr.z), (prev.y + curr.y) * (prev.x - curr.x))
pt += curr
# Normalize result
norm.normalize()
pt /= len(ptList)
# 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
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:32,代码来源:bestFitPlane.py
示例17: testSubD
def testSubD(self):
trans = MayaCmds.polyPlane(n='plane', sx=1, sy=1, ch=False)[0]
shape = MayaCmds.pickWalk(d='down')[0]
MayaCmds.addAttr(attributeType='bool', defaultValue=1, keyable=True,
longName='SubDivisionMesh')
MayaCmds.select(trans+'.vtx[0:3]', r=True)
MayaCmds.move(0, 1, 0, r=True)
MayaCmds.currentTime(1, update=True)
MayaCmds.setKeyframe()
MayaCmds.currentTime(2, update=True)
MayaCmds.move(0, 5, 0, r=True)
MayaCmds.setKeyframe()
self.__files.append(util.expandFileName('testSubDInterpolation.abc'))
MayaCmds.AbcExport(j='-fr 1 2 -root %s -file %s' % (trans, self.__files[-1]))
MayaCmds.AbcImport(self.__files[-1], mode='open')
MayaCmds.currentTime(1.004, update=True)
ty = MayaCmds.getAttr(shape+'.vt[0]')[0][1]
self.failUnlessAlmostEqual(1.02, ty)
setTime = MayaCmds.currentTime(1.422, update=True)
alpha = (setTime - 1) / (2 - 1)
ty = MayaCmds.getAttr(shape+'.vt[0]')[0][1]
self.failUnlessAlmostEqual(ty, (1-alpha)*1.0+alpha*6.0, 3)
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:25,代码来源:interpolation_test.py
示例18: ShapeInverterCmdold
def ShapeInverterCmdold(base=None, corrective=None, name=None):
mc.undoInfo(openChunk=True)
if not base or not corrective:
sel = mc.ls(sl=True)
base, corrective = sel
shapes = mc.listRelatives(base, children=True, shapes=True)
for s in shapes:
if mc.getAttr("%s.intermediateObject" % s) and mc.listConnections("%s.worldMesh" % s, source=False):
origMesh = s
break
deformed = mc.polyPlane(ch=False)[0]
mc.connectAttr("%s.worldMesh" % origMesh, "%s.inMesh" % deformed)
mc.setAttr("%s.intermediateObject" % origMesh, 0)
mc.delete(deformed, ch=True)
mc.setAttr("%s.intermediateObject" % origMesh, 1)
if not name:
name = "%s_inverted#" % corrective
invertedShape = duplicateMesh(base, name=name)
deformer = mc.deformer(invertedShape, type="ShapeInverter")[0]
mc.ShapeInverterCmd(baseMesh=base, invertedShape=invertedShape, ShapeInverterdeformer=deformer, origMesh=deformed)
# correctiveShape = duplicateMesh(base,name=corrective+"_corrective#")
# mc.connectAttr('%s.outMesh' % getShape(correctiveShape), '%s.correctiveMesh' % deformer)
# transferMesh(corrective,[correctiveShape])
mc.connectAttr("%s.outMesh" % getShape(corrective), "%s.correctiveMesh" % deformer)
mc.setAttr("%s.activate" % deformer, True)
mc.delete(deformed)
bdingBx = mc.polyEvaluate(corrective, boundingBox=True)
xDifVal = bdingBx[0][1] - bdingBx[0][0]
# mc.move(xDifVal*1.10,correctiveShape,r=True,moveX=True)
mc.move(xDifVal * 2.20, invertedShape, r=True, moveX=True)
mc.undoInfo(closeChunk=True)
return invertedShape # ,correctiveShape
开发者ID:jonntd,项目名称:cvShapeInverter,代码行数:32,代码来源:ShapeInverterScript.py
示例19: create_table
def create_table():
# Create a table mesh that collides with nCloth
cmds.polyPlane(name = "table", w = TABLE_SIZE, h = TABLE_SIZE)
cmds.select(clear = True)
# table material settings
mel.eval('select -r table;')
mel.eval('shadingNode -asShader lambert;')
mel.eval('rename lambert2 "table_mat";')
mel.eval('sets -renderable true -noSurfaceShader true' + \
'-empty -name -table_matSG;')
mel.eval('connectAttr -f table_mat.outColor table_matSG.surfaceShader;')
mel.eval('setAttr "table_mat.color" -type double3 0 0 0;')
mel.eval('setAttr "table_mat.ambientColor" -type double3 0 0 0;')
mel.eval('select -r table ; sets -e -forceElement table_matSG;')
cmds.select("table")
mel.eval("makeCollideNCloth")
开发者ID:wenlongx,项目名称:Maya-Cloth-Simulation,代码行数:16,代码来源:main_backup.py
示例20: createDebugVisualizerPlane
def createDebugVisualizerPlane(plane, position = None, name = None):
if(plane is None):
return None
#TODO: for now this creates a plane that ends up affecting the scene history, so undo/redo actions end up recreating the plane
#figure out how to draw this plane without this happening
debugPlane = cmds.polyPlane(name = name if name else "debugPlane", width=100, height=100, axis=[plane.normal().x, plane.normal().y, plane.normal().z], constructionHistory=False)
cmds.toggle(debugPlane, state=True, template=True) #make plane unselectable and undeletable so users can't accidentally delete it and break things
createPos = om.MVector()
if(position is None):
if(plane.normal().x != 0):
#automatically compute a position where we find x for if y and z were 0
createPos = om.MVector(-plane.distance() / plane.normal().x, 0, 0)
elif(plane.normal().y != 0):
#automatically compute a position where we find y for if x and z were 0
createPos = om.MVector(0, -plane.distance() / plane.normal().y, 0)
elif(plane.normal().z != 0):
#automatically compute a position where we find z for if x and y were 0
createPos = om.MVector(0, 0, -plane.distance() / plane.normal().z)
else:
print("Invalid plane normal, all components are 0")
else:
createPos = position
cmds.xform(debugPlane, absolute=True, worldSpace=True, translation=[createPos.x, createPos.y, createPos.z])
return debugPlane
开发者ID:ill,项目名称:CoplanarJointOrient,代码行数:29,代码来源:CoplanarJointOrient.py
注:本文中的maya.cmds.polyPlane函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论