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); } } }