mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
new handler for child setLocation calls
This commit is contained in:
parent
2f4327c5a0
commit
09962a0e54
@ -56,10 +56,6 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
|
|||||||
if self.gridParent:
|
if self.gridParent:
|
||||||
self.gridParent.delete()
|
self.gridParent.delete()
|
||||||
self.gridParent = None
|
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
|
|
||||||
|
|
||||||
|
|
||||||
def __cmp__(self, other):
|
def __cmp__(self, other):
|
||||||
# DistributedNode inherits from NodePath, which inherits a
|
# 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
|
# The store must run first so we know the old location
|
||||||
#self.cr.storeObjectLocation(self.doId, parentId, zoneId)
|
#self.cr.storeObjectLocation(self.doId, parentId, zoneId)
|
||||||
self.__location = (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):
|
def getLocation(self):
|
||||||
return self.__location
|
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):
|
def isLocal(self):
|
||||||
# This returns true if the distributed object is "local,"
|
# This returns true if the distributed object is "local,"
|
||||||
# which means the client created it instead of the AI, and it
|
# which means the client created it instead of the AI, and it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user