void OnGradientChanged(Gradient newValue) { value = newValue; GradientPreviewCache.ClearCache(); // needed because GradientEditor itself uses the cache and will no invalidate it on changes. IncrementVersion(VersionChangeType.Repaint); }
void OnGradientChanged(Gradient newValue) { SetValueAndNotify(newValue); GradientPreviewCache.ClearCache(); // needed because GradientEditor itself uses the cache and will no invalidate it on changes. Dirty(ChangeType.Repaint); }
public static void SetGradientAsColor(SerializedProperty gradientProp, Color color) { Gradient gradientValue = gradientProp.gradientValue; gradientValue.constantColor = color; GradientPreviewCache.ClearCache(); }
public static void Show(Gradient newGradient, bool hdr, Action <Gradient> onGradientChanged) { GradientPicker.PrepareShow(hdr); GradientPicker.s_GradientPicker.m_DelegateView = null; GradientPicker.s_GradientPicker.m_Delegate = onGradientChanged; GradientPicker.s_GradientPicker.Init(newGradient, hdr); GradientPreviewCache.ClearCache(); }
private void Paste() { ParticleSystemClipboard.PasteGradient(this.m_Prop1, null); if (this.m_Prop1 != null) { this.m_Prop1.serializedObject.ApplyModifiedProperties(); } GradientPreviewCache.ClearCache(); }
private static void Show(Gradient newGradient, bool hdr, ColorSpace colorSpace, System.Action <Gradient> onGradientChanged, GUIView currentView) { PrepareShow(hdr, colorSpace); s_GradientPicker.m_DelegateView = currentView; s_GradientPicker.m_Delegate = onGradientChanged; s_GradientPicker.Init(newGradient, hdr, colorSpace); GradientPreviewCache.ClearCache(); }
public static void Show(Gradient newGradient, bool hdr) { GUIView current = GUIView.current; GradientPicker.PrepareShow(hdr); GradientPicker.s_GradientPicker.m_DelegateView = current; GradientPicker.s_GradientPicker.m_Delegate = null; GradientPicker.s_GradientPicker.Init(newGradient, hdr); GradientPreviewCache.ClearCache(); }
private void PresetClickedCallback(int clickCount, object presetObject) { Gradient gradient = presetObject as Gradient; if (gradient == null) { Debug.LogError("Incorrect object passed " + presetObject); } GradientPicker.SetCurrentGradient(gradient); GradientPreviewCache.ClearCache(); this.gradientChanged = true; }
public static void Show(Gradient newGradient) { GUIView current = GUIView.current; if (GradientPicker.s_GradientPicker == null) { GradientPicker.s_GradientPicker = (GradientPicker)EditorWindow.GetWindow(typeof(GradientPicker), true, "Gradient Editor", false); Vector2 minSize = new Vector2(360f, 224f); Vector2 maxSize = new Vector2(1900f, 3000f); GradientPicker.s_GradientPicker.minSize = minSize; GradientPicker.s_GradientPicker.maxSize = maxSize; GradientPicker.s_GradientPicker.wantsMouseMove = true; GradientPicker.s_GradientPicker.ShowAuxWindow(); } else { GradientPicker.s_GradientPicker.Repaint(); } GradientPicker.s_GradientPicker.m_DelegateView = current; GradientPicker.s_GradientPicker.Init(newGradient); GradientPreviewCache.ClearCache(); }
private void Paste() { ParticleSystemClipboard.PasteGradient(this.m_Prop1, null); GradientPreviewCache.ClearCache(); }
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); }
private void OnGradientChanged(Gradient newValue) { this.SetValueAndNotify(newValue); GradientPreviewCache.ClearCache(); base.Dirty(ChangeType.Repaint); }