예제 #1
0
        public override bool Execute(IEnumerable <TimelineClip> clips)
        {
            var clip = clips.FirstOrDefault();

            if (clip != null && (clip.curves != null || clip.animationClip != null))
            {
                var clipToEdit = clip.animationClip != null ? clip.animationClip : clip.curves;
                if (clipToEdit == null)
                {
                    return(false);
                }

                GameObject gameObject = null;
                if (TimelineEditor.inspectedDirector != null)
                {
                    gameObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, clip.parentTrack);
                }

                var timeController = TimelineAnimationUtilities.CreateTimeController(clip);
                TimelineAnimationUtilities.EditAnimationClipWithTimeController(
                    clipToEdit, timeController, clip.animationClip != null  ? gameObject : null);
                return(true);
            }

            return(false);
        }
        public static bool Do(WindowState state, TrackAsset track)
        {
            AnimationClip clipToEdit = null;

            AnimationTrack animationTrack = track as AnimationTrack;

            if (animationTrack != null)
            {
                if (!animationTrack.CanConvertToClipMode())
                {
                    return(false);
                }

                clipToEdit = animationTrack.infiniteClip;
            }
            else if (track.hasCurves)
            {
                clipToEdit = track.curves;
            }

            if (clipToEdit == null)
            {
                return(false);
            }

            var gameObject     = state.GetSceneReference(track);
            var timeController = TimelineAnimationUtilities.CreateTimeController(state, CreateTimeControlClipData(track));

            TimelineAnimationUtilities.EditAnimationClipWithTimeController(clipToEdit, timeController, gameObject);

            return(true);
        }
예제 #3
0
        public override bool Execute(TimelineWindow.TimelineState state, TimelineClip[] clips)
        {
            TimelineClip timelineClip = clips[0];
            bool         result;

            if (timelineClip.curves != null || timelineClip.animationClip != null)
            {
                AnimationClip animationClip = (!(timelineClip.animationClip != null)) ? timelineClip.curves : timelineClip.animationClip;
                if (animationClip == null)
                {
                    result = false;
                }
                else
                {
                    Component bindingForTrack = state.GetBindingForTrack(timelineClip.parentTrack);
                    TimelineWindowTimeControl timeController = TimelineAnimationUtilities.CreateTimeController(state, timelineClip);
                    TimelineAnimationUtilities.EditAnimationClipWithTimeController(animationClip, timeController, (!(timelineClip.animationClip != null)) ? null : bindingForTrack);
                    result = true;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
예제 #4
0
        public override bool Execute(WindowState state, TimelineClip[] clips)
        {
            var clip = clips[0];

            if (clip.curves != null || clip.animationClip != null)
            {
                var clipToEdit = clip.animationClip != null ? clip.animationClip : clip.curves;
                if (clipToEdit == null)
                {
                    return(false);
                }

                var gameObject     = state.GetSceneReference(clip.parentTrack);
                var timeController = TimelineAnimationUtilities.CreateTimeController(state, clip);
                TimelineAnimationUtilities.EditAnimationClipWithTimeController(
                    clipToEdit, timeController, clip.animationClip != null  ? gameObject : null);
                return(true);
            }

            return(false);
        }
예제 #5
0
        public static bool Do(TimelineWindow.TimelineState state, TrackAsset track)
        {
            AnimationTrack animationTrack = track as AnimationTrack;
            bool           result;

            if (animationTrack == null)
            {
                result = false;
            }
            else if (!animationTrack.CanConvertToClipMode())
            {
                result = false;
            }
            else
            {
                Component bindingForTrack = state.GetBindingForTrack(animationTrack);
                TimelineWindowTimeControl timeController = TimelineAnimationUtilities.CreateTimeController(state, EditTrackInAnimationWindow.CreateTimeControlClipData(animationTrack));
                TimelineAnimationUtilities.EditAnimationClipWithTimeController(animationTrack.animClip, timeController, (!(bindingForTrack != null)) ? null : bindingForTrack.get_gameObject());
                result = true;
            }
            return(result);
        }
예제 #6
0
        public static bool Do(TrackAsset track)
        {
            AnimationClip clipToEdit = null;

            AnimationTrack animationTrack = track as AnimationTrack;

            if (animationTrack != null)
            {
                if (!animationTrack.CanConvertToClipMode())
                {
                    return(false);
                }

                clipToEdit = animationTrack.infiniteClip;
            }
            else if (track.hasCurves)
            {
                clipToEdit = track.curves;
            }

            if (clipToEdit == null)
            {
                return(false);
            }

            GameObject gameObject = null;

            if (TimelineEditor.inspectedDirector != null)
            {
                gameObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, track);
            }

            var timeController = TimelineAnimationUtilities.CreateTimeController(CreateTimeControlClipData(track));

            TimelineAnimationUtilities.EditAnimationClipWithTimeController(clipToEdit, timeController, gameObject);

            return(true);
        }
예제 #7
0
        public override bool Execute(IEnumerable <TimelineClip> clips)
        {
            TimelineClip  clip;
            AnimationClip clipToEdit;

            if (!GetEditableClip(clips, out clip, out clipToEdit))
            {
                return(false);
            }

            GameObject gameObject = null;

            if (TimelineEditor.inspectedDirector != null)
            {
                gameObject = TimelineUtility.GetSceneGameObject(TimelineEditor.inspectedDirector, clip.parentTrack);
            }

            var timeController = TimelineAnimationUtilities.CreateTimeController(clip);

            TimelineAnimationUtilities.EditAnimationClipWithTimeController(
                clipToEdit, timeController, clip.animationClip != null ? gameObject : null);

            return(true);
        }