private void AddDefinitionButton_Click(object sender, System.EventArgs e) { ListWindow window = new ListWindow(); window.PopulateForm(actors.Items); if (window.ShowDialog() == DialogResult.OK) { ActorDefinition definition = actors.CreateActorDefinition((window.chosenObject as ActorEntry)); TreeNode node = new TreeNode(definition.Name); node.Name = definition.FrameNameHash.ToString(); node.Tag = definition; definitions.Nodes.Add(node); } }
private void ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (treeView1.SelectedNode == null) { return; } if (e.ClickedItem.Name == "contextExtract3D") { FrameObjectSingleMesh mesh = treeView1.SelectedNode.Tag as FrameObjectSingleMesh; FrameGeometry geom = SceneData.FrameResource.FrameGeometries[mesh.Refs["Mesh"]]; FrameMaterial mat = SceneData.FrameResource.FrameMaterials[mesh.Refs["Material"]]; IndexBuffer[] indexBuffers = new IndexBuffer[geom.LOD.Length]; VertexBuffer[] vertexBuffers = new VertexBuffer[geom.LOD.Length]; //we need to retrieve buffers first. for (int c = 0; c != geom.LOD.Length; c++) { indexBuffers[c] = SceneData.IndexBufferPool.GetBuffer(geom.LOD[c].IndexBufferRef.uHash); vertexBuffers[c] = SceneData.VertexBufferPool.GetBuffer(geom.LOD[c].VertexBufferRef.uHash); } Model newModel = new Model(mesh, indexBuffers, vertexBuffers, geom, mat); newModel.ModelStructure.ExportToM2T(ToolkitSettings.ExportPath + "\\"); switch (ToolkitSettings.Format) { case 0: newModel.ModelStructure.ExportToFbx(ToolkitSettings.ExportPath + "\\", false); break; case 1: newModel.ModelStructure.ExportToFbx(ToolkitSettings.ExportPath + "\\", true); break; case 2: newModel.ModelStructure.ExportToM2T(ToolkitSettings.ExportPath + "\\"); break; default: Log.WriteLine("Error! Unknown value set for ToolkitSettings.Format!", LoggingTypes.ERROR); break; } } else if (e.ClickedItem.Name == "contextUpdateParents") { FrameObjectBase obj = treeView1.SelectedNode.Tag as FrameObjectBase; ListWindow window = new ListWindow(); window.PopulateForm(true); window.ShowDialog(); if (window.type == -1) { return; } int refID = (window.chosenObject as FrameEntry).RefID; obj.IsOnFrameTable = true; obj.ParentIndex2.Index = window.chosenObjectIndex; obj.ParentIndex2.RefID = refID; obj.SubRef(FrameEntryRefTypes.Parent2); obj.AddRef(FrameEntryRefTypes.Parent2, refID); obj.UpdateNode(); treeView1.Nodes.Remove(treeView1.SelectedNode); TreeNode newNode = CreateTreeNode(obj); treeView1.Nodes[window.chosenObjectIndex].Nodes.Add(newNode); } }