From f80fa3e137df0f78c501e565851d84e86671b297 Mon Sep 17 00:00:00 2001 From: hu-xd <74464946+hu-xd@users.noreply.github.com> Date: Fri, 26 Apr 2024 12:24:55 +0000 Subject: [PATCH] Skip empty animations animations with no channels are invalid in GLTF --- src/gltf/Raw2Gltf.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gltf/Raw2Gltf.cpp b/src/gltf/Raw2Gltf.cpp index 30ff5a3..f6da104 100644 --- a/src/gltf/Raw2Gltf.cpp +++ b/src/gltf/Raw2Gltf.cpp @@ -155,6 +155,14 @@ ModelData* Raw2Gltf( for (int i = 0; i < raw.GetAnimationCount(); i++) { const RawAnimation& animation = raw.GetAnimation(i); + + if (animation.channels.empty()) { + fmt::printf( + "Animation '%s' has no channels, skipped\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))};