Ejemplo n.º 1
0
    def __init__(self, name=None, poolSize=1024):
        if (name == None):
            self.name = 'particles-%d' % Particles.id
            Particles.id += 1
        else:
            self.name = name
        ParticleSystem.__init__(self, poolSize)
        # self.setBirthRate(0.02)
        # self.setLitterSize(10)
        # self.setLitterSpread(0)

        # Set up a physical node
        self.node = PhysicalNode(self.name)
        self.nodePath = NodePath(self.node)
        self.setRenderParent(self.node)
        self.node.addPhysical(self)

        self.factory = None
        self.factoryType = "undefined"
        # self.setFactory("PointParticleFactory")
        self.renderer = None
        self.rendererType = "undefined"
        # self.setRenderer("PointParticleRenderer")
        self.emitter = None
        self.emitterType = "undefined"
        # self.setEmitter("SphereVolumeEmitter")

        # Enable particles by default
        self.fEnabled = 0
        #self.enable()
        self.geomReference = ""
 def setRenderer(self, type):
     if self.rendererType == type:
         return
     if self.renderer:
         self.renderer = None
     self.rendererType = type
     if type == 'PointParticleRenderer':
         self.renderer = PointParticleRenderer()
         self.renderer.setPointSize(1.0)
     else:
         if type == 'LineParticleRenderer':
             self.renderer = LineParticleRenderer()
         else:
             if type == 'GeomParticleRenderer':
                 self.renderer = GeomParticleRenderer()
                 if __dev__:
                     from direct.directtools import DirectSelection
                     npath = NodePath('default-geom')
                     bbox = DirectSelection.DirectBoundingBox(npath)
                     self.renderer.setGeomNode(bbox.lines.node())
             else:
                 if type == 'SparkleParticleRenderer':
                     self.renderer = SparkleParticleRenderer()
                 else:
                     if type == 'SpriteParticleRenderer':
                         self.renderer = SpriteParticleRendererExt.SpriteParticleRendererExt(
                         )
                     else:
                         print 'unknown renderer type: %s' % type
                         return
     ParticleSystem.setRenderer(self, self.renderer)
     return
Ejemplo n.º 3
0
 def setRenderer(self, type):
     if (self.rendererType == type):
         return None
     if (self.renderer):
         self.renderer = None
     self.rendererType = type
     if (type == "PointParticleRenderer"):
         self.renderer = PointParticleRenderer()
         self.renderer.setPointSize(1.0)
     elif (type == "LineParticleRenderer"):
         self.renderer = LineParticleRenderer()
     elif (type == "GeomParticleRenderer"):
         self.renderer = GeomParticleRenderer()
         # This was moved here because we do not want to download
         # the direct tools with toontown.
         if __dev__:
             from direct.directtools import DirectSelection
             npath = NodePath('default-geom')
             bbox = DirectSelection.DirectBoundingBox(npath)
             self.renderer.setGeomNode(bbox.lines.node())
     elif (type == "SparkleParticleRenderer"):
         self.renderer = SparkleParticleRenderer()
     elif (type == "SpriteParticleRenderer"):
         self.renderer = SpriteParticleRendererExt.SpriteParticleRendererExt(
         )
         # self.renderer.setTextureFromFile()
     else:
         print "unknown renderer type: %s" % type
         return None
     ParticleSystem.setRenderer(self, self.renderer)
Ejemplo n.º 4
0
 def setEmitter(self, type):
     if (self.emitterType == type):
         return None
     if (self.emitter):
         self.emitter = None
     self.emitterType = type
     if (type == "ArcEmitter"):
         self.emitter = ArcEmitter()
     elif (type == "BoxEmitter"):
         self.emitter = BoxEmitter()
     elif (type == "DiscEmitter"):
         self.emitter = DiscEmitter()
     elif (type == "LineEmitter"):
         self.emitter = LineEmitter()
     elif (type == "PointEmitter"):
         self.emitter = PointEmitter()
     elif (type == "RectangleEmitter"):
         self.emitter = RectangleEmitter()
     elif (type == "RingEmitter"):
         self.emitter = RingEmitter()
     elif (type == "SphereSurfaceEmitter"):
         self.emitter = SphereSurfaceEmitter()
     elif (type == "SphereVolumeEmitter"):
         self.emitter = SphereVolumeEmitter()
         self.emitter.setRadius(1.0)
     elif (type == "TangentRingEmitter"):
         self.emitter = TangentRingEmitter()
     else:
         print "unknown emitter type: %s" % type
         return None
     ParticleSystem.setEmitter(self, self.emitter)
Ejemplo n.º 5
0
    def __init__(self, name=None, poolSize=1024):
        if (name == None):
            self.name = 'particles-%d' % Particles.id
            Particles.id += 1
        else:
            self.name = name
        ParticleSystem.__init__(self, poolSize)
        # self.setBirthRate(0.02)
        # self.setLitterSize(10)
        # self.setLitterSpread(0)

        # Set up a physical node
        self.node = PhysicalNode(self.name)
        self.nodePath = NodePath(self.node)
        self.setRenderParent(self.node)
        self.node.addPhysical(self)

        self.factory = None
        self.factoryType = "undefined"
        # self.setFactory("PointParticleFactory")
        self.renderer = None
        self.rendererType = "undefined"
        # self.setRenderer("PointParticleRenderer")
        self.emitter = None
        self.emitterType = "undefined"
        # self.setEmitter("SphereVolumeEmitter")

        # Enable particles by default
        self.fEnabled = 0
        #self.enable()
        self.geomReference = ""
Ejemplo n.º 6
0
 def setEmitter(self, type):
     if (self.emitterType == type):
         return None
     if (self.emitter):
         self.emitter = None
     self.emitterType = type
     if (type == "ArcEmitter"):
         self.emitter = ArcEmitter()
     elif (type == "BoxEmitter"):
         self.emitter = BoxEmitter()
     elif (type == "DiscEmitter"):
         self.emitter = DiscEmitter()
     elif (type == "LineEmitter"):
         self.emitter = LineEmitter()
     elif (type == "PointEmitter"):
         self.emitter = PointEmitter()
     elif (type == "RectangleEmitter"):
         self.emitter = RectangleEmitter()
     elif (type == "RingEmitter"):
         self.emitter = RingEmitter()
     elif (type == "SphereSurfaceEmitter"):
         self.emitter = SphereSurfaceEmitter()
     elif (type == "SphereVolumeEmitter"):
         self.emitter = SphereVolumeEmitter()
         self.emitter.setRadius(1.0)
     elif (type == "TangentRingEmitter"):
         self.emitter = TangentRingEmitter()
     else:
         print("unknown emitter type: %s" % type)
         return None
     ParticleSystem.setEmitter(self, self.emitter)
Ejemplo n.º 7
0
 def setRenderer(self, type):
     if (self.rendererType == type):
         return None
     if (self.renderer):
         self.renderer = None
     self.rendererType = type
     if (type == "PointParticleRenderer"):
         self.renderer = PointParticleRenderer()
         self.renderer.setPointSize(1.0)
     elif (type == "LineParticleRenderer"):
         self.renderer = LineParticleRenderer()
     elif (type == "GeomParticleRenderer"):
         self.renderer = GeomParticleRenderer()
         # This was moved here because we do not want to download
         # the direct tools with toontown.
         if __dev__:
             from direct.directtools import DirectSelection
             npath = NodePath('default-geom')
             bbox = DirectSelection.DirectBoundingBox(npath)
             self.renderer.setGeomNode(bbox.lines.node())
     elif (type == "SparkleParticleRenderer"):
         self.renderer = SparkleParticleRenderer()
     elif (type == "SpriteParticleRenderer"):
         self.renderer = SpriteParticleRendererExt.SpriteParticleRendererExt()
         # self.renderer.setTextureFromFile()
     else:
         print("unknown renderer type: %s" % type)
         return None
     ParticleSystem.setRenderer(self, self.renderer)
Ejemplo n.º 8
0
 def setFactory(self, type):
     if (self.factoryType == type):
         return None
     if (self.factory):
         self.factory = None
     self.factoryType = type
     if (type == "PointParticleFactory"):
         self.factory = PointParticleFactory()
     elif (type == "ZSpinParticleFactory"):
         self.factory = ZSpinParticleFactory()
     elif (type == "OrientedParticleFactory"):
         self.factory = OrientedParticleFactory()
     else:
         print "unknown factory type: %s" % type
         return None
     self.factory.setLifespanBase(0.5)
     ParticleSystem.setFactory(self, self.factory)
Ejemplo n.º 9
0
 def setFactory(self, type):
     if (self.factoryType == type):
         return None
     if (self.factory):
         self.factory = None
     self.factoryType = type
     if (type == "PointParticleFactory"):
         self.factory = PointParticleFactory()
     elif (type == "ZSpinParticleFactory"):
         self.factory = ZSpinParticleFactory()
     elif (type == "OrientedParticleFactory"):
         self.factory = OrientedParticleFactory()
     else:
         print("unknown factory type: %s" % type)
         return None
     self.factory.setLifespanBase(0.5)
     ParticleSystem.setFactory(self, self.factory)
 def setEmitter(self, type):
     if self.emitterType == type:
         return
     if self.emitter:
         self.emitter = None
     self.emitterType = type
     if type == 'ArcEmitter':
         self.emitter = ArcEmitter()
     else:
         if type == 'BoxEmitter':
             self.emitter = BoxEmitter()
         else:
             if type == 'DiscEmitter':
                 self.emitter = DiscEmitter()
             else:
                 if type == 'LineEmitter':
                     self.emitter = LineEmitter()
                 else:
                     if type == 'PointEmitter':
                         self.emitter = PointEmitter()
                     else:
                         if type == 'RectangleEmitter':
                             self.emitter = RectangleEmitter()
                         else:
                             if type == 'RingEmitter':
                                 self.emitter = RingEmitter()
                             else:
                                 if type == 'SphereSurfaceEmitter':
                                     self.emitter = SphereSurfaceEmitter()
                                 else:
                                     if type == 'SphereVolumeEmitter':
                                         self.emitter = SphereVolumeEmitter(
                                         )
                                         self.emitter.setRadius(1.0)
                                     else:
                                         if type == 'TangentRingEmitter':
                                             self.emitter = TangentRingEmitter(
                                             )
                                         else:
                                             print 'unknown emitter type: %s' % type
                                             return
     ParticleSystem.setEmitter(self, self.emitter)
     return
 def setFactory(self, type):
     if self.factoryType == type:
         return
     if self.factory:
         self.factory = None
     self.factoryType = type
     if type == 'PointParticleFactory':
         self.factory = PointParticleFactory()
     else:
         if type == 'ZSpinParticleFactory':
             self.factory = ZSpinParticleFactory()
         else:
             if type == 'OrientedParticleFactory':
                 self.factory = OrientedParticleFactory()
             else:
                 print 'unknown factory type: %s' % type
                 return
     self.factory.setLifespanBase(0.5)
     ParticleSystem.setFactory(self, self.factory)
     return
 def __init__(self, name=None, poolSize=1024):
     if name == None:
         self.name = 'particles-%d' % Particles.id
         Particles.id += 1
     else:
         self.name = name
     ParticleSystem.__init__(self, poolSize)
     self.node = PhysicalNode(self.name)
     self.nodePath = NodePath(self.node)
     self.setRenderParent(self.node)
     self.node.addPhysical(self)
     self.factory = None
     self.factoryType = 'undefined'
     self.renderer = None
     self.rendererType = 'undefined'
     self.emitter = None
     self.emitterType = 'undefined'
     self.fEnabled = 0
     self.geomReference = ''
     return