Esempio n. 1
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);
        }
        public static TimelineWindowTimeControl CreateTimeController(TimelineWindow.TimelineState state, TimelineWindowTimeControl.ClipData clipData)
        {
            AnimationWindow           window = EditorWindow.GetWindow <AnimationWindow>();
            TimelineWindowTimeControl timelineWindowTimeControl = ScriptableObject.CreateInstance <TimelineWindowTimeControl>();

            timelineWindowTimeControl.Init(state.GetWindow(), window.get_state(), clipData);
            return(timelineWindowTimeControl);
        }
Esempio n. 3
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);
        }
        public static void EditAnimationClipWithTimeController(AnimationClip animationClip, TimelineWindowTimeControl timeController, Object sourceObject)
        {
            var animationWindow = EditorWindow.GetWindow <AnimationWindow>();

            animationWindow.EditSequencerClip(animationClip, sourceObject, timeController);
        }