How do I go about adding a sequence to a parallel? I’m building the parallel dynamically so I can’t do
I found addSequence() in the API reference but I don’t know what the other two arguments are. I’ve tried using it by just putting 0 for both mystery args but nothing happens in my code.
The code and files necessary to run it is in here, the main file is MudSimulator.py.
If you want to have the interval played when the previous one has finished, do this:
If you want to have it played at the same time as the previous one, do this:
Thanks for the quick response pro-rsoft, however its still not working. Do I have to do anything to the Parallel after adding the intervals? Here’s the relevant code.
mudtop = self.loadParticle("top")
mtopInt = mudtop.getInterval(self.topTime)
delugeTime = baseTime*1.3
#build the LerpFunc's here
flowParallel = Parallel()
for i in range(len(pickedFlows)):
flowTime = baseTime/2+random.random()
# Get the path index of the picked flows so that we can set the pos and rotation from
# mudDelugePts and mudPaths
pathIndex = pickedFlows[i]
flowType = random.choice(["flow","flow2"])
flowParticle = self.loadParticle(flowType)
# Add the lerpFunc/interval controlling the particles
flowInterval = flowParticle.getInterval(flowTime)
# Check if the mudflow will reach to deluge points, if they do load and set deluge
if scale >= 1:
ptInfo = self.mudDelugePts[pathIndex]
delugeParticle = self.loadParticle("deluge")
delugeInterval = delugeParticle.getInterval(delugeTime,ptInfo["lifespan"])
# Build the sequence for flow to deluge
flowParallel.addInterval(Sequence(flowInterval,delugeInterval,name="flow_%d"%(i)), 0, CMetaInterval.RSPreviousEnd)
print "Scale less than 1"
#flowParallel = Parallel(flowInterval, name="flow_%d"%(i))
flowParallel.addInterval(flowInterval, 0, CMetaInterval.RSPreviousEnd)
finalSequence = Sequence(mtopInt,flowParallel)
Hmm I don’t have much time so I solved this with the ugly ugly method of using an eval(). I built the sequences as strings then eval’d Parallel(sequenceString). It’s ugly but I needed this thing finished. I’m still interested in how to properly do this though.
Sorry. I’m too used to the C++ MetaInterval class.
The correct way to add intervals, sequences or parallels is:
Thanks pro-rsoft! Got rid of them nasty eval()'s in my code.