Added check to BaseImporter::SearchFileHeaderForToken making sure that a detected token is not in fact just a fraction of a longer token. Microsoft exported binary gltf files were detected as OBJ, because the "gltf " in the string "Microsoft GLTF Exporter 2.4.1.7" was detected as the token "f ". I added a new bool parameter to the method enabling this check. It's default false, and only ObjFileImporter sets it to true, so no other code should be affected.
This commit is contained in:
@@ -100,7 +100,7 @@ bool ObjFileImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler ,
|
||||
} else {
|
||||
// Check file Header
|
||||
static const char *pTokens[] = { "mtllib", "usemtl", "v ", "vt ", "vn ", "o ", "g ", "s ", "f " };
|
||||
return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 9 );
|
||||
return BaseImporter::SearchFileHeaderForToken(pIOHandler, pFile, pTokens, 9, 200, false, true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user