mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 12:12:10 -04:00
copying characters was not copying transforms
This commit is contained in:
parent
af5c5c55b7
commit
d3e7579bf0
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user