public override void OnInspectorGUI()
        {
            if (this.m_Images == null)
            {
                this.InitTexturesFromCubemap();
            }
            EditorGUIUtility.labelWidth = 50f;
            Cubemap cubemap = this.target as Cubemap;

            if (cubemap == null)
            {
                return;
            }
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Right\n(+X)", CubemapFace.PositiveX);
            this.ShowFace("Left\n(-X)", CubemapFace.NegativeX);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
            this.ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
            this.ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            EditorGUIUtility.labelWidth = 0f;
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.HelpBox("Lowering face size is a destructive operation, you might need to re-assign the textures later to fix resolution issues. It's preferable to use Cubemap texture import type instead of Legacy Cubemap assets.", MessageType.Warning);
            int num = TextureUtil.GetGLWidth(cubemap);

            num = EditorGUILayout.IntPopup("Face size", num, CubemapInspector.kSizes, CubemapInspector.kSizesValues, new GUILayoutOption[0]);
            int  num2      = TextureUtil.CountMipmaps(cubemap);
            bool useMipmap = EditorGUILayout.Toggle("MipMaps", num2 > 1, new GUILayoutOption[0]);
            bool flag      = TextureUtil.GetLinearSampled(cubemap);

            flag = EditorGUILayout.Toggle("Linear", flag, new GUILayoutOption[0]);
            bool flag2 = TextureUtil.IsCubemapReadable(cubemap);

            flag2 = EditorGUILayout.Toggle("Readable", flag2, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                if (TextureUtil.ReformatCubemap(ref cubemap, num, num, cubemap.format, useMipmap, flag))
                {
                    this.InitTexturesFromCubemap();
                }
                TextureUtil.MarkCubemapReadable(cubemap, flag2);
                cubemap.Apply();
            }
        }
示例#2
0
        public override void OnInspectorGUI()
        {
            if (this.m_Images == null)
            {
                this.InitTexturesFromCubemap();
            }
            EditorGUIUtility.labelWidth = 50f;
            Cubemap cubemap = this.target as Cubemap;

            if (cubemap == null)
            {
                return;
            }
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Right\n(+X)", CubemapFace.PositiveX);
            this.ShowFace("Left\n(-X)", CubemapFace.NegativeX);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
            this.ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
            this.ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            EditorGUIUtility.labelWidth = 0f;
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            int num = TextureUtil.GetGLWidth(cubemap);

            num = EditorGUILayout.IntPopup("Face size", num, CubemapInspector.kSizes, CubemapInspector.kSizesValues, new GUILayoutOption[0]);
            int  num2      = TextureUtil.CountMipmaps(cubemap);
            bool useMipmap = EditorGUILayout.Toggle("MipMaps", num2 > 1, new GUILayoutOption[0]);
            bool flag      = TextureUtil.GetLinearSampled(cubemap);

            flag = EditorGUILayout.Toggle("Linear", flag, new GUILayoutOption[0]);
            bool flag2 = TextureUtil.IsCubemapReadable(cubemap);

            flag2 = EditorGUILayout.Toggle("Readable", flag2, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                if (TextureUtil.ReformatCubemap(ref cubemap, num, num, cubemap.format, useMipmap, flag))
                {
                    this.InitTexturesFromCubemap();
                }
                TextureUtil.MarkCubemapReadable(cubemap, flag2);
                cubemap.Apply();
            }
        }
示例#3
0
        public override void OnInspectorGUI()
        {
            if (this.m_Images == null)
            {
                this.InitTexturesFromCubemap();
            }
            EditorGUIUtility.labelWidth = 50f;
            Cubemap target = this.target as Cubemap;

            if (target != null)
            {
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Right\n(+X)", CubemapFace.PositiveX);
                this.ShowFace("Left\n(-X)", CubemapFace.NegativeX);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
                this.ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
                this.ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                EditorGUIUtility.labelWidth = 0f;
                EditorGUILayout.Space();
                EditorGUI.BeginChangeCheck();
                int gLWidth = TextureUtil.GetGLWidth(target);
                gLWidth = EditorGUILayout.IntPopup("Face size", gLWidth, kSizes, kSizesValues, new GUILayoutOption[0]);
                int  num2          = TextureUtil.CountMipmaps(target);
                bool useMipmap     = EditorGUILayout.Toggle("MipMaps", num2 > 1, new GUILayoutOption[0]);
                bool linearSampled = TextureUtil.GetLinearSampled(target);
                linearSampled = EditorGUILayout.Toggle("Linear", linearSampled, new GUILayoutOption[0]);
                bool flag3 = TextureUtil.IsCubemapReadable(target);
                flag3 = EditorGUILayout.Toggle("Readable", flag3, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    if (TextureUtil.ReformatCubemap(ref target, gLWidth, gLWidth, target.format, useMipmap, linearSampled))
                    {
                        this.InitTexturesFromCubemap();
                    }
                    TextureUtil.MarkCubemapReadable(target, flag3);
                    target.Apply();
                }
            }
        }
示例#4
0
        public override string GetInfoString()
        {
            Texture   texture   = this.target as Texture;
            Texture2D texture2D = this.target as Texture2D;
            string    text      = texture.width.ToString() + "x" + texture.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                text = text + " " + TextureUtil.GetTextureColorSpaceString(texture);
            }
            bool          flag          = TextureInspector.IsNormalMap(texture);
            bool          flag2         = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(texture));
            bool          flag3         = texture2D != null && TextureUtil.IsNonPowerOfTwo(texture2D);
            TextureFormat textureFormat = TextureUtil.GetTextureFormat(texture);
            bool          flag4         = !flag2;

            if (flag3)
            {
                text += " (NPOT)";
            }
            if (flag2)
            {
                text += " (Not yet compressed)";
            }
            else
            {
                if (flag)
                {
                    TextureFormat textureFormat2 = textureFormat;
                    switch (textureFormat2)
                    {
                    case TextureFormat.ARGB4444:
                        text += "  Nm 16 bit";
                        goto IL_142;

                    case TextureFormat.RGB24:
                    case TextureFormat.RGBA32:
IL_E9:
                        if (textureFormat2 != TextureFormat.DXT5)
                        {
                            text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                            goto IL_142;
                        }
                        text += "  DXTnm";
                        goto IL_142;

                    case TextureFormat.ARGB32:
                        text += "  Nm 32 bit";
                        goto IL_142;
                    }
                    goto IL_E9;
                    IL_142 :;
                }
                else
                {
                    text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                }
            }
            if (flag4)
            {
                text = text + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySize(texture));
            }
            if (TextureUtil.GetUsageMode(texture) == TextureUsageMode.AlwaysPadded)
            {
                int gLWidth  = TextureUtil.GetGLWidth(texture);
                int gLHeight = TextureUtil.GetGLHeight(texture);
                if (texture.width != gLWidth || texture.height != gLHeight)
                {
                    text += string.Format("\nPadded to {0}x{1}", gLWidth, gLHeight);
                }
            }
            return(text);
        }
        public override string GetInfoString()
        {
            Texture         target1 = this.target as Texture;
            Texture2D       target2 = this.target as Texture2D;
            TextureImporter atPath  = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath((UnityEngine.Object)target1)) as TextureImporter;
            string          str1    = target1.width.ToString() + "x" + target1.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                str1 = str1 + " " + TextureUtil.GetTextureColorSpaceString(target1);
            }
            bool          flag1          = (bool)((UnityEngine.Object)atPath) && atPath.qualifiesForSpritePacking;
            bool          flag2          = TextureInspector.IsNormalMap(target1);
            bool          beCompressed   = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath((UnityEngine.Object)target1));
            bool          flag3          = (UnityEngine.Object)target2 != (UnityEngine.Object)null && TextureUtil.IsNonPowerOfTwo(target2);
            TextureFormat textureFormat1 = TextureUtil.GetTextureFormat(target1);
            bool          flag4          = !beCompressed;

            if (flag3)
            {
                str1 += " (NPOT)";
            }
            string str2;

            if (beCompressed)
            {
                str2 = str1 + " (Not yet compressed)";
            }
            else if (flag2)
            {
                TextureFormat textureFormat2 = textureFormat1;
                switch (textureFormat2)
                {
                case TextureFormat.ARGB4444:
                    str2 = str1 + "  Nm 16 bit";
                    break;

                case TextureFormat.ARGB32:
                    str2 = str1 + "  Nm 32 bit";
                    break;

                default:
                    str2 = textureFormat2 == TextureFormat.DXT5 ? str1 + "  DXTnm" : str1 + "  " + TextureUtil.GetTextureFormatString(textureFormat1);
                    break;
                }
            }
            else if (flag1)
            {
                TextureFormat desiredFormat;
                ColorSpace    colorSpace;
                int           compressionQuality;
                atPath.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out desiredFormat, out colorSpace, out compressionQuality);
                str2 = str1 + "\n " + TextureUtil.GetTextureFormatString(textureFormat1) + "(Original) " + TextureUtil.GetTextureFormatString(desiredFormat) + "(Atlas)";
            }
            else
            {
                str2 = str1 + "  " + TextureUtil.GetTextureFormatString(textureFormat1);
            }
            if (flag4)
            {
                str2 = str2 + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySize(target1));
            }
            if (TextureUtil.GetUsageMode(target1) == TextureUsageMode.AlwaysPadded)
            {
                int glWidth  = TextureUtil.GetGLWidth(target1);
                int glHeight = TextureUtil.GetGLHeight(target1);
                if (target1.width != glWidth || target1.height != glHeight)
                {
                    str2 += string.Format("\nPadded to {0}x{1}", (object)glWidth, (object)glHeight);
                }
            }
            return(str2);
        }
示例#6
0
        public override string GetInfoString()
        {
            Texture         texture         = this.target as Texture;
            Texture2D       texture2D       = this.target as Texture2D;
            TextureImporter textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(texture)) as TextureImporter;
            string          text            = texture.width.ToString() + "x" + texture.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                text = text + " " + TextureUtil.GetTextureColorSpaceString(texture);
            }
            bool          flag          = textureImporter && textureImporter.qualifiesForSpritePacking;
            bool          flag2         = TextureInspector.IsNormalMap(texture);
            bool          flag3         = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(texture));
            bool          flag4         = texture2D != null && TextureUtil.IsNonPowerOfTwo(texture2D);
            TextureFormat textureFormat = TextureUtil.GetTextureFormat(texture);
            bool          flag5         = !flag3;

            if (flag4)
            {
                text += " (NPOT)";
            }
            if (flag3)
            {
                text += " (Not yet compressed)";
            }
            else if (flag2)
            {
                TextureFormat textureFormat2 = textureFormat;
                switch (textureFormat2)
                {
                case TextureFormat.ARGB4444:
                    text += "  Nm 16 bit";
                    goto IL_16B;

                case TextureFormat.RGB24:
                case TextureFormat.RGBA32:
IL_112:
                    if (textureFormat2 != TextureFormat.DXT5)
                    {
                        text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                        goto IL_16B;
                    }
                    text += "  DXTnm";
                    goto IL_16B;

                case TextureFormat.ARGB32:
                    text += "  Nm 32 bit";
                    goto IL_16B;
                }
                goto IL_112;
                IL_16B :;
            }
            else if (flag)
            {
                TextureFormat format;
                ColorSpace    colorSpace;
                int           num;
                textureImporter.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out format, out colorSpace, out num);
                string text2 = text;
                text = string.Concat(new string[]
                {
                    text2,
                    "\n ",
                    TextureUtil.GetTextureFormatString(textureFormat),
                    "(Original) ",
                    TextureUtil.GetTextureFormatString(format),
                    "(Atlas)"
                });
            }
            else
            {
                text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
            }
            if (flag5)
            {
                text = text + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySize(texture));
            }
            if (TextureUtil.GetUsageMode(texture) == TextureUsageMode.AlwaysPadded)
            {
                int gLWidth  = TextureUtil.GetGLWidth(texture);
                int gLHeight = TextureUtil.GetGLHeight(texture);
                if (texture.width != gLWidth || texture.height != gLHeight)
                {
                    text += string.Format("\nPadded to {0}x{1}", gLWidth, gLHeight);
                }
            }
            return(text);
        }
示例#7
0
        public override string GetInfoString()
        {
            Texture         target = this.target as Texture;
            Texture2D       t      = this.target as Texture2D;
            TextureImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(target)) as TextureImporter;
            string          str    = target.width.ToString() + "x" + target.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                str = str + " " + TextureUtil.GetTextureColorSpaceString(target);
            }
            bool          flag          = true;
            bool          flag2         = (atPath != null) && atPath.qualifiesForSpritePacking;
            bool          flag3         = IsNormalMap(target);
            bool          flag4         = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(target));
            bool          flag5         = (t != null) && TextureUtil.IsNonPowerOfTwo(t);
            TextureFormat textureFormat = TextureUtil.GetTextureFormat(target);

            flag = !flag4;
            if (flag5)
            {
                str = str + " (NPOT)";
            }
            if (flag4)
            {
                str = str + " (Not yet compressed)";
            }
            else if (!flag3)
            {
                if (flag2)
                {
                    TextureFormat format2;
                    ColorSpace    space;
                    int           num;
                    atPath.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out format2, out space, out num);
                    string   str2       = str;
                    string[] textArray1 = new string[] { str2, "\n ", TextureUtil.GetTextureFormatString(textureFormat), "(Original) ", TextureUtil.GetTextureFormatString(format2), "(Atlas)" };
                    str = string.Concat(textArray1);
                }
                else
                {
                    str = str + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                }
            }
            else
            {
                TextureFormat format3 = textureFormat;
                switch (format3)
                {
                case TextureFormat.ARGB4444:
                    str = str + "  Nm 16 bit";
                    goto Label_01E0;

                case TextureFormat.ARGB32:
                    str = str + "  Nm 32 bit";
                    goto Label_01E0;
                }
                if (format3 == TextureFormat.DXT5)
                {
                    str = str + "  DXTnm";
                }
                else
                {
                    str = str + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                }
            }
Label_01E0:
            if (flag)
            {
                str = str + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySize(target));
            }
            if (TextureUtil.GetUsageMode(target) != TextureUsageMode.AlwaysPadded)
            {
                return(str);
            }
            int gLWidth  = TextureUtil.GetGLWidth(target);
            int gLHeight = TextureUtil.GetGLHeight(target);

            if ((target.width == gLWidth) && (target.height == gLHeight))
            {
                return(str);
            }
            return(str + string.Format("\nPadded to {0}x{1}", gLWidth, gLHeight));
        }