コード例 #1
0
ファイル: particleToBubble.py プロジェクト: r3dcube/scripts
		mc.pathAnimation(locObj, stu=sortedKeyFrameList[0], etu=sortedKeyFrameList[-1] ,c=curveObj)		
		
		#For every locator we create, make a bubble and attach that to the locator in worldspace and parent in underneath
	    
		makeBubble = mc.polyCube(name="bubble" + str(curveParticleId), w=.1, h=.1, d=.1, sx=5, sy=5, sz=5)		
        mc.sculpt(makeBubble, maxDisplacement=.1)
        mc.delete(makeBubble, ch=True)		
        getPos = mc.xform(locObj, ws=True, q=True, translation=True)        
        mc.xform(makeBubble[0], t=(getPos[0], getPos[1], getPos[2]))
        mc.parent(makeBubble[0], locObj)
        randBubbleSize = random.uniform(.4,.6)#This is what will give our bubbles the random size
        mc.scale(randBubbleSize, randBubbleSize, randBubbleSize, makeBubble[0])        
        
        #Create nCloth for each bubble and set the collide strength to turn on when the bubble moves, never before.
        mc.select(makeBubble[0])
        mc.nClothCreate()
        bubbleNClothName = mc.rename("nCloth1", "bubbleCloth")
        #mc.setAttr(locObj + ".collideStrength", 0)
        mc.setKeyframe(bubbleNClothName, attribute='collideStrength', t=[sortedKeyFrameList[0], sortedKeyFrameList[-1]])
        mc.setAttr(bubbleNClothName + ".collideStrength", 0)
        mc.setKeyframe(bubbleNClothName, attribute='collideStrength', t=[sortedKeyFrameList[0]-1, sortedKeyFrameList[-1]+1])
        
        mc.setKeyframe(bubbleNClothName, attribute='rigidity', t=[sortedKeyFrameList[0], sortedKeyFrameList[-1]+10])
        mc.setAttr(bubbleNClothName + ".rigidity", .1)
        mc.setKeyframe(bubbleNClothName, attribute='rigidity', t=[sortedKeyFrameList[0]+10, sortedKeyFrameList[-1]])
        
        mc.setAttr(bubbleNClothName + ".inputMeshAttract", .7)
        mc.setKeyframe(bubbleNClothName, attribute='inputMeshAttract', t=[sortedKeyFrameList[0], sortedKeyFrameList[-1]+10])
        mc.setAttr(bubbleNClothName + ".inputMeshAttract", .4)
        mc.setKeyframe(bubbleNClothName, attribute='inputMeshAttract', t=[sortedKeyFrameList[0]+10, sortedKeyFrameList[-1]])
        
コード例 #2
0
ファイル: operate.py プロジェクト: chirs/studio5
def main():
    cmds.polyCube( sx=10, sy=10, sz=10)
    cmds.nClothCreate()