From 20655d0303b4bdbb37c0f218955023acec67d155 Mon Sep 17 00:00:00 2001 From: Samir Naik Date: Mon, 18 Apr 2005 20:56:23 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/distributed/CartesianGridBase.py | 11 ++++++++--- direct/src/distributed/ClientRepository.py | 19 +++++++++++++++++++ .../distributed/DistributedCartesianGridAI.py | 4 ++-- direct/src/distributed/DistributedObject.py | 1 - 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/direct/src/distributed/CartesianGridBase.py b/direct/src/distributed/CartesianGridBase.py index 7487de488b..a88b79be19 100755 --- a/direct/src/distributed/CartesianGridBase.py +++ b/direct/src/distributed/CartesianGridBase.py @@ -3,10 +3,15 @@ class CartesianGridBase: def isValidZone(self, zoneId): - if ((zoneId < self.startingZone) or - (zoneId > self.startingZone + self.gridSize * self.gridSize - 1)): + if self.style == "Cartesian": + if ((zoneId < self.startingZone) or + (zoneId > self.startingZone + self.gridSize * self.gridSize - 1)): + return 0 + return 1 + elif self.style == "CartesianStated": + return 1 + else: return 0 - return 1 def getZoneFromXYZ(self, pos): # NOTE: pos should be relative to our own grid origin diff --git a/direct/src/distributed/ClientRepository.py b/direct/src/distributed/ClientRepository.py index 562bd0620c..025650deb2 100644 --- a/direct/src/distributed/ClientRepository.py +++ b/direct/src/distributed/ClientRepository.py @@ -936,3 +936,22 @@ class ClientRepository(ConnectionRepository.ConnectionRepository): def haveCreateAuthority(self): return (self.DOIDlast > self.DOIDnext) + + def getDoHierarchy(self): + return self.__doHierarchy + + def getWorld(self, doId): + # Get the world node for this object + obj = self.doId2do[doId] + + worldNP = obj.getParent() + while 1: + nextNP = worldNP.getParent() + if nextNP == render: + break + elif worldNP.isEmpty(): + return None + return worldNP + + + diff --git a/direct/src/distributed/DistributedCartesianGridAI.py b/direct/src/distributed/DistributedCartesianGridAI.py index 49c49540cc..f725a23019 100755 --- a/direct/src/distributed/DistributedCartesianGridAI.py +++ b/direct/src/distributed/DistributedCartesianGridAI.py @@ -12,9 +12,9 @@ class DistributedCartesianGridAI(DistributedNodeAI.DistributedNodeAI, RuleSeparator = ":" - def __init__(self, air, startingZone, gridSize, gridRadius): + def __init__(self, air, startingZone, gridSize, gridRadius, style="Cartesian"): DistributedNodeAI.DistributedNodeAI.__init__(self, air) - self.style = "Cartesian" + self.style = style self.startingZone = startingZone self.gridSize = gridSize self.gridRadius = gridRadius diff --git a/direct/src/distributed/DistributedObject.py b/direct/src/distributed/DistributedObject.py index a64e525c62..a42119d409 100644 --- a/direct/src/distributed/DistributedObject.py +++ b/direct/src/distributed/DistributedObject.py @@ -370,4 +370,3 @@ class DistributedObject(PandaObject): def isGridParent(self): # If this distributed object is a DistributedGrid return 1. 0 by default return 0 -