From 0985f1d1699480bc034d1de793d3dcf6aa2ac566 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Fri, 17 Jun 2005 01:18:56 +0000 Subject: [PATCH] generate global object --- direct/src/distributed/DistributedObjectAI.py | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index ffdb948c1a..58eb8983bf 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -335,6 +335,18 @@ class DistributedObjectAI(DirectObject.DirectObject): self.generate() if wantOtpServer: + def generateGlobalObject(self, parentId, zoneId, doId): + assert self.notify.debugStateCall(self) + self.doId = doId + # Put the new DO in the dictionaries + self.air.addDOToTables(self, location=(parentId,zoneId)) + + assert not hasattr(self, 'parentId') + self.parentId = parentId + self.zoneId = zoneId + self.__location = (parentId, zoneId) + self.generate() + def generateOtpObject(self, parentId, zoneId, optionalFields=[], doId=None): assert self.notify.debugStateCall(self) # have we already allocated a doId? @@ -342,8 +354,17 @@ class DistributedObjectAI(DirectObject.DirectObject): assert doId is None or doId == self.__preallocDoId doId=self.__preallocDoId self.__preallocDoId = 0 - self.air.sendGenerateOtpObject( - self, parentId, zoneId, optionalFields, doId=doId) + + # Assign it an id + if doId is None: + self.doId = self.air.allocateChannel() + else: + self.doId = doId + # Put the new DO in the dictionaries + self.air.addDOToTables(self, location=(parentId,zoneId)) + # Send a generate message + self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields) + assert not hasattr(self, 'parentId') self.parentId = parentId self.zoneId = zoneId @@ -376,9 +397,6 @@ class DistributedObjectAI(DirectObject.DirectObject): def sendGenerateWithRequired(self, repository, parentId, zoneId, optionalFields=[]): assert self.notify.debugStateCall(self) - if not wantOtpServer: - parentId = 0 - # Make the dclass do the hard work if not wantOtpServer: dg = self.dclass.aiFormatGenerate( self, self.doId, 0, zoneId,