Adding sequences to a parallel

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.

If you want to have the interval played when the previous one has finished, do this:

myParallelOrSequence.addInterval(myOtherParallelOrSequence,0,CMetaInterval.RSPreviousEnd)

If you want to have it played at the same time as the previous one, do this:

myParallelOrSequence.addInterval(myOtherParallelOrSequence,0,CMetaInterval.RSPreviousBegin)

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.

Sorry. I’m too used to the C++ MetaInterval class.

The correct way to add intervals, sequences or parallels is:

SqOrParallel.append(OtherSqOrParallel)

Thanks pro-rsoft! Got rid of them nasty eval()'s in my code.