public virtual void ShowImportSettings(Editor baseEditor, TextureImportPlatformSettings platformSettings) { TextureImporterInspector textureImporterInspector = baseEditor as TextureImporterInspector; EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.maxTextureSizeIsDifferent); int maxTextureSizeForAll = EditorGUILayout.IntPopup(DefaultTextureImportSettingsExtension.maxSize.text, platformSettings.maxTextureSize, DefaultTextureImportSettingsExtension.kMaxTextureSizeStrings, DefaultTextureImportSettingsExtension.kMaxTextureSizeValues, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetMaxTextureSizeForAll(maxTextureSizeForAll); } int[] array = null; string[] array2 = null; bool flag = false; int num = 0; bool flag2 = false; int num2 = 0; bool flag3 = false; for (int i = 0; i < textureImporterInspector.targets.Length; i++) { TextureImporter textureImporter = textureImporterInspector.targets[i] as TextureImporter; TextureImporterType textureImporterType = (!textureImporterInspector.textureTypeHasMultipleDifferentValues) ? textureImporterInspector.textureType : textureImporter.textureType; TextureImporterSettings settings = platformSettings.GetSettings(textureImporter); int num3 = (int)platformSettings.textureFormats[i]; int num4 = num3; if (!platformSettings.isDefault && num3 < 0) { num4 = (int)TextureImporter.SimpleToFullTextureFormat2((TextureImporterFormat)num4, textureImporterType, settings, textureImporter.DoesSourceTextureHaveAlpha(), textureImporter.IsSourceTextureHDR(), platformSettings.m_Target); } if (settings.normalMap && !TextureImporterInspector.IsGLESMobileTargetPlatform(platformSettings.m_Target)) { num4 = (int)TextureImporterInspector.MakeTextureFormatHaveAlpha((TextureImporterFormat)num4); } TextureImporterType textureImporterType2 = textureImporterType; int[] array3; string[] array4; if (textureImporterType2 != TextureImporterType.Cookie) { if (textureImporterType2 != TextureImporterType.Advanced) { array3 = textureImporterInspector.m_TextureFormatValues; array4 = (from content in TextureImporterInspector.s_Styles.textureFormatOptions select content.text).ToArray <string>(); if (num3 >= 0) { num3 = (int)TextureImporter.FullToSimpleTextureFormat((TextureImporterFormat)num3); } num3 = -1 - num3; } else { num3 = num4; if (TextureImporterInspector.IsGLESMobileTargetPlatform(platformSettings.m_Target)) { if (TextureImporterInspector.s_TextureFormatStringsiPhone == null) { TextureImporterInspector.s_TextureFormatStringsiPhone = TextureImporterInspector.BuildTextureStrings(TextureImportPlatformSettings.kTextureFormatsValueiPhone); } if (TextureImporterInspector.s_TextureFormatStringsAndroid == null) { TextureImporterInspector.s_TextureFormatStringsAndroid = TextureImporterInspector.BuildTextureStrings(TextureImportPlatformSettings.kTextureFormatsValueAndroid); } if (TextureImporterInspector.s_TextureFormatStringsTizen == null) { TextureImporterInspector.s_TextureFormatStringsTizen = TextureImporterInspector.BuildTextureStrings(TextureImportPlatformSettings.kTextureFormatsValueTizen); } if (platformSettings.m_Target == BuildTarget.iOS) { array3 = TextureImportPlatformSettings.kTextureFormatsValueiPhone; array4 = TextureImporterInspector.s_TextureFormatStringsiPhone; } else if (platformSettings.m_Target == BuildTarget.SamsungTV) { if (TextureImporterInspector.s_TextureFormatStringsSTV == null) { TextureImporterInspector.s_TextureFormatStringsSTV = TextureImporterInspector.BuildTextureStrings(TextureImportPlatformSettings.kTextureFormatsValueSTV); } array3 = TextureImportPlatformSettings.kTextureFormatsValueSTV; array4 = TextureImporterInspector.s_TextureFormatStringsSTV; } else { array3 = TextureImportPlatformSettings.kTextureFormatsValueAndroid; array4 = TextureImporterInspector.s_TextureFormatStringsAndroid; } } else if (!settings.normalMap) { if (TextureImporterInspector.s_TextureFormatStringsAll == null) { TextureImporterInspector.s_TextureFormatStringsAll = TextureImporterInspector.BuildTextureStrings(TextureImporterInspector.TextureFormatsValueAll); } if (TextureImporterInspector.s_TextureFormatStringsWiiU == null) { TextureImporterInspector.s_TextureFormatStringsWiiU = TextureImporterInspector.BuildTextureStrings(TextureImportPlatformSettings.kTextureFormatsValueWiiU); } if (TextureImporterInspector.s_TextureFormatStringsWeb == null) { TextureImporterInspector.s_TextureFormatStringsWeb = TextureImporterInspector.BuildTextureStrings(TextureImportPlatformSettings.kTextureFormatsValueWeb); } if (platformSettings.isDefault) { array3 = TextureImporterInspector.TextureFormatsValueAll; array4 = TextureImporterInspector.s_TextureFormatStringsAll; } else if (platformSettings.m_Target == BuildTarget.WiiU) { array3 = TextureImportPlatformSettings.kTextureFormatsValueWiiU; array4 = TextureImporterInspector.s_TextureFormatStringsWiiU; } else { array3 = TextureImportPlatformSettings.kTextureFormatsValueWeb; array4 = TextureImporterInspector.s_TextureFormatStringsWeb; } } else { if (TextureImporterInspector.s_NormalFormatStringsAll == null) { TextureImporterInspector.s_NormalFormatStringsAll = TextureImporterInspector.BuildTextureStrings(TextureImporterInspector.NormalFormatsValueAll); } if (TextureImporterInspector.s_NormalFormatStringsWeb == null) { TextureImporterInspector.s_NormalFormatStringsWeb = TextureImporterInspector.BuildTextureStrings(TextureImportPlatformSettings.kNormalFormatsValueWeb); } if (platformSettings.isDefault) { array3 = TextureImporterInspector.NormalFormatsValueAll; array4 = TextureImporterInspector.s_NormalFormatStringsAll; } else { array3 = TextureImportPlatformSettings.kNormalFormatsValueWeb; array4 = TextureImporterInspector.s_NormalFormatStringsWeb; } } } } else { array3 = new int[1]; array4 = new string[] { "8 Bit Alpha" }; num3 = 0; } if (i == 0) { array = array3; array2 = array4; num = num3; num2 = num4; } else { if (num3 != num) { flag2 = true; } if (num4 != num2) { flag3 = true; } if (!array3.SequenceEqual(array) || !array4.SequenceEqual(array2)) { flag = true; break; } } } using (new EditorGUI.DisabledScope(flag || array2.Length == 1)) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (flag || flag2); num = EditorGUILayout.IntPopup(TextureImporterInspector.s_Styles.textureFormat, num, EditorGUIUtility.TempContent(array2), array, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (textureImporterInspector.textureType != TextureImporterType.Advanced) { num = -1 - num; } if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)num); } } if (num2 == -5 || (!flag3 && ArrayUtility.Contains <TextureImporterFormat>(TextureImporterInspector.kFormatsWithCompressionSettings, (TextureImporterFormat)num2))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.compressionQualityIsDifferent); int compressionQualityForAll = this.EditCompressionQuality(platformSettings.m_Target, platformSettings.compressionQuality); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCompressionQualityForAll(compressionQualityForAll); } } if (TextureImporter.FullToSimpleTextureFormat((TextureImporterFormat)num) == TextureImporterFormat.AutomaticCrunched && TextureImporter.FullToSimpleTextureFormat((TextureImporterFormat)num2) != TextureImporterFormat.AutomaticCrunched) { EditorGUILayout.HelpBox("Crunched is not supported on this platform. Falling back to 'Compressed'.", MessageType.Warning); } bool flag4 = num == -1 || TextureImporter.IsTextureFormatETC1Compression((TextureFormat)num2); if (platformSettings.overridden && platformSettings.m_Target == BuildTarget.Android && flag4 && platformSettings.importers.Length > 0) { TextureImporter textureImporter2 = platformSettings.importers[0]; EditorGUI.BeginChangeCheck(); bool allowsAlphaSplitting = GUILayout.Toggle(textureImporter2.GetAllowsAlphaSplitting(), TextureImporterInspector.s_Styles.etc1Compression, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { TextureImporter[] importers = platformSettings.importers; for (int j = 0; j < importers.Length; j++) { TextureImporter textureImporter3 = importers[j]; textureImporter3.SetAllowsAlphaSplitting(allowsAlphaSplitting); } platformSettings.SetChanged(); } } if (!platformSettings.overridden && platformSettings.m_Target == BuildTarget.Android && platformSettings.importers.Length > 0 && platformSettings.importers[0].GetAllowsAlphaSplitting()) { platformSettings.importers[0].SetAllowsAlphaSplitting(false); platformSettings.SetChanged(); } }
public virtual void ShowImportSettings(Editor baseEditor, TextureImportPlatformSettings platformSettings) { TextureImporterInspector editor = baseEditor as TextureImporterInspector; // Max texture size EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.maxTextureSizeIsDifferent; int maxTextureSize = EditorGUILayout.IntPopup(maxSize.text, platformSettings.maxTextureSize, kMaxTextureSizeStrings, kMaxTextureSizeValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetMaxTextureSizeForAll(maxTextureSize); } // Resize Algorithm EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.resizeAlgorithmIsDifferent; int resizeAlgorithmVal = EditorGUILayout.IntPopup(resizeAlgorithm.text, (int)platformSettings.resizeAlgorithm, kResizeAlgorithmStrings, kResizeAlgorithmValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetResizeAlgorithmForAll((TextureResizeAlgorithm)resizeAlgorithmVal); } // Texture format int[] formatValuesForAll = null; string[] formatStringsForAll = null; bool formatOptionsAreDifferent = false; int formatForAll = 0; for (int i = 0; i < editor.targets.Length; i++) { TextureImporter imp = editor.targets[i] as TextureImporter; TextureImporterSettings settings = platformSettings.GetSettings(imp); TextureImporterType textureTypeForThis = editor.textureTypeHasMultipleDifferentValues ? settings.textureType : editor.textureType; int format = (int)platformSettings.format; int[] formatValues = null; string[] formatStrings = null; if (!platformSettings.isDefault && !platformSettings.overridden) { // If not overriden, show what the auto format is going to be // don't care about alpha in normal maps. If editor.assetTarget is null // then we are dealing with texture preset and we show all options. var showSettingsForPreset = editor.assetTarget == null; var sourceHasAlpha = showSettingsForPreset || (imp.DoesSourceTextureHaveAlpha() && textureTypeForThis != TextureImporterType.NormalMap); format = (int)TextureImporter.DefaultFormatFromTextureParameters(settings, platformSettings.platformTextureSettings, editor.assetTarget && sourceHasAlpha, editor.assetTarget && imp.IsSourceTextureHDR(), platformSettings.m_Target); formatValues = new int[] { format }; formatStrings = new string[] { TextureUtil.GetTextureFormatString((TextureFormat)format) }; } else { // otherwise show valid formats platformSettings.GetValidTextureFormatsAndStrings(textureTypeForThis, out formatValues, out formatStrings); } // Check if values are the same if (i == 0) { formatValuesForAll = formatValues; formatStringsForAll = formatStrings; formatForAll = format; } else { if (!formatValues.SequenceEqual(formatValuesForAll) || !formatStrings.SequenceEqual(formatStringsForAll)) { formatOptionsAreDifferent = true; break; } } } using (new EditorGUI.DisabledScope(formatOptionsAreDifferent || formatStringsForAll.Length == 1)) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = formatOptionsAreDifferent || platformSettings.textureFormatIsDifferent; formatForAll = EditorGUILayout.IntPopup(TextureImporterInspector.s_Styles.textureFormat, formatForAll, EditorGUIUtility.TempContent(formatStringsForAll), formatValuesForAll); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)formatForAll); } // In case the platform is overriden, the chosen format can become invalid when changing texture type (example: Switching from "Default" overridden with RGBAHalf to "Single Channel" where only Alpha8 is available) if (Array.IndexOf(formatValuesForAll, formatForAll) == -1) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)formatValuesForAll[0]); } } // Texture Compression if (platformSettings.isDefault && platformSettings.format == TextureImporterFormat.Automatic) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.textureCompressionIsDifferent || platformSettings.format != TextureImporterFormat.Automatic; TextureImporterCompression textureCompression = (TextureImporterCompression)EditorGUILayout.IntPopup(kTextureCompression, (int)platformSettings.textureCompression, kTextureCompressionOptions, kTextureCompressionValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureCompressionForAll(textureCompression); } } // Use Crunch Compression if (platformSettings.isDefault && (TextureImporterFormat)formatForAll == TextureImporterFormat.Automatic && platformSettings.textureCompression != TextureImporterCompression.Uncompressed) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.crunchedCompressionIsDifferent; bool crunchedCompression = EditorGUILayout.Toggle( TextureImporterInspector.s_Styles.crunchedCompression, platformSettings.crunchedCompression); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCrunchedCompressionForAll(crunchedCompression); } } // compression quality bool isCrunchedFormat = false || TextureUtil.IsCompressedCrunchTextureFormat((TextureFormat)formatForAll) ; if ( (platformSettings.isDefault && (TextureImporterFormat)formatForAll == TextureImporterFormat.Automatic && platformSettings.textureCompression != TextureImporterCompression.Uncompressed && platformSettings.crunchedCompression) || (platformSettings.isDefault && platformSettings.crunchedCompression && isCrunchedFormat) || (!platformSettings.isDefault && isCrunchedFormat) || (!platformSettings.textureFormatIsDifferent && ArrayUtility.Contains <TextureImporterFormat>( TextureImporterInspector.kFormatsWithCompressionSettings, (TextureImporterFormat)formatForAll))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.compressionQualityIsDifferent; int compressionQuality = EditCompressionQuality(platformSettings.m_Target, platformSettings.compressionQuality, isCrunchedFormat); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCompressionQualityForAll(compressionQuality); //SyncPlatformSettings (); } } // show the ETC1 split option only for sprites on platforms supporting ETC and only when there is an alpha channel bool isETCPlatform = TextureImporter.IsETC1SupportedByBuildTarget(BuildPipeline.GetBuildTargetByName(platformSettings.name)); bool isDealingWithSprite = (editor.spriteImportMode != SpriteImportMode.None); bool isETCFormatSelected = TextureImporter.IsTextureFormatETC1Compression((TextureFormat)formatForAll); if (isETCPlatform && isDealingWithSprite && isETCFormatSelected) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.allowsAlphaSplitIsDifferent; bool allowsAlphaSplit = EditorGUILayout.Toggle(TextureImporterInspector.s_Styles.useAlphaSplitLabel, platformSettings.allowsAlphaSplitting); if (EditorGUI.EndChangeCheck()) { platformSettings.SetAllowsAlphaSplitForAll(allowsAlphaSplit); } } }
public virtual void ShowImportSettings(Editor baseEditor, TextureImportPlatformSettings platformSettings) { TextureImporterInspector editor = baseEditor as TextureImporterInspector; // Max texture size EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.maxTextureSizeIsDifferent; int maxTextureSize = EditorGUILayout.IntPopup(maxSize.text, platformSettings.maxTextureSize, kMaxTextureSizeStrings, kMaxTextureSizeValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetMaxTextureSizeForAll(maxTextureSize); } // Resize Algorithm EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.resizeAlgorithmIsDifferent; int resizeAlgorithmVal = EditorGUILayout.IntPopup(resizeAlgorithm.text, (int)platformSettings.resizeAlgorithm, kResizeAlgorithmStrings, kResizeAlgorithmValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetResizeAlgorithmForAll((TextureResizeAlgorithm)resizeAlgorithmVal); } // Texture format int[] formatValuesForAll = null; string[] formatStringsForAll = null; bool formatOptionsAreDifferent = false; int formatForAll = 0; // TODO : This should not be calculated every refresh and be kept in a cache somewhere instead... for (int i = 0; i < editor.targets.Length; i++) { TextureImporter imp = editor.targets[i] as TextureImporter; TextureImporterSettings settings = platformSettings.GetSettings(imp); TextureImporterType textureTypeForThis = editor.textureTypeHasMultipleDifferentValues ? settings.textureType : editor.textureType; int format = (int)platformSettings.format; int[] formatValues = null; string[] formatStrings = null; if (!platformSettings.isDefault && !platformSettings.overridden) { // If not overriden, show what the auto format is going to be // don't care about alpha in normal maps. If editor.assetTarget is null // then we are dealing with texture preset and we show all options. var showSettingsForPreset = editor.assetTarget == null; var sourceHasAlpha = showSettingsForPreset || (imp.DoesSourceTextureHaveAlpha() && textureTypeForThis != TextureImporterType.NormalMap); format = (int)TextureImporter.DefaultFormatFromTextureParameters(settings, platformSettings.platformTextureSettings, editor.assetTarget && sourceHasAlpha, editor.assetTarget && imp.IsSourceTextureHDR(), platformSettings.m_Target); formatValues = new int[] { format }; formatStrings = new string[] { TextureUtil.GetTextureFormatString((TextureFormat)format) }; } else { // otherwise show valid formats platformSettings.GetValidTextureFormatsAndStrings(textureTypeForThis, out formatValues, out formatStrings); } // Check if values are the same if (i == 0) { formatValuesForAll = formatValues; formatStringsForAll = formatStrings; formatForAll = format; } else { if (!formatValues.SequenceEqual(formatValuesForAll) || !formatStrings.SequenceEqual(formatStringsForAll)) { formatOptionsAreDifferent = true; break; } } } using (new EditorGUI.DisabledScope(formatOptionsAreDifferent || formatStringsForAll.Length == 1)) { EditorGUI.BeginChangeCheck(); bool mixedValues = formatOptionsAreDifferent || platformSettings.textureFormatIsDifferent; EditorGUI.showMixedValue = mixedValues; var selectionResult = EditorGUILayout.IntPopup(TextureImporterInspector.s_Styles.textureFormat, formatForAll, EditorGUIUtility.TempContent(formatStringsForAll), formatValuesForAll); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)selectionResult); formatForAll = selectionResult; } if (!mixedValues && !Array.Exists(formatValuesForAll, i => i == formatForAll)) { EditorGUILayout.HelpBox(string.Format(L10n.Tr("The selected format value {0} is not compatible on this platform, please change it to a valid one from the dropdown."), (TextureImporterFormat)formatForAll), MessageType.Error); } } // Texture Compression if (platformSettings.isDefault && platformSettings.format == TextureImporterFormat.Automatic) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.textureCompressionIsDifferent || platformSettings.format != TextureImporterFormat.Automatic; TextureImporterCompression textureCompression = (TextureImporterCompression)EditorGUILayout.IntPopup(kTextureCompression, (int)platformSettings.textureCompression, kTextureCompressionOptions, kTextureCompressionValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureCompressionForAll(textureCompression); } } // Use Crunch Compression if (platformSettings.isDefault && (TextureImporterFormat)formatForAll == TextureImporterFormat.Automatic && platformSettings.textureCompression != TextureImporterCompression.Uncompressed) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.crunchedCompressionIsDifferent; bool crunchedCompression = EditorGUILayout.Toggle( TextureImporterInspector.s_Styles.crunchedCompression, platformSettings.crunchedCompression); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCrunchedCompressionForAll(crunchedCompression); } } // compression quality bool isCrunchedFormat = false || TextureUtil.IsCompressedCrunchTextureFormat((TextureFormat)formatForAll) ; if ( (platformSettings.isDefault && (TextureImporterFormat)formatForAll == TextureImporterFormat.Automatic && platformSettings.textureCompression != TextureImporterCompression.Uncompressed && platformSettings.crunchedCompression) || (platformSettings.isDefault && platformSettings.crunchedCompression && isCrunchedFormat) || (!platformSettings.isDefault && isCrunchedFormat) || (!platformSettings.textureFormatIsDifferent && ArrayUtility.Contains <TextureImporterFormat>( TextureImporterInspector.kFormatsWithCompressionSettings, (TextureImporterFormat)formatForAll))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.compressionQualityIsDifferent; // Prior to exposing compression quality for BC6H/BC7 formats they were always compressed at maximum quality even though the setting was // defaulted to 'Normal'. Now BC6H/BC7 quality is exposed to the user as Fast/Normal/Best 'Normal' maps to one setting down from maximum in the // ISPC compressor but to maintain the behaviour of existing projects we need to force their quality up to 'Best'. The 'forceMaximumCompressionQuality_BC6H_BC7' // flag is set when loading existing texture platform settings to do this and cleared when the compression quality level is manually set (by UI or API) bool forceBestQuality = platformSettings.forceMaximumCompressionQuality_BC6H_BC7 && (((TextureImporterFormat)formatForAll == TextureImporterFormat.BC6H) || ((TextureImporterFormat)formatForAll == TextureImporterFormat.BC7)); int compressionQuality = forceBestQuality ? (int)TextureCompressionQuality.Best : platformSettings.compressionQuality; compressionQuality = EditCompressionQuality(platformSettings.m_Target, compressionQuality, isCrunchedFormat, (TextureImporterFormat)formatForAll); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCompressionQualityForAll(compressionQuality); //SyncPlatformSettings (); } } // show the ETC1 split option only for sprites on platforms supporting ETC and only when there is an alpha channel bool isETCPlatform = TextureImporter.IsETC1SupportedByBuildTarget(BuildPipeline.GetBuildTargetByName(platformSettings.name)); bool isDealingWithSprite = (editor.spriteImportMode != SpriteImportMode.None); bool isETCFormatSelected = TextureImporter.IsTextureFormatETC1Compression((TextureFormat)formatForAll); if (isETCPlatform && isDealingWithSprite && isETCFormatSelected) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.allowsAlphaSplitIsDifferent; bool allowsAlphaSplit = EditorGUILayout.Toggle(TextureImporterInspector.s_Styles.useAlphaSplitLabel, platformSettings.allowsAlphaSplitting); if (EditorGUI.EndChangeCheck()) { platformSettings.SetAllowsAlphaSplitForAll(allowsAlphaSplit); } } }
public virtual void ShowImportSettings(Editor baseEditor, TextureImportPlatformSettings platformSettings) { TextureImporterInspector textureImporterInspector = baseEditor as TextureImporterInspector; EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.maxTextureSizeIsDifferent); int maxTextureSizeForAll = EditorGUILayout.IntPopup(DefaultTextureImportSettingsExtension.maxSize.text, platformSettings.maxTextureSize, DefaultTextureImportSettingsExtension.kMaxTextureSizeStrings, DefaultTextureImportSettingsExtension.kMaxTextureSizeValues, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetMaxTextureSizeForAll(maxTextureSizeForAll); } using (new EditorGUI.DisabledScope(platformSettings.overridden && !platformSettings.isDefault)) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.textureCompressionIsDifferent || (platformSettings.overridden && !platformSettings.isDefault)); TextureImporterCompression textureCompressionForAll = (TextureImporterCompression)EditorGUILayout.IntPopup(DefaultTextureImportSettingsExtension.kTextureCompression, (int)platformSettings.textureCompression, DefaultTextureImportSettingsExtension.kTextureCompressionOptions, DefaultTextureImportSettingsExtension.kTextureCompressionValues, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureCompressionForAll(textureCompressionForAll); } } int[] array = null; string[] array2 = null; bool flag = false; int num = 0; for (int i = 0; i < textureImporterInspector.targets.Length; i++) { TextureImporter textureImporter = textureImporterInspector.targets[i] as TextureImporter; TextureImporterSettings settings = platformSettings.GetSettings(textureImporter); TextureImporterType textureImporterType = (!textureImporterInspector.textureTypeHasMultipleDifferentValues) ? textureImporterInspector.textureType : settings.textureType; int num2 = (int)platformSettings.format; int[] array3; string[] array4; if (platformSettings.isDefault) { num2 = -1; array3 = new int[] { -1 }; array4 = new string[] { "Auto" }; } else if (!platformSettings.overridden) { num2 = (int)TextureImporter.FormatFromTextureParameters(settings, platformSettings.platformTextureSettings, textureImporter.DoesSourceTextureHaveAlpha(), textureImporter.IsSourceTextureHDR(), platformSettings.m_Target); array3 = new int[] { num2 }; array4 = new string[] { TextureUtil.GetTextureFormatString((TextureFormat)num2) }; } else if (textureImporterType == TextureImporterType.Cookie || textureImporterType == TextureImporterType.SingleChannel) { array3 = TextureImportPlatformSettings.kTextureFormatsValueSingleChannel; array4 = TextureImporterInspector.s_TextureFormatStringsSingleChannel; } else if (TextureImporterInspector.IsGLESMobileTargetPlatform(platformSettings.m_Target)) { if (platformSettings.m_Target == BuildTarget.iOS || platformSettings.m_Target == BuildTarget.tvOS) { array3 = TextureImportPlatformSettings.kTextureFormatsValueApplePVR; array4 = TextureImporterInspector.s_TextureFormatStringsApplePVR; } else if (platformSettings.m_Target == BuildTarget.SamsungTV) { array3 = TextureImportPlatformSettings.kTextureFormatsValueSTV; array4 = TextureImporterInspector.s_TextureFormatStringsSTV; } else { array3 = TextureImportPlatformSettings.kTextureFormatsValueAndroid; array4 = TextureImporterInspector.s_TextureFormatStringsAndroid; } } else if (textureImporterType == TextureImporterType.NormalMap) { array3 = TextureImportPlatformSettings.kNormalFormatsValueDefault; array4 = TextureImporterInspector.s_NormalFormatStringsDefault; } else if (platformSettings.m_Target == BuildTarget.WebGL) { array3 = TextureImportPlatformSettings.kTextureFormatsValueWebGL; array4 = TextureImporterInspector.s_TextureFormatStringsWebGL; } else if (platformSettings.m_Target == BuildTarget.WiiU) { array3 = TextureImportPlatformSettings.kTextureFormatsValueWiiU; array4 = TextureImporterInspector.s_TextureFormatStringsWiiU; } else { array3 = TextureImportPlatformSettings.kTextureFormatsValueDefault; array4 = TextureImporterInspector.s_TextureFormatStringsDefault; } if (i == 0) { array = array3; array2 = array4; num = num2; } else if (!array3.SequenceEqual(array) || !array4.SequenceEqual(array2)) { flag = true; break; } } using (new EditorGUI.DisabledScope(flag || array2.Length == 1)) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (flag || platformSettings.textureFormatIsDifferent); num = EditorGUILayout.IntPopup(TextureImporterInspector.s_Styles.textureFormat, num, EditorGUIUtility.TempContent(array2), array, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)num); } if (Array.IndexOf <int>(array, num) == -1) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)array[0]); } } if ((platformSettings.isDefault && platformSettings.textureCompression != TextureImporterCompression.Uncompressed) || (platformSettings.allAreOverridden && TextureImporterInspector.IsCompressedDXTTextureFormat((TextureImporterFormat)num))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.crunchedCompressionIsDifferent); bool crunchedCompressionForAll = EditorGUILayout.Toggle(TextureImporterInspector.s_Styles.crunchedCompression, platformSettings.crunchedCompression, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCrunchedCompressionForAll(crunchedCompressionForAll); } } if ((platformSettings.crunchedCompression && !platformSettings.crunchedCompressionIsDifferent && (platformSettings.textureCompression != TextureImporterCompression.Uncompressed || num == 10 || num == 12)) || (!platformSettings.textureFormatIsDifferent && ArrayUtility.Contains <TextureImporterFormat>(TextureImporterInspector.kFormatsWithCompressionSettings, (TextureImporterFormat)num))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.compressionQualityIsDifferent); int compressionQualityForAll = this.EditCompressionQuality(platformSettings.m_Target, platformSettings.compressionQuality); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCompressionQualityForAll(compressionQualityForAll); } } bool flag2 = TextureImporter.IsETC1SupportedByBuildTarget(BuildPipeline.GetBuildTargetByName(platformSettings.name)); bool flag3 = textureImporterInspector.spriteImportMode != SpriteImportMode.None; bool flag4 = platformSettings.textureCompression != TextureImporterCompression.Uncompressed || TextureImporter.IsTextureFormatETC1Compression((TextureFormat)num); if (flag2 && flag3 && flag4) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.allowsAlphaSplitIsDifferent); bool allowsAlphaSplitForAll = GUILayout.Toggle(platformSettings.allowsAlphaSplitting, TextureImporterInspector.s_Styles.etc1Compression, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { platformSettings.SetAllowsAlphaSplitForAll(allowsAlphaSplitForAll); } } }
public virtual void ShowImportSettings(Editor baseEditor, TextureImportPlatformSettings platformSettings) { TextureImporterInspector inspector = baseEditor as TextureImporterInspector; EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.maxTextureSizeIsDifferent; int maxTextureSize = EditorGUILayout.IntPopup(maxSize.text, platformSettings.maxTextureSize, kMaxTextureSizeStrings, kMaxTextureSizeValues, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetMaxTextureSizeForAll(maxTextureSize); } using (new EditorGUI.DisabledScope(platformSettings.overridden && !platformSettings.isDefault)) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = (platformSettings.overriddenIsDifferent || platformSettings.textureCompressionIsDifferent) || (platformSettings.overridden && !platformSettings.isDefault); TextureImporterCompression textureCompression = (TextureImporterCompression)EditorGUILayout.IntPopup(kTextureCompression, (int)platformSettings.textureCompression, kTextureCompressionOptions, kTextureCompressionValues, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureCompressionForAll(textureCompression); } } int[] second = null; string[] strArray = null; bool flag = false; int selectedValue = 0; for (int i = 0; i < inspector.targets.Length; i++) { TextureImporter importer = inspector.targets[i] as TextureImporter; TextureImporterSettings settings = platformSettings.GetSettings(importer); TextureImporterType type = !inspector.textureTypeHasMultipleDifferentValues ? inspector.textureType : settings.textureType; int format = (int)platformSettings.format; int[] first = null; string[] strArray2 = null; if (platformSettings.isDefault) { format = -1; first = new int[] { -1 }; strArray2 = new string[] { "Auto" }; } else if (!platformSettings.overridden) { format = (int)TextureImporter.FormatFromTextureParameters(settings, platformSettings.platformTextureSettings, importer.DoesSourceTextureHaveAlpha(), importer.IsSourceTextureHDR(), platformSettings.m_Target); first = new int[] { format }; strArray2 = new string[] { TextureUtil.GetTextureFormatString((TextureFormat)format) }; } else { switch (type) { case TextureImporterType.Cookie: case TextureImporterType.SingleChannel: first = TextureImportPlatformSettings.kTextureFormatsValueSingleChannel; strArray2 = TextureImporterInspector.s_TextureFormatStringsSingleChannel; goto Label_0304; } if (TextureImporterInspector.IsGLESMobileTargetPlatform(platformSettings.m_Target)) { if ((platformSettings.m_Target == BuildTarget.iOS) || (platformSettings.m_Target == BuildTarget.tvOS)) { first = TextureImportPlatformSettings.kTextureFormatsValueApplePVR; strArray2 = TextureImporterInspector.s_TextureFormatStringsApplePVR; } else if (platformSettings.m_Target == BuildTarget.SamsungTV) { first = TextureImportPlatformSettings.kTextureFormatsValueSTV; strArray2 = TextureImporterInspector.s_TextureFormatStringsSTV; } else { first = TextureImportPlatformSettings.kTextureFormatsValueAndroid; strArray2 = TextureImporterInspector.s_TextureFormatStringsAndroid; } } else if (type == TextureImporterType.NormalMap) { first = TextureImportPlatformSettings.kNormalFormatsValueDefault; strArray2 = TextureImporterInspector.s_NormalFormatStringsDefault; } else if (platformSettings.m_Target == BuildTarget.WebGL) { first = TextureImportPlatformSettings.kTextureFormatsValueWebGL; strArray2 = TextureImporterInspector.s_TextureFormatStringsWebGL; } else if (platformSettings.m_Target == BuildTarget.WiiU) { first = TextureImportPlatformSettings.kTextureFormatsValueWiiU; strArray2 = TextureImporterInspector.s_TextureFormatStringsWiiU; } else { first = TextureImportPlatformSettings.kTextureFormatsValueDefault; strArray2 = TextureImporterInspector.s_TextureFormatStringsDefault; } } Label_0304: if (i == 0) { second = first; strArray = strArray2; selectedValue = format; } else if (!first.SequenceEqual <int>(second) || !strArray2.SequenceEqual <string>(strArray)) { flag = true; break; } } using (new EditorGUI.DisabledScope(flag || (strArray.Length == 1))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = flag || platformSettings.textureFormatIsDifferent; selectedValue = EditorGUILayout.IntPopup(TextureImporterInspector.s_Styles.textureFormat, selectedValue, EditorGUIUtility.TempContent(strArray), second, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)selectedValue); } if (Array.IndexOf <int>(second, selectedValue) == -1) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)second[0]); } } if ((platformSettings.isDefault && (platformSettings.textureCompression != TextureImporterCompression.Uncompressed)) || (platformSettings.allAreOverridden && TextureImporterInspector.IsCompressedDXTTextureFormat((TextureImporterFormat)selectedValue))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.crunchedCompressionIsDifferent; bool crunched = EditorGUILayout.Toggle(TextureImporterInspector.s_Styles.crunchedCompression, platformSettings.crunchedCompression, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCrunchedCompressionForAll(crunched); } } if (((platformSettings.crunchedCompression && !platformSettings.crunchedCompressionIsDifferent) && (((platformSettings.textureCompression != TextureImporterCompression.Uncompressed) || (selectedValue == 10)) || (selectedValue == 12))) || (!platformSettings.textureFormatIsDifferent && ArrayUtility.Contains <TextureImporterFormat>(TextureImporterInspector.kFormatsWithCompressionSettings, (TextureImporterFormat)selectedValue))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.compressionQualityIsDifferent; int quality = this.EditCompressionQuality(platformSettings.m_Target, platformSettings.compressionQuality); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCompressionQualityForAll(quality); } } bool flag3 = TextureImporter.IsETC1SupportedByBuildTarget(BuildPipeline.GetBuildTargetByName(platformSettings.name)); bool flag4 = inspector.spriteImportMode != SpriteImportMode.None; bool flag5 = TextureImporter.IsTextureFormatETC1Compression((TextureFormat)selectedValue); if ((flag3 && flag4) && flag5) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.allowsAlphaSplitIsDifferent; bool flag6 = GUILayout.Toggle(platformSettings.allowsAlphaSplitting, TextureImporterInspector.s_Styles.etc1Compression, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { platformSettings.SetAllowsAlphaSplitForAll(flag6); } } }
public virtual void ShowImportSettings(Editor baseEditor, TextureImportPlatformSettings platformSettings) { TextureImporterInspector editor = baseEditor as TextureImporterInspector; // Max texture size EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.maxTextureSizeIsDifferent; int maxTextureSize = EditorGUILayout.IntPopup(maxSize.text, platformSettings.maxTextureSize, kMaxTextureSizeStrings, kMaxTextureSizeValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetMaxTextureSizeForAll(maxTextureSize); } // Resize Algorithm EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.resizeAlgorithmIsDifferent; int resizeAlgorithmVal = EditorGUILayout.IntPopup(resizeAlgorithm.text, (int)platformSettings.resizeAlgorithm, kResizeAlgorithmStrings, kResizeAlgorithmValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetResizeAlgorithmForAll((TextureResizeAlgorithm)resizeAlgorithmVal); } // Texture Compression using (new EditorGUI.DisabledScope(platformSettings.overridden && !platformSettings.isDefault)) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.textureCompressionIsDifferent || (platformSettings.overridden && !platformSettings.isDefault); TextureImporterCompression textureCompression = (TextureImporterCompression)EditorGUILayout.IntPopup(kTextureCompression, (int)platformSettings.textureCompression, kTextureCompressionOptions, kTextureCompressionValues); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureCompressionForAll(textureCompression); } } // Texture format int[] formatValuesForAll = null; string[] formatStringsForAll = null; bool formatOptionsAreDifferent = false; int formatForAll = 0; for (int i = 0; i < editor.targets.Length; i++) { TextureImporter imp = editor.targets[i] as TextureImporter; TextureImporterSettings settings = platformSettings.GetSettings(imp); TextureImporterType textureTypeForThis = editor.textureTypeHasMultipleDifferentValues ? settings.textureType : editor.textureType; int format = (int)platformSettings.format; int[] formatValues = null; string[] formatStrings = null; if (platformSettings.isDefault) { format = (int)TextureImporterFormat.Automatic; formatValues = new int[] { (int)TextureImporterFormat.Automatic }; formatStrings = new string[] { "Auto" }; } else { // If not overriden, show what the auto format is going to be if (!platformSettings.overridden) { format = (int)TextureImporter.FormatFromTextureParameters(settings, platformSettings.platformTextureSettings, editor.assetTarget && imp.DoesSourceTextureHaveAlpha(), editor.assetTarget && imp.IsSourceTextureHDR(), platformSettings.m_Target); formatValues = new int[] { format }; formatStrings = new string[] { TextureUtil.GetTextureFormatString((TextureFormat)format) }; } // else show the format choice filtered by platform. else { // Single channel format is the same for all platform at the moment if (textureTypeForThis == TextureImporterType.Cookie || textureTypeForThis == TextureImporterType.SingleChannel) { formatValues = TextureImportPlatformSettings.kTextureFormatsValueSingleChannel; formatStrings = TextureImporterInspector.s_TextureFormatStringsSingleChannel; } else { // on gles targets we use rgb normal maps so no need to split formats if (TextureImporterInspector.IsGLESMobileTargetPlatform(platformSettings.m_Target)) { if (platformSettings.m_Target == BuildTarget.iOS || platformSettings.m_Target == BuildTarget.tvOS) { formatValues = TextureImportPlatformSettings.kTextureFormatsValueApplePVR; formatStrings = TextureImporterInspector.s_TextureFormatStringsApplePVR; } else { formatValues = TextureImportPlatformSettings.kTextureFormatsValueAndroid; formatStrings = TextureImporterInspector.s_TextureFormatStringsAndroid; } } else if (textureTypeForThis == TextureImporterType.NormalMap) { formatValues = TextureImportPlatformSettings.kNormalFormatsValueDefault; formatStrings = TextureImporterInspector.s_NormalFormatStringsDefault; } else { if (platformSettings.m_Target == BuildTarget.WebGL) { formatValues = TextureImportPlatformSettings.kTextureFormatsValueWebGL; formatStrings = TextureImporterInspector.s_TextureFormatStringsWebGL; } else if (platformSettings.m_Target == BuildTarget.PSP2) { formatValues = TextureImportPlatformSettings.kTextureFormatsValuePSP2; formatStrings = TextureImporterInspector.s_TextureFormatStringsPSP2; } else if (platformSettings.m_Target == BuildTarget.Switch) { formatValues = TextureImportPlatformSettings.kTextureFormatsValueSwitch; formatStrings = TextureImporterInspector.s_TextureFormatStringsSwitch; } else { formatValues = TextureImportPlatformSettings.kTextureFormatsValueDefault; formatStrings = TextureImporterInspector.s_TextureFormatStringsDefault; } } } } } // Check if values are the same if (i == 0) { formatValuesForAll = formatValues; formatStringsForAll = formatStrings; formatForAll = format; } else { if (!formatValues.SequenceEqual(formatValuesForAll) || !formatStrings.SequenceEqual(formatStringsForAll)) { formatOptionsAreDifferent = true; break; } } } using (new EditorGUI.DisabledScope(formatOptionsAreDifferent || formatStringsForAll.Length == 1)) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = formatOptionsAreDifferent || platformSettings.textureFormatIsDifferent; formatForAll = EditorGUILayout.IntPopup(TextureImporterInspector.s_Styles.textureFormat, formatForAll, EditorGUIUtility.TempContent(formatStringsForAll), formatValuesForAll); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)formatForAll); } // In case the platform is overriden, the chosen format can become invalid when changing texture type (example: Switching from "Default" overridden with RGBAHalf to "Single Channel" where only Alpha8 is available) if (Array.IndexOf(formatValuesForAll, formatForAll) == -1) { platformSettings.SetTextureFormatForAll((TextureImporterFormat)formatValuesForAll[0]); } } if (platformSettings.isDefault && platformSettings.textureCompression != TextureImporterCompression.Uncompressed) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.crunchedCompressionIsDifferent; bool crunchedCompression = EditorGUILayout.Toggle(TextureImporterInspector.s_Styles.crunchedCompression, platformSettings.crunchedCompression); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCrunchedCompressionForAll(crunchedCompression); } } // compression quality bool isCrunchedFormat = false || (TextureImporterFormat)formatForAll == TextureImporterFormat.DXT1Crunched || (TextureImporterFormat)formatForAll == TextureImporterFormat.DXT5Crunched || (TextureImporterFormat)formatForAll == TextureImporterFormat.ETC_RGB4Crunched || (TextureImporterFormat)formatForAll == TextureImporterFormat.ETC2_RGBA8Crunched ; if ( (platformSettings.isDefault && platformSettings.textureCompression != TextureImporterCompression.Uncompressed && platformSettings.crunchedCompression) || (!platformSettings.isDefault && isCrunchedFormat) || (!platformSettings.textureFormatIsDifferent && ArrayUtility.Contains <TextureImporterFormat>(TextureImporterInspector.kFormatsWithCompressionSettings, (TextureImporterFormat)formatForAll))) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.compressionQualityIsDifferent; int compressionQuality = EditCompressionQuality(platformSettings.m_Target, platformSettings.compressionQuality, isCrunchedFormat); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { platformSettings.SetCompressionQualityForAll(compressionQuality); //SyncPlatformSettings (); } } // show the ETC1 split option only for sprites on platforms supporting ETC. bool isETCPlatform = TextureImporter.IsETC1SupportedByBuildTarget(BuildPipeline.GetBuildTargetByName(platformSettings.name)); bool isDealingWithSprite = (editor.spriteImportMode != SpriteImportMode.None); bool isETCFormatSelected = TextureImporter.IsTextureFormatETC1Compression((TextureFormat)formatForAll); if (isETCPlatform && isDealingWithSprite && isETCFormatSelected) { EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = platformSettings.overriddenIsDifferent || platformSettings.allowsAlphaSplitIsDifferent; bool allowsAlphaSplit = GUILayout.Toggle(platformSettings.allowsAlphaSplitting, TextureImporterInspector.s_Styles.etc1Compression); if (EditorGUI.EndChangeCheck()) { platformSettings.SetAllowsAlphaSplitForAll(allowsAlphaSplit); } } }