Load gltf using FileStream always failed.

Issue #26 invalid
Former user created an issue

Trying to load any gltf models using FileStream and FormatHint instead of file path. Always failed with: Error importing file: No suitable reader found for the file format of file "$$$magic$$$..gltf".;

Comments (4)

  1. Nicholas Woodfield repo owner

    Thank you for the report, please attach or point to a public GLTF model that I can reproduce this with.

  2. Nicholas Woodfield repo owner

    FYI,

    This is a quirk with native Assimp, the "from memory" Import functions do not take a custom IO handler. It's confusing enough that I forgot about it, but it's documented in the summary comments of the ImportFileFromStream functions.

    Distributed file formats like GLTF won't work reading from stream. The binary flavor (GLB) should work though.

    Basically, you need to supply an IOSystem that provides assimps with the streams to the data for each file. So you call ImportFile with the "file name" of the GLTF, and your IO handler will provide a stream to "XYZ.gltf", "XYZ.bin", etc if you aren't opening real files from disk, the names then are basically keys to to whatever data store you're using. I realize it's confusing, but it's the convention the native assimp authors chose.

    Might be worthwhile to create a wiki page showing the correct usage + sample.

    Edit: Also the error message comes from the native side, it's damn confusing. The magic name is a dummy file they refer to in the "load from memory" case. I can't change it on the managed side.

  3. Log in to comment