Skip to content

Commit

Permalink
Release 1.0.0-alpha.22; Fix incorrect animation range export (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrinktofit authored Aug 10, 2021
1 parent 82ff0ce commit a12375a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Core/Source/bee/Convert/SceneConverter.Animation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ void SceneConverter::_convertAnimation(fbxsdk::FbxScene &fbx_scene_) {
const auto animName = _convertName(animStack->GetName());
glTFAnimation.name = animName;

_log(Logger::Level::verbose, fmt::format("Take {}: {}s", animName, timeSpan.GetDuration().GetSecondDouble()));
_log(Logger::Level::verbose,
fmt::format("Take {}: {}s", animName,
timeSpan.GetDuration().GetSecondDouble()));

fbx_scene_.SetCurrentAnimationStack(animStack);
for (std::remove_const_t<decltype(nAnimLayers)> iAnimLayer = 0;
Expand Down Expand Up @@ -153,7 +155,7 @@ SceneConverter::_getAnimStackTimeSpan(fbxsdk::FbxAnimStack &fbx_anim_stack_,
", " +
std::to_string(referenceTimeSpan.GetStop().GetSecondDouble()) + "]");

fbxsdk::FbxTimeSpan animTimeSpan;
std::optional<fbxsdk::FbxTimeSpan> animTimeSpan;
for (std::remove_const_t<decltype(nAnimLayers)> iAnimLayer = 0;
iAnimLayer < nAnimLayers; ++iAnimLayer) {
const auto animLayer =
Expand All @@ -170,8 +172,10 @@ SceneConverter::_getAnimStackTimeSpan(fbxsdk::FbxAnimStack &fbx_anim_stack_,
InvalidNodeAnimationRange{
fbx_node_.GetName(), maxAllowedAnimDurationSeconds,
duration, fbx_anim_stack_.GetName()});
} else if (animTimeSpan) {
animTimeSpan->UnionAssignment(interval);
} else {
animTimeSpan.UnionAssignment(interval);
animTimeSpan = interval;
}
}

Expand All @@ -186,7 +190,7 @@ SceneConverter::_getAnimStackTimeSpan(fbxsdk::FbxAnimStack &fbx_anim_stack_,
getInterval(*fbx_scene_.GetRootNode());
}

return animTimeSpan;
return animTimeSpan.value_or(fbxsdk::FbxTimeSpan{});
}

void SceneConverter::_convertAnimationLayer(
Expand Down

0 comments on commit a12375a

Please sign in to comment.