From 3b31e5f5672d9c6adc5854505fbc00c1b56b96c6 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Tue, 12 Jul 2005 22:05:12 +0000 Subject: [PATCH] added want global managers --- direct/src/distributed/ClientRepository.py | 17 +++--- .../src/distributed/ConnectionRepository.py | 55 +++++++++++++++++++ 2 files changed, 62 insertions(+), 10 deletions(-) diff --git a/direct/src/distributed/ClientRepository.py b/direct/src/distributed/ClientRepository.py index 748f889a0e..b9380ceecf 100644 --- a/direct/src/distributed/ClientRepository.py +++ b/direct/src/distributed/ClientRepository.py @@ -296,7 +296,7 @@ class ClientRepository(ConnectionRepository): print "New DO:%s, dclass:%s"%(doId, dclass.getName()) return distObj - def generateGlobalObject(self , doId, dcname): + def generateGlobalObject(self, doId, dcname): # Look up the dclass dclass = self.dclassesByName[dcname] # Create a new distributed object, and put it in the dictionary @@ -316,11 +316,12 @@ class ClientRepository(ConnectionRepository): # Update the required fields distObj.generateInit() # Only called when constructed distObj.generate() - if wantOtpServer: - # TODO: ROGER: where should we get parentId and zoneId? - parentId = None - zoneId = None - distObj.setLocation(parentId, zoneId) + if not wantGlobalManagers: + if wantOtpServer: + # TODO: ROGER: where should we get parentId and zoneId? + parentId = None + zoneId = None + distObj.setLocation(parentId, zoneId) # updateRequiredFields calls announceGenerate return distObj @@ -819,10 +820,6 @@ class ClientRepository(ConnectionRepository): taskMgr.doMethodLater(self.heartbeatInterval, self.sendHeartbeatTask, "heartBeat") - def sendUpdate(self, do, fieldName, args, sendToId = None): - dg = do.dclass.clientFormatUpdate(fieldName, sendToId or do.doId, args) - self.send(dg) - def sendUpdateZone(self, obj, zoneId): # This method is only used in conjunction with the CMU LAN # server. diff --git a/direct/src/distributed/ConnectionRepository.py b/direct/src/distributed/ConnectionRepository.py index fa7bd2bdd8..4aa749d25d 100644 --- a/direct/src/distributed/ConnectionRepository.py +++ b/direct/src/distributed/ConnectionRepository.py @@ -59,6 +59,61 @@ class ConnectionRepository( # DC file. The AIRepository will redefine this to 'AI'. self.dcSuffix = '' + if wantGlobalManagers: + def generateGlobalObject(self, doId, dcname): + # Look up the dclass + dclass = self.dclassesByName[dcname+self.dcSuffix] + # Create a new distributed object, and put it in the dictionary + #distObj = self.generateWithRequiredFields(dclass, doId, di) + + # Construct a new one + classDef = dclass.getClassDef() + if classDef == None: + self.notify.error("Could not create an undefined %s object."%( + dclass.getName())) + distObj = classDef(self) + distObj.dclass = dclass + # Assign it an Id + distObj.doId = doId + # Put the new do in the dictionary + self.doId2do[doId] = distObj + # Update the required fields + distObj.generateInit() # Only called when constructed + distObj.generate() + ## if wantOtpServer: + ## # TODO: ROGER: where should we get parentId and zoneId? + ## parentId = None + ## zoneId = None + ## distObj.setLocation(parentId, zoneId) + # updateRequiredFields calls announceGenerate + return distObj + + ## def generateGlobalObject(self, doId, dcname, parentId=None, zoneId=None): + ## assert self.notify.debugStateCall(self) + ## # Look up the dclass + ## dclass = self.dclassesByName[dcname] + ## # Construct a new one + ## classDef = dclass.getClassDef() + ## if classDef == None: + ## self.notify.error("Could not create an undefined %s object."%( + ## dclass.getName())) + ## distObj = classDef(self) + ## distObj.dclass = dclass + + ## assert not hasattr(self, 'parentId') + ## self.doId = doId + ## self.parentId = parentId + ## self.zoneId = zoneId + ## # 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 + ## distObj.generateInit() # Only called when constructed + ## self.generate() + ## return distObj + def readDCFile(self, dcFileNames = None): """ Reads in the dc files listed in dcFileNames, or if