Beispiel #1
0
        public static TSOConfig Load(string source_file)
        {
            XmlReader     reader     = XmlReader.Create(source_file);
            XmlSerializer serializer = new XmlSerializer(typeof(TSOConfig));
            TSOConfig     config     = serializer.Deserialize(reader) as TSOConfig;

            reader.Close();
            return(config);
        }
Beispiel #2
0
        public Form1(TSOConfig tso_config, string[] args)
        {
            InitializeComponent();
            this.ClientSize = tso_config.ClientSize;

            this.viewer        = new WeightViewer();
            viewer.ScreenColor = tso_config.ScreenColor;

            this.slider_form     = new SliderForm(this);
            slider_form.TopLevel = false;
            slider_form.Location = new System.Drawing.Point(0, 26 + 160);
            this.Controls.Add(slider_form);
            slider_form.BringToFront();
            slider_form.viewer = this.viewer;

            if (viewer.InitializeApplication(this))
            {
                viewer.FigureEvent += delegate(object sender, EventArgs e)
                {
                    Figure fig;
                    if (viewer.TryGetFigure(out fig))
                    {
                        slider_form.SetFigure(fig);
                        AssignTSOFiles(fig);
                        viewer.NeedSkindeform = true;
                    }
                    else
                    {
                        slider_form.Clear();
                        viewer.SelectedMesh = null;
                        viewer.ClearCommands();
                    }
                };
                viewer.SelectedNodeChanged += delegate(object sender, EventArgs e)
                {
                    Console.WriteLine("select node {0}", viewer.SelectedNode.Name);
                };
                viewer.SelectedVertexChanged += delegate(object sender, EventArgs e)
                {
                    AssignSkinWeights(viewer.SelectedVertex);
                };
                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, +10.0f, +44.0f);

                //this.timer1.Enabled = true;
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));

            TSOConfig tso_config;

            string tso_config_file = Path.Combine(Application.StartupPath, @"config.xml");

            if (File.Exists(tso_config_file))
            {
                tso_config = TSOConfig.Load(tso_config_file);
            }
            else
            {
                tso_config = new TSOConfig();
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (Form1 form1 = new Form1(tso_config, args))
                using (Form2 form2 = new Form2())
                {
                    form2.TopLevel = false;
                    form2.Location = new System.Drawing.Point(0, 26);
                    form1.Controls.Add(form2);
                    form2.BringToFront();
                    form2.viewer         = form1.viewer;
                    form2.RotationEvent += delegate(object sender, EventArgs e)
                    {
                        form1.Invalidate(false);
                    };

                    form1.Show();
                    form2.Show();
                    form1.slider_form.Show();

                    Application.Run(form1);
                }
        }