mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
print object type when DoHierarchy gets an error
This commit is contained in:
parent
c6b8cb9cd6
commit
00e0c59f0f
@ -192,7 +192,7 @@ class DistributedObjectAI(DistributedObjectBase):
|
|||||||
|
|
||||||
oldParentId = self.parentId
|
oldParentId = self.parentId
|
||||||
oldZoneId = self.zoneId
|
oldZoneId = self.zoneId
|
||||||
self.air.storeObjectLocation(self.doId, parentId, zoneId)
|
self.air.storeObjectLocation(self, parentId, zoneId)
|
||||||
if ((oldParentId != parentId) or
|
if ((oldParentId != parentId) or
|
||||||
(oldZoneId != zoneId)):
|
(oldZoneId != zoneId)):
|
||||||
messenger.send(self.getZoneChangeEvent(), [zoneId, oldZoneId])
|
messenger.send(self.getZoneChangeEvent(), [zoneId, oldZoneId])
|
||||||
|
@ -172,7 +172,7 @@ class DistributedObjectOV(DistributedObjectBase):
|
|||||||
assert self.notify.debugStateCall(self)
|
assert self.notify.debugStateCall(self)
|
||||||
self.activeState = ESGenerating
|
self.activeState = ESGenerating
|
||||||
# this has already been set at this point
|
# this has already been set at this point
|
||||||
#self.cr.storeObjectLocation(self.doId, self.parentId, self.zoneId)
|
#self.cr.storeObjectLocation(self, self.parentId, self.zoneId)
|
||||||
|
|
||||||
def generateInit(self):
|
def generateInit(self):
|
||||||
"""
|
"""
|
||||||
|
@ -179,7 +179,7 @@ class DistributedObjectUD(DistributedObjectBase):
|
|||||||
self.air.sendSetLocation(self, parentId, zoneId)
|
self.air.sendSetLocation(self, parentId, zoneId)
|
||||||
|
|
||||||
def setLocation(self, parentId, zoneId):
|
def setLocation(self, parentId, zoneId):
|
||||||
self.air.storeObjectLocation(self.doId, parentId, zoneId)
|
self.air.storeObjectLocation(self, parentId, zoneId)
|
||||||
|
|
||||||
def getLocation(self):
|
def getLocation(self):
|
||||||
try:
|
try:
|
||||||
@ -330,7 +330,7 @@ class DistributedObjectUD(DistributedObjectBase):
|
|||||||
other networked info in this function.
|
other networked info in this function.
|
||||||
"""
|
"""
|
||||||
assert self.notify.debugStateCall(self)
|
assert self.notify.debugStateCall(self)
|
||||||
self.air.storeObjectLocation(self.doId, self.parentId, self.zoneId)
|
self.air.storeObjectLocation(self, self.parentId, self.zoneId)
|
||||||
|
|
||||||
def generateInit(self, repository=None):
|
def generateInit(self, repository=None):
|
||||||
"""
|
"""
|
||||||
|
@ -191,18 +191,13 @@ class DoCollectionManager:
|
|||||||
else:
|
else:
|
||||||
self.notify.warning('handleSetLocation: object %s not present' % self.getMsgChannel())
|
self.notify.warning('handleSetLocation: object %s not present' % self.getMsgChannel())
|
||||||
|
|
||||||
def storeObjectLocation(self, doId, parentId, zoneId, object=None):
|
def storeObjectLocation(self, object, parentId, zoneId):
|
||||||
if (object == None):
|
|
||||||
object = self.doId2do.get(doId)
|
|
||||||
if object is None:
|
|
||||||
self.notify.warning('storeObjectLocation: object %s not present' % doId)
|
|
||||||
else:
|
|
||||||
oldParentId = object.parentId
|
oldParentId = object.parentId
|
||||||
oldZoneId = object.zoneId
|
oldZoneId = object.zoneId
|
||||||
if ((None not in (oldParentId, oldZoneId)) and
|
if ((None not in (oldParentId, oldZoneId)) and
|
||||||
((oldParentId != parentId) or (oldZoneId != zoneId))):
|
((oldParentId != parentId) or (oldZoneId != zoneId))):
|
||||||
# Remove old location
|
# Remove old location
|
||||||
self.deleteObjectLocation(doId, oldParentId, oldZoneId)
|
self.deleteObjectLocation(object, oldParentId, oldZoneId)
|
||||||
elif oldParentId == parentId and oldZoneId == zoneId:
|
elif oldParentId == parentId and oldZoneId == zoneId:
|
||||||
# object is already at that parent and zone
|
# object is already at that parent and zone
|
||||||
return
|
return
|
||||||
@ -210,7 +205,7 @@ class DoCollectionManager:
|
|||||||
# Do not store null values
|
# Do not store null values
|
||||||
return
|
return
|
||||||
# Add to new location
|
# Add to new location
|
||||||
self._doHierarchy.storeObjectLocation(doId, parentId, zoneId)
|
self._doHierarchy.storeObjectLocation(object, parentId, zoneId)
|
||||||
# this check doesn't work because of global UD objects;
|
# this check doesn't work because of global UD objects;
|
||||||
# should they have a location?
|
# should they have a location?
|
||||||
#assert len(self._doHierarchy) == len(self.doId2do)
|
#assert len(self._doHierarchy) == len(self.doId2do)
|
||||||
@ -232,7 +227,7 @@ class DoCollectionManager:
|
|||||||
self.notify.warning('storeObjectLocation(%s): parent %s not present' %
|
self.notify.warning('storeObjectLocation(%s): parent %s not present' %
|
||||||
(doId, parentId))
|
(doId, parentId))
|
||||||
|
|
||||||
def deleteObjectLocation(self, doId, parentId, zoneId):
|
def deleteObjectLocation(self, object, parentId, zoneId):
|
||||||
# Do not worry about null values
|
# Do not worry about null values
|
||||||
if (parentId is None) or (zoneId is None):
|
if (parentId is None) or (zoneId is None):
|
||||||
return
|
return
|
||||||
@ -241,11 +236,10 @@ class DoCollectionManager:
|
|||||||
|
|
||||||
# notify any existing parent that we're moving away
|
# notify any existing parent that we're moving away
|
||||||
oldParentObj = self.doId2do.get(parentId)
|
oldParentObj = self.doId2do.get(parentId)
|
||||||
obj = self.doId2do.get(doId)
|
if oldParentObj is not None:
|
||||||
if oldParentObj is not None and obj is not None:
|
oldParentObj.handleChildLeave(object, zoneId)
|
||||||
oldParentObj.handleChildLeave(obj, zoneId)
|
|
||||||
|
|
||||||
self._doHierarchy.deleteObjectLocation(doId, parentId, zoneId)
|
self._doHierarchy.deleteObjectLocation(object, parentId, zoneId)
|
||||||
|
|
||||||
def addDOToTables(self, do, location=None, ownerView=False):
|
def addDOToTables(self, do, location=None, ownerView=False):
|
||||||
assert self.notify.debugStateCall(self)
|
assert self.notify.debugStateCall(self)
|
||||||
@ -270,7 +264,7 @@ class DoCollectionManager:
|
|||||||
|
|
||||||
if not ownerView:
|
if not ownerView:
|
||||||
if self.isValidLocationTuple(location):
|
if self.isValidLocationTuple(location):
|
||||||
self.storeObjectLocation(do.doId, location[0], location[1])
|
self.storeObjectLocation(do, location[0], location[1])
|
||||||
##assert do.doId not in self.zoneId2doIds.get(location, {})
|
##assert do.doId not in self.zoneId2doIds.get(location, {})
|
||||||
##self.zoneId2doIds.setdefault(location, {})
|
##self.zoneId2doIds.setdefault(location, {})
|
||||||
##self.zoneId2doIds[location][do.doId]=do
|
##self.zoneId2doIds[location][do.doId]=do
|
||||||
@ -289,7 +283,7 @@ class DoCollectionManager:
|
|||||||
assert self.notify.debugStateCall(self)
|
assert self.notify.debugStateCall(self)
|
||||||
#assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
|
#assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
|
||||||
#assert do.doId in self.doId2do
|
#assert do.doId in self.doId2do
|
||||||
self.deleteObjectLocation(do.doId, do.parentId, do.zoneId)
|
self.deleteObjectLocation(do, do.parentId, do.zoneId)
|
||||||
## location = do.getLocation()
|
## location = do.getLocation()
|
||||||
## if location is not None:
|
## if location is not None:
|
||||||
## if location not in self.zoneId2doIds:
|
## if location not in self.zoneId2doIds:
|
||||||
|
@ -58,17 +58,25 @@ class DoHierarchy:
|
|||||||
r = a
|
r = a
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def storeObjectLocation(self, doId, parentId, zoneId):
|
def storeObjectLocation(self, do, parentId, zoneId):
|
||||||
assert self.notify.debugCall()
|
assert self.notify.debugCall()
|
||||||
assert doId not in self._allDoIds
|
doId = do.doId
|
||||||
|
if doId in self._allDoIds:
|
||||||
|
self.notify.error(
|
||||||
|
'storeObjectLocation(%s %s) already in _allDoIds' % (
|
||||||
|
do.__class__.__name__, do.doId))
|
||||||
parentZoneDict = self._table.setdefault(parentId, {})
|
parentZoneDict = self._table.setdefault(parentId, {})
|
||||||
zoneDoSet = parentZoneDict.setdefault(zoneId, set())
|
zoneDoSet = parentZoneDict.setdefault(zoneId, set())
|
||||||
zoneDoSet.add(doId)
|
zoneDoSet.add(doId)
|
||||||
self._allDoIds.add(doId)
|
self._allDoIds.add(doId)
|
||||||
|
|
||||||
def deleteObjectLocation(self, doId, parentId, zoneId):
|
def deleteObjectLocation(self, do, parentId, zoneId):
|
||||||
assert self.notify.debugCall()
|
assert self.notify.debugCall()
|
||||||
#assert doId in self._allDoIds
|
doId = do.doId
|
||||||
|
if doId not in self._allDoIds:
|
||||||
|
self.notify.warning(
|
||||||
|
'deleteObjectLocation(%s %s) not in _allDoIds' % (
|
||||||
|
do.__class__.__name__, do.doId))
|
||||||
# jbutler: temp hack to get by the assert, this will be fixed soon
|
# jbutler: temp hack to get by the assert, this will be fixed soon
|
||||||
if (doId not in self._allDoIds):
|
if (doId not in self._allDoIds):
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user