From 62d290fd006dc132f06576daa907f6b5cc1017af Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 14 Feb 2007 17:24:51 +0000 Subject: [PATCH] update pointers properly when flattening characters --- panda/src/chan/partBundle.cxx | 13 ++++++++++++- panda/src/chan/partBundle.h | 3 +++ panda/src/chan/partBundleNode.cxx | 4 ++-- panda/src/chan/partGroup.h | 1 + 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/panda/src/chan/partBundle.cxx b/panda/src/chan/partBundle.cxx index c9091895f1..144cd8606e 100644 --- a/panda/src/chan/partBundle.cxx +++ b/panda/src/chan/partBundle.cxx @@ -318,7 +318,18 @@ control_activated(AnimControl *control) { } } - +//////////////////////////////////////////////////////////////////// +// Function: PartBundle::set_node +// Access: Protected, Virtual +// Description: Changes the PartBundleNode pointer associated with +// the PartBundle. Normally called only by the +// PartBundleNode itself, for instance when the bundle +// is flattened with another node. +//////////////////////////////////////////////////////////////////// +void PartBundle:: +set_node(PartBundleNode *node) { + _node = node; +} //////////////////////////////////////////////////////////////////// // Function: PartBundle::do_set_control_effect diff --git a/panda/src/chan/partBundle.h b/panda/src/chan/partBundle.h index b898b7089b..7d428f3bed 100644 --- a/panda/src/chan/partBundle.h +++ b/panda/src/chan/partBundle.h @@ -127,6 +127,9 @@ public: // bunch of friends. virtual void control_activated(AnimControl *control); +protected: + virtual void set_node(PartBundleNode *node); + private: class CData; diff --git a/panda/src/chan/partBundleNode.cxx b/panda/src/chan/partBundleNode.cxx index 2c25323caf..c028822d65 100644 --- a/panda/src/chan/partBundleNode.cxx +++ b/panda/src/chan/partBundleNode.cxx @@ -76,7 +76,7 @@ void PartBundleNode:: add_bundle(PartBundle *bundle) { nassertv(bundle->_node == NULL); _bundles.push_back(bundle); - bundle->_node = this; + bundle->set_node(this); } //////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ steal_bundles(PartBundleNode *other) { for (bi = other->_bundles.begin(); bi != other->_bundles.end(); ++bi) { PartBundle *bundle = (*bi); _bundles.push_back(bundle); - bundle->_node = this; + bundle->set_node(this); } other->_bundles.clear(); } diff --git a/panda/src/chan/partGroup.h b/panda/src/chan/partGroup.h index fd3231be7d..1acb120a81 100644 --- a/panda/src/chan/partGroup.h +++ b/panda/src/chan/partGroup.h @@ -140,6 +140,7 @@ private: static TypeHandle _type_handle; friend class Character; + friend class CharacterJointBundle; }; #include "partGroup.I"