Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appcrash if characterValue cannot be cast in StringValue #4

Open
freeminders123 opened this issue Feb 15, 2019 · 2 comments
Open

Appcrash if characterValue cannot be cast in StringValue #4

freeminders123 opened this issue Feb 15, 2019 · 2 comments

Comments

@freeminders123
Copy link

freeminders123 commented Feb 15, 2019

Hi,

I got an Appcrash with some FBX-Files when importing in the aiString + String Value.swift:

in the Method tupleOf8sToString line 17 (result.append): sometimes the value exceeds the limits of UInt8;

I got it working with:

result.append(Character(UnicodeScalar(UInt8(abs(Int(characterValue))))))

could you please update this?

Also I noticed, that files are not always recognized because of this bug and the return being longer than expected. So for return in this method I have:

var res = result as NSString
if (res.contains("png")) {
res = "png"
} else if (res.contains("jpg")) {
res = "jpg"
}
return res

Both works now in my code and should be easy to adopt.

Thanks for the lib ;-) helped us a lot

@eugenebokhan
Copy link
Owner

@freeminders123 please, provide the model you used so I could reproduce those cases.

@freeminders123
Copy link
Author

freeminders123 commented Sep 17, 2019

After fixing this, the App no longer crashes and it's been a while and we moved on, so it would take me a long time to find models that crash and reproduce this on our end.
But to give you a little idea: We used Blender to create models with multiple submeshes, materials and textures and included the files into fbx. Unluckily blender didn't support writing all material files to fbx in a way AssetImportKit can handle (some fields of the material weren't exported at all) so we had to change the meaning of some fields to get pbr running. But that doesn't affect the storing of the images in the fbx file. We recognized that in some cases there was an extra byte added to the filetype which caused crashes or odd behavior.
If no one else encounters this problem, maybe you could add this to troubleshooting or something else for others, if this problem occurs anytime in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants