- if(str=="NORMAL3")
- a = NORMAL3;
- else if(str.size()==12 && !str.compare(0, 5, "COLOR") && str[5]>='3' && str[5]<='4' && !str.compare(6, 6, "_FLOAT"))
- a = static_cast<VertexAttribute>(COLOR3_FLOAT+(str[5]-'3'));
- else if(str=="COLOR4_UBYTE")
- a = COLOR4_UBYTE;
- else if(str=="TANGENT3")
- a = TANGENT3;
- else if(str=="BINORMAL3")
- a = BINORMAL3;
- else if(!convert_attribute(str, "VERTEX", 2, 4, a, VERTEX2) &&
- !convert_attribute(str, "GROUP", 1, 4, a, GROUP1) &&
- !convert_attribute(str, "WEIGHT", 1, 4, a, WEIGHT1) &&
- !convert_attribute(str, "TEXCOORD", 1, 4, a, TEXCOORD1) &&
- !convert_attribute(str, "GENERIC", 1, 4, a, GENERIC1))
- throw lexical_error(format("conversion of '%s' to VertexAttribute", str));
+ try
+ {
+ if(convert_attribute(str, "VERTEX", 2, 4, a, VERTEX2) ||
+ convert_attribute(str, "COLOR", 3, 4, a, COLOR3) ||
+ convert_attribute(str, "NORMAL", 3, 3, a, NORMAL3) ||
+ convert_attribute(str, "TANGENT", 3, 3, a, TANGENT3) ||
+ convert_attribute(str, "GROUP", 1, 4, a, GROUP1) ||
+ convert_attribute(str, "WEIGHT", 1, 4, a, WEIGHT1) ||
+ convert_attribute(str, "TEXCOORD", 1, 4, a, TEXCOORD1) ||
+ convert_attribute(str, "GENERIC", 1, 4, a, GENERIC1) ||
+ convert_attribute(str, "PADDING", 1, 4, a, PADDING1))
+ return;
+ }
+ catch(...)
+ { }
+
+ throw lexical_error(format("conversion of '%s' to VertexAttribute", str));