Пример #1
0
        public override bool Execute(TimelineWindow.TimelineState state)
        {
            IEnumerable <EditorClip> data = Clipboard.GetData <EditorClip>();

            foreach (EditorClip current in data)
            {
                double end = current.clip.parentTrack.clips.Last <TimelineClip>().end;
                current.clip.DuplicateAtTime(current.clip.parentTrack, end, state.currentDirector);
            }
            IEnumerable <EditorMarker> data2 = Clipboard.GetData <EditorMarker>();

            foreach (EditorMarker current2 in data2)
            {
                double newTime = current2.theMarker.parentTrack.end + 0.5;
                MarkerModifiers.DuplicateAtTime(current2.theMarker, state.currentDirector, newTime);
            }
            IEnumerable <TrackAsset> data3 = Clipboard.GetData <TrackAsset>();

            foreach (TrackAsset current3 in data3)
            {
                current3.Duplicate(state.currentDirector, state.timeline);
            }
            state.Refresh();
            return(true);
        }
Пример #2
0
        public override bool Execute(TimelineWindow.TimelineState state, TimelineMarker[] markers)
        {
            PlayableDirector directorComponent = (state == null) ? null : state.currentDirector;
            bool             result;

            if (!markers.Any <TimelineMarker>())
            {
                result = false;
            }
            else
            {
                SelectionManager.Clear();
                for (int i = 0; i < markers.Length; i++)
                {
                    TimelineMarker theMarker      = markers[i];
                    TimelineMarker timelineMarker = MarkerModifiers.Duplicate(theMarker, directorComponent);
                    if (timelineMarker != null && state != null)
                    {
                        SelectionManager.Add(timelineMarker);
                    }
                }
                if (state != null)
                {
                    state.Refresh();
                }
                result = true;
            }
            return(result);
        }
Пример #3
0
        public static bool HandleShortcut(TimelineWindow.TimelineState state, Event evt, T item)
        {
            T[] items = new T[]
            {
                item
            };
            bool result;

            foreach (ItemAction <T> current in ItemAction <T> .actions)
            {
                object[] customAttributes = current.GetType().GetCustomAttributes(typeof(ShortcutAttribute), true);
                object[] array            = customAttributes;
                for (int i = 0; i < array.Length; i++)
                {
                    ShortcutAttribute shortcutAttribute = (ShortcutAttribute)array[i];
                    if (shortcutAttribute.IsRecognized(evt))
                    {
                        if (MenuItemActionBase.s_ShowActionTriggeredByShortcut)
                        {
                            Debug.Log(current.GetType().Name);
                        }
                        bool flag = current.Execute(state, items);
                        state.Refresh();
                        state.Evaluate();
                        result = flag;
                        return(result);
                    }
                }
            }
            result = false;
            return(result);
        }
Пример #4
0
 public static bool Do(TimelineWindow.TimelineState state, TrackAsset track)
 {
     PasteIntoAction.DoPasteClips(state, track);
     PasteIntoAction.DoPasteMarkers(state, track);
     state.Refresh();
     return(true);
 }
        public override bool Execute(TimelineWindow.TimelineState state, TrackAsset[] tracks)
        {
            HashSet <TrackAsset> hashSet = new HashSet <TrackAsset>();

            for (int i = 0; i < tracks.Length; i++)
            {
                TrackAsset trackAsset  = tracks[i];
                TrackAsset trackAsset2 = trackAsset.parent as TrackAsset;
                bool       flag        = false;
                while (trackAsset2 != null && !flag)
                {
                    if (hashSet.Contains(trackAsset2))
                    {
                        flag = true;
                    }
                    trackAsset2 = (trackAsset2.parent as TrackAsset);
                }
                if (!flag)
                {
                    hashSet.Add(trackAsset);
                }
            }
            foreach (TrackAsset current in hashSet)
            {
                current.Duplicate(state.currentDirector, null);
            }
            state.Refresh();
            return(true);
        }
Пример #6
0
 public override bool Execute(TimelineWindow.TimelineState state, TimelineClip[] clips)
 {
     state.Stop();
     ClipModifier.Delete(state.timeline, clips);
     SelectionManager.Clear();
     state.Refresh(true);
     return(true);
 }
Пример #7
0
        public override bool Execute(TimelineWindow.TimelineState state, TimelineClip[] clips)
        {
            bool flag = ClipModifier.Split(state.currentDirector, state.time, clips);

            if (flag)
            {
                state.Refresh();
            }
            return(flag);
        }
Пример #8
0
 public override bool Execute(TimelineWindow.TimelineState state, TrackAsset[] tracks)
 {
     for (int i = 0; i < tracks.Length; i++)
     {
         TrackAsset track = tracks[i];
         DeleteTracks.Do(state.timeline, track);
     }
     state.previewMode = false;
     state.Refresh();
     return(true);
 }
Пример #9
0
 private void RefreshStateIfBindingProblemIsFound(TimelineWindow.TimelineState state, bool hasProblems)
 {
     if (this.m_InitHadProblems && this.m_HadProblems != hasProblems)
     {
         TrackBindingValidationResult trackBindingValidationResult = this.GetTrackBindingValidationResult(state);
         bool flag = !trackBindingValidationResult.IsValid() && trackBindingValidationResult.bindingState != TimelineTrackBindingState.BoundGameObjectIsDisabled && trackBindingValidationResult.bindingState != TimelineTrackBindingState.RequiredComponentOnBoundGameObjectIsDisabled;
         if (flag)
         {
             state.Refresh();
         }
     }
 }
Пример #10
0
 protected void ToggleLock(TimelineWindow.TimelineState state, TrackAsset[] tracks)
 {
     if (tracks.Length != 0)
     {
         TimelineUndo.PushUndo(tracks[0], "Lock Track");
         for (int i = 0; i < tracks.Length; i++)
         {
             TrackAsset trackAsset = tracks[i];
             trackAsset.locked = !trackAsset.locked;
         }
         state.Refresh(true);
     }
 }
 public override bool Execute(TimelineWindow.TimelineState state, TrackAsset[] tracks)
 {
     for (int i = 0; i < tracks.Length; i++)
     {
         TrackAsset trackAsset = tracks[i];
         state.timeline.CreateTrack <GroupTrack>(trackAsset, "Track Sub-Group");
         TimelineTrackBaseGUI timelineTrackBaseGUI = TimelineTrackBaseGUI.FindGUITrack(trackAsset);
         if (timelineTrackBaseGUI != null)
         {
             TimelineWindow.instance.treeView.data.SetExpanded(timelineTrackBaseGUI, true);
         }
     }
     state.Refresh();
     return(true);
 }
Пример #12
0
 public override bool Execute(TimelineWindow.TimelineState state, TimelineMarker[] markers)
 {
     state.Stop();
     for (int i = 0; i < markers.Length; i++)
     {
         TimelineMarker           timelineMarker          = markers[i];
         ITimelineMarkerContainer timelineMarkerContainer = timelineMarker.parentTrack as ITimelineMarkerContainer;
         if (timelineMarkerContainer != null)
         {
             timelineMarkerContainer.RemoveMarker(timelineMarker);
         }
     }
     SelectionManager.Clear();
     state.Refresh(true);
     return(true);
 }
Пример #13
0
        private float DrawMuteButton(Rect rect, TimelineWindow.TimelineState state)
        {
            float result;

            if (!base.IsSubTrack() && base.track.muted)
            {
                if (GUI.Button(rect, GUIContent.none, TimelineWindow.styles.mute))
                {
                    base.track.muted = false;
                    state.Refresh();
                }
                result = 16f;
            }
            else
            {
                result = 0f;
            }
            return(result);
        }
        public override bool Execute(TimelineWindow.TimelineState state, TimelineClip[] clips)
        {
            PlayableDirector director = (state == null) ? null : state.currentDirector;

            for (int i = 0; i < clips.Length; i++)
            {
                TimelineClip clip         = clips[i];
                TimelineClip timelineClip = clip.Duplicate(director);
                if (timelineClip != null && state != null)
                {
                    SelectionManager.Clear();
                    SelectionManager.Add(timelineClip);
                }
            }
            if (state != null)
            {
                state.Refresh();
            }
            return(true);
        }
Пример #15
0
        public static TimelineClip AddRecordableClip(TrackAsset parentTrack, TimelineWindow.TimelineState state)
        {
            TimelineAsset timeline = state.timeline;
            TimelineClip  result;

            if (timeline == null)
            {
                Debug.LogError("Parent Track needs to be bound to an asset to add a recordable");
                result = null;
            }
            else
            {
                AnimationClip animationClip = new AnimationClip();
                animationClip.set_name(AnimationTrackRecorder.GetUniqueRecordedClipName(parentTrack, AnimationTrackRecorder.kRecordClipDefaultName));
                animationClip.set_frameRate(state.frameRate);
                AnimationUtility.SetGenerateMotionCurves(animationClip, true);
                Undo.RegisterCreatedObjectUndo(animationClip, "Create Clip");
                TimelineHelpers.SaveAnimClipIntoObject(animationClip, parentTrack);
                TimelineClip timelineClip = parentTrack.CreateClipFromAsset(animationClip);
                if (timelineClip != null)
                {
                    timelineClip.recordable            = true;
                    timelineClip.displayName           = animationClip.get_name();
                    timelineClip.timeScale             = 1.0;
                    timelineClip.start                 = 0.0;
                    timelineClip.duration              = 0.0;
                    timelineClip.mixInCurve            = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
                    timelineClip.mixOutCurve           = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
                    timelineClip.preExtrapolationMode  = TimelineClip.ClipExtrapolation.Hold;
                    timelineClip.postExtrapolationMode = TimelineClip.ClipExtrapolation.Hold;
                    TimelineCreateUtilities.SaveAssetIntoObject(timelineClip.asset, parentTrack);
                    state.Refresh();
                }
                result = timelineClip;
            }
            return(result);
        }