public void Sync() { if (!this.isDefault && (!this.overridden || this.m_OverriddenIsDifferent)) { TextureImportPlatformSettings textureImportPlatformSettings = this.m_Inspector.m_PlatformSettings[0]; this.m_PlatformSettings.maxTextureSize = textureImportPlatformSettings.maxTextureSize; this.m_MaxTextureSizeIsDifferent = textureImportPlatformSettings.m_MaxTextureSizeIsDifferent; this.m_PlatformSettings.textureCompression = textureImportPlatformSettings.textureCompression; this.m_TextureCompressionIsDifferent = textureImportPlatformSettings.m_TextureCompressionIsDifferent; this.m_PlatformSettings.format = textureImportPlatformSettings.format; this.m_TextureFormatIsDifferent = textureImportPlatformSettings.m_TextureFormatIsDifferent; this.m_PlatformSettings.compressionQuality = textureImportPlatformSettings.compressionQuality; this.m_CompressionQualityIsDifferent = textureImportPlatformSettings.m_CompressionQualityIsDifferent; this.m_PlatformSettings.crunchedCompression = textureImportPlatformSettings.crunchedCompression; this.m_CrunchedCompressionIsDifferent = textureImportPlatformSettings.m_CrunchedCompressionIsDifferent; this.m_PlatformSettings.allowsAlphaSplitting = textureImportPlatformSettings.allowsAlphaSplitting; this.m_AlphaSplitIsDifferent = textureImportPlatformSettings.m_AlphaSplitIsDifferent; } if ((this.overridden || this.m_OverriddenIsDifferent) && this.m_PlatformSettings.format < (TextureImporterFormat)0) { this.m_PlatformSettings.format = TextureImporter.FormatFromTextureParameters(this.GetSettings(this.importers[0]), this.m_PlatformSettings, this.importers[0].DoesSourceTextureHaveAlpha(), this.importers[0].IsSourceTextureHDR(), this.m_Target); this.m_TextureFormatIsDifferent = false; for (int i = 1; i < this.importers.Length; i++) { TextureImporter textureImporter = this.importers[i]; TextureImporterSettings settings = this.GetSettings(textureImporter); TextureImporterFormat textureImporterFormat = TextureImporter.FormatFromTextureParameters(settings, this.m_PlatformSettings, textureImporter.DoesSourceTextureHaveAlpha(), textureImporter.IsSourceTextureHDR(), this.m_Target); if (textureImporterFormat != this.m_PlatformSettings.format) { this.m_TextureFormatIsDifferent = true; } } } }
public void Sync() { // Use settings from default if any of the targets are not overridden if (!isDefault && (!overridden || m_OverriddenIsDifferent)) { TextureImportPlatformSettings defaultSettings = m_Inspector.m_PlatformSettings[0]; m_PlatformSettings.maxTextureSize = defaultSettings.maxTextureSize; m_MaxTextureSizeIsDifferent = defaultSettings.m_MaxTextureSizeIsDifferent; m_PlatformSettings.resizeAlgorithm = defaultSettings.resizeAlgorithm; m_ResizeAlgorithmIsDifferent = defaultSettings.m_ResizeAlgorithmIsDifferent; m_PlatformSettings.textureCompression = defaultSettings.textureCompression; m_TextureCompressionIsDifferent = defaultSettings.m_TextureCompressionIsDifferent; m_PlatformSettings.format = defaultSettings.format; m_TextureFormatIsDifferent = defaultSettings.m_TextureFormatIsDifferent; m_PlatformSettings.compressionQuality = defaultSettings.compressionQuality; m_CompressionQualityIsDifferent = defaultSettings.m_CompressionQualityIsDifferent; m_PlatformSettings.crunchedCompression = defaultSettings.crunchedCompression; m_CrunchedCompressionIsDifferent = defaultSettings.m_CrunchedCompressionIsDifferent; m_PlatformSettings.allowsAlphaSplitting = defaultSettings.allowsAlphaSplitting; m_AlphaSplitIsDifferent = defaultSettings.m_AlphaSplitIsDifferent; m_AndroidETC2FallbackOverrideIsDifferent = defaultSettings.m_AndroidETC2FallbackOverrideIsDifferent; } if ((overridden || m_OverriddenIsDifferent) && m_PlatformSettings.format < 0) { var showSettingsForPreset = m_Inspector.assetTarget == null; m_PlatformSettings.format = TextureImporter.DefaultFormatFromTextureParameters( GetSettings(importers[0]), m_PlatformSettings, showSettingsForPreset || importers[0].DoesSourceTextureHaveAlpha(), showSettingsForPreset || importers[0].IsSourceTextureHDR(), m_Target ); m_TextureFormatIsDifferent = false; for (int i = 1; i < importers.Length; i++) { TextureImporter imp = importers[i]; TextureImporterSettings settings = GetSettings(imp); TextureImporterFormat format = TextureImporter.DefaultFormatFromTextureParameters(settings, m_PlatformSettings, showSettingsForPreset || imp.DoesSourceTextureHaveAlpha(), showSettingsForPreset || imp.IsSourceTextureHDR(), m_Target ); if (format != m_PlatformSettings.format) { m_TextureFormatIsDifferent = true; } } } }
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 (!Enumerable.SequenceEqual<int>(first, second) || !Enumerable.SequenceEqual<string>(strArray2, 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 void Sync() { if (!this.isDefault && (!this.m_Overridden || this.m_OverriddenIsDifferent)) { TextureImportPlatformSettings textureImportPlatformSettings = this.m_Inspector.m_PlatformSettings[0]; this.m_MaxTextureSize = textureImportPlatformSettings.m_MaxTextureSize; this.m_MaxTextureSizeIsDifferent = textureImportPlatformSettings.m_MaxTextureSizeIsDifferent; this.m_TextureFormatArray = (TextureImporterFormat[])textureImportPlatformSettings.m_TextureFormatArray.Clone(); this.m_TextureFormatIsDifferent = textureImportPlatformSettings.m_TextureFormatIsDifferent; this.m_CompressionQuality = textureImportPlatformSettings.m_CompressionQuality; this.m_CompressionQualityIsDifferent = textureImportPlatformSettings.m_CompressionQualityIsDifferent; } TextureImporterType textureType = this.m_Inspector.textureType; int i = 0; while (i < this.importers.Length) { TextureImporter textureImporter = this.importers[i]; TextureImporterSettings settings = this.GetSettings(textureImporter); if (textureType == TextureImporterType.Advanced) { if (!this.isDefault) { if (!this.SupportsFormat(this.m_TextureFormatArray[i], textureImporter)) { this.m_TextureFormatArray[i] = TextureImporter.FullToSimpleTextureFormat(this.m_TextureFormatArray[i]); } if (this.m_TextureFormatArray[i] < (TextureImporterFormat)0) { this.m_TextureFormatArray[i] = TextureImporter.SimpleToFullTextureFormat2(this.m_TextureFormatArray[i], textureType, settings, textureImporter.DoesSourceTextureHaveAlpha(), textureImporter.IsSourceTextureHDR(), this.m_Target); } goto IL_14A; } } else { if (this.m_TextureFormatArray[i] >= (TextureImporterFormat)0) { this.m_TextureFormatArray[i] = TextureImporter.FullToSimpleTextureFormat(this.m_TextureFormatArray[i]); goto IL_14A; } goto IL_14A; } IL_17B: i++; continue; IL_14A: if (settings.normalMap && !TextureImporterInspector.IsGLESMobileTargetPlatform(this.m_Target)) { this.m_TextureFormatArray[i] = TextureImporterInspector.MakeTextureFormatHaveAlpha(this.m_TextureFormatArray[i]); goto IL_17B; } goto IL_17B; } this.m_TextureFormatIsDifferent = false; TextureImporterFormat[] textureFormatArray = this.m_TextureFormatArray; for (int j = 0; j < textureFormatArray.Length; j++) { TextureImporterFormat textureImporterFormat = textureFormatArray[j]; if (textureImporterFormat != this.m_TextureFormatArray[0]) { this.m_TextureFormatIsDifferent = true; } } }