How do I go about adding a sequence to a parallel? I’m building the parallel dynamically so I can’t do
Parallel(Sequence(),Sequence())
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.
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)
flowParticle.pEffect.setPos(self.mudPaths[pathIndex][0])
flowParticle.pEffect.setR(self.mudPaths[pathIndex][1])
flowParticle.pEffect.setScale(scale,scale,scale)
# 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")
delugeParticle.pEffect.setPos(ptInfo["pos"])
delugeParticle.pEffect.setR(ptInfo["Rot"])
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)
else:
print "Scale less than 1"
#flowParallel = Parallel(flowInterval, name="flow_%d"%(i))
flowParallel.addInterval(flowInterval, 0, CMetaInterval.RSPreviousEnd)
finalSequence = Sequence(mtopInt,flowParallel)
finalSequence.start()
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.