Ejemplo n.º 1
0
        public Form1(TSOConfig tso_config, string[] args)
        {
            InitializeComponent();
            this.ClientSize = tso_config.ClientSize;
            viewer          = new Viewer();
            morphing        = new Morphing();

            if (viewer.InitializeApplication(this))
            {
                viewer.FigureEvent += delegate(object sender, EventArgs e)
                {
                    Morph();
                };
                foreach (string arg in args)
                {
                    viewer.LoadAnyFile(arg, true);
                }
                if (viewer.FigureList.Count == 0)
                {
                    viewer.LoadAnyFile(Path.Combine(save_path, "system.tdcgsav.png"), true);
                }
                viewer.Camera.SetTranslation(0.0f, +18.0f, +10.0f);

                timer1.Enabled = true;
            }

            morphing.Load(morphing_path);

            for (int i = 0; i < morphing.Groups.Count; i++)
            {
                MorphGroup group = morphing.Groups[i];

                MorphSlider slider = new MorphSlider();
                slider.Tag       = group;
                slider.GroupName = group.Name;

                List <string> names = new List <string>();
                foreach (Morph morph in group.Items)
                {
                    names.Add(morph.Name);
                }
                slider.SetMorphNames(names);

                slider.Location      = new System.Drawing.Point(10, 10 + i * 95);
                slider.ValueChanged += new System.EventHandler(this.slider_ValueChanged);
                this.Controls.Add(slider);
            }
        }
Ejemplo n.º 2
0
        private void slider_ValueChanged(object sender, EventArgs e)
        {
            MorphSlider slider = sender as MorphSlider;

            {
                MorphGroup group = slider.Tag as MorphGroup;
                //group.ClearRatios();
                Morph morph = group.FindItemByName(slider.MorphName);
                if (morph != null)
                {
                    morph.Ratio = slider.Ratio;
                }
            }

            Morph();
        }