Skip animations with 0 channels.

This commit is contained in:
Robert Long 2017-10-19 16:27:47 -07:00
parent 946f12361c
commit 454cb7c864
1 changed files with 5 additions and 0 deletions

View File

@ -316,6 +316,11 @@ ModelData *Raw2Gltf(
for (int i = 0; i < raw.GetAnimationCount(); i++) {
const RawAnimation &animation = raw.GetAnimation(i);
if (animation.channels.size() == 0) {
fmt::printf("Warning: animation '%s has zero channels. Skipping.\n", animation.name.c_str());
continue;
}
auto accessor = gltf->AddAccessorAndView(buffer, GLT_FLOAT, animation.times);
accessor->min = { *std::min_element(std::begin(animation.times), std::end(animation.times)) };
accessor->max = { *std::max_element(std::begin(animation.times), std::end(animation.times)) };