guillaumeblanc / ozz-animation

Open source c++ skeletal animation library and toolset
http://guillaumeblanc.github.io/ozz-animation/
Other
2.46k stars 302 forks source link

import glTF asset with animations end the program when one of animations is invalid #117

Closed junjie020 closed 3 years ago

junjie020 commented 3 years ago

I have a glb file with multiple animations(this glb file may get from anywhere, like download from internet).

If one of the animation is invalid, the import produce will stop and exit with error. I found that it will check return value whether it is success in ImportAnimations: https://github.com/guillaumeblanc/ozz-animation/blob/master/src/animation/offline/tools/import2ozz_anim.cc#L376

When import animation using ProcessAnimations method: https://github.com/guillaumeblanc/ozz-animation/blob/master/src/animation/offline/tools/import2ozz_anim.cc#L395

It will return false if this animation is invalid, in my case it's an animation with empty channels binded.

I know it's confused with an invalid animation in file. But the import method ImportAnimations will stop when one of animation import is failed. What I want is, tell me which animation is failed, and continue to do the import.

If there are any reason needed to stop the import when any error occurred? I found that it will print error message when it found this animation is invalid: https://github.com/guillaumeblanc/ozz-animation/blob/master/src/animation/offline/gltf/gltf2ozz.cc#L767

guillaumeblanc commented 3 years ago

Hi,

I'm still not sure what the correct behavior should be. As a user, what would you expect while importing a single invalid animation? So far I was expecting a failure, hence this behavior with multiple animations. As a user, I need to know that one of the animation I was expecting to import failed. The returned error code is the way to do it I think. I don't expect anyone to read the error log unless he knows that execution failed.

What if execution continues with other animations, but exe still return a failure? Would that work for you?

Error logging shall then be part of the shared import process (import2ozz files), so the behavior is the same for any file type (fbx, gltf...).

Cheers, Guillaume

junjie020 commented 3 years ago

What if execution continues with other animations, but exe still return a failure? Would that work for you?

It's work for me.

In my case, I get a asset from artist or download from internet. Sometime, I need to convert asset from one format to other format(like from fbx file to glTF file), I can not guarantee the asset in that file are all correct, but I want to know which failed, that enough.

Thanks

guillaumeblanc commented 3 years ago

Solved by PR #118