private static GameObject CalculatePreviewGameObject(Animator selectedAnimator, Motion motion, ModelImporterAnimationType animationType)
{
AnimationClip firstAnimationClipFromMotion = AvatarPreview.GetFirstAnimationClipFromMotion(motion);
GameObject gameObject = AvatarPreviewSelection.GetPreview(animationType);
if (AvatarPreview.IsValidPreviewGameObject(gameObject, ModelImporterAnimationType.None))
{
return(gameObject);
}
if (selectedAnimator != null && AvatarPreview.IsValidPreviewGameObject(selectedAnimator.gameObject, animationType))
{
return(selectedAnimator.gameObject);
}
gameObject = AvatarPreview.FindBestFittingRenderableGameObjectFromModelAsset(firstAnimationClipFromMotion, animationType);
if (gameObject != null)
{
return(gameObject);
}
if (animationType == ModelImporterAnimationType.Human)
{
return(AvatarPreview.GetHumanoidFallback());
}
if (animationType == ModelImporterAnimationType.Generic)
{
return(AvatarPreview.GetGenericAnimationFallback());
}
return(null);
}