• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.polySphere函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.polySphere函数的典型用法代码示例。如果您正苦于以下问题:Python polySphere函数的具体用法?Python polySphere怎么用?Python polySphere使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了polySphere函数的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: test_assertConstrained

 def test_assertConstrained(self):
     a = cmds.polySphere()[0]
     b = cmds.polySphere()[0]
     
     temp = cmds.parentConstraint(a,b)
     self.assertTrue( self.lib.assertConstrained(a, b, type='parent') )
     cmds.delete(temp)
     
     temp = cmds.aimConstraint(a,b)
     self.assertTrue( self.lib.assertConstrained(a, b, type='aim') )
     cmds.delete(temp)        
     
     temp = cmds.pointConstraint(a,b)
     self.assertTrue( self.lib.assertConstrained(a, b, type='point') )
     cmds.delete(temp)  
     
     temp = cmds.orientConstraint(a,b)
     self.assertTrue( self.lib.assertConstrained(a,b,type='orient') )
     cmds.delete(temp)      
     
     temp = cmds.scaleConstraint(a,b)
     self.assertTrue( self.lib.assertConstrained(a,b,type='scale') )
     cmds.delete(temp)    
     
     temp = cmds.geometryConstraint(a,b)
     self.assertTrue( self.lib.assertConstrained(a,b,type='geometry') )
     cmds.delete(temp)       
     
     try:
         self.lib.assertConstrained(a,b,type='parent')
     except AssertionError:
         pass
开发者ID:Mauricio3000,项目名称:MSH_Maya,代码行数:32,代码来源:test_UnittestLib.py


示例3: HI

	def HI(self):
            if self.checkSphere.isChecked():
                cmds.polySphere()
            if self.checkTorus.isChecked():
                cmds.polyTorus()
            if self.checkCube.isChecked():
                cmds.polyCube()
            pass
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:8,代码来源:myMakeStuff.py


示例4: _setup_plugin

    def _setup_plugin(self):
        collider = cmds.polySphere()[0]
        target = cmds.polySphere(subdivisionsAxis=20,
                                 subdivisionsHeight=20)[0]
#         target = cmds.polyCube()
        plugin = cmds.deformer(target, type=self.name)[0]
        cmds.connectAttr('%s.worldInverseMatrix' % collider,
                         '%s.volumeInverseMatrix' % plugin)
开发者ID:jonntd,项目名称:Public,代码行数:8,代码来源:goe_volumenode.py


示例5: snapToMeshTest

def snapToMeshTest():
    inMeshT = cmds.polySphere()
    inMesh = cmds.listRelatives(inMeshT[0], fullPath = True, shapes = True)
    print inMesh
    outObj = cmds.polySphere(radius = 0.1)
    ctrl = cmds.circle(r=0.5, n="cn_arm_fk_ctrl");
    cmds.move(1,0,0,ctrl)
    snapToMesh(inMesh = inMesh[0], outObj = outObj[0], ctrlObj=ctrl[0])
开发者ID:jbrodskytd,项目名称:anomalia,代码行数:8,代码来源:snapToMesh.py


示例6: createRig

    def createRig(self):
        # Create a Cube for test cases
        mc.polySphere(name='mySphere')
        objCenter = mc.objectCenter('mySphere', l=True)

        # Get the bounding box for the selected ojbject
        XYZ = mc.xform('mySphere', bb=True, q=True)
        rad = XYZ[3] / 2 * self.settings.radius
        strltPos = self.settings.lightPos
        lightP = 0.0

        if strltPos == "High":
            lightP = 5.0
        elif strltPos == "Low":
            lightP = -5.0
        else:
            lightP = 0.0

        # Create a circle to place three point lights
        mc.circle(n='curveLights', nr=(0, 1, 0), c=(0, 0, 0), sections=9, radius=rad)

        # Create lights in three positions on the curve
        loc = mc.pointOnCurve('curveLights', pr=0.0, p=True)
        #_item = mc.spotLight(name='FillLight', coneAngle=45)
        _item = self.createLight(self.fillLight, "FillLight")
        mc.move(loc[0], loc[1]+lightP, loc[2], _item, ls=True)

        loc = mc.pointOnCurve('curveLights', pr=3.0, p=True)
        #_item = mc.spotLight(name='KeyLight', coneAngle=45)
        _item = self.createLight(self.keyLight, "KeyLight")
        mc.move(loc[0], loc[1]+lightP, loc[2], _item, ls=True)

        loc = mc.pointOnCurve('curveLights', pr=6.0, p=True)
        #_item = mc.spotLight(name='RimLight', coneAngle=45)
        _item = self.createLight(self.rimLight, "RimLight")
        mc.move(loc[0], loc[1]+lightP, loc[2], _item, ls=True)

        # Create space locator and aimConstraints
        mc.spaceLocator(n='fillLocator', p=(objCenter[0], objCenter[1], objCenter[2]))
        mc.aimConstraint('fillLocator', 'FillLight', aimVector=(0.0, 0.0, -1.0))
        mc.parent('fillLocator', 'curveLights', relative=True)

        mc.spaceLocator(n='keyLocator', p=(objCenter[0], objCenter[1], objCenter[2]))
        mc.aimConstraint('keyLocator', 'KeyLight', aimVector=(0.0, 0.0, -1.0))
        mc.parent('keyLocator', 'curveLights', relative=True)

        mc.spaceLocator(n='rimLocator', p=(objCenter[0], objCenter[1], objCenter[2]))
        mc.aimConstraint('rimLocator', 'RimLight', aimVector=(0.0, 0.0, -1.0))
        mc.parent('rimLocator', 'curveLights', relative=True)

        # Create lights main locator
        mc.spaceLocator(n='lightsMainLocator', p=(objCenter[0], objCenter[1], objCenter[2]))
        mc.parent('FillLight', 'lightsMainLocator', relative=True)
        mc.parent('KeyLight', 'lightsMainLocator', relative=True)
        mc.parent('RimLight', 'lightsMainLocator', relative=True)

        # Create Main Group for the entire light rig
        mc.group('curveLights', 'lightsMainLocator', n='LightRigGroup')
开发者ID:lbmk27,项目名称:maya_python,代码行数:58,代码来源:LightRigTool.py


示例7: diamondLattice

def diamondLattice(dimX=1, dimY=1, dimZ=1, radiusBall = 0.1, radiusStick = 0.02, latticeConst = 1.0, sticks = True):
  
    for x in xrange (0, dimX + 1):
        for y in xrange (0, dimY + 1):
            for z in xrange (0, dimZ + 1):

                scBalls(x, y, z, radiusBall, latticeConst)
                
                #coordinates for translation of spheres to lattice points
                xCoord = x * latticeConst
                yCoord = y * latticeConst
                zCoord = z * latticeConst
                
                xCoordFace = (x + 0.5) * latticeConst
                yCoordFace = (y + 0.5) * latticeConst
                zCoordFace = (z + 0.5) * latticeConst
                
                xCoordDia25 = (x + 0.25) * latticeConst
                yCoordDia25 = (y + 0.25) * latticeConst
                zCoordDia25 = (z + 0.25) * latticeConst
                
                xCoordDia75 = (x + 0.75) * latticeConst
                yCoordDia75 = (y + 0.75) * latticeConst
                zCoordDia75 = (z + 0.75) * latticeConst

                faceTranslations = [(xCoordFace, yCoordFace, zCoord), (xCoord, yCoordFace, zCoordFace), (xCoordFace, yCoord, zCoordFace)]
                
                nameSuffix = str(x) + str(y) + str(z)
                suffixDimChar = ['x', 'y', 'z']

                #fcc atoms
                for i in xrange(0, 3):
                    if suffixDimChar[i] == 'x' and x != dimX and y!= dimY or suffixDimChar[i] == 'y' and z != dimZ and y != dimY or suffixDimChar[i] == 'z' and x != dimX and z!=dimZ:
                        #facecentered balls
                        nameFaceBall = 'faceBall' + suffixDimChar[i] + nameSuffix
                        cmds.polySphere(sx=10, sy=10, r=radiusBall, n=nameFaceBall)
                        cmds.setAttr(str(nameFaceBall)+'.translate', faceTranslations[i][0], faceTranslations[i][1], faceTranslations[i][2])
                

                diamondTranslations = [(xCoordDia25, yCoordDia25, zCoordDia25), (xCoordDia75, yCoordDia75, zCoordDia25), (xCoordDia25, yCoordDia75, zCoordDia75), (xCoordDia75, yCoordDia25, zCoordDia75)]
                
                for i in xrange(0, 4):
                    if x != dimX and y != dimY and z != dimZ:
                        # 1/4 balls
                        nameDiaBall = 'diaBall' + str(i) + nameSuffix
                        cmds.polySphere(sx=10, sy=10, r=radiusBall, n=nameDiaBall)
                        cmds.setAttr(str(nameDiaBall)+'.translate', diamondTranslations[i][0], diamondTranslations[i][1], diamondTranslations[i][2])
                        
                        # bonds between lattice points
                        if sticks == True:
                            axes = [(-1, -1, -1), (1, 1, -1), (-1, 1, 1), (1, -1, 1)]
                            heightDia = math.sqrt(3) * 0.25 * latticeConst
                        
                            for j in xrange(0, 4):
                                #diamond sticks                
                                nameDiaStick = 'diaStick' + str(i) + str(j) + '_' + nameSuffix
                                cmds.polyCylinder(r=radiusStick, h=heightDia, sx=5, n=nameDiaStick, axis=axes[i])
                                cmds.setAttr(str(nameDiaStick)+'.translate', diamondTranslations[j][0] + 0.125*axes[i][0], diamondTranslations[j][1] + 0.125*axes[i][1], diamondTranslations[j][2] + 0.125*axes[i][2])
开发者ID:julae,项目名称:maya-crystals,代码行数:58,代码来源:crystalLattice.py


示例8: testBasicObjectSetMain

def testBasicObjectSetMain():
	failures = 0

	# Test #1
	#
	# - Create a sphere and a cube.
	# - Create a custom MPxObjectSet and add the sphere and cube to the set.
	# - Delete the sphere.
	# - Ensure the set is still present.
	# - Delete the cube.
	# - Ensure the set is deleted.
	#
	cmds.file(f=True, new=True)
	sphere = cmds.polySphere(r=1, sx=20, sy=20, ax=(0, 1, 0), tx=1, ch=1)
	cube = cmds.polyCube(w=1, h=1, d=1, sx=1, sy=1, sz=1, ax=(0, 1, 0), tx=1, ch=1)
	cmds.select(sphere[0], cube[0])
	objSet = maya.mel.eval("spBasicObjectSetTest")

	cmds.delete(sphere[0])
	if not cmds.objExists(objSet):
		failures += 1

	cmds.delete(cube[0])
	if cmds.objExists(objSet):
		failures += 1

	if failures > 0:
		print "testBasicObjectSetMain (Test #1): FAILED\n"
		failures = 0

	# Test #2
	#
	# - Create a sphere and a cube.
	# - Create a custom MPxObjectSet and add the sphere to the set.
	# - Connect the cube.message -> set.usedBy.
	# - Delete the sphere.
	# - Ensure the set is still present.
	#
	cmds.file(f=True, new=True)
	sphere = cmds.polySphere(r=1, sx=20, sy=20, ax=(0, 1, 0), tx=1, ch=1)
	cube = cmds.polyCube(w=1, h=1, d=1, sx=1, sy=1, sz=1, ax=(0, 1, 0), tx=1, ch=1)
	cmds.select(sphere[0])
	objSet = maya.mel.eval("spBasicObjectSetTest")
	cmds.connectAttr("%s.message" % cube[0], "%s.usedBy[0]" % objSet)
	cmds.delete(sphere[0])
	if not cmds.objExists(objSet):
		failures += 1

	if failures > 0:
		print "testBasicObjectSetMain (Test #1): FAILED\n"

	# Clamp failures to 1.
	#
	if failures > 1:
		failures = 1

	return failures
开发者ID:DimondTheCat,项目名称:xray,代码行数:57,代码来源:basicObjectSetTest.py


示例9: scBalls

def scBalls(x, y, z, radiusBall, latticeConst):
        xCoord = x*latticeConst
        yCoord = y*latticeConst
        zCoord = z*latticeConst
        nameSuffix = str(x) + str(y) + str(z)
        
        nameBall = 'ball' + nameSuffix
        cmds.polySphere(sx=10, sy=10, r=radiusBall, n=nameBall)
        cmds.setAttr(str(nameBall)+'.translate', xCoord, yCoord, zCoord)
开发者ID:julae,项目名称:maya-crystals,代码行数:9,代码来源:crystalLattice.py


示例10: 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


示例11: RandomSphere

def RandomSphere():
    cmds.polySphere(r = random.randrange(1,50), sx=4, sy=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))
开发者ID:njculpin,项目名称:maya_scripts,代码行数:10,代码来源:make_random_shape.py


示例12: lgtSpheresCreator

def lgtSpheresCreator():
    #check render engine
    renderEngine = mc.getAttr("defaultRenderGlobals.ren")

    #create locator
    loc = mc.spaceLocator(n = "Lgt_Spheres_"+str(renderEngine), p = (0,0,0))

    #create chromn ball
    chromnBallName = mc.polySphere(n = loc[0]+"_chromnBall")
    mc.delete(chromnBallName,ch = True)
    chromnBallShape = mc.listRelatives(chromnBallName[0], s = True)
    mc.setAttr(chromnBallShape[0]+'.castsShadows', 0)
    mc.setAttr(chromnBallShape[0]+'.receiveShadows', 0)
    mc.setAttr(chromnBallShape[0]+'.visibleInReflections', 0)
    mc.setAttr(chromnBallShape[0]+'.visibleInRefractions', 0)
    mc.setAttr(chromnBallName[0]+'.translateY', 7)
    mc.parent(chromnBallName[0], loc[0], relative = True)
    chromnBall = mc.ls(chromnBallName[0], l = True)

    #create gray ball
    grayBallName = mc.polySphere(n = loc[0]+"_grayBall")
    mc.delete(grayBallName,ch = True)
    grayBallShape = mc.listRelatives(grayBallName[0], s = True)
    mc.setAttr(grayBallShape[0]+'.castsShadows', 0)
    mc.setAttr(grayBallShape[0]+'.receiveShadows', 0)
    mc.setAttr(grayBallShape[0]+'.visibleInReflections', 0)
    mc.setAttr(grayBallShape[0]+'.visibleInRefractions', 0)
    mc.setAttr(grayBallName[0]+'.translateY', 4.5)
    mc.parent(grayBallName[0], loc[0], relative = True)
    grayBall = mc.ls(grayBallName[0], l = True)

    #create white ball
    whiteBallName = mc.polySphere(n = loc[0]+"_whiteBall")
    mc.delete(whiteBallName,ch = True)
    whiteBallShape = mc.listRelatives(whiteBallName[0], s = True)
    mc.setAttr(whiteBallShape[0]+'.castsShadows', 0)
    mc.setAttr(whiteBallShape[0]+'.receiveShadows', 0)
    mc.setAttr(whiteBallShape[0]+'.visibleInReflections', 0)
    mc.setAttr(whiteBallShape[0]+'.visibleInRefractions', 0)
    mc.setAttr(whiteBallName[0]+'.translateY', 2)
    mc.parent(whiteBallName[0], loc[0], relative = True)
    whiteBall = mc.ls(whiteBallName[0], l = True)
    
    #create and assign shaders by render engine 
    if renderEngine == "vray":
        assignVrayShaders(chromnBall,grayBall,whiteBall)
        mc.select(loc, r=True)
    elif renderEngine == "arnold":
        assignArnoldShaders(chromnBall,grayBall,whiteBall)
        mc.select(loc, r=True)
    else:
        assignMayaShaders(chromnBall,grayBall,whiteBall)
        mc.select(loc, r=True)
开发者ID:jackieliao67,项目名称:lightingTools,代码行数:53,代码来源:lgtSpheresCreator.py


示例13: createStaticSolarSystem

def createStaticSolarSystem():
    MayaCmds.file(new=True, force=True)

    moon = MayaCmds.polySphere(radius=0.5, name="moon")[0]
    MayaCmds.move(-5, 0.0, 0.0, r=1)
    earth = MayaCmds.polySphere(radius=2, name="earth")[0]
    MayaCmds.select(moon, earth)
    MayaCmds.group(name="group1")

    MayaCmds.polySphere(radius=5, name="sun")[0]
    MayaCmds.move(25, 0.0, 0.0, r=1)
    MayaCmds.group(name="group2")
开发者ID:keithbcg,项目名称:alembic,代码行数:12,代码来源:AbcImport_connect_test.py


示例14: initializeBalloon

def initializeBalloon(initRadius):
	mc.polySphere(sx = 12, sy = 8, n = "balloonTemp", r = initRadius)
	mc.rename( "polySphere1", "balloonTempHistory")
	mc.polySoftEdge( a = 180 )
	mc.lattice( n = 'balloon', cp = True, dv = (2, 4, 2), objectCentered = True,  ldv = (2, 3, 2), outsideLattice = True )
	mc.hide()
	mc.select('balloonTemp.vtx[84]', r=True)
	mc.ChamferVertex()
	mc.rename( "polyChamfer1", "tempChamfer" )
	mc.setAttr( 'tempChamfer.width', .1 )
	mc.delete( 'balloonTemp.f[72]' )
	return
开发者ID:radvfx,项目名称:py,代码行数:12,代码来源:jimboBalloon.py


示例15: createCore

 def createCore(self):
     ''' This method creates the core for flower. '''
     
     mc.polySphere( ax=(0, 1, 0) )
     self.currentCore = mc.ls( sl=True )
     mc.scale( 1, 0.5, 1 )
     mc.move( 0, 0.2, 0 )
     
     # delete history
     maya.mel.eval( "DeleteHistory" )
     
     mc.select( clear=True )
     
     return self.currentCore
开发者ID:remusvrm,项目名称:plugins,代码行数:14,代码来源:Flower_v03.py


示例16: createCollisionSphereGuide

 def createCollisionSphereGuide(self, name):
     shpere = cmds.polySphere(name=n_collisionSphere, sx=6, sy=6)
     cmds.polyColorPerVertex(shpere[0],  rgb=(0.75,0.75,0))
     cmds.polyColorPerVertex(shpere[0], colorDisplayOption=1)
     self.setAttr(shpere[0],'overrideEnabled', 1)
     self.setAttr(shpere[0],'overrideDisplayType', 2)
     return shpere
开发者ID:KiyoteruOgawa,项目名称:pw_matrix_collision_rig,代码行数:7,代码来源:matrix_collision_rig.py


示例17: createControl

        def createControl(lid, tz):
            locator1 = mc.spaceLocator(p = (0, 0, 0), n = '%s_locator%d' % (light, lid))[0]
            mc.parent(locator1, decay_grp)
            locator1 = "|%s|%s" % (decay_grp, locator1)
            mc.setAttr("%s.translateX" % locator1, lock = True)
            mc.setAttr("%s.translateY" % locator1, lock = True)
            mc.setAttr("%s.translateZ" % locator1, tz)

            sphere = mc.polySphere(r = 1, sx = 20, sy = 20, ax = (0, 1, 0), cuv = 0, ch = 0, n = '%s_sphere%d' % (light, lid))[0]
            mc.parent(sphere, decay_grp)
            sphere = "|%s|%s" % (decay_grp, sphere)
            
            # mc.pointConstraint(light, sphere, w = 1)
            mc.setAttr("%s.overrideEnabled" % sphere, 1)
            mc.setAttr("%s.overrideDisplayType" % sphere, 1)

            decomM1 = mc.createNode("decomposeMatrix")
            mc.connectAttr("%s.worldMatrix[0]" % light, "%s.inputMatrix" % decomM1, f = True)
            decomM2 = mc.createNode("decomposeMatrix")
            mc.connectAttr("%s.worldMatrix[0]" % locator1, "%s.inputMatrix" % decomM2, f = True)

            dis = mc.createNode("distanceBetween")
            mc.connectAttr("%s.outputTranslate" % decomM1, "%s.point1" % dis, f = True)
            mc.connectAttr("%s.outputTranslate" % decomM2, "%s.point2" % dis, f = True)
            mc.connectAttr("%s.distance" % dis, "%s.scaleX" % sphere, f = True)
            mc.connectAttr("%s.distance" % dis, "%s.scaleY" % sphere, f = True)
            mc.connectAttr("%s.distance" % dis, "%s.scaleZ" % sphere, f = True)

            return dis
开发者ID:akoon,项目名称:OldPipeline,代码行数:29,代码来源:light.py


示例18: makeTree

def makeTree(shaders):
    '''
    Creates a tree.
    
    shaders: A list of shaders for the tree crown.
    On exit: A tree has been modeled, and is returned as a tuple 
             containing the object name and the node name. Some of the
             variables are chosen randomly to create different results.
    '''
    height = random.uniform(0.3,1.5)
    trunk = cmds.polyCylinder(name = "trunk", h = height, r = 0.07)
    cmds.sets(trunk[0], edit=True, forceElement="trunkMaterialGroup")
    cmds.xform(trunk, translation = (0,height/2.0 + 0.2,0))
    crown = cmds.polySphere(name = "crown", r = 0.5)
    cmds.xform(crown, translation = (0,height + 0.6,0))
    cmds.softSelect(sse = True, ssd = 0.86)
    cmds.select(crown[0] + ".vtx[381]")
    translation = random.uniform(0.3,1.5)
    cmds.move(translation, y = True, r = True)
    cmds.softSelect(sse = False)
    shader = random.choice(shaders)
    scale_ = random.uniform(0.7,1.8)
    cmds.select(crown)
    cmds.scale(scale_, scale_, scale_, pivot = (0,height,0))
    cmds.sets(crown[0], edit=True, forceElement= shader[1])
    tree = cmds.polyUnite(trunk[0],crown[0])
    cmds.delete(tree[0], ch = True)
    return tree
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:28,代码来源:park.py


示例19: sphereCtl

def sphereCtl( name, functArgs ):
        J=[]
        ctl = Lib.getFirst(cmds.polySphere( n = (name + "_CTL"), r= functArgs["size"], sx= 1, sy= 1, ax= [0, 1, 0], ch= 1))
        grp = cmds.group( ctl, n = (name + "Ctl_GRP"))
        J.append(ctl)
        J.append(grp)
        return J
开发者ID:jwnwilson,项目名称:nw_rig,代码行数:7,代码来源:Control.py


示例20: generateCollision

def generateCollision(mode="sphere"):
    
    selected = cmds.ls(sl=True)
    
    if not selected:
        logging.error("Please Select Something")
        return
    
    xmin, ymin, zmin, xmax, ymax, zmax = cmds.xform(selected[0], q=True, bb=True) # give 6 values 
    
    width = abs(xmax - xmin)
    height = abs(ymax - ymin)
    depth = abs(zmax - zmin)
    
    name = selected[0] + "_COL" # new name
    
    if (mode == "box"):
        mesh = cmds.polyCube(w=width, h=height, d=depth, n=name)[0]
        
    if (mode == "sphere"):
        radius = max([width, height, depth])/2
        mesh = cmds.polySphere(r=radius, sx=10, sy=10,n=name)
        
    if (mode == "cylinder"):
        radius = max([width,depth])/2
        mesh = cmds.polyCylinder(r=radius, h=height, n=name, sc=1, sx=12, sy=1, sz=1)
    
    xPos = xmax - width/2
    yPos = ymax - height/2
    zPos = zmax - depth/2
    
    cmds.xform(mesh, ws=True, t=[xPos,yPos,zPos])
开发者ID:orekamenpe,项目名称:maya-scripts,代码行数:32,代码来源:generateCollision.py



注:本文中的maya.cmds.polySphere函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.polyUVSet函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.polySelectConstraint函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap