Ejemplo n.º 1
0
        private void btn_AddObject_Click(object sender, EventArgs e)
        {
            frm_Add3dObject frm = null;

            //Fill up the step info cause they will be used by the Object3d Form.
            this.Step.setName(txtBx_Title.Text);
            this.Step.setDescription(txtBx_Description.Text);

            //If the step has already some 3d models we pass the number of the last one so the new model will take its place after it.
            if (this.Step.getObjectList() != null && this.Step.getObjectList().Count > 0)
            {
                frm = new frm_Add3dObject(this, this.Step, this.Step.getObjectList()[this.Step.getObjectList().Count - 1]);
            }
            else
            {
                frm = new frm_Add3dObject(this, this.Step, null);
            }

            //MessageBox.Show("Step.Name: "+Step.getName(),"frm_AddStep.btn_AddObject");

            frm.ShowDialog();



            if (frm.Tag != null)
            {
                lstVw_3dObjects.Items.Clear();
                RenderForm.Objects.Clear();
                this.Step.setObjectList(new List <Object3d>());
                RenderForm.Objects = (List <Object3d>)frm.Tag;

                //MessageBox.Show("Render.Objects.count: " + RenderForm.Objects.Count, "frm_AddStep.btn_AddObject");
                foreach (Object3d obj in RenderForm.Objects)
                {
                    //MessageBox.Show("frm_AddStep.btn_AddObject.Obj.name:\n" + obj.getName().ToString());
                    //MessageBox.Show("REnder.Objects.count: " + RenderForm.Objects.Count, "frm_AddStep.btn_AddObject");
                    //this.Step.addObject3d(obj);
                    //Fill the list view with the RenderForm.Objects data.
                    ListViewItem item = new ListViewItem(new string[] { obj.getId().ToString(), obj.getNb().ToString(), Path.GetFileNameWithoutExtension(obj.getName()), obj.getObjType(),
                                                                        VectorToString(obj.getPosition(), false), VectorToString(obj.getRotation(), true), VectorToString(obj.getScale(), false) });
                    lstVw_3dObjects.Items.Add(item);

                    this.Step.addObject3d(obj);
                }
            }
            //else
            //    MessageBox.Show("frm_AddStep.btn_AddObject: " + "Tag is null");
        }
Ejemplo n.º 2
0
        private void btn_AddObject_Click(object sender, EventArgs e)
        {
            frm_Add3dObject frm = null;
            //Fill up the step info cause they will be used by the Object3d Form.
            this.Step.setName(txtBx_Title.Text);
            this.Step.setDescription(txtBx_Description.Text);

            //If the step has already some 3d models we pass the number of the last one so the new model will take its place after it.
            if (this.Step.getObjectList() != null && this.Step.getObjectList().Count > 0)
                frm = new frm_Add3dObject(this, this.Step, this.Step.getObjectList()[this.Step.getObjectList().Count - 1]);
            else
                frm = new frm_Add3dObject(this, this.Step, null);

            //MessageBox.Show("Step.Name: "+Step.getName(),"frm_AddStep.btn_AddObject");

            frm.ShowDialog();
            if (frm.Tag != null)
            {
                lstVw_3dObjects.Items.Clear();
                RenderForm.Objects.Clear();
                this.Step.setObjectList(new List<Object3d>());

                RenderForm.Objects = (List<Object3d>)frm.Tag;
                //MessageBox.Show("Render.Objects.count: " + RenderForm.Objects.Count, "frm_AddStep.btn_AddObject");
                foreach (Object3d obj in RenderForm.Objects)
                {
                    //MessageBox.Show("frm_AddStep.btn_AddObject.Obj.name:\n" + obj.getName().ToString());
                    //MessageBox.Show("REnder.Objects.count: " + RenderForm.Objects.Count, "frm_AddStep.btn_AddObject");
                    //this.Step.addObject3d(obj);
                    //Fill the list view with the RenderForm.Objects data.
                    ListViewItem item = new ListViewItem(new string[] { obj.getId().ToString(),obj.getNb().ToString(), Path.GetFileNameWithoutExtension(obj.getName()), obj.getObjType(),
                    VectorToString(obj.getPosition()), VectorToString(obj.getRotation()), VectorToString(obj.getScale()) });
                    lstVw_3dObjects.Items.Add(item);

                    this.Step.addObject3d(obj);

                }
            }
            //else
            //    MessageBox.Show("frm_AddStep.btn_AddObject: " + "Tag is null");
        }