From 9fcb8cf1593fdc8e87d6db9929e87135ac1ebb4d Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 11 Feb 2005 21:17:07 +0000 Subject: [PATCH] another round of test fixes --- direct/src/distributed/ClientRepository.py | 19 +++++++++++++++++++ direct/src/distributed/DistributedObject.py | 2 +- .../src/distributed/DistributedSmoothNode.py | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/direct/src/distributed/ClientRepository.py b/direct/src/distributed/ClientRepository.py index 106aedd999..246e2f82a5 100644 --- a/direct/src/distributed/ClientRepository.py +++ b/direct/src/distributed/ClientRepository.py @@ -723,6 +723,25 @@ class ClientRepository(ConnectionRepository.ConnectionRepository): # send the message self.send(datagram) + def getObjectsOfClass(self, objClass): + """ returns dict of doId:object, containing all objects + that inherit from 'class'. returned dict is safely mutable. """ + doDict = {} + for doId, do in self.doId2do.items(): + if isinstance(do, objClass): + doDict[doId] = do + return doDict + + def getObjectsOfExactClass(self, objClass): + """ returns dict of doId:object, containing all objects that + are exactly of type 'class' (neglecting inheritance). returned + dict is safely mutable. """ + doDict = {} + for doId, do in self.doId2do.items(): + if do.__class__ == objClass: + doDict[doId] = do + return doDict + if wantOtpServer: def sendEmulateSetZone(self, zoneId, visibleZoneList=None, parentIdin=None, event=None): """ diff --git a/direct/src/distributed/DistributedObject.py b/direct/src/distributed/DistributedObject.py index 1c144ff558..e31f9f1946 100644 --- a/direct/src/distributed/DistributedObject.py +++ b/direct/src/distributed/DistributedObject.py @@ -350,7 +350,7 @@ class DistributedObject(PandaObject): # which means the client created it instead of the AI, and it # gets some other special handling. Normally, only the local # avatar class overrides this to return true. - return (self.cr.isLocalId(self.doId)) + return self.cr and self.cr.isLocalId(self.doId) def updateZone(self, zoneId): self.cr.sendUpdateZone(self, zoneId) diff --git a/direct/src/distributed/DistributedSmoothNode.py b/direct/src/distributed/DistributedSmoothNode.py index 5b537b4fb5..d60262f77c 100644 --- a/direct/src/distributed/DistributedSmoothNode.py +++ b/direct/src/distributed/DistributedSmoothNode.py @@ -121,7 +121,7 @@ class DistributedSmoothNode(DistributedNode.DistributedNode, running, you won't be able to lerp the node or directly position it. """ - if not self.wantsSmoothing() or self.isLocal() or self.isDisabled(): + if not self.wantsSmoothing() or self.isDisabled() or self.isLocal(): return if not self.smoothStarted: taskName = self.taskName("smooth")