From 454cb7c864cbb6339aa84bea89c4ee747f298ecd Mon Sep 17 00:00:00 2001 From: Robert Long Date: Thu, 19 Oct 2017 16:27:47 -0700 Subject: [PATCH] Skip animations with 0 channels. --- src/Raw2Gltf.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Raw2Gltf.cpp b/src/Raw2Gltf.cpp index 3c8e759..eff5875 100644 --- a/src/Raw2Gltf.cpp +++ b/src/Raw2Gltf.cpp @@ -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)) };