Browse Source

using DistributedObjectBase

Dave Schuyler 20 years ago
parent
commit
484fb2bd52

+ 8 - 11
direct/src/distributed/DistributedObject.py

@@ -1,9 +1,9 @@
 """DistributedObject module: contains the DistributedObject class"""
 
-from direct.showbase.PandaObject import *
 from direct.directnotify.DirectNotifyGlobal import directNotify
-from PyDatagram import PyDatagram
-from PyDatagramIterator import PyDatagramIterator
+from direct.distributed.DistributedObjectBase import DistributedObjectBase
+#from PyDatagram import PyDatagram
+#from PyDatagramIterator import PyDatagramIterator
 
 # Values for DistributedObject.activeState
 
@@ -14,7 +14,7 @@ ESDisabled     = 4  # values here and lower are considered "disabled"
 ESGenerating   = 5  # values here and greater are considered "generated"
 ESGenerated    = 6
 
-class DistributedObject(PandaObject):
+class DistributedObject(DistributedObjectBase):
     """
     The Distributed Object class is the base class for all network based
     (i.e. distributed) objects.  These will usually (always?) have a
@@ -34,8 +34,7 @@ class DistributedObject(PandaObject):
             self.DistributedObject_initialized
         except:
             self.DistributedObject_initialized = 1
-            self.cr = cr
-            self.children = {}
+            DistributedObjectBase.__init__(self, cr)
 
             # Most DistributedObjects are simple and require no real
             # effort to load.  Some, particularly actors, may take
@@ -64,11 +63,9 @@ class DistributedObject(PandaObject):
             # This is used by doneBarrier().
             self.__barrierContext = None
 
-            #zone of the distributed object, default to 0
-            self.zone = 0
-    
-            self.parentId = None
-            self.zoneId = None
+            ## TODO: This should probably be move to a derived class for CMU
+            ## #zone of the distributed object, default to 0
+            ## self.zone = 0
 
     if __debug__:
         def status(self, indent=0):

+ 6 - 8
direct/src/distributed/DistributedObjectAI.py

@@ -1,13 +1,13 @@
 """DistributedObjectAI module: contains the DistributedObjectAI class"""
 
-from direct.directnotify.DirectNotifyGlobal import *
+from direct.directnotify.DirectNotifyGlobal import directNotify
+from direct.distributed.DistributedObjectBase import DistributedObjectBase
 from direct.showbase import PythonUtil
-from direct.showbase.DirectObject import DirectObject
 from pandac.PandaModules import *
-from PyDatagram import PyDatagram
-from PyDatagramIterator import PyDatagramIterator
+#from PyDatagram import PyDatagram
+#from PyDatagramIterator import PyDatagramIterator
 
-class DistributedObjectAI(DirectObject):
+class DistributedObjectAI(DistributedObjectBase):
     notify = directNotify.newCategory("DistributedObjectAI")
     QuietZone = 1
 
@@ -16,13 +16,11 @@ class DistributedObjectAI(DirectObject):
             self.DistributedObjectAI_initialized
         except:
             self.DistributedObjectAI_initialized = 1
+            DistributedObjectBase.__init__(self, air)
 
             self.accountName=''
             # Record the repository
             self.air = air
-            # Record our parentId and zoneId
-            self.parentId = None
-            self.zoneId = None
 
             # Record our distributed class
             className = self.__class__.__name__

+ 6 - 5
direct/src/distributed/DistributedObjectOV.py

@@ -1,8 +1,9 @@
-from direct.showbase.PandaObject import *
+
 from direct.directnotify.DirectNotifyGlobal import directNotify
+from direct.distributed.DistributedObjectBase import DistributedObjectBase
 
-from PyDatagram import PyDatagram
-from PyDatagramIterator import PyDatagramIterator
+#from PyDatagram import PyDatagram
+#from PyDatagramIterator import PyDatagramIterator
 
 # Values for DistributedObjectOV.activeState
 # these should match DistributedObject.ES*
@@ -14,7 +15,7 @@ ESDisabled     = 4  # values here and lower are considered "disabled"
 ESGenerating   = 5  # values here and greater are considered "generated"
 ESGenerated    = 6
 
-class DistributedObjectOV(PandaObject):
+class DistributedObjectOV(DistributedObjectBase):
     """
     Implementation of the 'owner view' (OV) of a distributed object; 
     """
@@ -26,7 +27,7 @@ class DistributedObjectOV(PandaObject):
             self.DistributedObjectOV_initialized
         except:
             self.DistributedObjectOV_initialized = 1
-            self.cr = cr
+            DistributedObjectBase.__init__(self, cr)
 
             # This count tells whether the object can be deleted right away,
             # or not.

+ 6 - 8
direct/src/distributed/DistributedObjectUD.py

@@ -1,13 +1,13 @@
 """DistributedObjectUD module: contains the DistributedObjectUD class"""
 
-from direct.directnotify.DirectNotifyGlobal import *
+from direct.directnotify.DirectNotifyGlobal import directNotify
+from direct.distributed.DistributedObjectBase import DistributedObjectBase
 from direct.showbase import PythonUtil
-from direct.showbase.DirectObject import DirectObject
 from pandac.PandaModules import *
-from PyDatagram import PyDatagram
-from PyDatagramIterator import PyDatagramIterator
+#from PyDatagram import PyDatagram
+#from PyDatagramIterator import PyDatagramIterator
 
-class DistributedObjectUD(DirectObject):
+class DistributedObjectUD(DistributedObjectBase):
     notify = directNotify.newCategory("DistributedObjectUD")
     QuietZone = 1
 
@@ -16,13 +16,11 @@ class DistributedObjectUD(DirectObject):
             self.DistributedObjectUD_initialized
         except:
             self.DistributedObjectUD_initialized = 1
+            DistributedObjectBase.__init__(self, air)
 
             self.accountName=''
             # Record the repository
             self.air = air
-            # Record our parentId and zoneId
-            self.parentId = None
-            self.zoneId = None
 
             # Record our distributed class
             className = self.__class__.__name__