private static void DrawGradientSwatchInternal(Rect position, Gradient gradient, SerializedProperty property, Color bgColor) { if (Event.current.type != EventType.Repaint) { return; } Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); if ((UnityEngine.Object)backgroundTexture != (UnityEngine.Object)null) { Color color = GUI.color; GUI.color = bgColor; EditorGUIUtility.GetBasicTextureStyle(backgroundTexture).Draw(position, false, false, false, false); GUI.color = color; } Texture2D tex = property == null?GradientPreviewCache.GetGradientPreview(gradient) : GradientPreviewCache.GetPropertyPreview(property); if ((UnityEngine.Object)tex == (UnityEngine.Object)null) { Debug.Log((object)"Warning: Could not create preview for gradient"); } else { EditorGUIUtility.GetBasicTextureStyle(tex).Draw(position, false, false, false, false); } }
private static void DrawGradientSwatchInternal(Rect position, Gradient gradient, SerializedProperty property, Color bgColor) { if (Event.current.type != EventType.Repaint) { return; } Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); if (backgroundTexture != null) { Color color = GUI.color; GUI.color = bgColor; GUIStyle basicTextureStyle = EditorGUIUtility.GetBasicTextureStyle(backgroundTexture); basicTextureStyle.Draw(position, false, false, false, false); GUI.color = color; } Texture2D texture2D; if (property != null) { texture2D = GradientPreviewCache.GetPropertyPreview(property); } else { texture2D = GradientPreviewCache.GetGradientPreview(gradient); } if (texture2D == null) { Debug.Log("Warning: Could not create preview for gradient"); return; } GUIStyle basicTextureStyle2 = EditorGUIUtility.GetBasicTextureStyle(texture2D); basicTextureStyle2.Draw(position, false, false, false, false); }
private void DrawInternal(Rect rect, Gradient gradient) { if (gradient != null) { GradientEditor.DrawGradientWithBackground(rect, gradient); } }
private void DrawInternal(Rect rect, Gradient gradient) { if (gradient != null) { GradientEditor.DrawGradientWithBackground(rect, GradientPreviewCache.GetGradientPreview(gradient)); } }
public static Texture2D GetBackgroundTexture() { if ((UnityEngine.Object)GradientEditor.s_BackgroundTexture == (UnityEngine.Object)null) { GradientEditor.s_BackgroundTexture = GradientEditor.CreateCheckerTexture(32, 4, 4, Color.white, new Color(0.7f, 0.7f, 0.7f)); } return(GradientEditor.s_BackgroundTexture); }
private void DrawInternal(Rect rect, Gradient gradient, ColorSpace colorSpace) { if (gradient == null) { return; } GradientEditor.DrawGradientWithBackground(rect, gradient, colorSpace); }
public static Texture2D GetBackgroundTexture() { if (s_BackgroundTexture == null) { s_BackgroundTexture = GradientEditor.CreateCheckerTexture(32, 4, 4, Color.white, new Color(0.7f, 0.7f, 0.7f)); } return(s_BackgroundTexture); }
public static Texture2D CreateGradientTexture(Gradient gradient) { Texture2D texture2D = new Texture2D(256, 2, TextureFormat.ARGB32, false); texture2D.wrapMode = TextureWrapMode.Clamp; texture2D.hideFlags = HideFlags.HideAndDontSave; GradientEditor.RefreshPreview(gradient, texture2D); return(texture2D); }
private static void DrawGradientSwatchInternal(Rect position, Gradient gradient, SerializedProperty property, Color bgColor) { if (Event.current.type == EventType.Repaint) { if (EditorGUI.showMixedValue) { Color color = GUI.color; float a = (float)((!GUI.enabled) ? 2 : 1); GUI.color = new Color(0.82f, 0.82f, 0.82f, a) * bgColor; GUIStyle whiteTextureStyle = EditorGUIUtility.whiteTextureStyle; whiteTextureStyle.Draw(position, false, false, false, false); EditorGUI.BeginHandleMixedValueContentColor(); whiteTextureStyle.Draw(position, EditorGUI.mixedValueContent, false, false, false, false); EditorGUI.EndHandleMixedValueContentColor(); GUI.color = color; } else { Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); if (backgroundTexture != null) { Color color2 = GUI.color; GUI.color = bgColor; GUIStyle basicTextureStyle = EditorGUIUtility.GetBasicTextureStyle(backgroundTexture); basicTextureStyle.Draw(position, false, false, false, false); GUI.color = color2; } Texture2D texture2D; float maxColorComponent; if (property != null) { texture2D = GradientPreviewCache.GetPropertyPreview(property); maxColorComponent = GradientEditor.GetMaxColorComponent(property.gradientValue); } else { texture2D = GradientPreviewCache.GetGradientPreview(gradient); maxColorComponent = GradientEditor.GetMaxColorComponent(gradient); } if (texture2D == null) { Debug.Log("Warning: Could not create preview for gradient"); } else { GUIStyle basicTextureStyle2 = EditorGUIUtility.GetBasicTextureStyle(texture2D); basicTextureStyle2.Draw(position, false, false, false, false); if (maxColorComponent > 1f) { GUI.Label(new Rect(position.x, position.y - 1f, position.width - 3f, position.height + 2f), "HDR", EditorStyles.centeredGreyMiniLabel); } } } } }
private void BuildTexture() { if (this.m_PreviewTex == null) { this.m_PreviewTex = GradientEditor.CreateGradientTexture(this.m_Gradient); } else { GradientEditor.RefreshPreview(this.m_Gradient, this.m_PreviewTex); } this.m_TextureDirty = false; }
public static void DrawGradientWithBackground(Rect position, Texture2D gradientTexture) { Rect position2 = new Rect(position.x + 1f, position.y + 1f, position.width - 2f, position.height - 2f); Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); Rect texCoords = new Rect(0f, 0f, position2.width / (float)backgroundTexture.width, position2.height / (float)backgroundTexture.height); GUI.DrawTextureWithTexCoords(position2, backgroundTexture, texCoords, false); if (gradientTexture != null) { GUI.DrawTexture(position2, gradientTexture, ScaleMode.StretchToFill, true); } GUI.Label(position, GUIContent.none, EditorStyles.colorPickerBox); }
private void Init() { if (this.m_ColorSwatch == null) { this.m_ColorSwatch = ColorPresetLibrary.CreateColorSwatchWithBorder(14, 14, false); } if (this.m_ColorSwatchTriangular == null) { this.m_ColorSwatchTriangular = ColorPresetLibrary.CreateColorSwatchWithBorder(14, 14, true); } if (this.m_MiniColorSwatchTriangular == null) { this.m_MiniColorSwatchTriangular = ColorPresetLibrary.CreateColorSwatchWithBorder(8, 8, true); } if (this.m_CheckerBoard == null) { this.m_CheckerBoard = GradientEditor.CreateCheckerTexture(2, 2, 3, new Color(0.8f, 0.8f, 0.8f), new Color(0.5f, 0.5f, 0.5f)); } }
private void InitIfNeeded() { if (this.m_GradientEditor == null) { this.m_GradientEditor = new GradientEditor(); this.m_GradientEditor.Init(this.m_Gradient, 0); } if (this.m_GradientLibraryEditorState == null) { this.m_GradientLibraryEditorState = new PresetLibraryEditorState(GradientPicker.presetsEditorPrefID); this.m_GradientLibraryEditorState.TransferEditorPrefsState(true); } if (this.m_GradientLibraryEditor != null) { return; } this.m_GradientLibraryEditor = new PresetLibraryEditor <GradientPresetLibrary>(new ScriptableObjectSaveLoadHelper <GradientPresetLibrary>("gradients", SaveType.Text), this.m_GradientLibraryEditorState, new System.Action <int, object>(this.PresetClickedCallback)); this.m_GradientLibraryEditor.showHeader = true; this.m_GradientLibraryEditor.minMaxPreviewHeight = new Vector2(14f, 14f); }
public static void DrawGradientWithBackground(Rect position, Gradient gradient) { Texture2D gradientPreview = GradientPreviewCache.GetGradientPreview(gradient); Rect position2 = new Rect(position.x + 1f, position.y + 1f, position.width - 2f, position.height - 2f); Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); Rect texCoords = new Rect(0f, 0f, position2.width / (float)backgroundTexture.width, position2.height / (float)backgroundTexture.height); GUI.DrawTextureWithTexCoords(position2, backgroundTexture, texCoords, false); if (gradientPreview != null) { GUI.DrawTexture(position2, gradientPreview, ScaleMode.StretchToFill, true); } GUI.Label(position, GUIContent.none, EditorStyles.colorPickerBox); float maxColorComponent = GradientEditor.GetMaxColorComponent(gradient); if (maxColorComponent > 1f) { GUI.Label(new Rect(position.x, position.y, position.width - 3f, position.height), "HDR", EditorStyles.centeredGreyMiniLabel); } }
private void InitIfNeeded() { if (this.m_GradientEditor == null) { this.m_GradientEditor = new GradientEditor(); this.m_GradientEditor.Init(this.m_Gradient, 0); } if (this.m_GradientLibraryEditorState == null) { this.m_GradientLibraryEditorState = new PresetLibraryEditorState(presetsEditorPrefID); this.m_GradientLibraryEditorState.TransferEditorPrefsState(true); } if (this.m_GradientLibraryEditor == null) { ScriptableObjectSaveLoadHelper<GradientPresetLibrary> helper = new ScriptableObjectSaveLoadHelper<GradientPresetLibrary>("gradients", SaveType.Text); this.m_GradientLibraryEditor = new PresetLibraryEditor<GradientPresetLibrary>(helper, this.m_GradientLibraryEditorState, new Action<int, object>(this.PresetClickedCallback)); this.m_GradientLibraryEditor.showHeader = true; this.m_GradientLibraryEditor.minMaxPreviewHeight = new Vector2(14f, 14f); } }
private void Init() { if (m_ColorSwatch == null) { m_ColorSwatch = CreateColorSwatchWithBorder(kSwatchSize, kSwatchSize, false); } if (m_ColorSwatchTriangular == null) { m_ColorSwatchTriangular = CreateColorSwatchWithBorder(kSwatchSize, kSwatchSize, true); } if (m_MiniColorSwatchTriangular == null) { m_MiniColorSwatchTriangular = CreateColorSwatchWithBorder(kMiniSwatchSize, kMiniSwatchSize, true); } if (m_CheckerBoard == null) { m_CheckerBoard = GradientEditor.CreateCheckerTexture(2, 2, 3, new Color(0.8f, 0.8f, 0.8f), new Color(0.5f, 0.5f, 0.5f)); } }
void InitIfNeeded() { // Init editor when needed if (m_GradientEditor == null) { m_GradientEditor = new GradientEditor(); m_GradientEditor.Init(m_Gradient, k_DefaultNumSteps, m_HDR); } if (m_GradientLibraryEditorState == null) { m_GradientLibraryEditorState = new PresetLibraryEditorState(presetsEditorPrefID); m_GradientLibraryEditorState.TransferEditorPrefsState(true); } if (m_GradientLibraryEditor == null) { var saveLoadHelper = new ScriptableObjectSaveLoadHelper <GradientPresetLibrary>("gradients", SaveType.Text); m_GradientLibraryEditor = new PresetLibraryEditor <GradientPresetLibrary>(saveLoadHelper, m_GradientLibraryEditorState, PresetClickedCallback); m_GradientLibraryEditor.showHeader = true; m_GradientLibraryEditor.minMaxPreviewHeight = new Vector2(14f, 14f); } }
public static void DrawGradientSwatch(Rect position, Gradient gradient, Color bgColor) { GradientEditor.DrawGradientSwatchInternal(position, gradient, null, bgColor); }
public static void DrawGradientSwatch(Rect position, Gradient gradient, Color bgColor) { GradientEditor.DrawGradientSwatchInternal(position, gradient, (SerializedProperty)null, bgColor); }
private static void DrawGradientSwatchInternal(Rect position, Gradient gradient, SerializedProperty property, Color bgColor, ColorSpace colorSpace) { if (Event.current.type != EventType.Repaint) { return; } if (EditorGUI.showMixedValue) { Color oldColor = GUI.color; float a = GUI.enabled ? 1 : 2; GUI.color = new Color(0.82f, 0.82f, 0.82f, a) * bgColor; GUIStyle mgs = EditorGUIUtility.whiteTextureStyle; mgs.Draw(position, false, false, false, false); EditorGUI.BeginHandleMixedValueContentColor(); mgs.Draw(position, EditorGUI.mixedValueContent, false, false, false, false); EditorGUI.EndHandleMixedValueContentColor(); GUI.color = oldColor; return; } // Draw Background Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); if (backgroundTexture != null) { Color oldColor = GUI.color; GUI.color = bgColor; GUIStyle backgroundStyle = EditorGUIUtility.GetBasicTextureStyle(backgroundTexture); backgroundStyle.Draw(position, false, false, false, false); GUI.color = oldColor; } // DrawTexture Texture2D preview = null; float maxColorComponent; bool linearGradientKeys = colorSpace == ColorSpace.Linear; if (colorSpace == ColorSpace.Uninitialized) { Debug.LogError("GradientEditor color space is not initialized, assuming linear gradient keys to build the gradient preview."); linearGradientKeys = true; } if (property != null) { preview = GradientPreviewCache.GetPropertyPreview(property, linearGradientKeys); maxColorComponent = GetMaxColorComponent(property.gradientValue); } else { preview = GradientPreviewCache.GetGradientPreview(gradient, linearGradientKeys); maxColorComponent = GetMaxColorComponent(gradient); } if (preview == null) { Debug.Log("Warning: Could not create preview for gradient"); return; } Color color = GUI.color; GUI.color = Color.white; //Dont want the Playmode tint to be applied to gradient textures. GUIStyle gs = EditorGUIUtility.GetBasicTextureStyle(preview); gs.Draw(position, false, false, false, false); GUI.color = color; // HDR label if (maxColorComponent > 1.0f) { GUI.Label(new Rect(position.x, position.y - 1, position.width - 3, position.height + 2), "HDR", EditorStyles.centeredGreyMiniLabel); } }
private int SwatchSort(GradientEditor.Swatch lhs, GradientEditor.Swatch rhs) { if (lhs.m_Time == rhs.m_Time && lhs == this.m_SelectedSwatch) { return -1; } if (lhs.m_Time == rhs.m_Time && rhs == this.m_SelectedSwatch) { return 1; } return lhs.m_Time.CompareTo(rhs.m_Time); }
public void OnGUI(Rect position) { if (GradientEditor.s_Styles == null) { GradientEditor.s_Styles = new GradientEditor.Styles(); } float num = 16f; float num2 = 30f; float num3 = position.height - 2f * num - num2; position.height = num; this.ShowSwatchArray(position, this.m_AlphaSwatches, true); position.y += num; if (Event.current.type == EventType.Repaint) { position.height = num3; if (this.m_TextureDirty) { this.BuildTexture(); } GradientEditor.DrawGradientWithBackground(position, this.m_PreviewTex); } position.y += num3; position.height = num; this.ShowSwatchArray(position, this.m_RGBSwatches, false); if (this.m_SelectedSwatch != null) { position.y += num; position.height = num2; position.y += 10f; float num4 = 45f; float num5 = 60f; float num6 = 20f; float labelWidth = 50f; float num7 = num5 + num6 + num5 + num4; Rect position2 = position; position2.height = 18f; position2.x += 17f; position2.width -= num7; EditorGUIUtility.labelWidth = labelWidth; if (this.m_SelectedSwatch.m_IsAlpha) { EditorGUIUtility.fieldWidth = 30f; EditorGUI.BeginChangeCheck(); float num8 = (float)EditorGUI.IntSlider(position2, GradientEditor.s_Styles.alphaText, (int)(this.m_SelectedSwatch.m_Value.r * 255f), 0, 255) / 255f; if (EditorGUI.EndChangeCheck()) { num8 = Mathf.Clamp01(num8); this.m_SelectedSwatch.m_Value.r = (this.m_SelectedSwatch.m_Value.g = (this.m_SelectedSwatch.m_Value.b = num8)); this.AssignBack(); HandleUtility.Repaint(); } } else { EditorGUI.BeginChangeCheck(); this.m_SelectedSwatch.m_Value = EditorGUI.ColorField(position2, GradientEditor.s_Styles.colorText, this.m_SelectedSwatch.m_Value, true, false); if (EditorGUI.EndChangeCheck()) { this.AssignBack(); HandleUtility.Repaint(); } } position2.x += position2.width + num6; position2.width = num4 + num5; EditorGUIUtility.labelWidth = num5; string kFloatFieldFormatString = EditorGUI.kFloatFieldFormatString; EditorGUI.kFloatFieldFormatString = "f1"; EditorGUI.BeginChangeCheck(); float value = EditorGUI.FloatField(position2, GradientEditor.s_Styles.locationText, this.m_SelectedSwatch.m_Time * 100f) / 100f; if (EditorGUI.EndChangeCheck()) { this.m_SelectedSwatch.m_Time = Mathf.Clamp(value, 0f, 1f); this.AssignBack(); } EditorGUI.kFloatFieldFormatString = kFloatFieldFormatString; position2.x += position2.width; position2.width = 20f; GUI.Label(position2, GradientEditor.s_Styles.percentText); } }
private Rect CalcSwatchRect(Rect totalRect, GradientEditor.Swatch s) { float time = s.m_Time; return new Rect((float) ((double) totalRect.x + (double) Mathf.Round(totalRect.width * time) - 5.0), totalRect.y, 10f, totalRect.height); }
private int SwatchSort(GradientEditor.Swatch lhs, GradientEditor.Swatch rhs) { if ((double) lhs.m_Time == (double) rhs.m_Time && lhs == this.m_SelectedSwatch) return -1; if ((double) lhs.m_Time == (double) rhs.m_Time && rhs == this.m_SelectedSwatch) return 1; return lhs.m_Time.CompareTo(rhs.m_Time); }
private void DrawSwatch(Rect totalPos, GradientEditor.Swatch s, bool upwards) { Color backgroundColor = GUI.backgroundColor; Rect position = this.CalcSwatchRect(totalPos, s); GUI.backgroundColor = s.m_Value; GUIStyle guiStyle1 = !upwards ? GradientEditor.s_Styles.downSwatch : GradientEditor.s_Styles.upSwatch; GUIStyle guiStyle2 = !upwards ? GradientEditor.s_Styles.downSwatchOverlay : GradientEditor.s_Styles.upSwatchOverlay; guiStyle1.Draw(position, false, false, this.m_SelectedSwatch == s, false); GUI.backgroundColor = backgroundColor; guiStyle2.Draw(position, false, false, this.m_SelectedSwatch == s, false); }
private static void DrawGradientSwatchInternal(Rect position, Gradient gradient, SerializedProperty property, Color bgColor) { if (Event.current.type != EventType.Repaint) { return; } if (EditorGUI.showMixedValue) { Color oldColor = GUI.color; float a = GUI.enabled ? 1 : 2; GUI.color = new Color(0.82f, 0.82f, 0.82f, a) * bgColor; GUIStyle mgs = EditorGUIUtility.whiteTextureStyle; mgs.Draw(position, false, false, false, false); EditorGUI.BeginHandleMixedValueContentColor(); mgs.Draw(position, EditorGUI.mixedValueContent, false, false, false, false); EditorGUI.EndHandleMixedValueContentColor(); GUI.color = oldColor; return; } // Draw Background Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture(); if (backgroundTexture != null) { Color oldColor = GUI.color; GUI.color = bgColor; GUIStyle backgroundStyle = EditorGUIUtility.GetBasicTextureStyle(backgroundTexture); backgroundStyle.Draw(position, false, false, false, false); GUI.color = oldColor; } // DrawTexture Texture2D preview = null; float maxColorComponent; if (property != null) { preview = GradientPreviewCache.GetPropertyPreview(property); maxColorComponent = GetMaxColorComponent(property.gradientValue); } else { preview = GradientPreviewCache.GetGradientPreview(gradient); maxColorComponent = GetMaxColorComponent(gradient); } if (preview == null) { Debug.Log("Warning: Could not create preview for gradient"); return; } GUIStyle gs = EditorGUIUtility.GetBasicTextureStyle(preview); gs.Draw(position, false, false, false, false); // HDR label if (maxColorComponent > 1.0f) { GUI.Label(new Rect(position.x, position.y - 1, position.width - 3, position.height + 2), "HDR", EditorStyles.centeredGreyMiniLabel); } }
public static void DrawGradientSwatch(Rect position, SerializedProperty property, Color bgColor) { GradientEditor.DrawGradientSwatchInternal(position, null, property, bgColor); }
internal static Gradient DoGradientField(Rect position, int id, Gradient value, SerializedProperty property, bool hdr) { Event evt = Event.current; switch (evt.GetTypeForControl(id)) { case EventType.MouseDown: if (position.Contains(evt.mousePosition)) { if (evt.button == 0) { s_GradientID = id; GUIUtility.keyboardControl = id; Gradient gradient = property != null ? property.gradientValue : value; GradientPicker.Show(gradient, hdr); GUIUtility.ExitGUI(); } else if (evt.button == 1) { if (property != null) { GradientContextMenu.Show(property.Copy()); } // TODO: make work for Gradient value } } break; case EventType.Repaint: { Rect r2 = new Rect(position.x + 1, position.y + 1, position.width - 2, position.height - 2); // Adjust for box drawn on top if (property != null) { GradientEditor.DrawGradientSwatch(r2, property, Color.white); } else { GradientEditor.DrawGradientSwatch(r2, value, Color.white); } EditorStyles.colorPickerBox.Draw(position, GUIContent.none, id); break; } case EventType.ExecuteCommand: if (s_GradientID == id && evt.commandName == GradientPicker.GradientPickerChangedCommand) { GUI.changed = true; GradientPreviewCache.ClearCache(); HandleUtility.Repaint(); if (property != null) { property.gradientValue = GradientPicker.gradient; } return(GradientPicker.gradient); } break; case EventType.ValidateCommand: if (s_GradientID == id && evt.commandName == EventCommandNames.UndoRedoPerformed) { if (property != null) { GradientPicker.SetCurrentGradient(property.gradientValue); } GradientPreviewCache.ClearCache(); return(value); } break; case EventType.KeyDown: if (GUIUtility.keyboardControl == id && (evt.keyCode == KeyCode.Space || evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter)) { Event.current.Use(); Gradient gradient = property != null ? property.gradientValue : value; GradientPicker.Show(gradient, hdr); GUIUtility.ExitGUI(); } break; } return(value); }
public void OnGUI(Rect position) { if (GradientEditor.s_Styles == null) { GradientEditor.s_Styles = new GradientEditor.Styles(); } float num = 24f; float num2 = 16f; float num3 = 26f; float num4 = position.height - 2f * num2 - num3 - num; position.height = num; this.m_GradientMode = (GradientMode)EditorGUI.EnumPopup(position, GradientEditor.s_Styles.modeText, this.m_GradientMode); if (this.m_GradientMode != this.m_Gradient.mode) { this.AssignBack(); } position.y += num; position.height = num2; this.ShowSwatchArray(position, this.m_AlphaSwatches, true); position.y += num2; if (Event.current.type == EventType.Repaint) { position.height = num4; GradientEditor.DrawGradientWithBackground(position, this.m_Gradient); } position.y += num4; position.height = num2; this.ShowSwatchArray(position, this.m_RGBSwatches, false); if (this.m_SelectedSwatch != null) { position.y += num2; position.height = num3; position.y += 10f; float num5 = 45f; float num6 = 60f; float num7 = 20f; float labelWidth = 50f; float num8 = num6 + num7 + num6 + num5; Rect position2 = position; position2.height = 18f; position2.x += 17f; position2.width -= num8; EditorGUIUtility.labelWidth = labelWidth; if (this.m_SelectedSwatch.m_IsAlpha) { EditorGUIUtility.fieldWidth = 30f; EditorGUI.BeginChangeCheck(); float num9 = (float)EditorGUI.IntSlider(position2, GradientEditor.s_Styles.alphaText, (int)(this.m_SelectedSwatch.m_Value.r * 255f), 0, 255) / 255f; if (EditorGUI.EndChangeCheck()) { num9 = Mathf.Clamp01(num9); this.m_SelectedSwatch.m_Value.r = (this.m_SelectedSwatch.m_Value.g = (this.m_SelectedSwatch.m_Value.b = num9)); this.AssignBack(); HandleUtility.Repaint(); } } else { EditorGUI.BeginChangeCheck(); this.m_SelectedSwatch.m_Value = EditorGUI.ColorField(position2, GradientEditor.s_Styles.colorText, this.m_SelectedSwatch.m_Value, true, false, this.m_HDR, ColorPicker.defaultHDRConfig); if (EditorGUI.EndChangeCheck()) { this.AssignBack(); HandleUtility.Repaint(); } } position2.x += position2.width + num7; position2.width = num5 + num6; EditorGUIUtility.labelWidth = num6; string kFloatFieldFormatString = EditorGUI.kFloatFieldFormatString; EditorGUI.kFloatFieldFormatString = "f1"; EditorGUI.BeginChangeCheck(); float value = EditorGUI.FloatField(position2, GradientEditor.s_Styles.locationText, this.m_SelectedSwatch.m_Time * 100f) / 100f; if (EditorGUI.EndChangeCheck()) { this.m_SelectedSwatch.m_Time = Mathf.Clamp(value, 0f, 1f); this.AssignBack(); } EditorGUI.kFloatFieldFormatString = kFloatFieldFormatString; position2.x += position2.width; position2.width = 20f; GUI.Label(position2, GradientEditor.s_Styles.percentText); } }