From d4679444efb47489779894ebfc76a392f18bdfa4 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sun, 22 Nov 2009 19:32:32 +0000 Subject: [PATCH] minor distributed object fixes --- direct/src/distributed/ClientRepository.py | 12 +++++++++++- direct/src/distributed/DistributedObjectAI.py | 8 ++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/direct/src/distributed/ClientRepository.py b/direct/src/distributed/ClientRepository.py index 3b5257af69..0952dc411b 100644 --- a/direct/src/distributed/ClientRepository.py +++ b/direct/src/distributed/ClientRepository.py @@ -40,6 +40,9 @@ class ClientRepository(ClientRepositoryBase): # processed. self.currentSenderId = None + # Explicitly-requested interest zones. + self.interestZones = [] + def handleSetDoIdrange(self, di): self.doIdBase = di.getUint32() self.doIdLast = self.doIdBase + di.getUint32() @@ -136,6 +139,12 @@ class ClientRepository(ClientRepositoryBase): assert self.isLocalId(doId) self.doIdAllocator.free(doId) + def storeObjectLocation(self, object, parentId, zoneId): + # The CMU implementation doesn't use the DoCollectionManager + # much. + object.parentId = parentId + object.zoneId = zoneId + def createDistributedObject(self, className = None, distObj = None, zoneId = 0, optionalFields = None, doId = None): @@ -230,7 +239,7 @@ class ClientRepository(ClientRepositoryBase): def setInterestZones(self, interestZoneIds): """ Changes the set of zones that this particular client is interested in hearing about. """ - + datagram = PyDatagram() # Add message type datagram.addUint16(CLIENT_SET_INTEREST_CMU) @@ -240,6 +249,7 @@ class ClientRepository(ClientRepositoryBase): # send the message self.send(datagram) + self.interestZones = interestZoneIds[:] def setObjectZone(self, distObj, zoneId): """ Moves the object into the indicated zone. """ diff --git a/direct/src/distributed/DistributedObjectAI.py b/direct/src/distributed/DistributedObjectAI.py index b044d0d2e7..ff9f041a29 100644 --- a/direct/src/distributed/DistributedObjectAI.py +++ b/direct/src/distributed/DistributedObjectAI.py @@ -88,12 +88,20 @@ class DistributedObjectAI(DistributedObjectBase): if delEvent: messenger.send(delEvent) + def getCacheable(self): + """ This method exists only to mirror the similar method on + DistributedObject. AI objects aren't cacheable. """ + return False + def deleteOrDelay(self): """ This method exists only to mirror the similar method on DistributedObject. AI objects don't have delayDelete, they just get deleted immediately. """ self.delete() + def getDelayDeleteCount(self): + return 0 + def delete(self): """ Inheritors should redefine this to take appropriate action on delete