- fbx: fix object names when reading binary files.

pull/14/head
Alexander Gessler 2012-08-11 04:29:21 +02:00
parent 29b11f1cde
commit 811e2492df
1 changed files with 14 additions and 1 deletions

View File

@ -95,11 +95,24 @@ const Object* LazyObject::Get(bool dieOnError)
} }
const char* err; const char* err;
const std::string name = ParseTokenAsString(*tokens[1],err); std::string name = ParseTokenAsString(*tokens[1],err);
if (err) { if (err) {
DOMError(err,&element); DOMError(err,&element);
} }
// small fix for binary reading: binary fbx files don't use
// prefixes such as Model:: in front of their names. The
// loading code expects this at many places, though!
// so convert the binary representation (a 0x0001) to the
// double colon notation.
if(tokens[1]->IsBinary()) {
for (size_t i = 0; i < name.length(); ++i) {
if (name[i] == 0x0 && name[i+1] == 0x1) {
name = name.substr(i+2) + "::" + name.substr(0,i);
}
}
}
const std::string classtag = ParseTokenAsString(*tokens[2],err); const std::string classtag = ParseTokenAsString(*tokens[2],err);
if (err) { if (err) {
DOMError(err,&element); DOMError(err,&element);