本文整理汇总了Python中pymel.core.polyCube函数的典型用法代码示例。如果您正苦于以下问题:Python polyCube函数的具体用法?Python polyCube怎么用?Python polyCube使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了polyCube函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: create_collider
def create_collider(flaps, radius):
'''
Create collision geometry for combined flaps.
:param flaps: Combined flaps geometry
:param radius: Radius of inner wheel allows us to estimate collider geo
'''
tx = flaps.boundingBox().width() * 0.5
ty = flaps.boundingBox().height() * 0.505 - radius
tz = radius * 1.08
tz2 = radius * 1.15
cubea, cubea_shape = pm.polyCube(width=0.2, height=0.05, depth=0.05)
cubeb, cubeb_shape = pm.polyCube(width=0.2, height=0.05, depth=0.05)
cubec, cubec_shape = pm.polyCube(width=0.2, height=0.05, depth=0.05)
cubed, cubed_shape = pm.polyCube(width=0.2, height=0.05, depth=0.05)
cubea.setTranslation([tx, ty, tz])
cubeb.setTranslation([-tx, ty, tz])
cubec.setTranslation([tx, -ty, -tz2])
cubed.setTranslation([-tx, -ty, -tz2])
merge_verts(cubea, 7, 5)
merge_verts(cubea, 6, 4)
merge_verts(cubeb, 7, 5)
merge_verts(cubeb, 6, 4)
merge_verts(cubec, 3, 1)
merge_verts(cubec, 2, 0)
merge_verts(cubed, 3, 1)
merge_verts(cubed, 2, 0)
collider = pm.polyUnite(
[cubea, cubeb, cubec, cubed],
ch=False,
mergeUVSets=True,
name=flaps.replace('geo', 'collider_geo')
)[0]
return collider
开发者ID:danbradham,项目名称:splitflap,代码行数:35,代码来源:utils.py
示例2: setUp
def setUp(self):
self.temp = tempfile.mkdtemp(prefix='referencesTest')
print "created temp dir: %s" % self.temp
# Refs:
# sphere.ma
# (no refs)
# cube.ma
# :sphere => sphere.ma
# cone.ma
# :cubeInCone => cube.ma
# :cubeInCone:sphere => sphere.ma
# master.ma
# :sphere1 => sphere.ma
# :sphere2 => sphere.ma
# :cube1 => cube.ma
# :cube1:sphere => sphere.ma
# :cone1 => cone.ma
# :cone1:cubeInCone => cube.ma
# :cone1:cubeInCone:sphere => sphere.ma
# create sphere file
print "sphere file"
# cmds.file(new=1, f=1)
pm.newFile(f=1)
sphere = pm.polySphere()
# We will use this to test failed ref edits...
pm.addAttr(sphere, ln='zombieAttr')
self.sphereFile = pm.saveAs( os.path.join( self.temp, 'sphere.ma' ), f=1 )
# create cube file
print "cube file"
pm.newFile(f=1)
pm.polyCube()
pm.createReference( self.sphereFile, namespace='sphere' )
pm.PyNode('sphere:pSphere1').attr('translateX').set(2)
self.cubeFile = pm.saveAs( os.path.join( self.temp, 'cube.ma' ), f=1 )
# create cone file
print "cone file"
pm.newFile(f=1)
pm.polyCone()
pm.createReference( self.cubeFile, namespace='cubeInCone' )
pm.PyNode('cubeInCone:pCube1').attr('translateZ').set(2)
pm.PyNode('cubeInCone:sphere:pSphere1').attr('translateZ').set(2)
self.coneFile = pm.saveAs( os.path.join( self.temp, 'cone.ma' ), f=1 )
print "master file"
pm.newFile(f=1)
self.sphereRef1 = pm.createReference( self.sphereFile, namespace='sphere1' )
pm.PyNode('sphere1:pSphere1').attr('translateY').set(2)
self.sphereRef2 = pm.createReference( self.sphereFile, namespace='sphere2' )
pm.PyNode('sphere2:pSphere1').attr('translateY').set(4)
self.cubeRef1 = pm.createReference( self.cubeFile, namespace='cube1' )
pm.PyNode('cube1:sphere:pSphere1').attr('translateY').set(6)
pm.PyNode('cube1:pCube1').attr('translateY').set(6)
self.coneRef1 = pm.createReference( self.coneFile, namespace='cone1' )
self.masterFile = pm.saveAs(os.path.join(self.temp, 'master.ma'), f=1)
开发者ID:assumptionsoup,项目名称:pymel,代码行数:58,代码来源:test_system.py
示例3: test_getPositions2
def test_getPositions2():
# Basic world position test
cube1 = pm.polyCube()[0]
cube2 = pm.polyCube()[0]
cube1.setParent(cube2)
cube2.t.set(1, 3, 4)
cube1.t.set(1, 2, 3)
mat = pm.dt.Matrix()
mat[3] = [2, 5, 7, 1]
foundMats = mmo.getNodePositions([cube1])
assert(flattenMat(foundMats[0]) == pytest.approx(flattenMat(mat)))
开发者ID:assumptionsoup,项目名称:guppy_animation_tools,代码行数:12,代码来源:test_move_my_objects.py
示例4: test_mainClass
def test_mainClass():
mm = mmo.MoveMyObjects()
cube1 = pm.polyCube()[0]
cube2 = pm.polyCube()[0]
cube2.t.set(1, 2, 3)
pm.select([cube1, cube2])
mm.savePositions()
cube2.t.set(0, 0, 0)
mm.applyPositions()
# Test state
assert(list(cube2.t.get()) == [1, 2, 3])
assert(len(mm.positions) == 2)
开发者ID:assumptionsoup,项目名称:guppy_animation_tools,代码行数:14,代码来源:test_move_my_objects.py
示例5: createProxyCube
def createProxyCube(self, targetJoint, count):
# Create the cube of that height
try:
height = self.jointSystem.lengths[count]
except IndexError:
height = self.jointSystem.lengths[count - 1]
cube = pm.polyCube(height=height, ch=False)[0]
cubeMeta = ProxyCube(part=targetJoint.part.get(), side=self.side, endSuffix="Geo")
cubeMeta.transferShape(cube)
cube = cubeMeta.pynode
cube.translateY.set(height * .5)
# Freeze Transform
libUtilities.freeze_transform(cube)
# reset the pivot to origin
cube.scalePivot.set([0, 0, 0])
cube.rotatePivot.set([0, 0, 0])
if self.flipProxyCube:
cube.attr(self.bendAxis).set(180)
libUtilities.freeze_rotation(cube)
cube.rotateOrder.set(self.rotateOrder)
# Snap the pivot of the cube to this cluster
# Snap the cube to joint
libUtilities.snap(cube, targetJoint)
libUtilities.skinGeo(cube, [targetJoint])
return cubeMeta
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:33,代码来源:parts.py
示例6: locatorGrid
def locatorGrid(width, height, depth, offset, centered=True):
'''Create a grid of locators to test upon
Args:
width (int): Width of the grid
height (int): Height of the grid
offset (float): Adds an offset multiplier to the locator positions
centered (bool): determines whether it's centered in world space
Returns (pm.PyNode): The top group of the locator grid
Usage: locatorGrid(5,5,5,2)
'''
if not pm.objExists('locatorGrid'):
grp=pm.group(em=True,n='locatorGrid')
for d in range(0,depth):
for w in range(0,width):
for h in range(0,height):
loc = pm.polyCube(w=.5, h=.5, d=.5, ch=0)[0]
pm.move(loc,(w*offset,h*offset,d*offset), rpr=True)
loc.setParent(grp)
if loc.getShape().type() == "locator":
loc.localScale.set(.2,.2,.2)
if centered:
pm.xform(grp, cp=1)
pm.move(grp, (0, 0, 0), rpr=1)
pm.makeIdentity(grp, apply=True, r=1,s=1,t=1)
return grp
开发者ID:AndresMWeber,项目名称:aw,代码行数:25,代码来源:aw_influenceGrid.py
示例7: _prep
def _prep(self,args):
basename=self.inputName.getText()
nparticle=pm.ls(sl=True)[0]
if not pm.objExists(self.inputBar.getText()):
pm.error ('GEO plane doesn\'t exist')
geo = pm.PyNode(self.inputBar.getText())
if not isinstance(nparticle.getShape(), pm.nt.NParticle):
pm.error('Your selection is not an nParticle object')
#create an instancer
tempCube=pm.polyCube(n='temp_iinst_GEO',w=.01,h=.01,d=.01,ch=0)
self.instancer=pm.PyNode(pm.particleInstancer(nparticle,name=(nparticle.name().replace('_NPARTICLE','_INSTANCER')),addObject=True,object=tempCube[0],cycleStep=1,cycleStepUnits='Frames',levelOfDetail='Geometry',rotationUnits='Degrees',rotationOrder='XYZ',position='worldPosition',rotation='rotPP',scale='scalePP',objectIndex='indexPP'))
pm.delete(tempCube)
#group the nparticle + instancer
group=pm.group(n=(nparticle.name().replace('_NPATICLE','_lodA_GRP')))
nparticle.setParent(group)
self.instancer.setParent(group)
#nCache itR
if not pm.objExists( nparticle.name().replace('_NPARTICLE','_NUCLEUS') ):
pm.error('Nucleus doesn\'t exist!')
nucleus = nparticle.name().replace('_NPARTICLE','_NUCLEUS')
#delete everything unnecessary that might cause issues
print geo, nucleus
print 'issue?'
pm.delete(geo, nucleus)
print 'issue?'
pm.select(nparticle)
mm.eval('performCreateNclothCache 1 \"add\";')
pm.confirmDialog(m='WARNING, DO NOT SAVE AFTER THIS STEP',t='DONT SAVE!')
开发者ID:AndresMWeber,项目名称:aw,代码行数:32,代码来源:aw_scatterParticle.py
示例8: createEmitter
def createEmitter(self, mesh, name="particleEmitter_msh"):
# Create boundingBox of the mesh
bbx = pm.polyEvaluate(mesh, b=True)
cube = pm.polyCube(
w=abs(bbx[0][1] - bbx[0][0]),
h=abs(bbx[1][1] - bbx[1][0]),
d=abs(bbx[2][1] - bbx[2][0]),
sx=1,
sy=1,
sz=1,
ax=(0, 1, 0),
cuv=4,
ch=0,
name=name,
)
cube = cube[0]
cube.setAttr("t", ((bbx[0][1] + bbx[0][0]) / 2, (bbx[1][1] + bbx[1][0]) / 2, (bbx[2][1] + bbx[2][0]) / 2))
# Keep only face 1 for emit
pm.delete([cube + ".f[2:6]", cube + ".f[0]"])
# Connection of mesh and the emitter
self.connectOriginaleMesh(mesh, cube)
# Move emitter in y in a percentage of area of face.
face = pm.PyNode(cube + ".f[1]")
area = face.getArea(space="world")
pm.select(cube)
y = pow(area, 0.1) * 100
pm.move(0, y, 0, r=1, os=1, wd=1)
return cube
开发者ID:nicolasboselli,项目名称:test,代码行数:31,代码来源:forestGenerator.py
示例9: test_bind_to_pyNode
def test_bind_to_pyNode(self):
ex = self.Example('cube', 45)
cmds.file(new=True, f=True)
cube, shape = pm.polyCube()
tester = ex & 'val' > bindings.bind() > (cube, 'tx')
tester()
assert cmds.getAttr('pCube1.tx') == 45
开发者ID:bob-white,项目名称:mGui,代码行数:7,代码来源:test_Bindings.py
示例10: test_pyattr_accessor
def test_pyattr_accessor(self):
cmds.file(new=True, f=True)
cube, shape = pm.polyCube()
ac = bindings.get_accessor(cube.rx)
assert isinstance(ac, bindings.PyAttributeAccessor)
ac2 = bindings.get_accessor(shape.width)
assert isinstance(ac2, bindings.PyAttributeAccessor)
开发者ID:bob-white,项目名称:mGui,代码行数:7,代码来源:test_Bindings.py
示例11: test_pynode_accessor
def test_pynode_accessor(self):
cmds.file(new=True, f=True)
cube, shape = pm.polyCube()
ac = bindings.get_accessor(cube, 'rx')
assert isinstance(ac, bindings.PyNodeAccessor)
ac2 = bindings.get_accessor(shape, 'width')
assert isinstance(ac2, bindings.PyNodeAccessor)
开发者ID:bob-white,项目名称:mGui,代码行数:7,代码来源:test_Bindings.py
示例12: _attachRenderProxy
def _attachRenderProxy( self, objects ):
path = self.fileInput.text()
proxy = []
if os.path.isdir(path):
for file in glob.glob(path+"/*.mib"):
bipx = pm.createNode('mip_binaryproxy',n=file.split('/').pop().split('.')[0]+'_BINARYPROXY')
bipx.object_filename.set(file)
proxy.append(bipx)
else:
bipx = pm.createNode('mip_binaryproxy',n=path.split('/').pop().split('.')[0]+'_BINARYPROXY')
bipx.object_filename.set(path)
proxy.append( bipx )
if not objects:
for prx in proxy:
objects.append(pm.polyCube())
for arg in objects:
if len(proxy)==0: pm.error('No proxies found in folder. Womp Womp.')
elif len(proxy)>1:
print 'more than one proxy'
#turn the lo geometry shader on
arg.miExportGeoShader.set(1)
#connect the proxy to the lo's geo shader
proxy[random.randint(0,len(proxy)-1)].outValue.connect(arg.miGeoShader, f=True)
else:
print 'one proxy'
#turn the lo geometry shader on
arg.miExportGeoShader.set(1)
#connect the proxy to the lo's geo shader
proxy.pop().outValue.connect(arg.miGeoShader, f=True)
开发者ID:creuter23,项目名称:tools,代码行数:32,代码来源:aw_binaryProxy.py
示例13: test_applyOneMatrix
def test_applyOneMatrix():
cube, shape = pm.polyCube()
# Pass through identity matrix
mat = pm.dt.Matrix()
mmo.applyNodePositions([mat], [cube])
cubeMat = flattenMat(cube.getMatrix(worldSpace=True))
assert(cubeMat == pytest.approx(flattenMat(mat)))
# Reset to identity
cube.t.set((1, 2, 3))
mmo.applyNodePositions([mat], [cube])
cubeMat = flattenMat(cube.getMatrix(worldSpace=True))
assert(cubeMat == pytest.approx(flattenMat(mat)))
# Arbitrary matrix.
mat = pm.dt.Matrix([
[0.664463024389, 0.664463024389, -0.342020143326, 0.0],
[-0.386220403522, 0.697130037317, 0.604022773555, 0.0],
[0.639783314196, -0.269255641148, 0.719846310393, 0.0],
[15.5773616478, 17.4065855678, 15.7988353267, 1.0]])
mmo.applyNodePositions([mat], [cube])
cubeMat = flattenMat(cube.getMatrix(worldSpace=True))
assert(cubeMat == pytest.approx(flattenMat(mat)))
开发者ID:assumptionsoup,项目名称:guppy_animation_tools,代码行数:25,代码来源:test_move_my_objects.py
示例14: create_system
def create_system(self):
shader = pm.shadingNode('transmat', asShader= True)
volume = pm.polyCube(name= 'fog_volume', width=40,
height=40, depth=40)[0]
pm.hyperShade(volume, assign= shader)
parti_volume = pm.mel.eval('mrCreateCustomNode -asShader "" parti_volume;')
pm.setAttr('%s.scatter' % (parti_volume), 1,1,1, type= 'double3' )
pm.setAttr('%s.min_step_len' % (parti_volume), .03)
pm.setAttr('%s.max_step_len' % (parti_volume), .2)
pm.connectAttr('%s.outValue' % (parti_volume),
'%sSG.miVolumeShader' % (shader), force= True)
light_node = pm.shadingNode('%s' % (self.light_types[value]),
asLight= True)
light_node.translate.set(0,15,0)
light_node.rotate.set(-90,0,0)
light = pm.rename(light_node, 'fog_light')
pm.connectAttr('%s.message' % (light.getShape()),
'%s.lights[0]' % (parti_volume), force= True)
if self.checkBox.getValue() == 1:
# mrCreateCustomNode -asUtility "" physical_light;
# // Result: Connected physical_light1.message to fog_lightShape.mentalRayControls.miLightShader. //
phys_light = pm.mel.eval('mrCreateCustomNode -asUtility "" physical_light;')
pm.connectAttr('%s.message' % (phys_light),
'%s.mentalRayControls.miLightShader' % (light.getShape()))
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:32,代码来源:light_rig.py
示例15: setUp
def setUp(self):
self.parentNode, self.parentNodeName = pm.polyCube()
self.coreNode = NodeMock()
self.source = NodeMock()
self.standIn = StandIn(
coreNode=self.coreNode,
source=self.source,
)
开发者ID:campbellwmorgan,项目名称:charactercrowd,代码行数:8,代码来源:test_standin.py
示例16: boxHull
def boxHull(self):
sel = pm.ls(sl=True, fl=True)
bb, cnt, transform = self._get_bounds(sel)
hull = pm.polyCube(w=bb.width(), h=bb.height(), d=bb.depth(), n='UCX_{0}_01'.format(transform))
hull[0].setTranslation(cnt)
sg = pm.PyNode('initialShadingGroup')
sg.remove(hull[0].getShape())
hull[0].setParent(transform)
开发者ID:cmcpasserby,项目名称:pbUDK,代码行数:8,代码来源:pbUDK.py
示例17: setUp
def setUp(self):
self.cube, self.cubeShape = pm.polyCube(
h=20,
d=10,
w=5,
n="srcCube"
)
self.gen = BoxGenerator(self.cube)
开发者ID:campbellwmorgan,项目名称:charactercrowd,代码行数:8,代码来源:test_boxGenerator.py
示例18: test_relativeMove
def test_relativeMove(self):
cube = pm.polyCube()[0]
pm.move(1,0,0, xyz=True, r=1)
self.assertEqual(cube.getTranslation(), dt.Vector(1,0,0))
pm.move(0,1,0, xyz=True, r=1)
self.assertEqual(cube.getTranslation(), dt.Vector(1,1,0))
pm.move(0,0,1, xyz=True, r=1)
self.assertEqual(cube.getTranslation(), dt.Vector(1,1,1))
开发者ID:0xb1dd1e,项目名称:PipelineConstructionSet,代码行数:8,代码来源:test_general.py
示例19: testDelete
def testDelete(self):
self.standIn.name = 'test'
self.coreNode.children = ['test']
self.source.children = ['test']
self.standIn.node, nodeName = pm.polyCube()
self.standIn.delete()
eq_(len(self.coreNode.children),0)
eq_(len(self.source.children),0)
eq_(pm.objExists(nodeName), False)
开发者ID:campbellwmorgan,项目名称:charactercrowd,代码行数:9,代码来源:test_standin.py
示例20: createJointGeo
def createJointGeo( joints=[], constraint=False, parent=True, color=True ):
if not joints:
joints = pm.selected(type='joint')
GEOs = []
for jnt in joints:
jnt = pm.PyNode(jnt)
child = jnt.getChildren( type='joint' )
if not child: continue # 자식 조인트가 없으면 넘어감
# 지오메트리 생성
geo = pm.polyCube(ch=False)[0]
#
geo.setParent(jnt)
geo.t.set( child[0].t.get() * 0.5 )
geo.r.set( 0,0,0 )
# 스케일 조정
tr = child[0].t.get()
abtr = [ abs(val) for val in tr ]
radius = jnt.radius.get() * 2
sx = abtr[0] if abtr[0] > 0.001 else radius
sy = abtr[1] if abtr[1] > 0.001 else radius
sz = abtr[2] if abtr[2] > 0.001 else radius
geo.s.set( sx,sy,sz )
# 이름 변경
geo.rename( jnt.name()+'_geo' )
# 지오메트리 pivot 옮김
copyPivot( jnt, geo )
# transform 초기화
pm.makeIdentity(geo, t=True, r=True, s=True, apply=True)
if color:
assignColorAxisShader( geo.f[4], 'x' )
assignColorAxisShader( geo.f[1], 'y' )
assignColorAxisShader( geo.f[0], 'z' )
if not parent:
geo.setParent(w=True)
# 구속
if constraint:
geo.setParent(w=True)
pm.parentConstraint(jnt,geo)
pm.scaleConstraint(jnt,geo)
GEOs.append(geo)
return GEOs
开发者ID:kyuhoChoi,项目名称:mayaTools,代码行数:56,代码来源:joint.py
注:本文中的pymel.core.polyCube函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论