Skip to content

Commit

Permalink
Merge pull request #53 from hu-xd/skip-empty-animations
Browse files Browse the repository at this point in the history
Skip empty animations, fixes #44
  • Loading branch information
fire authored Apr 28, 2024
2 parents 0a151c8 + f80fa3e commit 6154391
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gltf/Raw2Gltf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))};
Expand Down

0 comments on commit 6154391

Please sign in to comment.