dmsurti / AssimpKit

A library (macOS, iOS) that converts the files supported by Assimp to Scene Kit scenes.
http://assimpkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
477 stars 54 forks source link

Unable to load model from bundle #91

Closed mreiche closed 6 years ago

mreiche commented 6 years ago

I'm using the iOS example as template and built up a new project with a single UIViewController with SCNView as view. I'm trying to load the skinned_explorer.dae model from app bundle, which is the main difference between my app, and the iOS example, which loads the model from user documents directory.

NSString* modelPath = [[NSBundle mainBundle] pathForResource:@"explorer_skinned" ofType:@"dae"];
NSLog(@"%@ load model: %@",self,modelPath);
NSError *error;
/*SCNAssimpScene* modelScene = [SCNScene assimpSceneNamed:@"art.scnassets/explorer_skinned.dae"  postProcessFlags:AssimpKit_Process_FlipUVs |AssimpKit_Process_Triangulate error:&error];*/
/*SCNAssimpScene* modelScene = [SCNScene assimpSceneWithURL:[NSURL fileURLWithPath:modelPath] postProcessFlags:AssimpKit_Process_FlipUVs |AssimpKit_Process_Triangulate error:&error];*/
SCNAssimpScene* modelScene = [SCNScene assimpSceneNamed:@"explorer_skinned.dae" postProcessFlags:AssimpKit_Process_FlipUVs |AssimpKit_Process_Triangulate error:&error];

It doesn't matter which type of import I use. I always get the following error:

Error Domain=AssimpImporter Code=-1 "Collada: File came out empty. Something is wrong here."

In reference to: https://github.com/assimp/assimp/issues/1278

Facts:

dmsurti commented 6 years ago

My educated guess is: .dae files are processed by Xcode and what AssimpKit loads is that processed version from your app bundle. .dae is the file format that SceneKit supports.

To test further, you could open the .dae from your app bundle (via Finder), add that to user docs and load that with AssimpKit; you might end up with the same error.

IIRC, in the docs I have used an example .obj file.

Can you please upload a sample GitHub project for the above issue, that will help to test quickly?

Thanks.

kimkulling commented 6 years ago

I guess I need a Mac to reproduce this issue, right?

kimkulling commented 6 years ago

Did you wrote the exporter in Objective-C?

dmsurti commented 6 years ago

@kimkulling Yes you need a Mac to test this issue and the exporter is written in Objective-C.

mreiche commented 6 years ago

@dmsurti Yes, you were right with your educated guess. XCode does performing a scenekit conversion of Collada (.dae) assets. Therefor I'm able to load this scene directly like

[SCNScene sceneNamed:@"art.scnassets/explorer_skinned.dae"];

but not with AssimpKit anymore. I think this is an important hint for the tutorial.