public override bool OnInspectorGUI(bool changed, SerializedObject serializedObject) { if (m_CurveDrawer == null) { m_CurveDrawer = new CurveDrawer(null, 0.0f, 1.0f, 0.0f, 1.0f, 140, false); m_CurveDrawer.AddCurve(serializedObject.FindProperty("AlphaCurve"), new Color(1.0f, 0.55f, 0.1f), "Alpha Curve"); } if (AlphaCurve == null) { DefaultCurve(); } var brightness = serializedObject.FindProperty("Brightness"); var contrast = serializedObject.FindProperty("Contrast"); var saturation = serializedObject.FindProperty("Saturation"); var alphaCurve = serializedObject.FindProperty("AlphaCurve"); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(brightness, VFXToolboxGUIUtility.Get("Brightness")); EditorGUILayout.PropertyField(contrast, VFXToolboxGUIUtility.Get("Contrast")); EditorGUILayout.PropertyField(saturation, VFXToolboxGUIUtility.Get("Saturation")); bool curveChanged = false; using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(VFXToolboxGUIUtility.Get("Alpha Curve"), GUILayout.Width(EditorGUIUtility.labelWidth)); if (GUILayout.Button(VFXToolboxGUIUtility.Get("Reset"))) { alphaCurve.animationCurveValue = AnimationCurve.Linear(0, 0, 1, 1); m_CurveDrawer.ClearSelection(); curveChanged = true; } } if (!curveChanged) { curveChanged = m_CurveDrawer.OnGUILayout(); } if (EditorGUI.EndChangeCheck() || curveChanged) { Invalidate(); changed = true; } return(changed); }
protected override bool DrawSidePanelContent(bool hasChanged) { var brightness = m_SerializedObject.FindProperty("Brightness"); var contrast = m_SerializedObject.FindProperty("Contrast"); var saturation = m_SerializedObject.FindProperty("Saturation"); var alphaCurve = m_SerializedObject.FindProperty("AlphaCurve"); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(brightness, VFXToolboxGUIUtility.Get("Brightness")); EditorGUILayout.PropertyField(contrast, VFXToolboxGUIUtility.Get("Contrast")); EditorGUILayout.PropertyField(saturation, VFXToolboxGUIUtility.Get("Saturation")); bool curveChanged = false; using (new GUILayout.HorizontalScope()) { EditorGUILayout.LabelField(VFXToolboxGUIUtility.Get("Alpha Curve"), GUILayout.Width(EditorGUIUtility.labelWidth)); if (GUILayout.Button(VFXToolboxGUIUtility.Get("Reset"))) { alphaCurve.animationCurveValue = AnimationCurve.Linear(0, 0, 1, 1); m_CurveDrawer.ClearSelection(); curveChanged = true; } } if (!curveChanged) { curveChanged = m_CurveDrawer.OnGUILayout(); } if (EditorGUI.EndChangeCheck() || curveChanged) { Invalidate(); hasChanged = true; } return(hasChanged); }