assimp / assimp-net

Automatically exported from code.google.com/p/assimp-net
191 stars 82 forks source link

Custom IO System doesnt work when Importing from stream #45

Open zbendefy opened 5 years ago

zbendefy commented 5 years ago

Hi! I was trying to load some .OBJ files from an IOStream. These obj files have attached materials in a separate file. If I'm loading the .obj files using ImportFileFromStream, I get the following error logs:

|Information| - ASSIMP - Info,  T10160: Import root directory is './'
|Error| - ASSIMP - Error, T10160: OBJ: Unable to locate material file wall.mtl

If I load the file from the disk with ImportFIle() |Information| - ASSIMP - Info, T16528: Import root directory is 'D:/Dev/GLAssets\'

I tried using a creating an IO System and setting it to the importer, but it doesnt even get called.

Starnick commented 5 years ago

Indeed, I am seeing the error too. I'll look into a fix

FYI, the official AssimpNet repository that I maintain is over at BitBucket (https://bitbucket.org/Starnick/assimpnet/src/master/)

Starnick commented 5 years ago

I looked into this. Using the ImportFileFromStream doesn't use the IOSystem - this isn't an oversight, the native library is like that too. If additional model files need to be loaded (like the MTL file), it is recommended to attach an IOSystem and call ImportFromFile. In that scenario, the IOSystem you supply will open a stream to both the OBJ file and the MTL file.

I'm adding some documentation to the XML comments to reflect this.