Cope with animation edge case, don't NPE.

This commit is contained in:
Par Winzell 2017-11-08 11:25:55 -08:00
parent 145f0d84a1
commit 412b98b9ab
1 changed files with 8 additions and 3 deletions

View File

@ -1015,13 +1015,18 @@ static void ReadAnimations(RawModel &raw, FbxScene *pScene)
FbxAnimStack *pAnimStack = pScene->GetSrcObject<FbxAnimStack>(animIx);
FbxString animStackName = pAnimStack->GetName();
pScene->SetCurrentAnimationStack(pAnimStack);
FbxTakeInfo *takeInfo = pScene->GetTakeInfo(animStackName);
if (takeInfo == nullptr) {
fmt::printf("Warning:: animation '%s' has no Take information. Skipping.\n", animStackName);
// not all animstacks have a take
continue;
}
if (verboseOutput) {
fmt::printf("animation %zu: %s (%d%%)", animIx, (const char *) animStackName, 0);
}
pScene->SetCurrentAnimationStack(pAnimStack);
FbxTakeInfo *takeInfo = pScene->GetTakeInfo(animStackName);
FbxTime start = takeInfo->mLocalTimeSpan.GetStart();
FbxTime end = takeInfo->mLocalTimeSpan.GetStop();