public static void OnClipMenu(ITimelineState state, TimelineClip[] clips, GenericMenu menu)
 {
     if (!(state.currentDirector == null))
     {
         TimelineClip[] array = (from c in clips
                                 where c.asset as AnimationPlayableAsset != null && c.parentTrack.clips.Any((TimelineClip x) => x.start < c.start)
                                 select c).ToArray <TimelineClip>();
         TimelineClip[] array2 = (from c in clips
                                  where c.asset as AnimationPlayableAsset != null && c.parentTrack.clips.Any((TimelineClip x) => x.start > c.start)
                                  select c).ToArray <TimelineClip>();
         if (array.Any <TimelineClip>() || array2.Any <TimelineClip>())
         {
             if (array.Any <TimelineClip>())
             {
                 menu.AddItem(AnimationOffsetMenu.MatchPreviousMenuItem, false, delegate(object x)
                 {
                     AnimationOffsetMenu.MatchClipsToPrevious(state, (TimelineClip[])x);
                 }, array);
             }
             if (array2.Any <TimelineClip>())
             {
                 menu.AddItem(AnimationOffsetMenu.MatchNextMenuItem, false, delegate(object x)
                 {
                     AnimationOffsetMenu.MatchClipsToNext(state, (TimelineClip[])x);
                 }, array2);
             }
             menu.AddItem(AnimationOffsetMenu.ResetOffsetMenuItem, false, delegate
             {
                 AnimationOffsetMenu.ResetClipOffsets(state, clips);
             });
         }
     }
 }
 public override bool Execute(IEnumerable <TimelineClip> clips)
 {
     if (clips == null || !clips.Any())
     {
         return(false);
     }
     AnimationOffsetMenu.MatchClipsToPrevious(clips.Where(x => IsValidClip(x, TimelineEditor.inspectedDirector)).ToArray());
     return(true);
 }
 internal static void MatchClipsToNext(ITimelineState state, TimelineClip[] clips)
 {
     if (AnimationOffsetMenu.EnforcePreviewMode(state))
     {
         clips = (from x in clips
                  orderby x.start descending
                  select x).ToArray <TimelineClip>();
         TimelineClip[] array = clips;
         for (int i = 0; i < array.Length; i++)
         {
             TimelineClip timelineClip = array[i];
             TimelineUndo.PushUndo(timelineClip.asset, "Match Clip");
             GameObject sceneGameObject = TimelineUtility.GetSceneGameObject(state.currentDirector, timelineClip.parentTrack);
             TimelineAnimationUtilities.MatchNext(timelineClip, sceneGameObject.get_transform(), state.currentDirector);
         }
     }
 }
Beispiel #4
0
 public override void OnBuildClipContextMenu(GenericMenu menu, TimelineClip[] clips, WindowState state)
 {
     AnimationOffsetMenu.OnClipMenu(state, clips, menu);
 }
 public override bool Execute(IEnumerable <TimelineClip> clips)
 {
     AnimationOffsetMenu.MatchClipsToNext(clips.Where(x => IsValidClip(x, TimelineEditor.inspectedDirector)).ToArray());
     return(true);
 }
 public override bool Execute(IEnumerable <TimelineClip> clips)
 {
     AnimationOffsetMenu.ResetClipOffsets(clips.Where(TimelineAnimationUtilities.IsAnimationClip).ToArray());
     return(true);
 }
 public override bool Execute(WindowState state, TimelineClip[] items)
 {
     AnimationOffsetMenu.ResetClipOffsets(state, items.Where(TimelineAnimationUtilities.IsAnimationClip).ToArray());
     return(true);
 }
 public override bool Execute(WindowState state, TimelineClip[] items)
 {
     AnimationOffsetMenu.MatchClipsToNext(state, items.Where(x => IsValidClip(x, TimelineEditor.inspectedDirector)).ToArray());
     return(true);
 }