Ejemplo n.º 1
0
 public void OnSetValue(IEnumerable <ITimelineItem> items, double endValue, WindowState state)
 {
     foreach (var item in items.OfType <ITrimmable>())
     {
         EditMode.BeginTrim(item, TrimEdge.End);
         EditMode.TrimEnd(item, endValue, stretch);
         EditMode.FinishTrim();
     }
     state.UpdateRootPlayableDuration(state.editSequence.duration);
 }
Ejemplo n.º 2
0
            public void OnDrag(double endValue, WindowState state)
            {
                var trimValue = endValue;

                trimValue = TimelineWindow.instance.state.SnapToFrameIfRequired(trimValue);

                foreach (var item in grabbedItems)
                {
                    EditMode.TrimEnd(item, trimValue, stretch);
                }
                state.UpdateRootPlayableDuration(state.editSequence.duration);
            }
        protected override bool MouseDrag(Event evt, WindowState state)
        {
            if (state.editSequence.isReadOnly)
            {
                return(false);
            }

            if (!m_IsCaptured)
            {
                return(false);
            }

            var uiClip = m_TrimClipHandler.clipGUI;

            if (!m_UndoSaved)
            {
                UndoExtensions.RegisterClip(uiClip.clip, "Trim Clip");
                if (TimelineUtility.IsRecordableAnimationClip(uiClip.clip))
                {
                    TimelineUndo.PushUndo(uiClip.clip.animationClip, "Trim Clip");
                }

                m_UndoSaved = true;
            }

            //Reset to original ease values. The trim operation will calculate the proper blend values.
            uiClip.clip.easeInDuration  = m_OriginalEaseInDuration;
            uiClip.clip.easeOutDuration = m_OriginalEaseOutDuration;

            if (m_SnapEngine != null)
            {
                m_SnapEngine.Snap(evt.mousePosition, evt.modifiers);
            }

            RefreshOverlayStrings(m_TrimClipHandler, state);

            if (Selection.activeObject != null)
            {
                EditorUtility.SetDirty(Selection.activeObject);
            }

            // updates the duration of the graph without rebuilding
            state.UpdateRootPlayableDuration(state.editSequence.duration);

            return(true);
        }
Ejemplo n.º 4
0
        static void SelectDurationCallback(WindowState state, TimelineAsset.DurationMode mode)
        {
            if (mode == state.editSequence.asset.durationMode)
            {
                return;
            }

            TimelineUndo.PushUndo(state.editSequence.asset, "Duration Mode");


            // if we switched from Auto to Fixed, use the auto duration as the new fixed duration so the end marker stay in the same position.
            if (state.editSequence.asset.durationMode == TimelineAsset.DurationMode.BasedOnClips && mode == TimelineAsset.DurationMode.FixedLength)
            {
                state.editSequence.asset.fixedDuration = state.editSequence.duration;
            }

            state.editSequence.asset.durationMode = mode;
            state.UpdateRootPlayableDuration(state.editSequence.duration);
        }
Ejemplo n.º 5
0
        protected override bool MouseDrag(Event evt, WindowState state)
        {
            if (state.editSequence.isReadOnly)
            {
                return(false);
            }

            if (!m_IsCaptured)
            {
                return(false);
            }

            if (!m_UndoSaved)
            {
                var uiClip = m_TrimClipHandler.clipGUI;
                TimelineUndo.PushUndo(uiClip.clip.parentTrack, "Trim Clip");
                if (TimelineUtility.IsRecordableAnimationClip(uiClip.clip))
                {
                    TimelineUndo.PushUndo(uiClip.clip.animationClip, "Trim Clip");
                }

                m_UndoSaved = true;
            }

            if (m_SnapEngine != null)
            {
                m_SnapEngine.Snap(evt.mousePosition, evt.modifiers);
            }

            RefreshOverlayStrings(m_TrimClipHandler, state);

            if (Selection.activeObject != null)
            {
                EditorUtility.SetDirty(Selection.activeObject);
            }

            // updates the duration of the graph without rebuilding
            state.UpdateRootPlayableDuration(state.editSequence.duration);

            return(true);
        }