Пример #1
0
        public void SetKeyFrames <T>(AbsoluteKeyFrameCollection <T> keyFrames)
        {
            Curves?.Destroy();
            KeyFrames?.Destroy();

            if (keyFrames == null)
            {
                Curves    = null;
                KeyFrames = null;
            }
            else
            {
                var t = new TimelineKeyFrames <T> {
                    KeyFrames = keyFrames
                };
                var curves = new CurveVisualObject {
                    Series = new TimelineCurveSeries <T> {
                        KeyFrames = keyFrames
                    }, IsSelectable = false
                }.Style(new Pen(Brushes.White, 1));

                t.SelectionChanged += (sender, e) =>
                {
                    if (e.OriginalSource is TimelineKeyFrame <T> tkf)
                    {
                        m_setting = true;
                        var kf = tkf.Selection.IsEmpty ? null : tkf.Focus < 1 ? tkf.KeyFrame : tkf.NextKeyFrame;
                        keyFramesEditor.Type   = kf == null ? null : typeof(AbsoluteKeyFrame <T>);
                        keyFramesEditor.Object = kf;
                        m_setting = false;
                    }
                };
                t.Changed += (sender, e) =>
                {
                    plane.RenderdWithoutCache(t);
                    plane.RenderdWithoutCache(curves);
                    UpdateCursorPoint(PropertiesAnimation.GeneralTime);
                };

                plane.Items.Insert(1, curves);
                plane.Items.Add(t);

                KeyFrames = t;
                Curves    = curves;
            }

            m_keyFrames = keyFrames;
            UpdateCursorPoint(PropertiesAnimation.GeneralTime);
        }
Пример #2
0
 internal static void NotifyDataRemoved(IAbsoluteKeyFrameCollection data) => DataRemoved?.Invoke(null, EventArgsHelper.Create(data));