示例#1
0
        public TLEditorString(List <TLBaseKeyFrame> Keys) : base(Keys)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //check if all keyframes have the same time/value
            double         time = FKeyFrames[0].Time;
            string         text = (FKeyFrames[0] as TLStringKeyFrame).Value;
            TLBaseKeyFrame kf   = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time != time); });

            if (kf == null)
            {
                TimeBox.Value = time;
            }

            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLStringKeyFrame).Value != text); });
            if (kf == null)
            {
                ValueBox.Text = text;
            }

            FStartValue = ValueBox.Text;

            Height = TimeBox.Height + ValueBox.Height + 1;

            //make the valuebox have the focus
            ValueBox.SelectAll();

            this.ActiveControl = ValueBox;
        }
示例#2
0
        public TLEditorValue(List <TLBaseKeyFrame> Keys) : base(Keys)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            ValueBox.Minimum = double.MinValue;
            ValueBox.Maximum = double.MaxValue;

            //check if all keyframes have the same time/value
            double         time = FKeyFrames[0].Time;
            double         val  = (FKeyFrames[0] as TLValueKeyFrame).Value;
            TLBaseKeyFrame kf   = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time != time); });

            if (kf == null)
            {
                TimeBox.Value = time;
            }

            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLValueKeyFrame).Value != val); });
            if (kf == null)
            {
                ValueBox.Value = val;
            }

            FStartValue = val;

            Height             = TimeBox.Height + ValueBox.Height + 1;
            this.ActiveControl = ValueBox;
            ValueBox.ShowValueBox();
        }
示例#3
0
        public TLEditorColor(List <TLBaseKeyFrame> Keys) : base(Keys)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //check if all keyframes have the same time/value
            //if they have the same value, show that value, if not leave it blank
            double         time = FKeyFrames[0].Time;
            TLBaseKeyFrame kf   = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time != time); });

            if (kf == null)
            {
                TimeBox.Value = time;
            }

            RGBAColor rgba = (FKeyFrames[0] as TLColorKeyFrame).RGBAColor;

            VColor.RGBtoHSV(rgba.R, rgba.G, rgba.B, out FOldH, out FOldS, out FOldV);
            FOldA = rgba.A;

            /*
             * FOldH = (FKeyFrames[0] as TLColorKeyFrame).Color.GetHue();
             * FOldS = (FKeyFrames[0] as TLColorKeyFrame).Color.GetSaturation();
             * FOldL = (FKeyFrames[0] as TLColorKeyFrame).Color.GetBrightness();
             * FOldA = (FKeyFrames[0] as TLColorKeyFrame).Color.A;
             */

            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLColorKeyFrame).Hue != FOldH); });
            if (kf == null)
            {
                HueBox.Value = FOldH;
            }
            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLColorKeyFrame).Saturation != FOldS); });
            if (kf == null)
            {
                SatBox.Value = FOldS;
            }
            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLColorKeyFrame).Value != FOldV); });
            if (kf == null)
            {
                LumBox.Value = FOldV;
            }
            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLColorKeyFrame).Alpha != FOldA); });
            if (kf == null)
            {
                AlphaBox.Value = FOldA;
            }

            Height = TimeBox.Height + HueBox.Height + SatBox.Height + LumBox.Height + AlphaBox.Height + 4;

            this.ActiveControl = LumBox;
        }
示例#4
0
        public TLEditorState(List <TLBaseKeyFrame> Keys) : base(Keys)
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //check if all keyframes have the same time/value
            double time        = FKeyFrames[0].Time;
            string name        = (FKeyFrames[0] as TLStateKeyFrame).Name;
            string onEndAction = (FKeyFrames[0] as TLStateKeyFrame).Events[0].Action.ToString();

            TLBaseKeyFrame kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time != time); });

            if (kf == null)
            {
                TimeBox.Value = time;
            }

            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLStateKeyFrame).Name != name); });
            if (kf == null)
            {
                NameBox.Text = name;
            }
            FStartName = NameBox.Text;


            string events = "";

            for (int i = 1; i < (FKeyFrames[0] as TLStateKeyFrame).Events.Count; i++)
            {
                events += (FKeyFrames[0] as TLStateKeyFrame).Events[i].ToString();
            }

            events         = events.Replace(";", "\r\n");
            events         = events.Trim();
            EventsBox.Text = events;


            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLStateKeyFrame).Events[0].Action.ToString() != onEndAction); });
            if (kf == null)
            {
                EndActionBox.Text = onEndAction;
            }

            FStartEvents = (FKeyFrames[0] as TLStateKeyFrame).EventsAsString;

            Height = TimeBox.Height + NameBox.Height + label3.Height + EventsBox.Height + EndActionBox.Height + 4;

            //make the valuebox have the focus
            EndActionBox.SelectAll();

            this.ActiveControl = EndActionBox;
        }
示例#5
0
        public override void Evaluate(double CurrentTime)
        {
            base.Evaluate(CurrentTime);

            TLBaseKeyFrame kf = FKeyFrames.FindLast(delegate(TLBaseKeyFrame k) { return(k.Time <= CurrentTime); });

            if (kf == null)
            {
                FOutput = "";
            }
            else
            {
                FOutput = (kf as TLStringKeyFrame).Value;
            }

            OutputAsString = FOutput;
        }
示例#6
0
        public override void Evaluate(double CurrentTime)
        {
            base.Evaluate(CurrentTime);
            double         t;
            TLBaseKeyFrame kf  = FKeyFrames.FindLast(delegate(TLBaseKeyFrame k) { return(k.Time <= CurrentTime); });
            TLBaseKeyFrame kf1 = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time >= CurrentTime); });

            if (kf == null && kf1 == null)
            {
                FOutput = 0;
            }
            else if (kf == null)
            {
                FOutput = (kf1 as TLValueKeyFrame).Value;
            }
            else if (kf1 == null)
            {
                FOutput = (kf as TLValueKeyFrame).Value;
            }
            else
            {
                if ((kf as TLValueKeyFrame).OutType == TLInterpolationType.Step)
                {
                    FOutput = (kf as TLValueKeyFrame).Value;
                }
                else if ((kf as TLValueKeyFrame).OutType == TLInterpolationType.Linear)
                {
                    // LINEAR INTERPOLATION
                    t       = VMath.Map(CurrentTime, kf.Time, kf1.Time, 0, 1, TMapMode.Float);
                    FOutput = VMath.Lerp((kf as TLValueKeyFrame).Value, (kf1 as TLValueKeyFrame).Value, t);
                }
                else if ((kf as TLValueKeyFrame).OutType == TLInterpolationType.Cubic)
                {
                    // CUBIC INTERPOLATION
                    t       = VMath.Map(CurrentTime, kf.Time, kf1.Time, 0, 1, TMapMode.Float);
                    FOutput = VMath.SolveCubic(t, (kf as TLValueKeyFrame).Value, (kf as TLValueKeyFrame).Value, (kf1 as TLValueKeyFrame).Value, (kf1 as TLValueKeyFrame).Value);
                }
                //spline here
            }

            OutputAsString = FOutput.ToString("f4", TimelinerPlugin.GNumberFormat);
        }
示例#7
0
        private void UpdateInvalidKeyFrames(double From, double To)
        {
            //find all kfs within the clipping region
            FInvalidKeyFrames = FKeyFrames.FindAll(delegate(TLBaseKeyFrame k) { return((k.Time >= From) && (k.Time <= To)); });

            //+ find the first ones left and right out of the region
            TLBaseKeyFrame kf = null;

            kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time > To); });
            if (kf != null)
            {
                FInvalidKeyFrames.Add(kf);
            }
            kf = FKeyFrames.FindLast(delegate(TLBaseKeyFrame k) { return(k.Time < From); });
            if (kf != null)
            {
                FInvalidKeyFrames.Add(kf);
            }

            FInvalidKeyFrames.Sort(delegate(TLBaseKeyFrame k0, TLBaseKeyFrame k1) { return(k0.Time.CompareTo(k1.Time)); });
        }
示例#8
0
        public TLBaseKeyFrame AddKeyFrame(Point P)
        {
            TLBaseKeyFrame k = null;

            if (AllInOne.Checked)             //create a keyframe for every slice
            {
                foreach (TLSlice s in FOutputSlices)
                {
                    k = s.AddKeyFrame(P);
                    s.SaveKeyFrames();
                }
            }
            else                //create a keyframe in the correct slice
            {
                int   y           = P.Y - Top;
                float sliceheight = Height / FOutputSlices.Count;
                int   sliceidx    = (int)(y / sliceheight);

                k = FOutputSlices[sliceidx].AddKeyFrame(P);
                FOutputSlices[sliceidx].SaveKeyFrames();
            }

            return(k);
        }