public static void RepositionKeyframesForConstantSpeed(SpherePointKeyframeGroup group)
        {
            if (group.GetKeyFrameCount() < 2)
            {
                return;
            }

            // Because time is always 1, no need to divide by it.
            float totalDistance = GetTotalDistanceBetweenKeyframes(group);
            float targetSpeed   = totalDistance;

            int keyFrameCount = group.GetKeyFrameCount();

            for (int j = 0; j < keyFrameCount; j++)
            {
                for (int i = keyFrameCount - 2; i >= 0; i--)
                {
                    int nextIndex = i + 1;
                    SpherePointKeyframe keyframe     = group.keyframes[i];
                    SpherePointKeyframe nextKeyframe = group.keyframes[nextIndex];

                    MoveKeyframeTimeToMatchSpeed(keyframe, nextKeyframe, targetSpeed);
                }

                // This is a hack, we resort and re-calculated edges since durations were changed.
                group.SortKeyframes();
            }
        }
        public static void RenderSpherePointRow(Rect rect, SkyProfile profile, SpherePointKeyframeGroup group)
        {
            bool sortGroup = false;

            RenderColorGradients(rect, group);

            for (int i = 0; i < group.keyframes.Count; i++)
            {
                SpherePointKeyframe currentKey = group.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, group, KeyframeInspectorWindow.KeyType.SpherePoint, profile);

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

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