diff --git a/direct/src/distributed/ClientRepository.py b/direct/src/distributed/ClientRepository.py index 4bb07cf040..6040c71c38 100644 --- a/direct/src/distributed/ClientRepository.py +++ b/direct/src/distributed/ClientRepository.py @@ -266,13 +266,14 @@ class ClientRepository(DirectObject.DirectObject): doId = di.getArg(STUint32) #print("Updating " + str(doId)) # Find the DO - assert(self.doId2do.has_key(doId)) - do = self.doId2do[doId] - # Find the cdc - assert(self.doId2cdc.has_key(doId)) - cdc = self.doId2cdc[doId] - # Let the cdc finish the job - cdc.updateField(do, di) + do = self.doId2do.get(doId) + cdc = self.doId2cdc.get(doId) + if (do != None and cdc != None): + # Let the cdc finish the job + cdc.updateField(do, di) + else: + ClientRepository.notify.warning( + "Asked to update non-existent DistObj " + str(doId)) return None def handleUnexpectedMsgType(self, msgType, di): diff --git a/direct/src/distributed/MsgTypes.py b/direct/src/distributed/MsgTypes.py index d274011083..a20e93d34d 100644 --- a/direct/src/distributed/MsgTypes.py +++ b/direct/src/distributed/MsgTypes.py @@ -1,10 +1,17 @@ -"""MsgTypes module: contains distributed object message types""" - -CLIENT_OBJECT_UPDATE_FIELD = 24 -CLIENT_OBJECT_UPDATE_FIELD_RESP = 24 -CLIENT_OBJECT_DISABLE_RESP = 25 -CLIENT_OBJECT_DELETE_RESP = 27 -CLIENT_SET_ZONE = 29 -CLIENT_SET_SHARD = 31 -CLIENT_CREATE_OBJECT_REQUIRED = 34 -CLIENT_CREATE_OBJECT_REQUIRED_OTHER = 35 +"""MsgTypes module: contains distributed object message types""" + +CLIENT_OBJECT_UPDATE_FIELD = 24 +CLIENT_OBJECT_UPDATE_FIELD_RESP = 24 +CLIENT_OBJECT_DISABLE_RESP = 25 +CLIENT_OBJECT_DELETE_RESP = 27 +CLIENT_SET_ZONE = 29 +CLIENT_SET_SHARD = 31 +CLIENT_CREATE_OBJECT_REQUIRED = 34 +CLIENT_CREATE_OBJECT_REQUIRED_OTHER = 35 + +# These messages are ignored when the client is headed to the quiet zone +QUIET_ZONE_IGNORED_LIST = [ + CLIENT_OBJECT_UPDATE_FIELD, + CLIENT_CREATE_OBJECT_REQUIRED, + CLIENT_CREATE_OBJECT_REQUIRED_OTHER, + ] diff --git a/direct/src/showbase/ShowBaseGlobal.py b/direct/src/showbase/ShowBaseGlobal.py index 9ad7247766..a0c5d22c0a 100644 --- a/direct/src/showbase/ShowBaseGlobal.py +++ b/direct/src/showbase/ShowBaseGlobal.py @@ -7,7 +7,6 @@ __builtin__.base = ShowBase() # Make some global aliases for convenience __builtin__.ostream = Notify.out() -__builtin__.run = base.run __builtin__.directNotify = directNotify # Set direct notify categories now that we have config diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 2a59cc3af3..3deac55f35 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -71,7 +71,7 @@ def pause(delayTime): return cont else: # Time is up, return done - TaskManager.notify.debug('pause done: ' + self.name) + # TaskManager.notify.debug('pause done: ' + self.name) return done task = Task(func) task.name = 'pause' @@ -82,7 +82,7 @@ def pause(delayTime): def release(): def func(self): # A release is immediately done - TaskManager.notify.debug('release done: ' + self.name) + # TaskManager.notify.debug('release done: ' + self.name) return done task = Task(func) task.name = 'release' @@ -97,7 +97,7 @@ def make_sequence(taskList): def func(self): # If we got to the end of the list, this sequence is done if (self.index >= len(self.taskList)): - TaskManager.notify.debug('sequence done: ' + self.name) + # TaskManager.notify.debug('sequence done: ' + self.name) return done else: task = self.taskList[self.index] @@ -150,7 +150,7 @@ def make_loop(taskList): def func(self): # If we got to the end of the list, this sequence is done if (self.index >= len(self.taskList)): - TaskManager.notify.debug('sequence done, looping: ' + self.name) + # TaskManager.notify.debug('sequence done, looping: ' + self.name) self.prevIndex = -1 self.index = 0 return cont @@ -235,7 +235,7 @@ def timeline(*timelineList): self.sequenceDone = 1 # See if the timeline is done if (lenTaskList == 0): - TaskManager.notify.debug('timeline done: ' + self.name) + # TaskManager.notify.debug('timeline done: ' + self.name) return done else: return cont @@ -273,7 +273,8 @@ class TaskManager: return self.spawnTaskNamed(task, name) def spawnTaskNamed(self, task, name): - TaskManager.notify.debug('spawning task named: ' + name) + if TaskManager.notify.getDebug(): + TaskManager.notify.debug('spawning task named: ' + name) task.name = name task.setStartTimeFrame(self.currentTime, self.currentFrame) # search back from the end of the list until we find a @@ -315,22 +316,26 @@ class TaskManager: self.removeTask(task) def removeTask(self, task): - TaskManager.notify.debug('removing task: ' + `task`) + if TaskManager.notify.getDebug(): + TaskManager.notify.debug('removing task: ' + `task`) + removed = 0 try: self.taskList.remove(task) + removed = 1 except: pass - if task.uponDeath: + if (task.uponDeath and removed): task.uponDeath(task) def removeTasksNamed(self, taskName): - TaskManager.notify.debug('removing tasks named: ' + taskName) - removedTasks = [] + if TaskManager.notify.getDebug(): + TaskManager.notify.debug('removing tasks named: ' + taskName) # Find the tasks that match by name and make a list of them + removedTasks = [] for task in self.taskList: - if (task.name == taskName): - removedTasks.append(task) + if (task.name == taskName): + removedTasks.append(task) # Now iterate through the tasks we need to remove and remove them for task in removedTasks: @@ -352,7 +357,8 @@ class TaskManager: standard shell globbing characters like *, ?, and []. """ - TaskManager.notify.debug('removing tasks matching: ' + taskPattern) + if TaskManager.notify.getDebug(): + TaskManager.notify.debug('removing tasks matching: ' + taskPattern) removedTasks = [] # Find the tasks that match by name and make a list of them @@ -362,13 +368,14 @@ class TaskManager: # Now iterate through the tasks we need to remove and remove them for task in removedTasks: - self.removeTask(task) + self.removeTask(task) # Return the number of tasks removed return len(removedTasks) def step(self): - TaskManager.notify.debug('step') + if TaskManager.notify.getDebug(): + TaskManager.notify.debug('step') self.currentTime, self.currentFrame = getTimeFrame() for task in self.taskList: task.setCurrentTimeFrame(self.currentTime, self.currentFrame)