mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
new handler for child setLocation calls
This commit is contained in:
parent
2f4327c5a0
commit
09962a0e54
@ -55,11 +55,7 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
|
||||
else:
|
||||
if self.gridParent:
|
||||
self.gridParent.delete()
|
||||
self.gridParent = None
|
||||
# NOTE: at this point the avatar has been detached from the scene
|
||||
# graph. Someone else needs to reparent him to something in the scene graph
|
||||
# TODO: handle DistributedNode parenting
|
||||
|
||||
self.gridParent = None
|
||||
|
||||
def __cmp__(self, other):
|
||||
# DistributedNode inherits from NodePath, which inherits a
|
||||
|
@ -353,10 +353,28 @@ class DistributedObject(PandaObject):
|
||||
# The store must run first so we know the old location
|
||||
#self.cr.storeObjectLocation(self.doId, parentId, zoneId)
|
||||
self.__location = (parentId, zoneId)
|
||||
# Give the parent a chance to run code when a new child
|
||||
# sets location to it. For example, the parent may want to
|
||||
# scene graph reparent the child to some subnode it owns.
|
||||
parentObj = self.cr.doId2do.get(parentId)
|
||||
if parentObj:
|
||||
parentObj.handleChildSetLocation(self, zoneId)
|
||||
|
||||
def getLocation(self):
|
||||
return self.__location
|
||||
|
||||
def handleChildSetLocation(self, childObj, zoneId):
|
||||
self.notify.info("handleChildSetLocation: %s childId: %s zoneId: %s" %
|
||||
(self.doId, childObj.doId, zoneId))
|
||||
# A new child has just setLocation beneath us. Give us a
|
||||
# chance to run code when a new child sets location to us. For
|
||||
# example, we may want to scene graph reparent the child to
|
||||
# some subnode we own.
|
||||
|
||||
# Inheritors should override
|
||||
pass
|
||||
|
||||
|
||||
def isLocal(self):
|
||||
# This returns true if the distributed object is "local,"
|
||||
# which means the client created it instead of the AI, and it
|
||||
|
Loading…
x
Reference in New Issue
Block a user