From ffecbe0e9afdd6c24c25800835e18d62dbe1cee2 Mon Sep 17 00:00:00 2001 From: Samir Naik Date: Tue, 31 May 2005 17:49:28 +0000 Subject: [PATCH] changed __location to location so we can set its initial value --- direct/src/distributed/AsyncRequest.py | 3 ++- direct/src/distributed/DistributedObject.py | 14 +++++++------- direct/src/distributed/DistributedObjectAI.py | 8 ++++---- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/direct/src/distributed/AsyncRequest.py b/direct/src/distributed/AsyncRequest.py index 6f92fd2279..5e454f9301 100755 --- a/direct/src/distributed/AsyncRequest.py +++ b/direct/src/distributed/AsyncRequest.py @@ -2,6 +2,7 @@ from otp.ai.AIBaseGlobal import * from direct.directnotify import DirectNotifyGlobal from direct.showbase.DirectObject import DirectObject +from ConnectionRepository import * if __debug__: BreakOnTimeout = config.GetBool("break-on-timeout", 0) @@ -41,7 +42,7 @@ class AsyncRequest(DirectObject): timeout is how many seconds to wait before aborting the request. """ assert self.notify.debugCall() - #assert isinstance(air, ConnectionRepository) # The api to AsyncRequest has changed. + assert isinstance(air, ConnectionRepository) # The api to AsyncRequest has changed. #DirectObject.DirectObject.__init__(self) self.air=air self.replyToChannelId=replyToChannelId diff --git a/direct/src/distributed/DistributedObject.py b/direct/src/distributed/DistributedObject.py index 95e60ce1b8..fdea1bc5ff 100644 --- a/direct/src/distributed/DistributedObject.py +++ b/direct/src/distributed/DistributedObject.py @@ -37,7 +37,7 @@ class DistributedObject(PandaObject): self.cr = cr if wantOtpServer: # Location stores the parentId, zoneId of this object - self.__location = (None, None) + self.location = (None, None) # Most DistributedObjects are simple and require no real # effort to load. Some, particularly actors, may take @@ -156,8 +156,8 @@ class DistributedObject(PandaObject): self.activeState = ESDisabled self.__callbacks = {} if wantOtpServer: - #self.cr.deleteObjectLocation(self.doId, self.__location[0], self.__location[1]) - self.__location = (None, None) + #self.cr.deleteObjectLocation(self.doId, self.location[0], self.location[1]) + self.location = (None, None) # TODO: disable my children def isDisabled(self): @@ -349,13 +349,13 @@ class DistributedObject(PandaObject): self.cr.sendSetLocation(self.doId, parentId, zoneId) def setLocation(self, parentId, zoneId): - self.notify.info("setLocation: %s parentId: %s zoneId: %s" % (self.doId, parentId, zoneId)) + #self.notify.info("setLocation: %s parentId: %s zoneId: %s" % (self.doId, parentId, zoneId)) # The store must run first so we know the old location #self.cr.storeObjectLocation(self.doId, parentId, zoneId) - self.__location = (parentId, zoneId) - # init the parentId and zoneId + self.location = (parentId, zoneId) self.parentId = parentId self.zoneId = zoneId + # Give the parent a chance to run code when a new child # sets location to it. For example, the parent may want to # scene graph reparent the child to some subnode it owns. @@ -364,7 +364,7 @@ class DistributedObject(PandaObject): parentObj.handleChildSetLocation(self, zoneId) def getLocation(self): - return self.__location + return self.location def handleChildSetLocation(self, childObj, zoneId): self.notify.info("handleChildSetLocation: %s childId: %s zoneId: %s" % diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index 3c101fe3da..b125cab61e 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -21,7 +21,7 @@ class DistributedObjectAI(DirectObject.DirectObject): # Record the repository self.air = air # Record our parentId and zoneId - self.__location = None + self.location = None # Record our distributed class className = self.__class__.__name__ @@ -167,10 +167,10 @@ class DistributedObjectAI(DirectObject.DirectObject): self.handleLogicalZoneChange(zoneId, lastLogicalZone) self.lastNonQuietZone = zoneId #self.air.storeObjectLocation(self.doId, parentId, zoneId) - self.__location = (parentId, zoneId) + self.location = (parentId, zoneId) def getLocation(self): - return self.__location + return self.location else: # NON OTP @@ -342,7 +342,7 @@ class DistributedObjectAI(DirectObject.DirectObject): assert not hasattr(self, 'parentId') self.parentId = parentId self.zoneId = zoneId - self.__location = (parentId, zoneId) + self.location = (parentId, zoneId) self.generate() def generate(self):