Exemplo n.º 1
0
        private void PreviewAnimationEvent(FAnimationEventEditor animEvtEditor, int frame)
        {
            FPlayAnimationEvent animEvt = (FPlayAnimationEvent)animEvtEditor._evt;

            if (animEvt._animationClip == null)
            {
                return;
            }

            bool isEditable = animEvt.IsAnimationEditable();

            // render path
            if (isEditable)
            {
                TransformCurves transformCurves = new TransformCurves(animEvt.Owner, animEvt._animationClip);

                RenderTransformPath(transformCurves, animEvt.LengthTime, 1f / animEvt.Sequence.FrameRate);

                float t = (float)(frame + animEvt._startOffset - animEvt.Start) / animEvt.Sequence.FrameRate;

                if (animEvt.FrameRange.Contains(frame))
                {
//					float t = (float)(frame + animEvt._startOffset - animEvt.Start) / animEvt.Sequence.FrameRate;
                    RenderTransformAnimation(transformCurves, t);
                }

//				AnimationClipCurveData[] allCurves = AnimationUtility.GetAllCurves( animEvt._animationClip, true );
//				foreach( AnimationClipCurveData curve in allCurves )
//				{
//
//				}
            }
            else if (animEvt.FrameRange.Contains(frame))
            {
                float t = (float)(frame + animEvt._startOffset - animEvt.Start) / animEvt.Sequence.FrameRate;

                bool wasInAnimationMode = AnimationMode.InAnimationMode();

                if (!AnimationMode.InAnimationMode())
                {
                    AnimationMode.StartAnimationMode();
                }
                AnimationMode.BeginSampling();
                AnimationMode.SampleAnimationClip(animEvt.Owner.gameObject, animEvt._animationClip, t);
                AnimationMode.EndSampling();

                if (!wasInAnimationMode)
                {
                    AnimationMode.StopAnimationMode();
                }
            }
        }
Exemplo n.º 2
0
        void OnSceneGUI(SceneView sceneView)
        {
            if (_track == null)
            {
                return;
            }

            for (int i = 0; i != _eventEditors.Count; ++i)
            {
                FAnimationEventEditor animEvtEditor = (FAnimationEventEditor)_eventEditors[i];
                FPlayAnimationEvent   animEvt       = (FPlayAnimationEvent)_eventEditors[i]._evt;
                if (animEvt._animationClip != null && animEvt.IsAnimationEditable() && _track.IsPreviewing)
                {
                    animEvtEditor.RenderTransformCurves(animEvt.Sequence.FrameRate);
                }
            }
        }