diff --git a/panda/src/chan/partBundleNode.I b/panda/src/chan/partBundleNode.I index f75f699221..d27e2e5059 100644 --- a/panda/src/chan/partBundleNode.I +++ b/panda/src/chan/partBundleNode.I @@ -47,14 +47,21 @@ PartBundleNode() : PandaNode("") { // Function: PartBundleNode::Copy Constructor // Access: Protected // Description: Use make_copy() or copy_subgraph() to copy one of -// these. Copying a PartBundleNode will always force a -// deep copy of the PartGroup hierarchy. +// these. +// +// If the supplied PartBundle is non-null, it is +// assigned to the new node; otherwise, a copy is made +// of the complete PartGroup hierarchy. //////////////////////////////////////////////////////////////////// INLINE PartBundleNode:: -PartBundleNode(const PartBundleNode ©) : - PandaNode(copy), - _bundle(DCAST(PartBundle, copy._bundle->copy_subgraph())) +PartBundleNode(const PartBundleNode ©, PartBundle *bundle) : + PandaNode(copy) { + if (bundle != (PartBundle *)NULL) { + _bundle = bundle; + } else { + _bundle = DCAST(PartBundle, copy._bundle->copy_subgraph()); + } _bundle->_node = this; } diff --git a/panda/src/chan/partBundleNode.h b/panda/src/chan/partBundleNode.h index 8e54f5d83f..56f3cb84a5 100644 --- a/panda/src/chan/partBundleNode.h +++ b/panda/src/chan/partBundleNode.h @@ -38,7 +38,7 @@ public: protected: INLINE PartBundleNode(); - INLINE PartBundleNode(const PartBundleNode ©); + INLINE PartBundleNode(const PartBundleNode ©, PartBundle *bundle = NULL); public: virtual bool safe_to_flatten() const; diff --git a/panda/src/char/character.cxx b/panda/src/char/character.cxx index 52ddbb5659..379c8312f2 100644 --- a/panda/src/char/character.cxx +++ b/panda/src/char/character.cxx @@ -44,15 +44,16 @@ PStatCollector Character::_anim_pcollector("App:Animation"); //////////////////////////////////////////////////////////////////// Character:: Character(const Character ©) : - PartBundleNode(copy.get_name(), new CharacterJointBundle(copy.get_bundle()->get_name())), + PartBundleNode(copy, new CharacterJointBundle(copy.get_bundle()->get_name())), _cv(DynamicVertices::deep_copy(copy._cv)), _computed_vertices(copy._computed_vertices), _parts(copy._parts), _char_pcollector(copy._char_pcollector) { // Now make a copy of the joint/slider hierarchy. We could just use - // the PartBundleNode's copy constructor, but if we do it ourselves - // we can simultaneously update our _parts list. + // the copy_subgraph feature of the PartBundleNode's copy + // constructor, but if we do it ourselves we can simultaneously + // update our _parts list. copy_joints(get_bundle(), copy.get_bundle()); }