def creatSphere(): circleSel = mc.ls(sl=1)[0] radiusCircle = mc.circle(circleSel, q=1, r=1) radiusSpere = radiusCircle*.75 particleSphere = mc.polySphere(n='%s_Sphere'%circleSel, r=radiusSpere, sx=float(radiusSpere), sy=float(radiusSpere), ax=[0, 1, 0])[0] mc.parent(particleSphere, circleSel) mc.setAttr('%s.tx'%particleSphere, 0) mc.setAttr('%s.ty'%particleSphere, 0) mc.setAttr('%s.tz'%particleSphere, 0) mc.setAttr('%s.rx'%particleSphere, 0) mc.setAttr('%s.ry'%particleSphere, 0) mc.setAttr('%s.rz'%particleSphere, 0) mc.setAttr('%s.v'%particleSphere, 0) mc.select(particleSphere, r=1) mc.emitter(type='surface', r=100, dx=1, dy=0, dz=0, n='%s_emitter'%circleSel ) mc.particle( n='%s_Particles'%circleSel ) mc.connectDynamic( '%s_Particles'%circleSel, em='%s_emitter'%circleSel ) particlesShape = mc.listRelatives('%s_Particles'%circleSel, s=1)[0] mc.setAttr('%s.lifespanMode'%particlesShape, 1.6) mc.setAttr('%s.startFrame'%particlesShape, 960) mc.connectControl( 'numText', '%s.rate'%('%s_emitter'%circleSel) ) mc.shadingNode('%s_blinn'%circleSel, asShader=1) mc.sets('%s_blinnSG', renderable=True, noSurfaceShader=True, empty=1) mc.connectAttr(f=1, '%s.outColor'%('%s_blinn'%circleSel), '%s.surfaceShader'%('%s_blinnSG')) mc.sets( '%s_Particles'%circleSel, e=1, forceElement='%s_blinnSG' ) mc.connectControl( 'myColorIndex', '%s.color'%('%s_blinn'%circleSel) )