mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
optimized avatar nodepath counts
This commit is contained in:
parent
fdf9d849b2
commit
d38b81dc8d
@ -97,6 +97,7 @@ class Actor(DirectObject, NodePath):
|
||||
self.__controlJoints = {}
|
||||
|
||||
self.__LODNode = None
|
||||
self.switches = None
|
||||
|
||||
if (other == None):
|
||||
# act like a normal constructor
|
||||
@ -190,21 +191,7 @@ class Actor(DirectObject, NodePath):
|
||||
self.loadAnims(anims)
|
||||
|
||||
else:
|
||||
# act like a copy constructor
|
||||
# copy the scene graph elements of other
|
||||
otherCopy = other.copyTo(hidden)
|
||||
otherCopy.detachNode()
|
||||
# assign these elements to ourselve
|
||||
self.gotName = other.gotName
|
||||
self.assign(otherCopy)
|
||||
self.setGeomNode(otherCopy.getChild(0))
|
||||
|
||||
# copy the part dictionary from other
|
||||
self.__copyPartBundles(other)
|
||||
self.__subpartDict = copy_module.deepcopy(other.__subpartDict)
|
||||
|
||||
# copy the anim dictionary from other
|
||||
self.__copyAnimControls(other)
|
||||
self.copyActor(other, True) # overwrite everything
|
||||
|
||||
# For now, all Actors will by default set their top bounding
|
||||
# volume to be the "final" bounding volume: the bounding
|
||||
@ -229,6 +216,32 @@ class Actor(DirectObject, NodePath):
|
||||
self.Actor_deleted = 1
|
||||
self.cleanup()
|
||||
|
||||
def copyActor(self, other, overwrite=False):
|
||||
# act like a copy constructor
|
||||
self.gotName = other.gotName
|
||||
|
||||
# copy the scene graph elements of other
|
||||
if (overwrite):
|
||||
otherCopy = other.copyTo(hidden)
|
||||
otherCopy.detachNode()
|
||||
# assign these elements to ourselve (overwrite)
|
||||
self.assign(otherCopy)
|
||||
else:
|
||||
# just copy these to ourselve
|
||||
otherCopy = other.copyTo(self)
|
||||
self.setGeomNode(otherCopy.getChild(0))
|
||||
|
||||
# copy the part dictionary from other
|
||||
self.__copyPartBundles(other)
|
||||
self.__subpartDict = copy_module.deepcopy(other.__subpartDict)
|
||||
|
||||
# copy the anim dictionary from other
|
||||
self.__copyAnimControls(other)
|
||||
|
||||
# copy the switches for lods
|
||||
self.switches = other.switches
|
||||
self.__LODNode = self.find('**/+LODNode')
|
||||
|
||||
def __cmp__(self, other):
|
||||
# Actor inherits from NodePath, which inherits a definition of
|
||||
# __cmp__ from FFIExternalObject that uses the NodePath's
|
||||
@ -360,7 +373,7 @@ class Actor(DirectObject, NodePath):
|
||||
self.__animControlDict = {}
|
||||
self.__controlJoints = {}
|
||||
|
||||
if self.__LODNode:
|
||||
if self.__LODNode and (not self.__LODNode.isEmpty()):
|
||||
self.__LODNode.removeNode()
|
||||
self.__LODNode = None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user