*** empty log message ***

This commit is contained in:
David Rose 2001-05-11 04:18:16 +00:00
parent 84f03e3d20
commit c275aa7e17
6 changed files with 118 additions and 3 deletions

View File

@ -14,6 +14,7 @@
#include <nullAttributeWrapper.h>
#include <nullLevelState.h>
#include <renderRelation.h>
#include <string_utils.h>
typedef set<AnimBundleNode *> AnimNodes;
typedef map<string, AnimNodes> Anims;
@ -78,8 +79,20 @@ bind_anims(const PartNodes &parts, const AnimNodes &anims,
PT(AnimControl) control =
part->bind_anim(anim, hierarchy_match_flags);
string name = anim->get_name();
if (control != (AnimControl *)NULL) {
controls.store_anim(control, anim->get_name());
if (controls.find_anim(name) != (AnimControl *)NULL) {
// That name's already used; synthesize another one.
int index = 0;
string new_name;
do {
index++;
new_name = name + '.' + format_string(index);
} while (controls.find_anim(new_name) != (AnimControl *)NULL);
name = new_name;
}
controls.store_anim(control, name);
}
if (chan_cat.is_info()) {
@ -89,7 +102,8 @@ bind_anims(const PartNodes &parts, const AnimNodes &anims,
} else {
chan_cat.info()
<< "Bind succeeded, index "
<< control->get_channel_index() << "\n";
<< control->get_channel_index() << "; accessible as "
<< name << "\n";
}
}
}
@ -132,8 +146,11 @@ void auto_bind(Node *root_node, AnimControlCollection &controls,
// But here we have (at least one) match!
bind_anims((*pi).second, (*ai).second, controls,
hierarchy_match_flags);
++ai;
++pi;
// We don't increment the anim counter yet. That way, the same
// anim may bind to multiple parts, if they all share the same
// name.
}
}
}

View File

@ -4,6 +4,8 @@
////////////////////////////////////////////////////////////////////
#include "colorProperty.h"
#include <datagram.h>
#include <datagramIterator.h>
////////////////////////////////////////////////////////////////////
// Function: ColorProperty::output
@ -18,3 +20,27 @@ output(ostream &out) const {
out << "uncolor";
}
}
////////////////////////////////////////////////////////////////////
// Function: ColorProperty::write_datagram
// Access: Public
// Description: Function to write the important information in
// this object to a Datagram
////////////////////////////////////////////////////////////////////
void ColorProperty::
write_datagram(Datagram &destination) {
_color.write_datagram(destination);
destination.add_bool(_real);
}
////////////////////////////////////////////////////////////////////
// Function: ColorProperty::read_datagram
// Access: Public
// Description: Function to write the important information into
// this object out of a Datagram
////////////////////////////////////////////////////////////////////
void ColorProperty::
read_datagram(DatagramIterator &source) {
_color.read_datagram(source);
_real = source.get_bool();
}

View File

@ -10,6 +10,9 @@
#include <luse.h>
class Datagram;
class DatagramIterator;
////////////////////////////////////////////////////////////////////
// Class : ColorProperty
// Description : This class defines the scene graph color property
@ -33,6 +36,10 @@ public:
INLINE int compare_to(const ColorProperty &other) const;
void output(ostream &out) const;
public:
void write_datagram(Datagram &destination);
void read_datagram(DatagramIterator &source);
private:
Colorf _color;
bool _real;

View File

@ -7,6 +7,10 @@
#include "colorAttribute.h"
#include <indent.h>
#include <datagram.h>
#include <datagramIterator.h>
#include <bamReader.h>
#include <bamWriter.h>
TypeHandle ColorTransition::_type_handle;
@ -78,3 +82,55 @@ void ColorTransition::
write_value(ostream &out, int indent_level) const {
indent(out, indent_level) << _value << "\n";
}
////////////////////////////////////////////////////////////////////
// Function: ColorTransition::register_with_read_factory
// Access: Public, Static
// Description: Factory method to generate a ColorTransition object
////////////////////////////////////////////////////////////////////
void ColorTransition::
register_with_read_factory() {
BamReader::get_factory()->register_factory(get_class_type(), make_ColorTransition);
}
////////////////////////////////////////////////////////////////////
// Function: ColorTransition::write_datagram
// Access: Public
// Description: Function to write the important information in
// the particular object to a Datagram
////////////////////////////////////////////////////////////////////
void ColorTransition::
write_datagram(BamWriter *manager, Datagram &me) {
OnOffTransition::write_datagram(manager, me);
_value.write_datagram(me);
}
////////////////////////////////////////////////////////////////////
// Function: ColorTransition::make_ColorTransition
// Access: Protected
// Description: Factory method to generate a ColorTransition object
////////////////////////////////////////////////////////////////////
TypedWritable *ColorTransition::
make_ColorTransition(const FactoryParams &params) {
ColorTransition *me = new ColorTransition;
DatagramIterator scan;
BamReader *manager;
parse_params(params, scan, manager);
me->fillin(scan, manager);
return me;
}
////////////////////////////////////////////////////////////////////
// Function: ColorTransition::fillin
// Access: Protected
// Description: Function that reads out of the datagram (or asks
// manager to read) all of the data that is needed to
// re-create this object and stores it in the appropiate
// place
////////////////////////////////////////////////////////////////////
void ColorTransition::
fillin(DatagramIterator& scan, BamReader* manager) {
OnOffTransition::fillin(scan, manager);
_value.read_datagram(scan);
}

View File

@ -49,6 +49,14 @@ protected:
ColorProperty _value;
public:
static void register_with_read_factory();
virtual void write_datagram(BamWriter *manager, Datagram &me);
protected:
static TypedWritable *make_ColorTransition(const FactoryParams &params);
void fillin(DatagramIterator& scan, BamReader* manager);
public:
virtual TypeHandle get_type() const {
return get_class_type();

View File

@ -188,6 +188,7 @@ ConfigureFn(config_sgattrib) {
//functions with BamReader's factory
BillboardTransition::register_with_read_factory();
ColorMatrixTransition::register_with_read_factory();
ColorTransition::register_with_read_factory();
CullFaceTransition::register_with_read_factory();
DecalTransition::register_with_read_factory();
DepthTestTransition::register_with_read_factory();