From e3f2d56b6fa8be34f4851741d1cc33fcd23441a9 Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Wed, 12 Sep 2001 02:15:40 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/distributed/ClientRepository.py | 34 ++++++++++++++++++--- direct/src/distributed/DistributedObject.py | 13 ++++---- direct/src/distributed/MsgTypes.py | 9 ++++-- direct/src/fsm/FSM.py | 34 ++++++++++++--------- 4 files changed, 64 insertions(+), 26 deletions(-) diff --git a/direct/src/distributed/ClientRepository.py b/direct/src/distributed/ClientRepository.py index 97c2048a2f..37bdf67021 100644 --- a/direct/src/distributed/ClientRepository.py +++ b/direct/src/distributed/ClientRepository.py @@ -155,8 +155,6 @@ class ClientRepository(DirectObject.DirectObject): cdc = self.number2cdc[classId] # Create a new distributed object, and put it in the dictionary distObj = self.generateWithRequiredFields(cdc, doId, di) - # Call "generate" for the dist obj - #distObj.generate() return None def handleGenerateWithRequiredOther(self, di): @@ -168,8 +166,36 @@ class ClientRepository(DirectObject.DirectObject): cdc = self.number2cdc[classId] # Create a new distributed object, and put it in the dictionary distObj = self.generateWithRequiredOtherFields(cdc, doId, di) - # Call "generate" for the distObj - #distObj.generate() + return None + + def handleQuietZoneGenerateWithRequired(self, di): + # Special handler for quiet zone generates -- we need to filter + # Get the class Id + classId = di.getArg(STUint16); + # Get the DO Id + doId = di.getArg(STUint32) + # Look up the cdc + cdc = self.number2cdc[classId] + # If the class is a neverDisable class (which implies uberzone) we + # should go ahead and generate it even though we are in the quiet zone + if cdc.constructor.neverDisable: + # Create a new distributed object, and put it in the dictionary + distObj = self.generateWithRequiredFields(cdc, doId, di) + return None + + def handleQuietZoneGenerateWithRequiredOther(self, di): + # Special handler for quiet zone generates -- we need to filter + # Get the class Id + classId = di.getArg(STUint16); + # Get the DO Id + doId = di.getArg(STUint32) + # Look up the cdc + cdc = self.number2cdc[classId] + # If the class is a neverDisable class (which implies uberzone) we + # should go ahead and generate it even though we are in the quiet zone + if cdc.constructor.neverDisable: + # Create a new distributed object, and put it in the dictionary + distObj = self.generateWithRequiredOtherFields(cdc, doId, di) return None def generateWithRequiredFields(self, cdc, doId, di): diff --git a/direct/src/distributed/DistributedObject.py b/direct/src/distributed/DistributedObject.py index aabca4b04a..66a22564b6 100644 --- a/direct/src/distributed/DistributedObject.py +++ b/direct/src/distributed/DistributedObject.py @@ -6,6 +6,13 @@ from DirectNotifyGlobal import * class DistributedObject(PandaObject): """Distributed Object class:""" notify = directNotify.newCategory("DistributedObject") + + # A few objects will set neverDisable to 1... Examples are + # localToon, and anything that lives in the UberZone. This + # keeps them from being disabled when you change zones, + # even to the quiet zone. + neverDisable = 0 + def __init__(self, cr): try: self.DistributedObject_initialized @@ -13,12 +20,6 @@ class DistributedObject(PandaObject): self.DistributedObject_initialized = 1 self.cr = cr - # A few objects will set neverDisable to 1... Examples are - # localToon, and anything that lives in the UberZone. This - # keeps them from being disabled when you change zones, - # even to the quiet zone. - self.setNeverDisable(0) - # Most DistributedObjects are simple and require no real # effort to load. Some, particularly actors, may take # some significant time to load; these we can optimize by diff --git a/direct/src/distributed/MsgTypes.py b/direct/src/distributed/MsgTypes.py index e691d67584..2bde9500f6 100644 --- a/direct/src/distributed/MsgTypes.py +++ b/direct/src/distributed/MsgTypes.py @@ -11,9 +11,14 @@ CLIENT_CREATE_OBJECT_REQUIRED_OTHER = 35 # These messages are ignored when the client is headed to the quiet zone QUIET_ZONE_IGNORED_LIST = [ + # We mustn't ignore updates, because some updates for localToon # are always important. #CLIENT_OBJECT_UPDATE_FIELD, - CLIENT_CREATE_OBJECT_REQUIRED, - CLIENT_CREATE_OBJECT_REQUIRED_OTHER, + + # These are now handled. If it is a create for a class that is in the + # uber zone, we should create it. + #CLIENT_CREATE_OBJECT_REQUIRED, + #CLIENT_CREATE_OBJECT_REQUIRED_OTHER, + ] diff --git a/direct/src/fsm/FSM.py b/direct/src/fsm/FSM.py index 4747891d0c..a872aa99cf 100644 --- a/direct/src/fsm/FSM.py +++ b/direct/src/fsm/FSM.py @@ -132,8 +132,9 @@ class FSM(DirectObject): def __exitCurrent(self, argList): """__exitCurrent(self) Exit the current state""" - FSM.notify.debug("[%s]: exiting %s" % (self.__name, - self.__currentState.getName())) + if FSM.notify.getDebug(): + FSM.notify.debug("[%s]: exiting %s" % (self.__name, + self.__currentState.getName())) self.__currentState.exit(argList) # Only send the state change event if we are inspecting it # If this event turns out to be generally useful, we can @@ -147,8 +148,9 @@ class FSM(DirectObject): """__enter(self, State) Enter a given state, if it exists""" if (aState in self.__states): - FSM.notify.debug("[%s]: entering %s" % (self.__name, - aState.getName())) + if FSM.notify.getDebug(): + FSM.notify.debug("[%s]: entering %s" % (self.__name, + aState.getName())) self.__currentState = aState # Only send the state change event if we are inspecting it # If this event turns out to be generally useful, we can @@ -200,27 +202,31 @@ class FSM(DirectObject): elif (aStateName == self.__finalState.getName()): if (self.__currentState == self.__finalState): # Do not do the transition if we are already in the final state - FSM.notify.debug("[%s]: already in final state: %s" % - (self.__name, aStateName)) + if FSM.notify.getDebug(): + FSM.notify.debug("[%s]: already in final state: %s" % + (self.__name, aStateName)) return 1 else: # Force a transition to allow for cleanup - FSM.notify.debug("[%s]: implicit transition to final state: %s" % - (self.__name, aStateName)) + if FSM.notify.getDebug(): + FSM.notify.debug("[%s]: implicit transition to final state: %s" % + (self.__name, aStateName)) self.__transition(aState, enterArgList, exitArgList) return 1 # are we already in this state? elif (aStateName == self.__currentState.getName()): - FSM.notify.debug("[%s]: already in state %s and no self transition" % - (self.__name, aStateName)) + if FSM.notify.getDebug(): + FSM.notify.debug("[%s]: already in state %s and no self transition" % + (self.__name, aStateName)) return 0 else: - FSM.notify.warning("[%s]: no transition exists from %s to %s" % - (self.__name, - self.__currentState.getName(), - aStateName)) + if FSM.notify.getDebug(): + FSM.notify.warning("[%s]: no transition exists from %s to %s" % + (self.__name, + self.__currentState.getName(), + aStateName)) return 0