diff --git a/code/FBXDocument.cpp b/code/FBXDocument.cpp index da8841d08..242f52c7a 100644 --- a/code/FBXDocument.cpp +++ b/code/FBXDocument.cpp @@ -95,11 +95,24 @@ const Object* LazyObject::Get(bool dieOnError) } const char* err; - const std::string name = ParseTokenAsString(*tokens[1],err); + std::string name = ParseTokenAsString(*tokens[1],err); if (err) { 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); if (err) { DOMError(err,&element);