示例#1
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();
                }
            }
        }
示例#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();
            }
        }
 private void DrawInternal(Rect rect, DoubleCurve doubleCurve)
 {
     if (doubleCurve == null)
     {
         Debug.Log("DoubleCurve is null");
         return;
     }
     EditorGUIUtility.DrawRegionSwatch(rect, doubleCurve.maxCurve, doubleCurve.minCurve, new Color(0.8f, 0.8f, 0.8f, 1f), EditorGUI.kCurveBGColor, (!doubleCurve.signedRange) ? this.kUnsignedRange : this.kSignedRange);
 }
示例#4
0
        private void DrawInternal(Rect rect, DoubleCurve doubleCurve)
        {
            if (doubleCurve == null)
            {
                Debug.Log("DoubleCurve is null");
                return;
            }

            if (m_UseRanges)
            {
                EditorGUIUtility.DrawRegionSwatch(rect, doubleCurve.maxCurve, doubleCurve.minCurve, new Color(0.8f, 0.8f, 0.8f, 1.0f), EditorGUI.kCurveBGColor, doubleCurve.signedRange ? kSignedRange : kUnsignedRange);
            }
            else
            {
                EditorGUIUtility.DrawRegionSwatch(rect, doubleCurve.maxCurve, doubleCurve.minCurve, new Color(0.8f, 0.8f, 0.8f, 1.0f), EditorGUI.kCurveBGColor, kDefaultRange);
            }
        }
示例#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;
            }
        }