private void AlphaHandlingGUI(TextureInspectorGUIElement guiElements) { int count = 0; int num2 = 0; bool flag = CountImportersWithAlpha(base.targets, out count) && CountImportersWithHDR(base.targets, out num2); EditorGUI.showMixedValue = this.m_AlphaSource.hasMultipleDifferentValues; EditorGUI.BeginChangeCheck(); int num3 = EditorGUILayout.IntPopup(s_Styles.alphaSource, this.m_AlphaSource.intValue, s_Styles.alphaSourceOptions, s_Styles.alphaSourceValues, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { this.m_AlphaSource.intValue = num3; } bool flag2 = (flag && (this.m_AlphaSource.intValue != 0)) && (num2 == 0); using (new EditorGUI.DisabledScope(!flag2)) { this.ToggleFromInt(this.m_AlphaIsTransparency, s_Styles.alphaIsTransparency); } }
private void SpriteGUI(TextureInspectorGUIElement guiElements) { EditorGUI.BeginChangeCheck(); EditorGUILayout.IntPopup(this.m_SpriteMode, s_Styles.spriteModeOptions, new int[] { 1, 2, 3 }, s_Styles.spriteMode, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { GUIUtility.keyboardControl = 0; } EditorGUI.indentLevel++; this.m_ShowGenericSpriteSettings.target = this.m_SpriteMode.intValue != 0; if (EditorGUILayout.BeginFadeGroup(this.m_ShowGenericSpriteSettings.faded)) { EditorGUILayout.PropertyField(this.m_SpritePackingTag, s_Styles.spritePackingTag, new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_SpritePixelsToUnits, s_Styles.spritePixelsPerUnit, new GUILayoutOption[0]); int[] optionValues = new int[2]; optionValues[1] = 1; EditorGUILayout.IntPopup(this.m_SpriteMeshType, s_Styles.spriteMeshTypeOptions, optionValues, s_Styles.spriteMeshType, new GUILayoutOption[0]); EditorGUILayout.IntSlider(this.m_SpriteExtrude, 0, 0x20, s_Styles.spriteExtrude, new GUILayoutOption[0]); if (this.m_SpriteMode.intValue == 1) { EditorGUILayout.Popup(this.m_Alignment, s_Styles.spriteAlignmentOptions, s_Styles.spriteAlignment, new GUILayoutOption[0]); if (this.m_Alignment.intValue == 9) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PropertyField(this.m_SpritePivot, this.m_EmptyContent, new GUILayoutOption[0]); GUILayout.EndHorizontal(); } } using (new EditorGUI.DisabledScope(base.targets.Length != 1)) { GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayout.FlexibleSpace(); if (GUILayout.Button("Sprite Editor", new GUILayoutOption[0])) { if (this.HasModified()) { string message = ("Unapplied import settings for '" + ((TextureImporter) base.target).assetPath + "'.\n") + "Apply and continue to sprite editor or cancel."; if (EditorUtility.DisplayDialog("Unapplied import settings", message, "Apply", "Cancel")) { base.ApplyAndImport(); SpriteEditorWindow.GetWindow(); GUIUtility.ExitGUI(); } } else { SpriteEditorWindow.GetWindow(); } } GUILayout.EndHorizontal(); } } EditorGUILayout.EndFadeGroup(); EditorGUI.indentLevel--; }
private bool ShouldDisplayGUIElement(TextureInspectorGUIElement guiElements, TextureInspectorGUIElement guiElement) { return ((guiElements & guiElement) == guiElement); }
private void ReadableGUI(TextureInspectorGUIElement guiElements) { this.ToggleFromInt(this.m_IsReadable, s_Styles.readWrite); }
private void MipMapGUI(TextureInspectorGUIElement guiElements) { this.ToggleFromInt(this.m_EnableMipMap, s_Styles.generateMipMaps); this.m_ShowMipMapSettings.target = this.m_EnableMipMap.boolValue && !this.m_EnableMipMap.hasMultipleDifferentValues; if (EditorGUILayout.BeginFadeGroup(this.m_ShowMipMapSettings.faded)) { EditorGUI.indentLevel++; this.ToggleFromInt(this.m_BorderMipMap, s_Styles.borderMipMaps); EditorGUILayout.Popup(this.m_MipMapMode, s_Styles.mipMapFilterOptions, s_Styles.mipMapFilter, new GUILayoutOption[0]); this.ToggleFromInt(this.m_FadeOut, s_Styles.mipmapFadeOutToggle); if (this.m_FadeOut.intValue > 0) { EditorGUI.indentLevel++; EditorGUI.BeginChangeCheck(); float intValue = this.m_MipMapFadeDistanceStart.intValue; float maxValue = this.m_MipMapFadeDistanceEnd.intValue; EditorGUILayout.MinMaxSlider(s_Styles.mipmapFadeOut, ref intValue, ref maxValue, 0f, 10f, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_MipMapFadeDistanceStart.intValue = Mathf.RoundToInt(intValue); this.m_MipMapFadeDistanceEnd.intValue = Mathf.RoundToInt(maxValue); } EditorGUI.indentLevel--; } EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); }
private void POTScaleGUI(TextureInspectorGUIElement guiElements) { using (new EditorGUI.DisabledScope(this.m_IsPOT)) { this.EnumPopup(this.m_NPOTScale, typeof(TextureImporterNPOTScale), s_Styles.npot); } }
private void DoGUIElements(TextureInspectorGUIElement guiElements, List<TextureInspectorGUIElement> guiElementsDisplayOrder) { foreach (TextureInspectorGUIElement element in guiElementsDisplayOrder) { if (this.ShouldDisplayGUIElement(guiElements, element) && this.m_GUIElementMethods.ContainsKey(element)) { this.m_GUIElementMethods[element](guiElements); } } }
private void CubemapMappingGUI(TextureInspectorGUIElement guiElements) { this.m_ShowCubeMapSettings.target = this.m_TextureShape.intValue == 2; if (EditorGUILayout.BeginFadeGroup(this.m_ShowCubeMapSettings.faded) && (this.m_TextureShape.intValue == 2)) { using (new EditorGUI.DisabledScope(!this.m_IsPOT && (this.m_NPOTScale.intValue == 0))) { EditorGUI.showMixedValue = this.m_GenerateCubemap.hasMultipleDifferentValues || this.m_SeamlessCubemap.hasMultipleDifferentValues; EditorGUI.BeginChangeCheck(); int num = EditorGUILayout.IntPopup(s_Styles.cubemap, this.m_GenerateCubemap.intValue, s_Styles.cubemapOptions, s_Styles.cubemapValues2, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.m_GenerateCubemap.intValue = num; } EditorGUI.indentLevel++; if (this.ShouldDisplayGUIElement(guiElements, TextureInspectorGUIElement.CubeMapConvolution)) { EditorGUILayout.IntPopup(this.m_CubemapConvolution, s_Styles.cubemapConvolutionOptions, s_Styles.cubemapConvolutionValues, s_Styles.cubemapConvolution, new GUILayoutOption[0]); } this.ToggleFromInt(this.m_SeamlessCubemap, s_Styles.seamlessCubemap); EditorGUI.indentLevel--; EditorGUI.showMixedValue = false; EditorGUILayout.Space(); } } EditorGUILayout.EndFadeGroup(); }
private void CookieGUI(TextureInspectorGUIElement guiElements) { CookieMode spot; EditorGUI.BeginChangeCheck(); if (this.m_BorderMipMap.intValue > 0) { spot = CookieMode.Spot; } else if (this.m_TextureShape.intValue == 2) { spot = CookieMode.Point; } else { spot = CookieMode.Directional; } spot = (CookieMode) EditorGUILayout.Popup(s_Styles.cookieType, (int) spot, s_Styles.cookieOptions, new GUILayoutOption[0]); if (EditorGUI.EndChangeCheck()) { this.SetCookieMode(spot); } if (spot == CookieMode.Point) { this.m_TextureShape.intValue = 2; } else { this.m_TextureShape.intValue = 1; } }
private void ColorSpaceGUI(TextureInspectorGUIElement guiElements) { this.ToggleFromInt(this.m_sRGBTexture, s_Styles.sRGBTexture); }
private void BumpGUI(TextureInspectorGUIElement guiElements) { EditorGUI.BeginChangeCheck(); this.ToggleFromInt(this.m_ConvertToNormalMap, s_Styles.generateFromBump); this.m_ShowBumpGenerationSettings.target = this.m_ConvertToNormalMap.intValue > 0; if (EditorGUILayout.BeginFadeGroup(this.m_ShowBumpGenerationSettings.faded)) { EditorGUI.indentLevel++; EditorGUILayout.Slider(this.m_HeightScale, 0f, 0.3f, s_Styles.bumpiness, new GUILayoutOption[0]); EditorGUILayout.Popup(this.m_NormalMapFilter, s_Styles.bumpFilteringOptions, s_Styles.bumpFiltering, new GUILayoutOption[0]); EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); if (EditorGUI.EndChangeCheck()) { this.SyncPlatformSettings(); } }