当前位置: 首页>>代码示例>>Python>>正文


Python cmds.sphere函数代码示例

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


在下文中一共展示了sphere函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: joint

def joint(side, lowerJoint, upperJoint, useSphere=0, sharedUpper=0, sharedLower=0, show=1, heightScale=1):
    name = lowerJoint + "_" + upperJoint

    upperName = "SKEL_"
    if sharedUpper == 0:
        upperName += side + "_"
    upperName += upperJoint

    lowerName = "SKEL_"
    if sharedLower == 0:
        lowerName += side + "_"
    lowerName += lowerJoint

    print name
    cmds.spaceLocator(name="%s_%s" % (side, name))
    cmds.pointConstraint(lowerName, "%s_%s" % (side, name))
    cmds.pointConstraint(upperName, "%s_%s" % (side, name))
    cmds.aimConstraint(upperName, "%s_%s" % (side, name))
    if useSphere:
        cmds.sphere(name="%s_%s_C" % (side, name), radius=1)
    else:
        cmds.cylinder(name="%s_%s_C" % (side, name), radius=0.5, heightRatio=6 * heightScale)

    cmds.setAttr("%s_%s_C.doubleSided" % (side, name), 0)
    if show == 0:
        cmds.setAttr("%s_%s_C.primaryVisibility" % (side, name), 0)

        # cmds.rotate( 0, 0, 90, '%s_FOREARM_C' % (side) )
        # cmds.makeIdentity( '%s_FOREARM_C' % (side), apply = 1, rotate = 1 )
    cmds.select("%s_%s" % (side, name), "%s_%s_C" % (side, name))
    cmds.parentConstraint()
    return
开发者ID:torbensko,项目名称:Kinect-to-Maya-motion-capture,代码行数:32,代码来源:mayaKinectAutoRig.py

示例2: newGrp

def newGrp(name):
    #Create a clean group
    try:
        cmds.select(name)
    except:
        cmds.sphere(n="temp")
        cmds.group("temp",n = name,world=True)
        cmds.delete("temp")
开发者ID:davidwilliamsDK,项目名称:maya,代码行数:8,代码来源:dsCamClean.py

示例3: testStaticNurbsSurfacePropReadWrite

 def testStaticNurbsSurfacePropReadWrite(self):
     nodeName = 'nSphere'
     shapeName = 'nSphereShape'
     MayaCmds.sphere(name=nodeName)
     self.setProps(shapeName)
     self.__files.append(util.expandFileName('staticPropNurbs.abc'))
     MayaCmds.AbcExport(j='-atp SPT_ -root %s -file %s' % (nodeName, self.__files[-1]))
     self.verifyProps(shapeName, self.__files[-1])
开发者ID:GameFusion,项目名称:alembic,代码行数:8,代码来源:staticProp_test.py

示例4: create_world_button

 def create_world_button( self, *args  ):
     if( cmds.objExists( "OurSampleWorld" ) ):
         return 0
     else:
         cmds.sphere( r=10, sections=40, spans=30, name="OurSampleWorld" )
         cmds.setAttr( "OurSampleWorld.scale", 9.599, 9.599, 9.599 )
         cmds.makeIdentity( apply=True, t=1, r=1, s=1 )
         self.wbbox = cmds.exactWorldBoundingBox( "OurSampleWorld" )
         cmds.move((self.wbbox[0] + self.wbbox[3])/2, self.wbbox[4], (self.wbbox[2] + self.wbbox[5])/2, "OurSampleWorld.scalePivot", "OurSampleWorld.rotatePivot", absolute=True)
         cmds.move( 0, 0, 0, "OurSampleWorld", rpr=True )
         cmds.connectControl( "world_size_slider", "OurSampleWorld.scaleX", "OurSampleWorld.scaleY", "OurSampleWorld.scaleZ" )
开发者ID:cwilmot,项目名称:maya-bulge-deformer-tool,代码行数:11,代码来源:MayaBulgeTool.py

示例5: drawCurve

def drawCurve( target,start,end,colour,samples ):
	# print target,start,end,samples,colour
	# make locator, constrain to target
	cmds.spaceLocator( name="myLocator" )
	cmds.select( target )
	cmds.select( "myLocator", add=True )
	cmds.pointConstraint()

	# make a new render layer with locator, and change display colour
	cmds.select( "myLocator" )
	exists = cmds.objExists( "AnimationCurves" )
	if ( exists==False ):
		cmds.createDisplayLayer( name="AnimationCurves", number=1, nr=True )
		cmds.createDisplayLayer( name="Spheres", number=1, nr=True )
		cmds.setAttr( "AnimationCurves.color", colour )
		cmds.setAttr( "Spheres.color", 16 )		

	# make a list of all the frames where points for the curve will be created
	frameList = []
	frameList.append( start )
	length = end - start
	samples = cmds.intField( samplesField, q=1, v=1 )
	interval = int( length / (samples-1) ) # using int() to ensure integer frame numbers
	for i in range( 1,samples ):
		frameList.append( start+interval*i )
	frameList.append( end )

	# make a list of tuples containing the locations of the target/locator for every frame needed
	xFormList = []
	n = 0
	for frame in ( frameList ):
		x = cmds.getAttr( "myLocator.tx",time=frame )
		y = cmds.getAttr( "myLocator.ty",time=frame )
		z = cmds.getAttr( "myLocator.tz",time=frame )
		currentXForm = ( x,y,z )
		xFormList.append( currentXForm )
		cmds.sphere( n="sphere"+str(n), r=0.2 )
		cmds.move( x,y,z, "sphere"+str(n), a=True )
		n+=1
		# print frame, "= ", x,y,z
	cmds.editDisplayLayerMembers( "Spheres", "sphere*", nr=True )

	# create curve using list of tuples
	cmds.curve( p=xFormList, d=1, ws=True )
	cmds.rename( target+"_animation_curve" )
	cmds.group( target+"_animation_curve", "sphere*", n="curve" )
	# add curve to animation curves layer
	cmds.editDisplayLayerMembers( "AnimationCurves", "curve", nr=True )
	cmds.delete("myLocator")
	cmds.button( ccButton, e=1, en=0 )
	cmds.frameLayout( buttonGroup, e=1, l="Delete curve before creating another" )
开发者ID:LewisHaley,项目名称:BitsAndPieces,代码行数:51,代码来源:animationCurve.py

示例6: addModification

def addModification( meshObjs ):
    
    import sgBFunction_attribute
    import sgBFunction_dag
    
    meshObjs = sgBFunction_dag.getChildrenMeshExists( meshObjs )
    softMod = cmds.deformer( meshObjs, type='softMod' )[0]
    
    ctlGrp = cmds.createNode( 'transform' )
    cmds.setAttr( ctlGrp+'.dh', 1 )
    dcmp   = cmds.createNode( 'decomposeMatrix' )
    ctl = cmds.sphere()[0]
    ctl = cmds.parent( ctl, ctlGrp )[0]
    sgBFunction_attribute.addAttr( ctl, ln='__________', at='enum', enumName = ':Modify Attr', cb=1 )
    sgBFunction_attribute.addAttr( ctl, ln='falloffRadius', min=0, dv=1, k=1 )
    sgBFunction_attribute.addAttr( ctl, ln='envelope', min=0, max=1, dv=1, k=1 )
    
    cmds.connectAttr( ctlGrp+'.wim', softMod+'.bindPreMatrix' )
    cmds.connectAttr( ctlGrp+'.wm', softMod+'.preMatrix' )
    cmds.connectAttr( ctl+'.wm', softMod+'.matrix' )
    cmds.connectAttr( ctl+'.m',  softMod+'.weightedMatrix' )
    
    cmds.connectAttr( ctlGrp+'.wm', dcmp+'.imat' )
    
    cmds.connectAttr( dcmp+'.ot', softMod+'.falloffCenter' )
    for i in range( len( meshObjs ) ):
        cmds.connectAttr( meshObjs[i]+'.wm', softMod+'.geomMatrix[%d]' % i )
    
    cmds.connectAttr( ctl+'.envelope', softMod+'.envelope' )
    cmds.connectAttr( ctl+'.falloffRadius', softMod+'.falloffRadius' )
    
    cmds.xform( ctlGrp, ws=1, t=cmds.getAttr( meshObjs[0]+'.wm' )[-4:-1] )
    cmds.select( ctlGrp )
开发者ID:jonntd,项目名称:mayadev-1,代码行数:33,代码来源:sgBFunction_rigObject.py

示例7: createImpactHelper

 def createImpactHelper(self):
     '''
     Creates IS Sphere Helper
     '''
     mImpact = cmds.sphere(r = 0.00001, n = 'IS_Impact')
     mImpactShape = cmds.listRelatives(mImpact[0])[0]
     
     self._mVoroImpactTrs = mImpact[0]
     self._mVoroImpactShape = mImpact[1]
     
     cmds.setAttr(mImpact[0] + '.visibility', False)
     cmds.setAttr(mImpact[0] + '.overrideEnabled', True)
     cmds.setAttr(mImpact[0] + '.overrideColor', 14)
     cmds.setAttr(mImpact[1] + '.sections', 2)
     cmds.setAttr(mImpact[1] + '.spans', 2)
     cmds.setAttr(mImpactShape + '.curvePrecisionShaded', 20)
     
     self._mVoroImpactShader = cmds.shadingNode('lambert', name = 'IS_ImpactMat', asShader = True)
     cmds.setAttr(self._mVoroImpactShader + '.diffuse', 0.0)
     cmds.setAttr(self._mVoroImpactShader + '.translucence', 0.3)
     cmds.setAttr(self._mVoroImpactShader + '.translucenceDepth', 0.75)
     cmds.setAttr(self._mVoroImpactShader + '.color', 0.0, 1.0, 0.0, type = 'double3')
     cmds.setAttr(self._mVoroImpactShader + '.incandescence', 0.0, 0.15, 0.0, type = 'double3')
     cmds.setAttr(self._mVoroImpactShader + '.transparency', 0.55, 0.55, 0.55, type = 'double3')
     
     cmds.select(mImpact, replace = True)
     cmds.hyperShade(assign = self._mVoroImpactShader)
     mel.eval('hyperShadePanelMenuCommand("hyperShadePanel1", "deleteUnusedNodes")')
     
     if (cmds.attributeQuery('hiddenInOutliner', node = self._mVoroImpactTrs, exists = True)):
         cmds.setAttr(self._mVoroImpactTrs + '.hiddenInOutliner', True)
     
     cmds.select(clear = True)
     cmds.scriptEditorInfo (clearHistory = True)
开发者ID:jeffhong21,项目名称:scripts,代码行数:34,代码来源:IShatterCTX.py

示例8: createPetals

 def createPetals(self):
     '''This method creates the petals of flower. '''
     
     # create the petal
     mc.sphere( ax=(0, 1, 0) );
     mc.move( 0, 0, -1.6 );
     mc.scale( 0.7, 0.3, 1.7 );    
     self.currentPetal = mc.ls( sl=True );
     currentPetal0 = self.currentPetal[0]
 
     # reset the coordinates
     mc.makeIdentity( apply=True, t=1, r=1, s=1, n=0 );
     mc.move( 0, 0, 0, currentPetal0 + '.scalePivot' )
     mc.move( 0, 0, 0, currentPetal0 + '.rotatePivot' )
      
     # move the tip of the petal
     mc.select( currentPetal0 + ".cv[3] [7]" )
     mc.move( 0, 1.5, 0, r=True )
   
     # select the inner part of the petal
     # move them down
     for uCV in range (5,7):  
         for vCV in range (0, 8):
             mc.select( currentPetal0 + ".cv[" + str(uCV) + "] [" + str(vCV) + "]" );
             mc.move( 0, -0.3, 0, r=True )
     
     # delete history
     mc.select( currentPetal0 )
     maya.mel.eval( "DeleteHistory" )
     
     # create the rest of the petals
     numPetals = random.randrange (10, 20);
     mc.select( currentPetal0 )
     degreeApart = ( 360 / numPetals );
     for i in range (0, numPetals):    
         newPetal = mc.duplicate ( rr=True );
         self.currentPetal.append(newPetal)
         mc.rotate( 0, degreeApart, 0, r=True );
         
         # randomly rotate the petals
         petalRX = random.randrange( -5, 5 );
         petalRY = random.randrange( -5, 5 );
         petalRZ = random.randrange( -5, 5 );
         mc.makeIdentity(apply=True, t=1, r=1, s=1, n=0)
         mc.rotate( petalRX, petalRY, petalRZ, r=True )
         
     return self.currentPetal
开发者ID:remusvrm,项目名称:plugins,代码行数:47,代码来源:Flower_v03.py

示例9: runTest

    def runTest(self):
        # create a nurbs sphere
        mySphere = cmds.sphere()[0]
        # a default sphere should have u/v
        # parameter ranges of 0:4/0:8
        
        # The following selections should
        # result in one of these:
        desiredResults = ('nurbsSphere1.u[2:3][0:8]',
                          'nurbsSphere1.u[2:3][*]',
                          'nurbsSphere1.u[2:3]',
                          'nurbsSphere1.uv[2:3][0:8]',
                          'nurbsSphere1.uv[2:3][*]',
                          'nurbsSphere1.uv[2:3]',
                          'nurbsSphere1.v[0:8][2:3]',
                          'nurbsSphere1.v[*][2:3]')

                
        # Passes
        cmds.select('nurbsSphere1.u[2:3][*]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)
        
        # Passes
        cmds.select('nurbsSphere1.v[*][2:3]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)        

        # Fails! - returns 'nurbsSphere1.u[2:3][0:1]'
        cmds.select('nurbsSphere1.u[2:3]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)
        
        # Fails! - returns 'nurbsSphere1.u[2:3][0:1]'
        cmds.select('nurbsSphere1.uv[2:3][*]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)

        # The following selections should
        # result in one of these:
        desiredResults = ('nurbsSphere1.u[0:4][2:3]',
                          'nurbsSphere1.u[*][2:3]',
                          'nurbsSphere1.uv[0:4][2:3]',
                          'nurbsSphere1.uv[*][2:3]',
                          'nurbsSphere1.v[2:3][0:4]',
                          'nurbsSphere1.v[2:3][*]',
                          'nurbsSphere1.v[2:3]')
                
        # Passes
        cmds.select('nurbsSphere1.u[*][2:3]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)

        # Passes
        cmds.select('nurbsSphere1.v[2:3][*]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)

        # Fails! - returns 'nurbsSphereShape1.u[0:1][2:3]'
        cmds.select('nurbsSphere1.v[2:3]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)

        # Fails! - returns 'nurbsSphereShape1.u[0:4][0:1]'
        cmds.select('nurbsSphere1.uv[*][2:3]')
        self.assertTrue(cmds.ls(sl=1)[0] in desiredResults)
开发者ID:CountZer0,项目名称:pymel,代码行数:59,代码来源:test_mayaBugs.py

示例10: test_create_node_and_compile

    def test_create_node_and_compile(self):
        sphere = cmds.sphere()
        node = cmds.shadingNode("dl_uberLightShape", asLight=True)
#        cmds.select(sphere, replace=True)
#        node_sg = cmds.sets(renderable=True, noSurfaceShader=True, empty=True, name=node);
#        cmds.defaultNavigation(connectToExisting=True, source=node, destination=node_sg)
#        mel.eval('connectNodeToNodeOverride("%s", "%s")' % (node, node_sg))
#        cmds.sets(edit=True, forceElement=node_sg)
        mel.eval("delightRender %s" % self.renderpass)
开发者ID:mjmvisser,项目名称:3deluxe,代码行数:9,代码来源:testuberlight.py

示例11: setUp

 def setUp(self):
     cmds.file(f=1, new=1)
     cmds.namespace(add="FOO")
     cmds.namespace(add="BAR")
     cmds.namespace(add="FRED")
     cmds.namespace(add="BAR", parent=":FOO")
     cmds.namespace(add="CALVIN", parent=":FOO:BAR")
     cmds.sphere(n="FOO:sphere1")
     cmds.sphere(n="FOO:sphere2")
     cmds.sphere(n="BAR:sphere1")
     cmds.sphere(n="FOO:BAR:sphere1")
开发者ID:Khenu,项目名称:PipelineConstructionSet,代码行数:11,代码来源:test_system.py

示例12: main

def main():
    for e in range(COUNT):
        name = "sphere" + str(e)
        shader_name = "sphereShader" + str(e)

        ep = [rp2(5), rp2(5), rp2(5)]
        circle = cmds.sphere(name=name, p=ep, r=rp(.5))

        #color = (int(rp(120)), int(rp(120)), int(rp(120)))
        color = (rp(1), rp(1), rp(1))

        assignNewMaterial(shader_name, color, 'lambert', name)
开发者ID:chirs,项目名称:studio5,代码行数:12,代码来源:render.py

示例13: __setup_plugin

 def __setup_plugin(self):
     rivet = cmds.createNode(self._plugin)
     obj = cmds.sphere()[0]
     shape = cmds.listRelatives(obj, allDescendents=True)[0]
     cmds.connectAttr(shape + ".local", rivet + ".inSurface")
     cmds.connectAttr(obj + ".worldMatrix", rivet + ".inMatrix")
     for num in range(12):
         loc = cmds.spaceLocator()[0]
         cmds.setAttr(rivet + ".parameterUV[%s].parameterU" % num, 0.5)
         cmds.setAttr(rivet + ".parameterUV[%s].parameterV" % num, 0.0)
         cmds.connectAttr(rivet + ".outTranslate[%s]" % num, loc + ".translate")
         cmds.connectAttr(rivet + ".outRotate[%s]" % num, loc + ".rotate")
开发者ID:jonntd,项目名称:Public,代码行数:12,代码来源:goe_nurbsrivet.py

示例14: setUp

 def setUp(self):
     OpenMaya.MFileIO.newFile(True)
     master = cmds.group(name='master', empty=True)
     for i in (1, 2):
         root = cmds.group(name='root_%d' % i, parent=master, empty=True)
         child = cmds.group(name='child_%d' % i, parent=root, empty=True)
         node = cmds.group(name='node', parent=child, empty=True)
     
     cmds.group('|master|root_2|child_2|node', name='grandchild', parent='|master|root_2|child_2')
     cmds.group(name='node', parent='|master', empty=True)
     cmds.group(name='awesome_node', parent='|master', empty=True)
     cmds.group(name='node_awesome', parent='|master', empty=True)
     cmds.group(name='n0de', parent='|master', empty=True)
     cmds.polyCube(name='cube')
     cmds.parent('cube', '|master')
     cmds.sphere(name='sphere')
     cmds.parent('sphere', '|master')
     cmds.circle(name='circle')
     cmds.parent('|circle', '|master')
     cmds.projectCurve('|master|circle', '|master|sphere')
     cmds.namespace(add='awesome')
     cmds.pointLight(name='awesome:light')
     cmds.parent('|awesome:light', '|master')
开发者ID:jonntd,项目名称:banana.maya,代码行数:23,代码来源:test_MDagPath.py

示例15:

def	createSpherical4Arrowhead	():
	_controlled		=	cmds.ls		(	long	=	True,	selection	=	True	)
	_baseCurve		=	cmds.curve	( 	degree	=	1,	point	=	[	(0,1,1),(0,3,1),(0,3,2),(0,6,0),(0,3,-2),(0,3,-1),
										(0,1,-1),(0,1,-3),(0,2,-3),(0,0,-6),(0,-2,-3),(0,-1,-3),(0,-1,-1),(0,-3,-1),
										(0,-3,-2),(0,-6,0),(0,-3,2),(0,-3,1),(0,-1,1),(0,-1,3),(0,-2,3),(0,0,6),(0,2,3),
										(0,1,3),(0,1,1)	]	)
	_tempSphere		=	cmds.sphere	(	radius	=	7,	axis	=	(	0,	1,	0	),	sections	=	4,
										startSweep	=	270,	endSweep	=	90,	constructionHistory	=	0	)
	_control 		=	cmds.projectCurve	(	_baseCurve,	_tempSphere,
												constructionHistory	=	False,	direction	=	(	1,	0,	0	),	)
	_control		=	cmds.duplicateCurve	(	_control,	constructionHistory	=	True,	object	=	True	)
		
	cmds.delete		(	_tempSphere	)
	cmds.delete		(	_baseCurve	)
	
	postProcessControl	(	_control[0],	'rotate',	_controlled	)
开发者ID:danielforgacs,项目名称:code-dump,代码行数:16,代码来源:ford_riggingAid.py


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