Pārlūkot izejas kodu

Tasks can return None to mean done now

Joe Shochet 22 gadi atpakaļ
vecāks
revīzija
0c81219af1
1 mainītis faili ar 3 papildinājumiem un 2 dzēšanām
  1. 3 2
      direct/src/task/Task.py

+ 3 - 2
direct/src/task/Task.py

@@ -1,3 +1,4 @@
+
 from libpandaexpressModules import *
 from libpandaexpressModules import *
 from DirectNotifyGlobal import *
 from DirectNotifyGlobal import *
 from PythonUtil import *
 from PythonUtil import *
@@ -621,7 +622,7 @@ class TaskManager:
             if (ret == cont):
             if (ret == cont):
                 # Leave it for next frame, its not done yet
                 # Leave it for next frame, its not done yet
                 pass
                 pass
-            elif ((ret == done) or (ret == exit)):
+            elif ((ret == done) or (ret == exit) or (ret == None)):
                 assert(TaskManager.notify.debug('__stepThroughList: task is finished %s' % (task)))
                 assert(TaskManager.notify.debug('__stepThroughList: task is finished %s' % (task)))
                 # Remove the task
                 # Remove the task
                 if not task.isRemoved():
                 if not task.isRemoved():
@@ -638,7 +639,7 @@ class TaskManager:
                 # Do not increment the iterator
                 # Do not increment the iterator
                 continue
                 continue
             else:
             else:
-                raise StandardError, "Task named %s did not return cont, exit, or done" % task.name
+                raise StandardError, "Task named %s did not return cont, exit, done, or None" % task.name
             # Move to the next element
             # Move to the next element
             i += 1
             i += 1