private void DisplayAlphaSourceSettings() { alphaSource = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup("Alpha Source", alphaSource); if (alphaSource != TextureImporterAlphaSource.None) { alphaIsTransparency = EditorGUILayout.Toggle("Alpha Is Transparency", alphaIsTransparency); } }
private void TextureAlphaSetting(TextureImporter textureImporter, TextureImporterAlphaSource textureImporterAlpha) { if (textureImporterAlpha == TextureImporterAlphaSource.None) { textureImporter.alphaSource = textureImporterAlpha; textureImporter.alphaIsTransparency = false; } else if (textureImporter.alphaSource != textureImporterAlpha) { textureImporter.alphaSource = textureImporterAlpha; textureImporter.alphaIsTransparency = true; } }
public TextureImportData() { AssetPath = ""; IsRecursive = true; FileFilter = ""; Index = -1; TotalCount = 0; TotalMemUse = 0; AlphaSource = TextureImporterAlphaSource.FromInput; TextureType = TextureImporterType.Default; Mipmap = false; ReadWriteEnable = false; MaxSize = -1; AndroidFormat = TextureImporterFormat.ETC2_RGB4; IosFormat = TextureImporterFormat.PVRTC_RGB4; }
// Token: 0x060003DB RID: 987 RVA: 0x000348F0 File Offset: 0x00032AF0 public static string GetAlphaSourceString(TextureImporterAlphaSource value) { switch ((int)value) { case 0: return("None"); case 1: return("Input Alpha"); case 2: return("From Grayscale"); default: return(value.ToString()); } }
public void Apply(TextureImporterSettings settings) { this.seamlessCubemap = settings.seamlessCubemap; this.mipmapBias = settings.mipmapBias; this.wrapMode = settings.wrapMode; this.wrapModeU = settings.wrapModeU; this.wrapModeV = settings.wrapModeV; this.wrapModeW = settings.wrapModeW; this.alphaIsTransparency = settings.alphaIsTransparency; this.spriteMode = settings.spriteMode; this.spritePixelsPerUnit = settings.spritePixelsPerUnit; this.spriteTessellationDetail = settings.spriteTessellationDetail; this.spriteExtrude = settings.spriteExtrude; this.spriteMeshType = settings.spriteMeshType; this.spriteAlignment = settings.spriteAlignment; this.spritePivot = settings.spritePivot; this.spriteBorder = settings.spriteBorder; this.spriteGenerateFallbackPhysicsShape = settings.spriteGenerateFallbackPhysicsShape; this.aniso = settings.aniso; this.filterMode = settings.filterMode; this.cubemapConvolution = settings.cubemapConvolution; this.textureType = settings.textureType; this.textureShape = settings.textureShape; this.mipmapFilter = settings.mipmapFilter; this.mipmapEnabled = settings.mipmapEnabled; this.sRGBTexture = settings.sRGBTexture; this.fadeOut = settings.fadeOut; this.borderMipmap = settings.borderMipmap; this.mipMapsPreserveCoverage = settings.mipMapsPreserveCoverage; this.mipmapFadeDistanceStart = settings.mipmapFadeDistanceStart; this.alphaTestReferenceValue = settings.alphaTestReferenceValue; this.convertToNormalMap = settings.convertToNormalMap; this.heightmapScale = settings.heightmapScale; this.normalMapFilter = settings.normalMapFilter; this.alphaSource = settings.alphaSource; this.singleChannelComponent = settings.singleChannelComponent; this.readable = settings.readable; this.streamingMipmaps = settings.streamingMipmaps; this.streamingMipmapsPriority = settings.streamingMipmapsPriority; this.npotScale = settings.npotScale; this.generateCubemap = settings.generateCubemap; this.mipmapFadeDistanceEnd = settings.mipmapFadeDistanceEnd; }
public TextureAlphaSettings(TextureImporterAlphaSource alphaSource, float alphaTolerance) { this.alphaTolerance = alphaTolerance; this.alphaSource = alphaSource; }
public TextureAlphaSettings() { alphaTolerance = 0.5f; alphaSource = TextureImporterAlphaSource.FromInput; }
void OnContent(int windowID) { #region Filter Settings string count = loadedtex == null ? "" : loadedtex.Count > 0 ? loadedtex.Count.ToString() : ""; EditorGUILayout.HelpBox("筛选素材:" + count, MessageType.None); GUILayout.BeginHorizontal(); GUILayout.Box("Resources Type"); fType = (FilterType)EditorGUILayout.EnumPopup(fType); externalFiler = GUILayout.TextField(externalFiler); GUILayout.EndHorizontal(); EditorGUILayout.HelpBox("反选工具,输入关键词进行反向筛选,多个关键词用空格隔开", MessageType.Info); GUILayout.BeginHorizontal(); GUILayout.Box("InversSelect"); externalFilerInvers = GUILayout.TextField(externalFilerInvers); if (GUILayout.Button("Search")) { currentPageID = 0; loadedtex = new List <Texture> (); loadedtex = FindAssetsAutoFilter <Texture> (externalFiler); if (!System.String.IsNullOrEmpty(externalFilerInvers)) { string inversfilterRule = externalFilerInvers.Replace(' ', ';'); Debug.Log(inversfilterRule); string [] inversRule = inversfilterRule.Split(';'); if (inversRule.Length == 0) { inversRule = new string[] { "externalFilerInvers" }; } List <Texture> selected = new List <Texture>(); for (int i = 0; i < loadedtex.Count; i++) { bool include = true; foreach (var rule in inversRule) { if (loadedtex[i].name.Contains(rule)) { include = false; break; } } if (include) { selected.Add(loadedtex[i]); } } loadedtex = selected; selected = null; } } GUILayout.EndHorizontal(); #endregion GUILayout.Space(20); EditorGUILayout.HelpBox("Format Texture", MessageType.None); #region Format Settings if (DrawContent) { TextureImporterPlatformSettings platformSettings = new TextureImporterPlatformSettings(); TextureImporterSettings textureSettings = new TextureImporterSettings(); TextureImporterCompression texImpCompression = TextureImporterCompression.Compressed; GUILayout.BeginHorizontal(); GUILayout.Label("Texture Type"); texImpType = (TextureImporterType)EditorGUILayout.Popup((int)texImpType, GetAllTextureImportType); texFormat = (TextureImporterFormat)EditorGUILayout.EnumPopup(texFormat); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Texture Alpha"); texAlphaImportMode = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup(texAlphaImportMode); texAlphaIsTransparent = EditorGUILayout.Toggle("Alpha Is Transparent", texAlphaIsTransparent); GUILayout.EndHorizontal(); GUILayout.Space(10); GUILayout.BeginHorizontal(); texOverriden = EditorGUILayout.ToggleLeft("Override for " + EditorUserBuildSettings.activeBuildTarget.ToString(), texOverriden); texImpCompression = (TextureImporterCompression)EditorGUILayout.EnumPopup(texImpCompression); texSizeLevel = EditorGUILayout.Popup(texSizeLevel, new string[] { "16", "32", "64", "128", "256", "512", "1024", "2048", "4096" }); GUILayout.EndHorizontal(); if (texImpCompression != TextureImporterCompression.Uncompressed) { GUILayout.BeginHorizontal(); texCrunchedCompression = EditorGUILayout.Toggle("Crunched Compression", texCrunchedCompression); texCompressionQuality = Mathf.CeilToInt(EditorGUILayout.Slider("Quality", texCompressionQuality, 0, 100)); GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Format")) { FormatOpreator = new Opreator(); FormatOpreator.OpreatorName = "Format"; // string[] path = FindAssetsPath<Texture> (externalFiler); for (int i = 0; i < loadedtex.Count; i++) { TextureImporter texImporter = GetTextureSettings(AssetDatabase.GetAssetPath(loadedtex[i])); texImporter.ReadTextureSettings(textureSettings); textureSettings.ApplyTextureType(texImpType); textureSettings.filterMode = FilterMode.Bilinear; textureSettings.alphaIsTransparency = texAlphaIsTransparent; platformSettings.compressionQuality = texCompressionQuality; platformSettings.crunchedCompression = texCrunchedCompression; platformSettings.textureCompression = texImpCompression; Debug.Log("Overriden ?" + texOverriden); platformSettings.overridden = texOverriden; platformSettings.textureCompression = texImpCompression; platformSettings.format = texFormat; texImporter.SetTextureSettings(textureSettings); texImporter.SetPlatformTextureSettings(platformSettings); texImporter.textureType = texImpType; texImporter.maxTextureSize = GetOverrideTexSize; texImporter.alphaSource = texAlphaImportMode; FormatOpreator.Ditail = texImporter.name; FormatOpreator.progress = (float)i / (float)loadedtex.Count; texImporter.SaveAndReimport(); } FormatOpreator = null; } GUILayout.EndHorizontal(); } #endregion #region External float posX = Event.current.mousePosition.x + Mathf.Sin(Time.realtimeSinceStartup) * 20; float posY = Mathf.Clamp(Event.current.mousePosition.y, 200, 800) + Mathf.Cos(Time.realtimeSinceStartup) * 20; float size = 100 + Mathf.Sin(Time.realtimeSinceStartup) * 20; try{ GUI.DrawTexture(new Rect(posX, posY, size, size), Icon); }catch { GUI.Label(new Rect(posX, posY, size, size), "我插件里面的图不见了!喵喵喵???"); Debug.Log("我插件里面的图不见了!喵喵喵???"); } #endregion }
private void OnGUI() { Texturetype = (TextureImporterType)EditorGUILayout.EnumPopup("Texture Type", Texturetype); switch (Texturetype) { case TextureImporterType.Default: TexShape = (TextureImporterShape)EditorGUILayout.EnumPopup("Texture Shape", TexShape); IsSrgb = EditorGUILayout.Toggle("sRGB(Color Texture)", IsSrgb); AlphaSource = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup("Alpha Source", AlphaSource); IsAlphaIsTransparency = EditorGUILayout.Toggle("Alpha Is Transparency", IsAlphaIsTransparency); NpotScale = (TextureImporterNPOTScale)EditorGUILayout.EnumPopup("Non Power of 2", NpotScale); IsRead = EditorGUILayout.Toggle("Read/Write Enabled", IsRead); IsStreamingMipMap = EditorGUILayout.Toggle("Streaming Mip Maps", IsStreamingMipMap); IsGenerateMipmap = EditorGUILayout.Toggle("Generate Mip Maps", IsGenerateMipmap); DefalutWarpMode = (TextureWrapMode)EditorGUILayout.EnumPopup("Wrap Mode", DefalutWarpMode); MaxSize = (MaxSize)EditorGUILayout.EnumPopup("Max Size", MaxSize); Compression = (TextureImporterCompression)EditorGUILayout.EnumPopup("Compression", Compression); break; case TextureImporterType.NormalMap: break; case TextureImporterType.GUI: break; case TextureImporterType.Sprite: SpriteImportMode = (SpriteImportMode)EditorGUILayout.EnumPopup("Sprite Mode", SpriteImportMode); PackingTag = EditorGUILayout.TextField("Packing Tag", PackingTag); IsSrgb = EditorGUILayout.Toggle("sRGB(Color Texture)", IsSrgb); AlphaSource = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup("Alpha Source", AlphaSource); IsAlphaIsTransparency = EditorGUILayout.Toggle("Alpha Is Transparency", IsAlphaIsTransparency); IsRead = EditorGUILayout.Toggle("Read/Write Enabled", IsRead); IsGenerateMipmap = EditorGUILayout.Toggle("Generate Mip Maps", IsGenerateMipmap); SpriteWarpMode = (TextureWrapMode)EditorGUILayout.EnumPopup("Wrap Mode", SpriteWarpMode); MaxSize = (MaxSize)EditorGUILayout.EnumPopup("Max Size", MaxSize); Compression = (TextureImporterCompression)EditorGUILayout.EnumPopup("Compression", Compression); break; case TextureImporterType.Cursor: break; case TextureImporterType.Cookie: break; case TextureImporterType.Lightmap: break; case TextureImporterType.SingleChannel: break; } if (GUILayout.Button("设置图片属性后、导入或修改前,请点击本按钮!")) { IsApply = true; Debug.Log("已应用设置"); } if (GUILayout.Button("还原设置: 请点击本按钮 或者 直接关闭面板 !")) { IsApply = false; Debug.Log("已还原设置"); } }
void OnGUI() { Undo.RecordObject(this, "lb"); scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false, GUILayout.Width(Screen.width), GUILayout.Height(Screen.height)); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); importerType = (TexImporterType)EditorGUILayout.EnumPopup("Importer Mode", importerType, GUILayout.Width(343)); if (GUILayout.Button("Batch Import")) { if (importerType == TexImporterType.AllTextures) { var files = Directory.GetFiles("Assets", "*.*", SearchOption.AllDirectories) .Where(s => s.EndsWith(".png") || s.EndsWith(".jpg") || s.EndsWith(".psd") || s.EndsWith(".gif") || s.EndsWith(".iff") || s.EndsWith(".tga") || s.EndsWith(".tiff") || s.EndsWith(".bmp") || s.EndsWith(".pict")); foreach (string s in files) { TextureImporter tImporter = AssetImporter.GetAtPath(s) as TextureImporter; tImporter.maxTextureSize = textureSize; if (comprissonMode == TextureCompressionType.None) { tImporter.textureCompression = TextureImporterCompression.Uncompressed; } if (comprissonMode == TextureCompressionType.LowQuality) { tImporter.textureCompression = TextureImporterCompression.CompressedLQ; } if (comprissonMode == TextureCompressionType.HighQuality) { tImporter.textureCompression = TextureImporterCompression.CompressedHQ; } if (advancedMode) { tImporter.textureType = textureType; tImporter.textureShape = textureShape; tImporter.sRGBTexture = textureRGB; tImporter.alphaSource = textureAlphaSource; tImporter.alphaIsTransparency = AlphaIsTransparent; tImporter.isReadable = ReadWriteEnabled; tImporter.mipmapEnabled = GenerateMipMaps; tImporter.wrapMode = wrapMode; tImporter.filterMode = filterMode; tImporter.anisoLevel = AnisoLevel; } AssetDatabase.ImportAsset(s, ImportAssetOptions.ForceUpdate); } } if (importerType == TexImporterType.CustomPath) { if (CustomPath.Length > 0) { foreach (string f in CustomPath) { var files = Directory.GetFiles(f, "*.*", SearchOption.AllDirectories) .Where(s => s.EndsWith(".png") || s.EndsWith(".jpg") || s.EndsWith(".psd") || s.EndsWith(".gif") || s.EndsWith(".iff") || s.EndsWith(".tga") || s.EndsWith(".tiff") || s.EndsWith(".bmp") || s.EndsWith(".pict")); foreach (string ss in files) { TextureImporter tImporter = AssetImporter.GetAtPath(ss) as TextureImporter; tImporter.maxTextureSize = textureSize; if (comprissonMode == TextureCompressionType.None) { tImporter.textureCompression = TextureImporterCompression.Uncompressed; } if (comprissonMode == TextureCompressionType.LowQuality) { tImporter.textureCompression = TextureImporterCompression.CompressedLQ; } if (comprissonMode == TextureCompressionType.HighQuality) { tImporter.textureCompression = TextureImporterCompression.CompressedHQ; } if (advancedMode) { tImporter.textureType = textureType; tImporter.textureShape = textureShape; tImporter.sRGBTexture = textureRGB; tImporter.alphaSource = textureAlphaSource; tImporter.alphaIsTransparency = AlphaIsTransparent; tImporter.isReadable = ReadWriteEnabled; tImporter.mipmapEnabled = GenerateMipMaps; tImporter.wrapMode = wrapMode; tImporter.filterMode = filterMode; tImporter.anisoLevel = AnisoLevel; } AssetDatabase.ImportAsset(ss, ImportAssetOptions.ForceUpdate); } } } } if (importerType == TexImporterType.CustomTextures) { if (targets.Length > 0) { foreach (Texture2D s in targets) { TextureImporter tImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(s)) as TextureImporter; tImporter.maxTextureSize = textureSize; if (comprissonMode == TextureCompressionType.None) { tImporter.textureCompression = TextureImporterCompression.Uncompressed; } if (comprissonMode == TextureCompressionType.LowQuality) { tImporter.textureCompression = TextureImporterCompression.CompressedLQ; } if (comprissonMode == TextureCompressionType.HighQuality) { tImporter.textureCompression = TextureImporterCompression.CompressedHQ; } if (advancedMode) { tImporter.textureType = textureType; tImporter.textureShape = textureShape; tImporter.sRGBTexture = textureRGB; tImporter.alphaSource = textureAlphaSource; tImporter.alphaIsTransparency = AlphaIsTransparent; tImporter.isReadable = ReadWriteEnabled; tImporter.mipmapEnabled = GenerateMipMaps; tImporter.wrapMode = wrapMode; tImporter.filterMode = filterMode; tImporter.anisoLevel = AnisoLevel; } AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(s), ImportAssetOptions.ForceUpdate); } } } } EditorGUILayout.Space(); EditorGUILayout.Space(); if (importerType == TexImporterType.CustomTextures) { ScriptableObject target = this; SerializedObject so = new SerializedObject(target); SerializedProperty stringsProperty = so.FindProperty("targets"); EditorGUILayout.PropertyField(stringsProperty, true); // True means show children so.ApplyModifiedProperties(); // Remember to apply modified properties } if (importerType == TexImporterType.CustomPath) { ScriptableObject target = this; SerializedObject so = new SerializedObject(target); SerializedProperty stringsProperty = so.FindProperty("CustomPath"); EditorGUILayout.PropertyField(stringsProperty, true); // True means show children so.ApplyModifiedProperties(); // Remember to apply modified properties } textureSize = EditorGUILayout.IntField("Texture Size", textureSize, GUILayout.Width(343)); EditorGUILayout.Space(); EditorGUILayout.Space(); comprissonMode = (TextureCompressionType)EditorGUILayout.EnumPopup("Comprisson Mode", comprissonMode, GUILayout.Width(343)); EditorGUILayout.Space(); EditorGUILayout.Space(); advancedMode = EditorGUILayout.Toggle("Show Advanced Options", advancedMode); EditorGUILayout.Space(); EditorGUILayout.Space(); if (advancedMode) { EditorGUILayout.LabelField("Recommended non-advanced mode to avoid problems"); EditorGUILayout.Space(); EditorGUILayout.Space(); textureType = (TextureImporterType)EditorGUILayout.EnumPopup("Texture Type", textureType, GUILayout.Width(343)); textureShape = (TextureImporterShape)EditorGUILayout.EnumPopup("Texture Shape", textureShape, GUILayout.Width(343)); textureRGB = EditorGUILayout.Toggle("sRGB Mode", textureRGB, GUILayout.Width(343)); textureAlphaSource = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup("Alpha Source", textureAlphaSource, GUILayout.Width(343)); EditorGUILayout.Space(); EditorGUILayout.Space(); AlphaIsTransparent = EditorGUILayout.Toggle("Alpha Is Transparent", AlphaIsTransparent, GUILayout.Width(343)); ReadWriteEnabled = EditorGUILayout.Toggle("Read Write Enabled", ReadWriteEnabled, GUILayout.Width(343)); GenerateMipMaps = EditorGUILayout.Toggle("Generate Mip Maps", GenerateMipMaps, GUILayout.Width(343)); EditorGUILayout.Space(); EditorGUILayout.Space(); wrapMode = (TextureWrapMode)EditorGUILayout.EnumPopup("Wrap Mode", wrapMode, GUILayout.Width(343)); filterMode = (FilterMode)EditorGUILayout.EnumPopup("Filter Mode", filterMode, GUILayout.Width(343)); EditorGUILayout.Space(); EditorGUILayout.Space(); AnisoLevel = EditorGUILayout.IntField("Aniso Level", AnisoLevel, GUILayout.Width(343)); } EditorGUILayout.EndScrollView(); }
private void OnGUI() { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.LabelField("Path:"); currenTextureImportData.AssetPath = EditorGUILayout.TextField(currenTextureImportData.AssetPath); EditorGUILayout.LabelField("NameFilter:", GUILayout.MinWidth(200)); currenTextureImportData.FileFilter = EditorGUILayout.TextField(currenTextureImportData.FileFilter); if (GUILayout.Button("Save", GUILayout.MinWidth(100))) { SetSelectIndexDataInfo(); } if (GUILayout.Button("Delete", GUILayout.MinWidth(100))) { TextureImportManager.ImportRule.Delete(currentSelectIndex); } if (GUILayout.Button("New Data", GUILayout.MinWidth(100))) { if (string.IsNullOrEmpty(currenTextureImportData.AssetPath) || string.IsNullOrEmpty(currenTextureImportData.FileFilter)) { return; } TextureImportManager.TextureImportRule.TextureImportData data = GetNextTextureImportData(); data.AssetPath = currenTextureImportData.AssetPath; data.FileFilter = currenTextureImportData.FileFilter; TextureImportManager.ImportRule.Add(data); currenTextureImportData = data; currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); { textureType = (TextureImporterType)EditorGUILayout.EnumPopup("Texture类型", textureType); SetTextureTypeInfo(); alphaSourceType = (TextureImporterAlphaSource)EditorGUILayout.EnumPopup("AlphaSource", alphaSourceType); SetAlphaSourceInfo(); androidFormatType = (TextureImporterFormat)EditorGUILayout.EnumPopup("AndroidFormat", androidFormatType); androidFormatCompression = (TextureImporterCompression)EditorGUILayout.EnumPopup("AndroidCompression", androidFormatCompression); SetAndroidFormatInfo(); iPhoneFormatType = (TextureImporterFormat)EditorGUILayout.EnumPopup("iPhoneFormat", iPhoneFormatType); iPhoneFormatCompression = (TextureImporterCompression)EditorGUILayout.EnumPopup("iPhoneCompression", iPhoneFormatCompression); SetiPhoneFormatInfo(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); { currenTextureImportData.IsMinMap = EditorGUILayout.ToggleLeft("是否开启Mipmap", currenTextureImportData.IsMinMap); currenTextureImportData.IsReadWriteEnable = EditorGUILayout.ToggleLeft("是否开启ReadWrite", currenTextureImportData.IsReadWriteEnable); currenTextureImportData.Index = EditorGUILayout.IntField("Rule Index", currenTextureImportData.Index); currenTextureImportData.MaxTextureSize = EditorGUILayout.IntField("纹理MaxSize", currenTextureImportData.MaxTextureSize); } EditorGUILayout.EndHorizontal(); GUILayout.Space(25); int height = (TextureImportManager.ImportRule.TextureImportDatas.Count + 1) * 20; TextureImportManager.TextureImportRule.TextureImportData rule = TextureImportManager.ImportRule.GetRule(currentSelectIndex); string[] guids = null; if (null != rule) { guids = AssetDatabase.FindAssets("t:Texture", new string[] { rule.AssetPath }); height += (guids.Length + 1) * 20; } scrollPosition = GUI.BeginScrollView(new Rect(0, 30, position.width, position.height - 30), scrollPosition, new Rect(0, 0, 1250, height)); EditorGUILayout.BeginHorizontal(); { GUILayout.Label("AssetPath", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("FileFilter", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("Index", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("AlphaSource", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("TextureType", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("Mipmap", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("R/W", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("MaxSize", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("Android", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("AndroidCompression", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("iPhone", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("iPhoneCompression", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("Apply", EditorStyles.label, GUILayout.MinWidth(100)); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); GUIStyle style = GUI.skin.textField; for (int i = 0; i < TextureImportManager.ImportRule.TextureImportDatas.Count; i++) { EditorGUILayout.BeginHorizontal(); TextureImportManager.TextureImportRule.TextureImportData data = TextureImportManager.ImportRule.TextureImportDatas[i]; GUI.color = data.Index == currentSelectIndex ? Color.green : new Color(0.8f, 0.8f, 0.8f, 1); if (GUILayout.Button(data.AssetPath, style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.FileFilter, style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.Index.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.AlphaSource.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.TextureImporterType.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.IsMinMap.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.IsReadWriteEnable.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.MaxTextureSize.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.AndroidImporterFormat.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.AndroidImporterCompression.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.IphoneImporterFormat.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button(data.IphoneImporterCompression.ToString(), style, GUILayout.MinWidth(100))) { currentSelectIndex = data.Index; GetSelectIndexDataInfo(data); } if (GUILayout.Button("Apply", GUILayout.MinWidth(100))) { TextureImportManager.ReImportTextures(data); } EditorGUILayout.EndHorizontal(); } if (null != guids) { int count = 0; for (int i = 0; i < guids.Length; i++) { string path = AssetDatabase.GUIDToAssetPath(guids[i]); if (string.IsNullOrEmpty(path)) { continue; } string dir = path.Remove(path.LastIndexOf('/')); if (!dir.Equals(currenTextureImportData.AssetPath)) { continue; } string fileName = path.Substring(path.LastIndexOf('/') + 1); if (!currenTextureImportData.IsMatch(fileName)) { continue; } TextureImporter ai = AssetImporter.GetAtPath(path) as TextureImporter; if (null != ai) { EditorGUILayout.BeginHorizontal(); { GUILayout.Label(fileName, EditorStyles.label, GUILayout.MinWidth(120)); GUILayout.Label("", EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label((++count).ToString(), EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label(ai.alphaSource.ToString(), EditorStyles.label, GUILayout.MinWidth(120)); GUILayout.Label(ai.textureType.ToString(), EditorStyles.label, GUILayout.MinWidth(120)); GUILayout.Label(ai.mipmapEnabled.ToString(), EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label(ai.isReadable.ToString(), EditorStyles.label, GUILayout.MinWidth(100)); TextureImporterPlatformSettings settingAndroid = ai.GetPlatformTextureSettings("Android"); TextureImporterPlatformSettings settingiPhone = ai.GetPlatformTextureSettings("iPhone"); GUILayout.Label(settingAndroid.maxTextureSize.ToString(), EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label(settingAndroid.format.ToString(), EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label(settingAndroid.textureCompression.ToString(), EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label(settingiPhone.format.ToString(), EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label(settingiPhone.textureCompression.ToString(), EditorStyles.label, GUILayout.MinWidth(100)); GUILayout.Label("", EditorStyles.label, GUILayout.MinWidth(100)); } EditorGUILayout.EndHorizontal(); } } } GUI.EndScrollView(); if (EditorUtility.IsDirty(TextureImportManager.ImportRule)) { EditorUtility.SetDirty(TextureImportManager.ImportRule); AssetDatabase.Refresh(); } }