*** empty log message ***

This commit is contained in:
David Rose 2001-04-13 19:02:54 +00:00
parent c1200b5b09
commit 11cbc3ebf8
3 changed files with 34 additions and 5 deletions

View File

@ -12,6 +12,11 @@ class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):
except:
self.DistributedActor_initialized = 1
DistributedNode.DistributedNode.__init__(self, cr)
# Since actors are probably fairly heavyweight, we'd
# rather cache them than delete them if possible.
self.setCacheable(1)
return None

View File

@ -227,8 +227,14 @@ class ClientRepository(DirectObject.DirectObject):
del(self.doId2do[doId])
del(self.doId2cdc[doId])
assert(len(self.doId2do) == len(self.doId2cdc))
# cache the object
self.cache.cache(distObj)
# Only cache the object if it is a "cacheable" type
# object; this way we don't clutter up the caches with
# trivial objects that don't benefit from caching.
if distObj.getCacheable():
self.cache.cache(distObj)
else:
distObj.deleteOrDelay()
else:
ClientRepository.notify.warning("Disable failed. DistObj " +
str(doId) +

View File

@ -10,11 +10,21 @@ class DistributedObject(PandaObject):
except:
self.DistributedObject_initialized = 1
self.cr = cr
# A few objects will set neverDisable to 1... Examples are localToon, and anything
# that lives in the UberZone. This keeps them from being disabled when you change
# zones, even to the quiet zone.
# A few objects will set neverDisable to 1... Examples are
# localToon, and anything that lives in the UberZone. This
# keeps them from being disabled when you change zones,
# even to the quiet zone.
self.setNeverDisable(0)
# Most DistributedObjects are simple and require no real
# effort to load. Some, particularly actors, may take
# some significant time to load; these we can optimize by
# caching them when they go away instead of necessarily
# deleting them. The object should set cacheable to 1 if
# it needs to be optimized in this way.
self.setCacheable(0)
# This flag tells whether the object can be deleted right away,
# or not.
self.delayDeleteFlag = 0
@ -31,6 +41,14 @@ class DistributedObject(PandaObject):
def getNeverDisable(self):
return self.neverDisable
def setCacheable(self, bool):
assert((bool == 1) or (bool == 0))
self.cacheable = bool
return None
def getCacheable(self):
return self.cacheable
def deleteOrDelay(self):
if self.delayDeleteFlag:
self.deleteImminent = 1