mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
removed legacy part code
This commit is contained in:
parent
9253d0b298
commit
ccc84c8d48
@ -28,25 +28,4 @@ get_bundle(int i) const {
|
|||||||
return DCAST(CharacterJointBundle, PartBundleNode::get_bundle(i));
|
return DCAST(CharacterJointBundle, PartBundleNode::get_bundle(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: Character::get_num_parts
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns the total number of moving parts (e.g. joints
|
|
||||||
// and sliders) associated with the Character.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE int Character::
|
|
||||||
get_num_parts() const {
|
|
||||||
return _parts.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: Character::get_part
|
|
||||||
// Access: Published
|
|
||||||
// Description: Returns the nth moving part associated with the
|
|
||||||
// Character.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
INLINE PartGroup *Character::
|
|
||||||
get_part(int n) const {
|
|
||||||
nassertr(n >= 0 && n < (int)_parts.size(), NULL);
|
|
||||||
return _parts[n];
|
|
||||||
}
|
|
||||||
|
@ -42,7 +42,6 @@ PStatCollector Character::_animation_pcollector("*:Animation");
|
|||||||
Character::
|
Character::
|
||||||
Character(const Character ©) :
|
Character(const Character ©) :
|
||||||
PartBundleNode(copy),
|
PartBundleNode(copy),
|
||||||
_parts(copy._parts),
|
|
||||||
_joints_pcollector(copy._joints_pcollector),
|
_joints_pcollector(copy._joints_pcollector),
|
||||||
_skinning_pcollector(copy._skinning_pcollector)
|
_skinning_pcollector(copy._skinning_pcollector)
|
||||||
{
|
{
|
||||||
@ -376,11 +375,6 @@ copy_joints(PartGroup *copy, PartGroup *orig) {
|
|||||||
copy->_children.push_back(copy_child);
|
copy->_children.push_back(copy_child);
|
||||||
copy_joints(copy_child, orig_child);
|
copy_joints(copy_child, orig_child);
|
||||||
}
|
}
|
||||||
|
|
||||||
Parts::iterator pi = find(_parts.begin(), _parts.end(), orig);
|
|
||||||
if (pi != _parts.end()) {
|
|
||||||
(*pi) = copy;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -424,7 +418,6 @@ r_copy_children(const PandaNode *from, PandaNode::InstanceMap &inst_map,
|
|||||||
GeomSliderMap gsmap;
|
GeomSliderMap gsmap;
|
||||||
r_copy_char(this, from_char, from_char, node_map, joint_map,
|
r_copy_char(this, from_char, from_char, node_map, joint_map,
|
||||||
gvmap, gjmap, gsmap);
|
gvmap, gjmap, gsmap);
|
||||||
copy_node_pointers(from_char, node_map);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -559,64 +552,6 @@ copy_geom(const Geom *source, const Character *from,
|
|||||||
return dest;
|
return dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
// Function: Character::copy_node_pointers
|
|
||||||
// Access: Public
|
|
||||||
// Description: Creates _net_transform_nodes and _local_transform_nodes
|
|
||||||
// as appropriate in each of the Character's joints, as
|
|
||||||
// copied from the other Character.
|
|
||||||
////////////////////////////////////////////////////////////////////
|
|
||||||
void Character::
|
|
||||||
copy_node_pointers(const Character *from, const Character::NodeMap &node_map) {
|
|
||||||
nassertv(_parts.size() == from->_parts.size());
|
|
||||||
for (int i = 0; i < (int)_parts.size(); i++) {
|
|
||||||
if (_parts[i]->is_of_type(CharacterJoint::get_class_type())) {
|
|
||||||
nassertv(_parts[i] != from->_parts[i]);
|
|
||||||
CharacterJoint *source_joint;
|
|
||||||
CharacterJoint *dest_joint;
|
|
||||||
DCAST_INTO_V(source_joint, from->_parts[i]);
|
|
||||||
DCAST_INTO_V(dest_joint, _parts[i]);
|
|
||||||
|
|
||||||
CharacterJoint::NodeList::const_iterator ai;
|
|
||||||
for (ai = source_joint->_net_transform_nodes.begin();
|
|
||||||
ai != source_joint->_net_transform_nodes.end();
|
|
||||||
++ai) {
|
|
||||||
PandaNode *source_node = (*ai);
|
|
||||||
|
|
||||||
NodeMap::const_iterator mi;
|
|
||||||
mi = node_map.find(source_node);
|
|
||||||
if (mi != node_map.end()) {
|
|
||||||
PandaNode *dest_node = (*mi).second;
|
|
||||||
|
|
||||||
// Here's an internal joint that the source Character was
|
|
||||||
// animating directly. We'll animate our corresponding
|
|
||||||
// joint the same way.
|
|
||||||
dest_joint->set_character(this);
|
|
||||||
dest_joint->add_net_transform(dest_node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (ai = source_joint->_local_transform_nodes.begin();
|
|
||||||
ai != source_joint->_local_transform_nodes.end();
|
|
||||||
++ai) {
|
|
||||||
PandaNode *source_node = (*ai);
|
|
||||||
|
|
||||||
NodeMap::const_iterator mi;
|
|
||||||
mi = node_map.find(source_node);
|
|
||||||
if (mi != node_map.end()) {
|
|
||||||
PandaNode *dest_node = (*mi).second;
|
|
||||||
|
|
||||||
// Here's an internal joint that the source Character was
|
|
||||||
// animating directly. We'll animate our corresponding
|
|
||||||
// joint the same way.
|
|
||||||
dest_joint->set_character(this);
|
|
||||||
dest_joint->add_local_transform(dest_node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: Character::redirect_transform_table
|
// Function: Character::redirect_transform_table
|
||||||
// Access: Private
|
// Access: Private
|
||||||
@ -820,12 +755,7 @@ register_with_read_factory() {
|
|||||||
void Character::
|
void Character::
|
||||||
write_datagram(BamWriter *manager, Datagram &dg) {
|
write_datagram(BamWriter *manager, Datagram &dg) {
|
||||||
PartBundleNode::write_datagram(manager, dg);
|
PartBundleNode::write_datagram(manager, dg);
|
||||||
|
dg.add_uint16(0);
|
||||||
dg.add_uint16(_parts.size());
|
|
||||||
Parts::const_iterator pi;
|
|
||||||
for (pi = _parts.begin(); pi != _parts.end(); pi++) {
|
|
||||||
manager->write_pointer(dg, (*pi));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -837,14 +767,7 @@ write_datagram(BamWriter *manager, Datagram &dg) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
int Character::
|
int Character::
|
||||||
complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
complete_pointers(TypedWritable **p_list, BamReader *manager) {
|
||||||
int pi = PartBundleNode::complete_pointers(p_list, manager);
|
return PartBundleNode::complete_pointers(p_list, manager) + _temp_num_parts;
|
||||||
|
|
||||||
int num_parts = _parts.size();
|
|
||||||
for (int i = 0; i < num_parts; i++) {
|
|
||||||
_parts[i] = DCAST(PartGroup, p_list[pi++]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pi;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -881,12 +804,9 @@ fillin(DatagramIterator &scan, BamReader *manager) {
|
|||||||
// Read the number of parts to expect in the _parts list, and then
|
// Read the number of parts to expect in the _parts list, and then
|
||||||
// fill the array up with NULLs. We'll fill in the actual values in
|
// fill the array up with NULLs. We'll fill in the actual values in
|
||||||
// complete_pointers, later.
|
// complete_pointers, later.
|
||||||
int num_parts = scan.get_uint16();
|
_temp_num_parts = scan.get_uint16();
|
||||||
_parts.clear();
|
for (int i = 0; i < _temp_num_parts; i++) {
|
||||||
_parts.reserve(num_parts);
|
|
||||||
for (int i = 0; i < num_parts; i++) {
|
|
||||||
manager->read_pointer(scan);
|
manager->read_pointer(scan);
|
||||||
_parts.push_back((PartGroup *)NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DO_PSTATS
|
#ifdef DO_PSTATS
|
||||||
|
@ -64,9 +64,6 @@ public:
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE CharacterJointBundle *get_bundle(int i) const;
|
INLINE CharacterJointBundle *get_bundle(int i) const;
|
||||||
|
|
||||||
INLINE int get_num_parts() const;
|
|
||||||
INLINE PartGroup *get_part(int n) const;
|
|
||||||
|
|
||||||
CharacterJoint *find_joint(const string &name) const;
|
CharacterJoint *find_joint(const string &name) const;
|
||||||
CharacterSlider *find_slider(const string &name) const;
|
CharacterSlider *find_slider(const string &name) const;
|
||||||
|
|
||||||
@ -97,7 +94,6 @@ private:
|
|||||||
PT(Geom) copy_geom(const Geom *source, const Character *from,
|
PT(Geom) copy_geom(const Geom *source, const Character *from,
|
||||||
const JointMap &joint_map, GeomVertexMap &gvmap,
|
const JointMap &joint_map, GeomVertexMap &gvmap,
|
||||||
GeomJointMap &gjmap, GeomSliderMap &gsmap);
|
GeomJointMap &gjmap, GeomSliderMap &gsmap);
|
||||||
void copy_node_pointers(const Character *from, const NodeMap &node_map);
|
|
||||||
CPT(TransformTable) redirect_transform_table(const TransformTable *source,
|
CPT(TransformTable) redirect_transform_table(const TransformTable *source,
|
||||||
const JointMap &joint_map,
|
const JointMap &joint_map,
|
||||||
GeomJointMap &gjmap);
|
GeomJointMap &gjmap);
|
||||||
@ -114,10 +110,9 @@ private:
|
|||||||
|
|
||||||
void r_clear_joint_characters(PartGroup *part);
|
void r_clear_joint_characters(PartGroup *part);
|
||||||
|
|
||||||
// This vector is used by the ComputedVertices object to index back
|
|
||||||
// into our joints and sliders.
|
// into our joints and sliders.
|
||||||
typedef vector_PartGroupStar Parts;
|
//typedef vector_PartGroupStar Parts;
|
||||||
Parts _parts;
|
//Parts _parts;
|
||||||
|
|
||||||
double _last_auto_update;
|
double _last_auto_update;
|
||||||
|
|
||||||
@ -126,6 +121,8 @@ private:
|
|||||||
PStatCollector _skinning_pcollector;
|
PStatCollector _skinning_pcollector;
|
||||||
static PStatCollector _animation_pcollector;
|
static PStatCollector _animation_pcollector;
|
||||||
|
|
||||||
|
unsigned int _temp_num_parts;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void register_with_read_factory();
|
static void register_with_read_factory();
|
||||||
virtual void write_datagram(BamWriter *manager, Datagram &dg);
|
virtual void write_datagram(BamWriter *manager, Datagram &dg);
|
||||||
@ -154,8 +151,6 @@ private:
|
|||||||
static TypeHandle _type_handle;
|
static TypeHandle _type_handle;
|
||||||
|
|
||||||
friend class CharacterMaker;
|
friend class CharacterMaker;
|
||||||
friend class ComputedVerticesMaker;
|
|
||||||
friend class ComputedVertices;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "character.I"
|
#include "character.I"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user