public static bool HasRenderablePartsRecurse(GameObject go)
        {
            MeshRenderer exists     = go.GetComponent(typeof(MeshRenderer)) as MeshRenderer;
            MeshFilter   meshFilter = go.GetComponent(typeof(MeshFilter)) as MeshFilter;

            if (exists && meshFilter && meshFilter.sharedMesh)
            {
                return(true);
            }
            SkinnedMeshRenderer skinnedMeshRenderer = go.GetComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;

            if (skinnedMeshRenderer && skinnedMeshRenderer.sharedMesh)
            {
                return(true);
            }
            SpriteRenderer spriteRenderer = go.GetComponent(typeof(SpriteRenderer)) as SpriteRenderer;

            if (spriteRenderer && spriteRenderer.sprite)
            {
                return(true);
            }
            foreach (Transform transform in go.transform)
            {
                if (GameObjectInspector.HasRenderablePartsRecurse(transform.gameObject))
                {
                    return(true);
                }
            }
            return(false);
        }
        public static bool HasRenderablePartsRecurse(GameObject go)
        {
            MeshRenderer component1 = go.GetComponent(typeof(MeshRenderer)) as MeshRenderer;
            MeshFilter   component2 = go.GetComponent(typeof(MeshFilter)) as MeshFilter;

            if ((bool)((UnityEngine.Object)component1) && (bool)((UnityEngine.Object)component2) && (bool)((UnityEngine.Object)component2.sharedMesh))
            {
                return(true);
            }
            SkinnedMeshRenderer component3 = go.GetComponent(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;

            if ((bool)((UnityEngine.Object)component3) && (bool)((UnityEngine.Object)component3.sharedMesh))
            {
                return(true);
            }
            SpriteRenderer component4 = go.GetComponent(typeof(SpriteRenderer)) as SpriteRenderer;

            if ((bool)((UnityEngine.Object)component4) && (bool)((UnityEngine.Object)component4.sprite))
            {
                return(true);
            }
            foreach (Component component5 in go.transform)
            {
                if (GameObjectInspector.HasRenderablePartsRecurse(component5.gameObject))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #3
0
 public static bool IsValidPreviewGameObject(GameObject target, ModelImporterAnimationType requiredClipType)
 {
     if (target != null && !target.activeSelf)
     {
         Debug.LogWarning("Can't preview inactive object, using fallback object");
     }
     return(target != null && target.activeSelf && GameObjectInspector.HasRenderablePartsRecurse(target) && (requiredClipType == ModelImporterAnimationType.None || AvatarPreview.GetAnimationType(target) == requiredClipType));
 }
Example #4
0
 public static bool IsValidPreviewGameObject(GameObject target, ModelImporterAnimationType requiredClipType)
 {
     if ((Object)target != (Object)null && !target.activeSelf)
     {
         Debug.LogWarning((object)"Can't preview inactive object, using fallback object");
     }
     if ((Object)target != (Object)null && target.activeSelf && GameObjectInspector.HasRenderablePartsRecurse(target))
     {
         return((requiredClipType == ModelImporterAnimationType.None ? 0 : (AvatarPreview.GetAnimationType(target) != requiredClipType ? 1 : 0)) == 0);
     }
     return(false);
 }
        private bool HasStaticPreview()
        {
            if (base.targets.Length > 1)
            {
                return(true);
            }
            if (this.target == null)
            {
                return(false);
            }
            GameObject gameObject = this.target as GameObject;
            Camera     exists     = gameObject.GetComponent(typeof(Camera)) as Camera;

            return(exists || GameObjectInspector.HasRenderablePartsRecurse(gameObject));
        }
        private bool HasStaticPreview()
        {
            if (this.targets.Length > 1)
            {
                return(true);
            }
            if (this.target == (UnityEngine.Object)null)
            {
                return(false);
            }
            GameObject target = this.target as GameObject;

            if ((bool)((UnityEngine.Object)(target.GetComponent(typeof(Camera)) as Camera)))
            {
                return(true);
            }
            return(GameObjectInspector.HasRenderablePartsRecurse(target));
        }