Browse Source

*** empty log message ***

Joe Shochet 24 years ago
parent
commit
e3f2d56b6f

+ 30 - 4
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):

+ 7 - 6
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

+ 7 - 2
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,
+
     ]

+ 20 - 14
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