I figured out why it didn't work properly for field types beyond MFNode:
In the ftn array, which contains the field type names, it goes:
static char *ftn[] = {
"SFBool",
"SFColor",
"SFFloat",
"SFImage",
"SFInt32",
"SFNode",
"SFRotation",
"SFString",
"SFTime",
"SFVec2f",
"SFVec3f",
"MFColor",
"MFFloat",
"MFInt32",
"MFNode" <--- Note, no comma
"MFRotation",
"MFString",
"MFTime",
"MFVec2f",
"MFVec3f",
};
Therefore fieldTypeName(new VrmlMFNode) => "MFNodeMVRotation"
This patch'll fix the list, and let fieldTypeName work for all types.
-jeff
Index: VrmlField.cpp
===================================================================
RCS file: /cvsroot/openvrml/libvrml97/libvrml97core/src/vrml97/VrmlField.cpp,v
retrieving revision 1.7
diff -u -r1.7 VrmlField.cpp
--- VrmlField.cpp 2000/09/10 00:45:48 1.7
+++ VrmlField.cpp 2000/11/21 18:17:34
@@ -86,7 +86,7 @@
"MFColor",
"MFFloat",
"MFInt32",
- "MFNode"
+ "MFNode",
"MFRotation",
"MFString",
"MFTime",
@@ -99,7 +99,7 @@
char const * VrmlField::fieldTypeName() const
{
int ft = (int) this->fieldType();
- if (ft > 0 && ft <= (int) VrmlField::MFNODE)
+ if (ft > 0 && ft <= (int) VrmlField::MFVEC3F)
return ftn[ft-1];
return "<invalid field type>";
}
|