*** empty log message ***

This commit is contained in:
Joe Shochet 2001-06-06 16:40:10 +00:00
parent 08ddb0c4aa
commit 160ecdf91c
3 changed files with 52 additions and 59 deletions

View File

@ -25,7 +25,6 @@ import SphereVolumeEmitter
import TangentRingEmitter import TangentRingEmitter
import string import string
import os import os
import DirectSelection
import DirectNotifyGlobal import DirectNotifyGlobal
SparkleParticleRenderer.SparkleParticleRenderer.SPNOSCALE = 0 SparkleParticleRenderer.SparkleParticleRenderer.SPNOSCALE = 0
@ -135,6 +134,9 @@ class Particles(ParticleSystem.ParticleSystem):
elif (type == "GeomParticleRenderer"): elif (type == "GeomParticleRenderer"):
self.renderer = GeomParticleRenderer.GeomParticleRenderer() self.renderer = GeomParticleRenderer.GeomParticleRenderer()
npath = hidden.attachNewNode(NamedNode('default-geom')) npath = hidden.attachNewNode(NamedNode('default-geom'))
# This was moved here because we do not want to download
# the direct tools with toontown.
import DirectSelection
bbox = DirectSelection.DirectBoundingBox(npath) bbox = DirectSelection.DirectBoundingBox(npath)
self.renderer.setGeomNode(bbox.lines.node()) self.renderer.setGeomNode(bbox.lines.node())
elif (type == "SparkleParticleRenderer"): elif (type == "SparkleParticleRenderer"):

View File

@ -37,11 +37,12 @@ class Messenger:
to this event, otherwise it will respond only once. to this event, otherwise it will respond only once.
""" """
Messenger.notify.debug('object: ' + `object` if Messenger.notify.getDebug():
+ '\n now accepting: ' + `event` Messenger.notify.debug('object: ' + `object`
+ '\n method: ' + `method` + '\n now accepting: ' + `event`
+ '\n extraArgs: ' + `extraArgs` + '\n method: ' + `method`
+ '\n persistent: ' + `persistent`) + '\n extraArgs: ' + `extraArgs`
+ '\n persistent: ' + `persistent`)
acceptorDict = ifAbsentPut(self.dict, event, {}) acceptorDict = ifAbsentPut(self.dict, event, {})
acceptorDict[object] = [method, extraArgs, persistent] acceptorDict[object] = [method, extraArgs, persistent]
@ -51,39 +52,34 @@ class Messenger:
Make this object no longer respond to this event. Make this object no longer respond to this event.
It is safe to call even if it was not already accepting It is safe to call even if it was not already accepting
""" """
if Messenger.notify.getDebug():
Messenger.notify.debug(`object` + '\n now ignoring: ' + `event`)
Messenger.notify.debug(`object` + '\n now ignoring: ' + `event`) # Find the dictionary of all the objects accepting this event
acceptorDict = self.dict.get(event)
if self.dict.has_key(event): # If this object is there, delete it from the dictionary
# Find the dictionary of all the objects accepting this event if acceptorDict and acceptorDict.has_key(object):
acceptorDict = self.dict[event] del acceptorDict[object]
# If this object is there, delete it from the dictionary
if acceptorDict.has_key(object):
del acceptorDict[object]
# If this dictionary is now empty, remove the event # If this dictionary is now empty, remove the event
# entry from the Messenger alltogether # entry from the Messenger alltogether
if (len(acceptorDict) == 0): if (len(acceptorDict) == 0):
del self.dict[event] del self.dict[event]
def ignoreAll(self, object): def ignoreAll(self, object):
""" ignoreAll(self, DirectObject) """ ignoreAll(self, DirectObject)
Make this object no longer respond to any events it was accepting Make this object no longer respond to any events it was accepting
Useful for cleanup Useful for cleanup
""" """
if Messenger.notify.getDebug():
Messenger.notify.debug(`object` + '\n now ignoring all events') Messenger.notify.debug(`object` + '\n now ignoring all events')
for event, acceptorDict in self.dict.items():
for event in self.dict.keys():
# Find the dictionary of all the objects accepting this event
acceptorDict = self.dict[event]
# If this object is there, delete it from the dictionary # If this object is there, delete it from the dictionary
if acceptorDict.has_key(object): if acceptorDict.has_key(object):
del acceptorDict[object] del acceptorDict[object]
# If this dictionary is now empty, remove the event # If this dictionary is now empty, remove the event
# entry from the Messenger alltogether # entry from the Messenger alltogether
if (len(acceptorDict) == 0): if (len(acceptorDict) == 0):
del self.dict[event] del self.dict[event]
def isAccepting(self, event, object): def isAccepting(self, event, object):
@ -94,7 +90,6 @@ class Messenger:
if self.dict[event].has_key(object): if self.dict[event].has_key(object):
# Found it, return true # Found it, return true
return 1 return 1
# If we looked in both dictionaries and made it here # If we looked in both dictionaries and made it here
# that object must not be accepting that event. # that object must not be accepting that event.
return 0 return 0
@ -115,31 +110,31 @@ class Messenger:
""" send(self, string, [arg1, arg2,...]) """ send(self, string, [arg1, arg2,...])
Send this event, optionally passing in arguments Send this event, optionally passing in arguments
""" """
# Do not print the new frame debug, it is too noisy! # Do not print the new frame debug, it is too noisy!
if (event != 'NewFrame'): if (Messenger.notify.getDebug() and (event != 'NewFrame')):
Messenger.notify.debug('sent event: ' + event + ' sentArgs: ' + `sentArgs`) Messenger.notify.debug('sent event: ' + event + ' sentArgs: ' + `sentArgs`)
acceptorDict = self.dict.get(event)
if self.dict.has_key(event): if not acceptorDict:
acceptorDict = self.dict[event] return
for object in self.dict[event].keys(): for object in acceptorDict.keys():
# We have to make this apparently redundant check, because # We have to make this apparently redundant check, because
# it is possible that one object removes its own hooks # it is possible that one object removes its own hooks
# in response to a handler called by a previous object. # in response to a handler called by a previous object.
if acceptorDict.has_key(object): callList = acceptorDict.get(object)
method, extraArgs, persistent = acceptorDict[object] if callList:
apply(method, (extraArgs + sentArgs)) method, extraArgs, persistent = callList
# If this object was only accepting this event once, apply(method, (extraArgs + sentArgs))
# remove it from the dictionary # If this object was only accepting this event once,
if not persistent: # remove it from the dictionary
# We need to check this because the apply above might if not persistent:
# have done an ignore. # We need to check this because the apply above might
if acceptorDict.has_key(object): # have done an ignore.
del acceptorDict[object] if acceptorDict.has_key(object):
# If the dictionary at this event is now empty, remove the event del acceptorDict[object]
# entry from the Messenger alltogether # If the dictionary at this event is now empty, remove the event
if (self.dict.has_key(event) and (len(self.dict[event]) == 0)): # entry from the Messenger alltogether
del self.dict[event] if (self.dict.has_key(event) and (len(self.dict[event]) == 0)):
del self.dict[event]
def clear(self): def clear(self):
"""clear(self) """clear(self)

View File

@ -316,16 +316,12 @@ class TaskManager:
self.removeTask(task) self.removeTask(task)
def removeTask(self, task): def removeTask(self, task):
if TaskManager.notify.getDebug(): # if TaskManager.notify.getDebug():
TaskManager.notify.debug('removing task: ' + `task`) # TaskManager.notify.debug('removing task: ' + `task`)
removed = 0 if task in self.taskList:
try:
self.taskList.remove(task) self.taskList.remove(task)
removed = 1 if task.uponDeath:
except: task.uponDeath(task)
pass
if (task.uponDeath and removed):
task.uponDeath(task)
def removeTasksNamed(self, taskName): def removeTasksNamed(self, taskName):
if TaskManager.notify.getDebug(): if TaskManager.notify.getDebug():