mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
asserting notify statements to clean up the game logs
This commit is contained in:
parent
d2e689f8d3
commit
a480d86b62
@ -483,7 +483,7 @@ class Actor(DirectObject, NodePath):
|
|||||||
|
|
||||||
def removeNode(self):
|
def removeNode(self):
|
||||||
if self.__geomNode and (self.__geomNode.getNumChildren() > 0):
|
if self.__geomNode and (self.__geomNode.getNumChildren() > 0):
|
||||||
self.notify.warning("called actor.removeNode() on %s without calling cleanup()" % self.getName())
|
assert self.notify.warning("called actor.removeNode() on %s without calling cleanup()" % self.getName())
|
||||||
NodePath.removeNode(self)
|
NodePath.removeNode(self)
|
||||||
|
|
||||||
def clearPythonData(self):
|
def clearPythonData(self):
|
||||||
|
@ -22,7 +22,6 @@ class ControlManager:
|
|||||||
wantWASD = config.GetBool('want-WASD', 0)
|
wantWASD = config.GetBool('want-WASD', 0)
|
||||||
|
|
||||||
def __init__(self, enable=True, passMessagesThrough = False):
|
def __init__(self, enable=True, passMessagesThrough = False):
|
||||||
print ("init control manager %s" % (passMessagesThrough))
|
|
||||||
assert self.notify.debugCall(id(self))
|
assert self.notify.debugCall(id(self))
|
||||||
self.passMessagesThrough = passMessagesThrough
|
self.passMessagesThrough = passMessagesThrough
|
||||||
self.inputStateTokens = []
|
self.inputStateTokens = []
|
||||||
|
@ -7,6 +7,7 @@ from direct.task import Task
|
|||||||
from direct.gui import DirectGuiGlobals
|
from direct.gui import DirectGuiGlobals
|
||||||
from direct.showbase.EventGroup import EventGroup
|
from direct.showbase.EventGroup import EventGroup
|
||||||
from direct.showbase.PythonUtil import report
|
from direct.showbase.PythonUtil import report
|
||||||
|
from direct.distributed.GridParent import GridParent
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
# For grid drawing
|
# For grid drawing
|
||||||
@ -76,6 +77,31 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
def getCenterPos(self):
|
def getCenterPos(self):
|
||||||
return self.centerPos
|
return self.centerPos
|
||||||
|
|
||||||
|
def handleChildArrive(self, child, zoneId):
|
||||||
|
DistributedNode.handleChildArrive(self, child, zoneId)
|
||||||
|
if (zoneId >= self.startingZone):
|
||||||
|
if not child.gridParent:
|
||||||
|
child.gridParent = GridParent(child)
|
||||||
|
child.gridParent.setGridParent(self, zoneId)
|
||||||
|
elif child.gridParent:
|
||||||
|
child.gridParent.delete()
|
||||||
|
child.gridParent = None
|
||||||
|
|
||||||
|
def handleChildArriveZone(self, child, zoneId):
|
||||||
|
DistributedNode.handleChildArrive(self, child, zoneId)
|
||||||
|
if (zoneId >= self.startingZone):
|
||||||
|
if not child.gridParent:
|
||||||
|
child.gridParent = GridParent(child)
|
||||||
|
child.gridParent.setGridParent(self, zoneId)
|
||||||
|
elif child.gridParent:
|
||||||
|
child.gridParent.delete()
|
||||||
|
child.gridParent = None
|
||||||
|
|
||||||
|
def handleChildLeave(self, child, zoneId):
|
||||||
|
if child.gridParent:
|
||||||
|
child.gridParent.delete()
|
||||||
|
child.gridParent = None
|
||||||
|
|
||||||
@report(types = ['deltaStamp', 'avLocation', 'args'], dConfigParam = ['want-connector-report','want-shipboard-report'])
|
@report(types = ['deltaStamp', 'avLocation', 'args'], dConfigParam = ['want-connector-report','want-shipboard-report'])
|
||||||
def startProcessVisibility(self, avatar):
|
def startProcessVisibility(self, avatar):
|
||||||
if not self._onOffState:
|
if not self._onOffState:
|
||||||
@ -234,7 +260,7 @@ class DistributedCartesianGrid(DistributedNode, CartesianGridBase):
|
|||||||
# zones.
|
# zones.
|
||||||
# Make sure this is a valid zone
|
# Make sure this is a valid zone
|
||||||
if not self.isValidZone(zoneId):
|
if not self.isValidZone(zoneId):
|
||||||
self.notify.warning("handleAvatarZoneChange: not a valid zone (%s)" % zoneId)
|
assert self.notify.warning("handleAvatarZoneChange: not a valid zone (%s)" % zoneId)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Set the location on the server
|
# Set the location on the server
|
||||||
|
@ -292,7 +292,7 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
|
|||||||
self.lastSuggestResync = realTime
|
self.lastSuggestResync = realTime
|
||||||
timestampB = globalClockDelta.localToNetworkTime(realTime)
|
timestampB = globalClockDelta.localToNetworkTime(realTime)
|
||||||
serverTime = realTime - globalClockDelta.getDelta()
|
serverTime = realTime - globalClockDelta.getDelta()
|
||||||
self.notify.info(
|
assert self.notify.info(
|
||||||
"Suggesting resync for %s, with discrepency %s; local time is %s and server time is %s." % (
|
"Suggesting resync for %s, with discrepency %s; local time is %s and server time is %s." % (
|
||||||
self.doId, howFarFuture - chug,
|
self.doId, howFarFuture - chug,
|
||||||
realTime, serverTime))
|
realTime, serverTime))
|
||||||
@ -364,12 +364,12 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
|
|||||||
globalClockDelta.getUncertainty() != None:
|
globalClockDelta.getUncertainty() != None:
|
||||||
other = self.cr.doId2do.get(avId)
|
other = self.cr.doId2do.get(avId)
|
||||||
if (not other):
|
if (not other):
|
||||||
self.notify.info(
|
assert self.notify.info(
|
||||||
"Warning: couldn't find the avatar %d" % (avId))
|
"Warning: couldn't find the avatar %d" % (avId))
|
||||||
elif hasattr(other, "d_returnResync"):
|
elif hasattr(other, "d_returnResync"):
|
||||||
realTime = globalClock.getRealTime()
|
realTime = globalClock.getRealTime()
|
||||||
serverTime = realTime - globalClockDelta.getDelta()
|
serverTime = realTime - globalClockDelta.getDelta()
|
||||||
self.notify.info(
|
assert self.notify.info(
|
||||||
"Returning resync for %s; local time is %s and server time is %s." % (
|
"Returning resync for %s; local time is %s and server time is %s." % (
|
||||||
self.doId, realTime, serverTime))
|
self.doId, realTime, serverTime))
|
||||||
other.d_returnResync(
|
other.d_returnResync(
|
||||||
|
@ -259,8 +259,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
# we're not pending a removal, but we have outstanding events?
|
# we're not pending a removal, but we have outstanding events?
|
||||||
# probably we are waiting for an add/alter complete.
|
# probably we are waiting for an add/alter complete.
|
||||||
# should we send those events now?
|
# should we send those events now?
|
||||||
self.notify.warning('removeInterest: abandoning events: %s' %
|
assert self.notify.warning('removeInterest: abandoning events: %s' %
|
||||||
intState.events)
|
intState.events)
|
||||||
intState.clearEvents()
|
intState.clearEvents()
|
||||||
intState.state = InterestState.StatePendingDel
|
intState.state = InterestState.StatePendingDel
|
||||||
contextId = self._getNextContextId()
|
contextId = self._getNextContextId()
|
||||||
|
@ -505,7 +505,7 @@ class TaskManager:
|
|||||||
def doMethodLater(self, delayTime, funcOrTask, name, extraArgs=None,
|
def doMethodLater(self, delayTime, funcOrTask, name, extraArgs=None,
|
||||||
priority=0, uponDeath=None, appendTask=False, owner = None):
|
priority=0, uponDeath=None, appendTask=False, owner = None):
|
||||||
if delayTime < 0:
|
if delayTime < 0:
|
||||||
self.notify.warning('doMethodLater: added task: %s with negative delay: %s' % (name, delayTime))
|
assert self.notify.warning('doMethodLater: added task: %s with negative delay: %s' % (name, delayTime))
|
||||||
if isinstance(funcOrTask, Task):
|
if isinstance(funcOrTask, Task):
|
||||||
task = funcOrTask
|
task = funcOrTask
|
||||||
elif callable(funcOrTask):
|
elif callable(funcOrTask):
|
||||||
@ -747,7 +747,7 @@ class TaskManager:
|
|||||||
# warn if the task took too long
|
# warn if the task took too long
|
||||||
if self.warnTaskDuration:
|
if self.warnTaskDuration:
|
||||||
if dt >= self.taskDurationWarningThreshold:
|
if dt >= self.taskDurationWarningThreshold:
|
||||||
TaskManager.notify.warning('task %s ran for %.2f seconds' % (
|
assert TaskManager.notify.warning('task %s ran for %.2f seconds' % (
|
||||||
task.name, dt))
|
task.name, dt))
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
x
Reference in New Issue
Block a user