IsValidPreviewGameObject() public static method

public static IsValidPreviewGameObject ( GameObject target, ModelImporterAnimationType requiredClipType ) : bool
target UnityEngine.GameObject
requiredClipType ModelImporterAnimationType
return bool
Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public static GameObject FindBestFittingRenderableGameObjectFromModelAsset(UnityEngine.Object asset, ModelImporterAnimationType animationType)
        {
            GameObject result;

            if (asset == null)
            {
                result = null;
            }
            else
            {
                ModelImporter modelImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(asset)) as ModelImporter;
                if (modelImporter == null)
                {
                    result = null;
                }
                else
                {
                    string     assetPath  = modelImporter.CalculateBestFittingPreviewGameObject();
                    GameObject gameObject = AssetDatabase.LoadMainAssetAtPath(assetPath) as GameObject;
                    if (AvatarPreview.IsValidPreviewGameObject(gameObject, ModelImporterAnimationType.None))
                    {
                        result = gameObject;
                    }
                    else
                    {
                        result = null;
                    }
                }
            }
            return(result);
        }
Esempio n. 3
0
        public static GameObject FindBestFittingRenderableGameObjectFromModelAsset(Object asset, ModelImporterAnimationType animationType)
        {
            if (asset == (Object)null)
            {
                return((GameObject)null);
            }
            ModelImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(asset)) as ModelImporter;

            if ((Object)atPath == (Object)null)
            {
                return((GameObject)null);
            }
            GameObject target = AssetDatabase.LoadMainAssetAtPath(atPath.CalculateBestFittingPreviewGameObject()) as GameObject;

            if (AvatarPreview.IsValidPreviewGameObject(target, animationType))
            {
                return(target);
            }
            return((GameObject)null);
        }