Maya snippets
Selection
Action if selection has item or not
import maya.cmds as cmds
target = cmds.ls(sl=True)
if target:
print('yes')
else:
print('no')Adding objects
To a curve
import maya.cmds as cmds
from random import uniform
delta = 1.0/10
for n in range(40):
if uniform(0,1) > 0.5:
x,y,z = cmds.pointOnCurve( 'curve44', pr=(delta * n), p=True )
cmds.sphere(r=uniform(0.01, 0.04))
cmds.move(x,y,z)Last updated
Was this helpful?