Ejemplo n.º 1
0
 public static void ShowWindow()
 {
     if (_instance == null)
     {
         _instance              = CreateInstance <KeyframeInspectorWindow>();
         _instance.name         = "Keyframe Inspector";
         _instance.titleContent = new GUIContent("Keyframe Inspector");
         _instance.minSize      = new Vector2(k_MinWidth, k_MinHeight);
     }
     _instance.ShowUtility();
 }
Ejemplo n.º 2
0
 // True if the keyframe is shown in the inspector window.
 public static bool IsKeyframeActiveInInspector(BaseKeyframe keyFrame)
 {
     if (KeyframeInspectorWindow.inspectorEnabled && KeyframeInspectorWindow.GetActiveKeyframeId() == keyFrame.id)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
        private void InsertKeyframeInSpherePointGroup(float time, SpherePointKeyframeGroup group)
        {
            SpherePointKeyframe previousKeyFrame = group.GetPreviousKeyFrame(time);
            SpherePointKeyframe newKeyFrame      = new SpherePointKeyframe(previousKeyFrame);

            newKeyFrame.time = time;
            group.AddKeyFrame(newKeyFrame);

            KeyframeInspectorWindow.SetKeyframeData(
                newKeyFrame, group, KeyframeInspectorWindow.KeyType.SpherePoint, m_ActiveSkyProfile);
        }
Ejemplo n.º 4
0
        private void InsertKeyframeInNumericGroup(float time, NumberKeyframeGroup group)
        {
            NumberKeyframe previousKeyframe = group.GetPreviousKeyFrame(time);
            NumberKeyframe newKeyFrame      = new NumberKeyframe(previousKeyframe);

            newKeyFrame.time = time;
            group.AddKeyFrame(newKeyFrame);

            KeyframeInspectorWindow.SetKeyframeData(
                newKeyFrame, group, KeyframeInspectorWindow.KeyType.Numeric, m_ActiveSkyProfile);
        }
Ejemplo n.º 5
0
        private void InsertKeyframeInColorGroup(float time, ColorKeyframeGroup group)
        {
            ColorKeyframe previousKeyFrame = group.GetPreviousKeyFrame(time);
            //Color keyColor = previousKeyFrame != null ? previousKeyFrame.color : Color.white;
            ColorKeyframe newKeyFrame = new ColorKeyframe(previousKeyFrame);

            newKeyFrame.time = time;
            group.AddKeyFrame(newKeyFrame);

            KeyframeInspectorWindow.SetKeyframeData(
                newKeyFrame, group, KeyframeInspectorWindow.KeyType.Color, m_ActiveSkyProfile);
        }
Ejemplo n.º 6
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();
                }
            }
        }
Ejemplo n.º 7
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();
            }
        }