Ejemplo n.º 1
0
        // get the start and end times of what an added recording clip at a given time would be
        internal static void GetAddedRecordingClipRange(TrackAsset track, WindowState state, double atTime, out double start, out double end)
        {
            // size to make the clip in pixels. Reasonably big so that both handles are easily manipulated,
            // and the full title is normally visible
            double defaultDuration = state.PixelDeltaToDeltaTime(100);

            start = atTime;
            end   = atTime + defaultDuration;

            double gapStart = 0;
            double gapEnd   = 0;

            // no gap, pick are reasonable amount
            if (!track.GetGapAtTime(atTime, out gapStart, out gapEnd))
            {
                start = atTime;
                return;
            }

            if (!double.IsInfinity(gapEnd))
            {
                end = gapEnd;
            }

            start = TimeReferenceUtility.SnapToFrameIfRequired(start);
            end   = TimeReferenceUtility.SnapToFrameIfRequired(end);
        }
Ejemplo n.º 2
0
        static void DrawBorderOfAddedRecordingClip(Rect trackRect, TrackAsset trackAsset, Vector2 visibleTime, WindowState state)
        {
            if (!state.IsArmedForRecord(trackAsset))
            {
                return;
            }

            AnimationTrack animTrack = trackAsset as AnimationTrack;

            if (animTrack == null || !animTrack.inClipMode)
            {
                return;
            }

            // make sure there is no clip but we can add one
            TimelineClip clip = null;

            if (trackAsset.FindRecordingClipAtTime(state.editSequence.time, out clip) || clip != null)
            {
                return;
            }

            float yMax = trackRect.yMax;
            float yMin = trackRect.yMin;

            double startGap = 0;
            double endGap   = 0;

            trackAsset.GetGapAtTime(state.editSequence.time, out startGap, out endGap);
            if (double.IsInfinity(endGap))
            {
                endGap = visibleTime.y;
            }

            if (startGap > visibleTime.y || endGap < visibleTime.x)
            {
                return;
            }


            startGap = Math.Max(startGap, visibleTime.x);
            endGap   = Math.Min(endGap, visibleTime.y);

            float xMin = state.TimeToPixel(startGap);
            float xMax = state.TimeToPixel(endGap);

            Rect r = Rect.MinMaxRect(xMin, yMin, xMax, yMax);

            ClipDrawer.DrawBorder(r, ClipBorder.kRecording, ClipBlends.kNone);
        }