forked from lookbothways/vfxTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
randomisedAssetsOnPath
40 lines (32 loc) · 1.12 KB
/
randomisedAssetsOnPath
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#randomisedAssetsOnPath
#Put standins on a path and duplicate them by a framestep
#Sources a directory to randomise the standin source + rotation
import maya.cmds as cmds
import assetRandomiser
import sets
reload(assetRandomiser)
#Select the curve, select the object and run this:
selected = cmds.ls(sl=True)
cmds.select( selected[0], selected[1] )
motionPathName = cmds.pathAnimation(stu=1001, etu=1500, )
cmds.keyTangent(motionPathName, itt='linear', ott='linear')
step = 6
thingsToRandomise = []
thingsToRandomise = cmds.sets()
#sets the time to 1001
cmds.currentTime(1001)
while cmds.currentTime( query=True ) < 1500:
newObject = cmds.duplicate( selected[1] )
timeNow = cmds.currentTime( query=True )
nextStep = timeNow+step
cmds.currentTime( nextStep, update=True, edit=True )
timeNow = cmds.currentTime( query=True )
#appends new object to list of things to randomise
cmds.select(newObject)
cmds.sets( thingsToRandomise, q=True )
cmds.select(thingsToRandomise)
assetRandomiser.assetRandomiser()
newGroup = cmds.group()
cmds.setAttr(newGroup+'.translateY', 3500)
cmds.delete(motionPathName)
#end