Browse Source

distributed: Make a few slight cleanliness changes

I brought all of these over from the Astron fork
Sam Edwards 7 years ago
parent
commit
97368ec321

+ 2 - 0
direct/src/distributed/CRDataCache.py

@@ -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
 

+ 1 - 1
direct/src/distributed/ClientRepositoryBase.py

@@ -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,

+ 1 - 0
direct/src/distributed/ConnectionRepository.py

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

+ 2 - 0
direct/src/distributed/DistributedNode.py

@@ -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

+ 0 - 1
direct/src/distributed/DistributedNodeUD.py

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

+ 8 - 1
direct/src/distributed/DistributedObjectBase.py

@@ -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