static SynthesisGUI() { BXDSettings.Load(); object exportSettings = BXDSettings.Instance.GetSettingsObject("Exporter Settings"); object viewSettings = BXDSettings.Instance.GetSettingsObject("Viewer Settings"); ExporterSettings = (exportSettings != null) ? (ExporterSettingsForm.ExporterSettingsValues)exportSettings : ExporterSettingsForm.GetDefaultSettings(); ViewerSettings = (viewSettings != null) ? (ViewerSettingsForm.ViewerSettingsValues)viewSettings : ViewerSettingsForm.GetDefaultSettings(); }
public SynthesisGUI() { InitializeComponent(); Instance = this; robotViewer1.LoadSettings(ViewerSettings); bxdaEditorPane1.Units = ViewerSettings.modelUnits; RigidNode_Base.NODE_FACTORY = delegate(Guid guid) { return(new OGL_RigidNode(guid)); }; fileNew.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { SetNew(); }); fileLoad.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { LoadFromInventor(); }); fileOpen.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { OpenExisting(); }); fileSave.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { SaveRobot(false); }); fileSaveAs.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { SaveRobot(true); }); fileExit.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { Close(); }); settingsExporter.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { var defaultValues = BXDSettings.Instance.GetSettingsObject("Exporter Settings"); ExporterSettingsForm eSettingsForm = new ExporterSettingsForm((defaultValues != null) ? (ExporterSettingsForm.ExporterSettingsValues)defaultValues : ExporterSettingsForm.GetDefaultSettings()); eSettingsForm.ShowDialog(this); BXDSettings.Instance.AddSettingsObject("Exporter Settings", eSettingsForm.values); ExporterSettings = eSettingsForm.values; }); settingsViewer.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { var defaultValues = BXDSettings.Instance.GetSettingsObject("Viewer Settings"); ViewerSettingsForm vSettingsForm = new ViewerSettingsForm((defaultValues != null) ? (ViewerSettingsForm.ViewerSettingsValues)defaultValues : ViewerSettingsForm.GetDefaultSettings()); vSettingsForm.ShowDialog(this); BXDSettings.Instance.AddSettingsObject("Viewer Settings", vSettingsForm.values); ViewerSettings = vSettingsForm.values; robotViewer1.LoadSettings(ViewerSettings); bxdaEditorPane1.Units = ViewerSettings.modelUnits; }); helpAbout.Click += new System.EventHandler(delegate(object sender, System.EventArgs e) { AboutDialog about = new AboutDialog(); about.ShowDialog(this); }); this.FormClosing += new FormClosingEventHandler(delegate(object sender, FormClosingEventArgs e) { if (SkeletonBase != null && !WarnUnsaved()) { e.Cancel = true; } else { BXDSettings.Save(); } InventorManager.ReleaseInventor(); }); jointEditorPane1.ModifiedJoint += delegate(List <RigidNode_Base> nodes) { if (nodes == null || nodes.Count == 0) { return; } foreach (RigidNode_Base node in nodes) { if (node.GetSkeletalJoint() != null && node.GetSkeletalJoint().cDriver != null && node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>() != null && node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>().radius == 0 && node is OGL_RigidNode) { float radius, width; BXDVector3 center; (node as OGL_RigidNode).GetWheelInfo(out radius, out width, out center); WheelDriverMeta wheelDriver = node.GetSkeletalJoint().cDriver.GetInfo <WheelDriverMeta>(); wheelDriver.center = center; wheelDriver.radius = radius; wheelDriver.width = width; node.GetSkeletalJoint().cDriver.AddInfo(wheelDriver); } } }; jointEditorPane1.SelectedJoint += robotViewer1.SelectJoints; jointEditorPane1.SelectedJoint += bxdaEditorPane1.SelectJoints; robotViewer1.NodeSelected += jointEditorPane1.AddSelection; robotViewer1.NodeSelected += bxdaEditorPane1.AddSelection; bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) => { List <RigidNode_Base> nodes = new List <RigidNode_Base>(); SkeletonBase.ListAllNodes(nodes); jointEditorPane1.AddSelection(nodes[Meshes.IndexOf(mesh)], true); }; bxdaEditorPane1.NodeSelected += (BXDAMesh mesh) => { List <RigidNode_Base> nodes = new List <RigidNode_Base>(); SkeletonBase.ListAllNodes(nodes); robotViewer1.SelectJoints(nodes.GetRange(Meshes.IndexOf(mesh), 1)); }; }