distributed: Make a few slight cleanliness changes

I brought all of these over from the Astron fork
This commit is contained in:
Sam Edwards 2018-02-23 15:41:03 -07:00
parent aaeb925e84
commit 97368ec321
6 changed files with 14 additions and 3 deletions

View File

@ -2,6 +2,8 @@ from direct.distributed.CachedDOData import CachedDOData
from panda3d.core import ConfigVariableInt
__all__ = ["CRDataCache"]
class CRDataCache:
# Stores cached data for DistributedObjects between instantiations on the client

View File

@ -263,7 +263,7 @@ class ClientRepositoryBase(ConnectionRepository):
distObj.setLocation(parentId, zoneId)
distObj.updateRequiredFields(dclass, di)
# updateRequiredFields calls announceGenerate
print("New DO:%s, dclass:%s"%(doId, dclass.getName()))
self.notify.debug("New DO:%s, dclass:%s" % (doId, dclass.getName()))
return distObj
def generateWithRequiredOtherFields(self, dclass, doId, di,

View File

@ -10,6 +10,7 @@ from .PyDatagramIterator import PyDatagramIterator
import types
import gc
__all__ = ["ConnectionRepository", "GCTrigger"]
class ConnectionRepository(
DoInterestManager, DoCollectionManager, CConnectionRepository):

View File

@ -15,6 +15,8 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
self.DistributedNode_initialized = 1
self.gotStringParentToken = 0
DistributedObject.DistributedObject.__init__(self, cr)
if not self.this:
NodePath.__init__(self, "DistributedNode")
# initialize gridParent
self.gridParent = None

View File

@ -1,4 +1,3 @@
#from otp.ai.AIBaseGlobal import *
from .DistributedObjectUD import DistributedObjectUD
class DistributedNodeUD(DistributedObjectUD):

View File

@ -1,4 +1,3 @@
from direct.showbase.DirectObject import DirectObject
from direct.directnotify.DirectNotifyGlobal import directNotify
@ -93,3 +92,11 @@ class DistributedObjectBase(DirectObject):
def hasParentingRules(self):
return self.dclass.getFieldByName('setParentingRules') != None
def delete(self):
"""
Override this to handle cleanup right before this object
gets deleted.
"""
pass