static GameObject CalculatePreviewGameObject(Animator selectedAnimator, Motion motion, ModelImporterAnimationType animationType) { AnimationClip sourceClip = GetFirstAnimationClipFromMotion(motion); // Use selected preview GameObject selected = AvatarPreviewSelection.GetPreview(animationType); if (IsValidPreviewGameObject(selected, ModelImporterAnimationType.None)) { return(selected); } if (selectedAnimator != null && IsValidPreviewGameObject(selectedAnimator.gameObject, animationType)) { return(selectedAnimator.gameObject); } // Find the best fitting preview game object for the asset we are viewing (Handles @ convention, will pick base path for you) selected = FindBestFittingRenderableGameObjectFromModelAsset(sourceClip, animationType); if (selected != null) { return(selected); } if (animationType == ModelImporterAnimationType.Human) { return(GetHumanoidFallback()); } else if (animationType == ModelImporterAnimationType.Generic) { return(GetGenericAnimationFallback()); } return(null); }
private static GameObject CalculatePreviewGameObject(UnityEngine.Animator selectedAnimator, Motion motion, ModelImporterAnimationType animationType) { AnimationClip firstAnimationClipFromMotion = GetFirstAnimationClipFromMotion(motion); GameObject preview = AvatarPreviewSelection.GetPreview(animationType); if (IsValidPreviewGameObject(preview, ModelImporterAnimationType.None)) { return(preview); } if ((selectedAnimator != null) && IsValidPreviewGameObject(selectedAnimator.gameObject, animationType)) { return(selectedAnimator.gameObject); } preview = FindBestFittingRenderableGameObjectFromModelAsset(firstAnimationClipFromMotion, animationType); if (preview != null) { return(preview); } if (animationType == ModelImporterAnimationType.Human) { return(GetHumanoidFallback()); } if (animationType == ModelImporterAnimationType.Generic) { return(GetGenericAnimationFallback()); } return(null); }
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); }
private void SetPreview(GameObject gameObject) { AvatarPreviewSelection.SetPreview(this.animationClipType, gameObject); UnityEngine.Object.DestroyImmediate(this.m_PreviewInstance); this.InitInstance(this.m_SourceScenePreviewAnimator, this.m_SourcePreviewMotion); if (this.m_OnAvatarChangeFunc != null) { this.m_OnAvatarChangeFunc(); } }
void SetPreview(GameObject gameObject) { AvatarPreviewSelection.SetPreview(animationClipType, gameObject); Object.DestroyImmediate(m_PreviewInstance); InitInstance(m_SourceScenePreviewAnimator, m_SourcePreviewMotion); if (m_OnAvatarChangeFunc != null) { m_OnAvatarChangeFunc(); } }