示例#1
0
 private void DrawInternal(Rect rect, AnimationCurve animCurve)
 {
     if (animCurve != null)
     {
         EditorGUIUtility.DrawCurveSwatch(rect, animCurve, null, new Color(0.8f, 0.8f, 0.8f, 1f), EditorGUI.kCurveBGColor);
     }
 }
示例#2
0
        private static void GUICurveField(Rect position, SerializedProperty maxCurve, SerializedProperty minCurve, Color color, Rect ranges, CurveFieldMouseDownCallback mouseDownCallback)
        {
            int       controlID      = GUIUtility.GetControlID(0x4ec1c30f, FocusType.Keyboard, position);
            Event     current        = Event.current;
            EventType typeForControl = current.GetTypeForControl(controlID);

            if (typeForControl == EventType.Repaint)
            {
                Rect rect = position;
                if (minCurve == null)
                {
                    EditorGUIUtility.DrawCurveSwatch(rect, null, maxCurve, color, EditorGUI.kCurveBGColor, ranges);
                }
                else
                {
                    EditorGUIUtility.DrawRegionSwatch(rect, maxCurve, minCurve, color, EditorGUI.kCurveBGColor, ranges);
                }
                EditorStyles.colorPickerBox.Draw(rect, GUIContent.none, controlID, false);
            }
            else if (typeForControl == EventType.ValidateCommand)
            {
                if (current.commandName == "UndoRedoPerformed")
                {
                    AnimationCurvePreviewCache.ClearCache();
                }
            }
            else if ((typeForControl == EventType.MouseDown) && (position.Contains(current.mousePosition) && ((mouseDownCallback != null) && mouseDownCallback(current.button, position, ranges))))
            {
                current.Use();
            }
        }
示例#3
0
        private static void GUICurveField(Rect position, SerializedProperty maxCurve, SerializedProperty minCurve, Color color, Rect ranges, ModuleUI.CurveFieldMouseDownCallback mouseDownCallback)
        {
            int       controlID      = GUIUtility.GetControlID(1321321231, EditorGUIUtility.native, position);
            Event     current        = Event.current;
            EventType typeForControl = current.GetTypeForControl(controlID);

            if (typeForControl != EventType.MouseDown)
            {
                if (typeForControl == EventType.Repaint)
                {
                    Rect position2 = position;
                    if (minCurve == null)
                    {
                        EditorGUIUtility.DrawCurveSwatch(position2, null, maxCurve, color, EditorGUI.kCurveBGColor, ranges);
                    }
                    else
                    {
                        EditorGUIUtility.DrawRegionSwatch(position2, maxCurve, minCurve, color, EditorGUI.kCurveBGColor, ranges);
                    }
                    EditorStyles.colorPickerBox.Draw(position2, GUIContent.none, controlID, false);
                }
            }
            else
            {
                if (position.Contains(current.mousePosition) && mouseDownCallback != null && mouseDownCallback(current.button, position, ranges))
                {
                    current.Use();
                }
            }
        }
 private void DrawInternal(Rect rect, AnimationCurve animCurve)
 {
     if (animCurve == null)
     {
         return;
     }
     EditorGUIUtility.DrawCurveSwatch(rect, animCurve, (SerializedProperty)null, new Color(0.8f, 0.8f, 0.8f, 1f), EditorGUI.kCurveBGColor);
 }
示例#5
0
        private static void GUICurveField(Rect position, SerializedProperty maxCurve, SerializedProperty minCurve, Color color, Rect ranges, ModuleUI.CurveFieldMouseDownCallback mouseDownCallback)
        {
            int   controlId = GUIUtility.GetControlID(1321321231, EditorGUIUtility.native, position);
            Event current   = Event.current;

            switch (current.GetTypeForControl(controlId))
            {
            case EventType.MouseDown:
                if (!position.Contains(current.mousePosition) || mouseDownCallback == null || !mouseDownCallback(current.button, position, ranges))
                {
                    break;
                }
                current.Use();
                break;

            case EventType.Repaint:
                Rect position1 = position;
                if (minCurve == null)
                {
                    EditorGUIUtility.DrawCurveSwatch(position1, (AnimationCurve)null, maxCurve, color, EditorGUI.kCurveBGColor, ranges);
                }
                else
                {
                    EditorGUIUtility.DrawRegionSwatch(position1, maxCurve, minCurve, color, EditorGUI.kCurveBGColor, ranges);
                }
                EditorStyles.colorPickerBox.Draw(position1, GUIContent.none, controlId, false);
                break;

            case EventType.ValidateCommand:
                if (!(current.commandName == "UndoRedoPerformed"))
                {
                    break;
                }
                AnimationCurvePreviewCache.ClearCache();
                break;
            }
        }