2
0
Эх сурвалжийг харах

*** empty log message ***

Mark Mine 25 жил өмнө
parent
commit
83bc6d640d

+ 9 - 9
direct/src/showbase/Particles.py

@@ -76,7 +76,7 @@ class Particles(ParticleSystem.ParticleSystem):
 	else:
 	else:
 	    print "unknown factory type: %s" % type
 	    print "unknown factory type: %s" % type
 	    return None
 	    return None
-	self.factory.setLifespanBase(0.5)
+	#self.factory.setLifespanBase(0.5)
 	ParticleSystem.ParticleSystem.setFactory(self, self.factory)
 	ParticleSystem.ParticleSystem.setFactory(self, self.factory)
 
 
     def setRenderer(self, type):
     def setRenderer(self, type):
@@ -99,9 +99,9 @@ class Particles(ParticleSystem.ParticleSystem):
 	else:
 	else:
 	    print "unknown renderer type: %s" % type
 	    print "unknown renderer type: %s" % type
 	    return None
 	    return None
-	self.renderer.setAlphaMode(
-		BaseParticleRenderer.BaseParticleRenderer.PRALPHAUSER)
-	self.renderer.setUserAlpha(1.0)
+	#self.renderer.setAlphaMode(
+        #BaseParticleRenderer.BaseParticleRenderer.PRALPHAUSER)
+	#self.renderer.setUserAlpha(1.0)
 	ParticleSystem.ParticleSystem.setRenderer(self, self.renderer)
 	ParticleSystem.ParticleSystem.setRenderer(self, self.renderer)
 
 
     def setEmitter(self, type):
     def setEmitter(self, type):
@@ -111,7 +111,7 @@ class Particles(ParticleSystem.ParticleSystem):
 	if (type == "Box"):
 	if (type == "Box"):
 	    self.emitter = BoxEmitter.BoxEmitter()
 	    self.emitter = BoxEmitter.BoxEmitter()
 	elif (type == "Disc"):
 	elif (type == "Disc"):
-	    self.emitter = DiskEmitter.DiskEmitter()
+	    self.emitter = DiscEmitter.DiscEmitter()
 	elif (type == "Line"):
 	elif (type == "Line"):
 	    self.emitter = LineEmitter.LineEmitter()
 	    self.emitter = LineEmitter.LineEmitter()
 	elif (type == "Point"):
 	elif (type == "Point"):
@@ -130,10 +130,10 @@ class Particles(ParticleSystem.ParticleSystem):
 	else:
 	else:
 	    print "unknown emitter type: %s" % type
 	    print "unknown emitter type: %s" % type
 	    return None
 	    return None
-	self.emitter.setEmissionType(
-		BaseParticleEmitter.BaseParticleEmitter.ETEXPLICIT)
-	self.emitter.setExplicitLaunchVector(Vec3(-1.0, -1.0, 1.0))
-	self.emitter.setAmplitude(1.0)
+	#self.emitter.setEmissionType(
+        #BaseParticleEmitter.BaseParticleEmitter.ETEXPLICIT)
+	#self.emitter.setExplicitLaunchVector(Vec3(-1.0, -1.0, 1.0))
+	#self.emitter.setAmplitude(1.0)
 	ParticleSystem.ParticleSystem.setEmitter(self, self.emitter)
 	ParticleSystem.ParticleSystem.setEmitter(self, self.emitter)
 
 
     def __update(self, state):
     def __update(self, state):

+ 44 - 20
direct/src/tkpanels/ParticlePanel.py

@@ -62,7 +62,7 @@ class ParticlePanel(AppShell):
             ('System Pool size',
             ('System Pool size',
              'Size of particle pool',
              'Size of particle pool',
              self.setSystemPoolSize,
              self.setSystemPoolSize,
-             0.0, 1.0),
+             1.0, 1.0),
             ('System Birth rate',
             ('System Birth rate',
              'Seconds between particle births',
              'Seconds between particle births',
              self.setSystemBirthRate,
              self.setSystemBirthRate,
@@ -90,13 +90,13 @@ class ParticlePanel(AppShell):
             self.toggleSystemGrowsOlder, 0)
             self.toggleSystemGrowsOlder, 0)
         # Vector widgets
         # Vector widgets
         pos = self.createVector3Entry(systemPage, 'Pos',
         pos = self.createVector3Entry(systemPage, 'Pos',
-                                      'Particle system position')
-        pos.command = self.setSystemPos
+                                      'Particle system position',
+                                      command = self.setSystemPos)
         pos.addMenuItem('Popup Placer Panel', Placer.Placer)
         pos.addMenuItem('Popup Placer Panel', Placer.Placer)
         hpr = self.createVector3Entry(systemPage, 'Hpr',
         hpr = self.createVector3Entry(systemPage, 'Hpr',
                                      'Particle system orientation',
                                      'Particle system orientation',
-                                      fGroup_labels = ('H', 'P', 'R'))
-        hpr.command = self.setSystemHpr
+                                      fGroup_labels = ('H', 'P', 'R'),
+                                      command = self.setSystemHpr)
         hpr.addMenuItem('Popup Placer Panel', Placer.Placer)
         hpr.addMenuItem('Popup Placer Panel', Placer.Placer)
 
 
         ## FACTORY PAGE ##
         ## FACTORY PAGE ##
@@ -375,7 +375,9 @@ class ParticlePanel(AppShell):
         bool = BooleanVar()
         bool = BooleanVar()
         bool.set(initialState)
         bool.set(initialState)
         cb = Checkbutton(parent, text = text, anchor = W,
         cb = Checkbutton(parent, text = text, anchor = W,
-                         variable = bool, command = command)
+                         variable = bool)
+        # Do this after the widget so command isn't called on creation
+        cb.command = command
         cb.pack(fill = X)
         cb.pack(fill = X)
         return bool
         return bool
         
         
@@ -395,31 +397,41 @@ class ParticlePanel(AppShell):
         kw['initialValue'] = min
         kw['initialValue'] = min
         kw['resolution'] = resolution
         kw['resolution'] = resolution
         widget = apply(Floater.Floater, (parent,), kw)
         widget = apply(Floater.Floater, (parent,), kw)
-        widget.command = command
+        # Do this after the widget so command isn't called on creation
+        widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         self.widgetDict['text'] = widget
         self.widgetDict['text'] = widget
         return widget
         return widget
 
 
-    def createAngleDial(self, parent, text, balloonHelp, **kw):
+    def createAngleDial(self, parent, text, balloonHelp,
+                        command = None, **kw):
         kw['text'] = text
         kw['text'] = text
         widget = apply(Dial.AngleDial,(parent,), kw)
         widget = apply(Dial.AngleDial,(parent,), kw)
+        # Do this after the widget so command isn't called on creation
+        widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         return widget
         return widget
 
 
-    def createVector3Entry(self, parent, text, balloonHelp, **kw):
+    def createVector3Entry(self, parent, text, balloonHelp,
+                           command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
         widget = apply(VectorWidgets.Vector3Entry, (parent,), kw)
         widget = apply(VectorWidgets.Vector3Entry, (parent,), kw)
+        # Do this after the widget so command isn't called on creation
+        widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         return widget
         return widget
 
 
-    def createColorEntry(self, parent, text, balloonHelp, **kw):
+    def createColorEntry(self, parent, text, balloonHelp,
+                         command = None, **kw):
         # Set label's text
         # Set label's text
         kw['text'] = text
         kw['text'] = text
         widget = apply(VectorWidgets.ColorEntry, (parent,) ,kw)
         widget = apply(VectorWidgets.ColorEntry, (parent,) ,kw)
+        # Do this after the widget so command isn't called on creation
+        widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
         self.bind(widget, balloonHelp)
         self.bind(widget, balloonHelp)
         return widget
         return widget
@@ -430,8 +442,9 @@ class ParticlePanel(AppShell):
         widget = Pmw.OptionMenu(parent, labelpos = W, label_text = text,
         widget = Pmw.OptionMenu(parent, labelpos = W, label_text = text,
                                 label_width = 12, menu_tearoff = 1,
                                 label_width = 12, menu_tearoff = 1,
                                 menubutton_textvariable = optionVar,
                                 menubutton_textvariable = optionVar,
-                                items = items,
-                                command = command)
+                                items = items)
+        # Do this after the widget so command isn't called on creation
+        widget['command'] = command
         widget.pack(fill = X)
         widget.pack(fill = X)
         self.bind(widget.component('menubutton'), balloonHelp)
         self.bind(widget.component('menubutton'), balloonHelp)
         return optionVar
         return optionVar
@@ -439,7 +452,8 @@ class ParticlePanel(AppShell):
     ### PARTICLE SYSTEM COMMANDS ###
     ### PARTICLE SYSTEM COMMANDS ###
     ## System Page ##
     ## System Page ##
     def setSystemPoolSize(self, value):
     def setSystemPoolSize(self, value):
-	self.particles.setPoolSize(value)
+        print self.particles, int(value)
+	self.particles.setPoolSize(int(value))
     def setSystemBirthRate(self, value):
     def setSystemBirthRate(self, value):
 	self.particles.setBirthRate(value)
 	self.particles.setBirthRate(value)
     def setSystemLitterSize(self, value):
     def setSystemLitterSize(self, value):
@@ -488,9 +502,13 @@ class ParticlePanel(AppShell):
 	self.particles.setEmitter(type)
 	self.particles.setEmitter(type)
     # Box #
     # Box #
     def setEmitterBoxPoint1(self, point):
     def setEmitterBoxPoint1(self, point):
-	self.particles.emitter.setMinBound(Vec3(point[0], point[1], point[2]))
+	self.particles.emitter.setMinBound(Point3(point[0],
+                                                  point[1],
+                                                  point[2]))
     def setEmitterBoxPoint2(self, point):
     def setEmitterBoxPoint2(self, point):
-	self.particles.emitter.setMaxBound(Vec3(point[0], point[1], point[2]))
+	self.particles.emitter.setMaxBound(Point3(point[0],
+                                                  point[1],
+                                                  point[2]))
     def setEmitterBoxVelocityVector(self, vec):
     def setEmitterBoxVelocityVector(self, vec):
         print 'Emitter box velocity vector:', vec
         print 'Emitter box velocity vector:', vec
     # Disc #
     # Disc #
@@ -508,21 +526,27 @@ class ParticlePanel(AppShell):
 	self.particles.emitter.setCubicLerping(self.emitterDiscCubicLerping.get())
 	self.particles.emitter.setCubicLerping(self.emitterDiscCubicLerping.get())
     # Line #
     # Line #
     def setEmitterLinePoint1(self, point):
     def setEmitterLinePoint1(self, point):
-	self.particles.emitter.setEndpoint1(Vec3(point[0], point[1], point[2]))
+	self.particles.emitter.setEndpoint1(Point3(point[0],
+                                                   point[1],
+                                                   point[2]))
     def setEmitterLinePoint2(self, point):
     def setEmitterLinePoint2(self, point):
-	self.particles.emitter.setEndpoint2(Vec3(point[0], point[1], point[2]))
+	self.particles.emitter.setEndpoint2(Point3(point[0],
+                                                   point[1],
+                                                   point[2]))
     def setEmitterLineVelocityVector(self, vec):
     def setEmitterLineVelocityVector(self, vec):
         print 'Emitter line velocity vector:', vec
         print 'Emitter line velocity vector:', vec
     # Point #
     # Point #
     def setEmitterPointPosition(self, pos):
     def setEmitterPointPosition(self, pos):
-	self.particles.emitter.setLocation(Vec3(pos[0], pos[1], pos[2]))
+	self.particles.emitter.setLocation(Point3(pos[0], pos[1], pos[2]))
     def setEmitterPointVelocityVector(self, velocity):
     def setEmitterPointVelocityVector(self, velocity):
         print 'Emitter point velocity:', velocity
         print 'Emitter point velocity:', velocity
     # Rectangle #
     # Rectangle #
     def setEmitterRectanglePoint1(self, point):
     def setEmitterRectanglePoint1(self, point):
-	self.particles.emitter.setMinBound(Vec3(point[0], point[1], point[2]))
+	self.particles.emitter.setMinBound(Point3(point[0], point[1],
+                                                  point[2]))
     def setEmitterRectanglePoint2(self, point):
     def setEmitterRectanglePoint2(self, point):
-	self.particles.emitter.setMaxBound(Vec3(point[0], point[1], point[2]))
+	self.particles.emitter.setMaxBound(Point3(point[0], point[1],
+                                                  point[2]))
     def setEmitterRectangleVelocityVector(self, vec):
     def setEmitterRectangleVelocityVector(self, vec):
         print 'Emitter rectangle velocity vector:', vec
         print 'Emitter rectangle velocity vector:', vec
     # Ring #
     # Ring #