particle system error

heey,

today i was experementing with particle systems and i was trying to write some code of my own.

i got some error, debugged them until i got this one:

But i don’t know if the error i get is comming from the code, or the .ptf file.

my code is:

import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.particles.Particles import Particles
from direct.particles.ParticleEffect import ParticleEffect
from direct.particles.ForceGroup import ForceGroup
from direct.gui.OnscreenText import OnscreenText
from direct.showbase.DirectObject import DirectObject

class Main(DirectObject):
  def __init__(self):
    base.enableParticles()
    
    self.tea = loader.loadModel("models/lg")
    self.tea.reparentTo(render)
    
    self.p = ParticleEffect()
    self.p.cleanup()
    self.p.loadConfig(Filename("particle/fire.ptf"))
    self.t.start(self.tea)
    base.cam.setPos(0,-20,0)


m = Main()
run()

my ptf file:


self.reset()
self.setPos(0.000, 0.000, 0.000)
self.setHpr(0.000, 0.000, 0.000)
self.setScale(1.000, 1.000, 1.000)

SuperSpray = Particles.Particles('particles-1')
SuperSpray.setFactory("PointParticleFactory")
SuperSpray.setRenderer("SpriteParticleRenderer")
SuperSpray.setEmitter("DiscEmitter")


SuperSpray.setPoolSize(10000)

SuperSpray.setBirthRate(0.25)

SuperSpray.setLitterSize(1)
SuperSpray.setLitterSpread(0)
SuperSpray.setSystemLifespan(0.0000)
SuperSpray.setLocalVelocityFlag(1)
SuperSpray.setSystemGrowsOlderFlag(0)
SuperSpray.factory.setLifespanBase(27.775)
SuperSpray.factory.setLifespanSpread(0)
SuperSpray.renderer.setAlphaMode(BaseParticleRenderer.PRALPHAOUT)
SuperSpray.renderer.setUserAlpha(0.0)
SuperSpray.renderer.setTexture(loader.loadTexture("models/textures/fire.png"))
SuperSpray.renderer.setColor(Vec4(1.00, 1.00, 1.00, 1.00))
SuperSpray.renderer.setXScaleFlag(0)
SuperSpray.renderer.setYScaleFlag(0)
SuperSpray.renderer.setAnimAngleFlag(0)
SuperSpray.renderer.setInitialXScale(0.0100)
SuperSpray.renderer.setFinalXScale(0.0200)
SuperSpray.renderer.setInitialYScale(0.0100)
SuperSpray.renderer.setFinalYScale(0.0200)
SuperSpray.renderer.setNonanimatedTheta(0.0000)
SuperSpray.renderer.setAlphaBlendMethod(BaseParticleRenderer.PPBLENDLINEAR)
SuperSpray.renderer.setAlphaDisable(0)
SuperSpray.emitter.setEmissionType(BaseParticleEmitter.ETRADIATE)
SuperSpray.emitter.setAmplitude(1.0000)
SuperSpray.emitter.setAmplitudeSpread(0.0000)
SuperSpray.emitter.setOffsetForce(Vec3(0.0000, 0.0000, 0.0000))
SuperSpray.emitter.setExplicitLaunchVector(Vec3(1.0000, 0.0000, 0.0000))
SuperSpray.emitter.setRadiateOrigin(Point3(0.0000, 0.0000, 0.0000))
SuperSpray.emitter.setRadius(0.1000)

should not call cleanup before the particle is created. It is called only when it is created and you want to remove it.