fix bug in x2egg involving joint names with hyphens

This commit is contained in:
David Rose 2005-06-05 06:37:57 +00:00
parent 2a1a215fac
commit 9feab0567f
3 changed files with 16 additions and 4 deletions

View File

@ -29,10 +29,16 @@ TypeHandle EggGroupUniquifier::_type_handle;
////////////////////////////////////////////////////////////////////
// Function: EggGroupUniquifier::Constructor
// Access: Public
// Description:
// Description: If filter_names is true, then the group names will be
// coerced into a fairly safe, standard convention that
// uses no characters other than a-z, A-Z, 0-9, and
// underscore. If filter_names is false, the group
// names will be left unchanged.
////////////////////////////////////////////////////////////////////
EggGroupUniquifier::
EggGroupUniquifier() {
EggGroupUniquifier(bool filter_names)
: _filter_names(filter_names)
{
}
////////////////////////////////////////////////////////////////////
@ -62,6 +68,9 @@ get_category(EggNode *node) {
string EggGroupUniquifier::
filter_name(EggNode *node) {
string name = node->get_name();
if (!_filter_names) {
return name;
}
nassertr(!name.empty(), string());
string result;

View File

@ -32,13 +32,16 @@
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAEGG EggGroupUniquifier : public EggNameUniquifier {
PUBLISHED:
EggGroupUniquifier();
EggGroupUniquifier(bool filter_names = true);
virtual string get_category(EggNode *node);
virtual string filter_name(EggNode *node);
virtual string generate_name(EggNode *node,
const string &category, int index);
private:
bool _filter_names;
public:
static TypeHandle get_class_type() {
return _type_handle;

View File

@ -141,7 +141,7 @@ convert_file(const Filename &filename) {
if (_make_char) {
// Now make sure that each joint has a unique name.
EggGroupUniquifier uniquifier;
EggGroupUniquifier uniquifier(false);
uniquifier.uniquify(_dart_node);
}