private void button1_Click(object sender, EventArgs e)
        {
            if (cmbImage.SelectedIndex < 0)
            {
                MessageBox.Show("Cannot proceed without a selected Object!");
                return;
            }

            short StartFrame = (short)numStartFrame.Value;
            short EndFrame   = (short)numEndFrame.Value;
            float t          = 0;
            int   ImageIndex;

            if (prtEquations.SelectedObject is ParametricImage)
            {
                ImageIndex = cmbImage.SelectedIndex;
            }
            else
            {
                ImageIndex = int.Parse(cmbImage.Text.Split(' ')[1]);
            }

            for (short frame = StartFrame; frame <= EndFrame; frame++)
            {
                if (activeAnimation.getFrameOnTime(frame, false).Time < frame)
                {
                    activeAnimation.AddKeyFrame(frame);
                }

                t = ((float)(frame - StartFrame)) / (EndFrame - StartFrame);
                try
                {
                    if (prtEquations.SelectedObject is ParametricImage)
                    {
                        ((ParametricImage)prtEquations.SelectedObject).ApplyToImage(activeAnimation.getFrameOnTime(frame, false).Element.Images[ImageIndex], t);
                    }
                    else
                    {
                        ((ParametricIcon)prtEquations.SelectedObject).ApplyToIcon(activeAnimation.getFrameOnTime(frame, false).Element.Icons[ImageIndex], t);
                    }
                }
                catch (Exception exp)
                {
                    MessageBox.Show("Problem with calculation on frame " + frame.ToString() + ": " + exp.Message);
                }
            }

            tmlTimeLine.Refresh();
        }
Exemple #2
0
        private void timeLine1_KeyFrameAdded(DPOW.Reader.Animation animation, int Time)
        {
            animation.AddKeyFrame((short)Time);

            trcFrameBar.Maximum = dpow.getAnimation(treObjects.SelectedNode.Text).MaxTime;
        }