Beispiel #1
0
        // Use vertex shader to fix aspect ratio.
        public static void RenderNumberGroup(Rect rect, SkyProfile profile, NumberKeyframeGroup group)
        {
            lock (profile) {
                bool sortKeyFrames = false;

                RenderLinePath(rect, group);

                for (int i = 0; i < group.keyframes.Count; i++)
                {
                    NumberKeyframe currentKey = group.GetKeyframe(i);

                    int            nextIndex = (i + 1) % group.keyframes.Count;
                    NumberKeyframe nextKey   = group.GetKeyframe(nextIndex);

                    // Clamp time if we're wrapping around.
                    float nextTime = nextKey.time;
                    if (nextTime <= currentKey.time)
                    {
                        nextTime = 1.0f;
                    }

                    bool didSingleClick  = false;
                    bool isDragging      = false;
                    bool keyframeUpdated = false;

                    SkyEditorUtility.DrawNumericKeyMarker(rect, currentKey, group, profile,
                                                          out didSingleClick, out isDragging, out keyframeUpdated);

                    if (keyframeUpdated)
                    {
                        sortKeyFrames = true;
                    }

                    if (didSingleClick || isDragging)
                    {
                        KeyframeInspectorWindow.SetKeyframeData(
                            currentKey, group, KeyframeInspectorWindow.KeyType.Numeric, profile);

                        if (didSingleClick && KeyframeInspectorWindow.inspectorEnabled == false)
                        {
                            KeyframeInspectorWindow.ShowWindow();
                        }
                    }
                }

                if (sortKeyFrames)
                {
                    group.SortKeyframes();
                }
            }
        }
Beispiel #2
0
        public static void RenderColorGroupRow(Rect rect, SkyProfile profile, ColorKeyframeGroup colors)
        {
            bool sortGroup = false;

            RenderColorGroupRow(rect, colors);

            for (int i = 0; i < colors.keyframes.Count; i++)
            {
                ColorKeyframe currentKey = colors.GetKeyframe(i);

                // Track key marker mouse events and render.
                bool didSingleClick  = false;
                bool isDragging      = false;
                bool keyframeUpdated = false;
                SkyEditorUtility.DrawHorizontalKeyMarker(rect, currentKey, profile,
                                                         out didSingleClick, out isDragging, out keyframeUpdated);

                if (keyframeUpdated)
                {
                    sortGroup = true;
                }

                // Show the color keyframe property window.
                if (didSingleClick || isDragging)
                {
                    // Load info about this keyframe and show the editor window.
                    KeyframeInspectorWindow.SetKeyframeData(
                        currentKey, colors, KeyframeInspectorWindow.KeyType.Color, profile);

                    if (didSingleClick)
                    {
                        KeyframeInspectorWindow.ShowWindow();
                    }
                }
            }

            if (sortGroup)
            {
                colors.SortKeyframes();
            }
        }