mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
faster tasks and network updates from objects
This commit is contained in:
parent
2a3d4d0934
commit
a20301a2b5
@ -329,7 +329,9 @@ class DistributedObjectAI(DistributedObjectBase, EnforcesCalldowns):
|
||||
def sendUpdate(self, fieldName, args = []):
|
||||
assert self.notify.debugStateCall(self)
|
||||
if self.air:
|
||||
self.air.sendUpdate(self, fieldName, args)
|
||||
dg = self.dclass.aiFormatUpdate(
|
||||
fieldName, self.doId, self.doId, self.air.ourChannel, args)
|
||||
self.air.sendDatagram(dg)
|
||||
|
||||
def GetPuppetConnectionChannel(self, doId):
|
||||
return doId + (1L << 32)
|
||||
|
@ -3050,12 +3050,12 @@ if __debug__:
|
||||
|
||||
def quickProfile(name="unnamed"):
|
||||
def profileDecorator(f):
|
||||
if(not base.config.GetBool("use-profiler",0)):
|
||||
if(not config.GetBool("use-profiler",0)):
|
||||
return f
|
||||
def _profiled(*args, **kArgs):
|
||||
# must do this in here because we don't have base/simbase
|
||||
# at the time that PythonUtil is loaded
|
||||
if(not base.config.GetBool("profile-debug",0)):
|
||||
if(not config.GetBool("profile-debug",0)):
|
||||
#dumb timings
|
||||
st=globalClock.getRealTime()
|
||||
f(*args,**kArgs)
|
||||
|
@ -410,30 +410,26 @@ class TaskManager:
|
||||
def hasTaskNamed(self, taskName):
|
||||
# TODO: check pending task list
|
||||
# Get the tasks with this name
|
||||
tasks = self.nameDict.get(taskName)
|
||||
# If we found some, see if any of them are still active (not removed)
|
||||
if tasks:
|
||||
for task in tasks:
|
||||
if not task._removed:
|
||||
return 1
|
||||
for task in self.nameDict.get(taskName, []):
|
||||
if not task._removed:
|
||||
return 1
|
||||
# Didnt find any, return 0
|
||||
return 0
|
||||
|
||||
def getTasksNamed(self, taskName):
|
||||
# TODO: check pending tasks
|
||||
# Get the tasks with this name
|
||||
tasks = self.nameDict.get(taskName, [])
|
||||
# Filter out the tasks that have been removed
|
||||
if tasks:
|
||||
tasks = filter(lambda task: not task._removed, tasks)
|
||||
return tasks
|
||||
return [task for task in self.nameDict.get(taskName, []) #grab all tasks with name
|
||||
if not task._removed] #filter removed tasks
|
||||
|
||||
def __doLaterFilter(self):
|
||||
# Filter out all the tasks that have been removed like a mark and
|
||||
# sweep garbage collector. Returns the number of tasks that have
|
||||
# been removed Warning: this creates an entirely new doLaterList.
|
||||
oldLen = len(self.__doLaterList)
|
||||
self.__doLaterList = filter(lambda task: not task._removed, self.__doLaterList)
|
||||
self.__doLaterList = [task for task in self.__doLaterList #grab all tasks with name
|
||||
if not task._removed] #filter removed tasks
|
||||
# Re heapify to maintain ordering after filter
|
||||
heapify(self.__doLaterList)
|
||||
newLen = len(self.__doLaterList)
|
||||
|
Loading…
x
Reference in New Issue
Block a user