private void ShowMesh(TreeNode node, PrOD.Mesh mesh) { for (int i = 0; i < mesh.instancesCount; i++) { TreeNode meshInstance = new TreeNode("instance"); TreeNode position = new TreeNode("positon"); TreeNode x = new TreeNode(mesh.instances[i].position[0].ToString()); TreeNode y = new TreeNode(mesh.instances[i].position[1].ToString()); TreeNode z = new TreeNode(mesh.instances[i].position[2].ToString()); position.Nodes.Add(x); position.Nodes.Add(y); position.Nodes.Add(z); meshInstance.Nodes.Add(position); TreeNode rotation = new TreeNode("rotation"); x = new TreeNode(mesh.instances[i].rotation[0].ToString()); y = new TreeNode(mesh.instances[i].rotation[1].ToString()); z = new TreeNode(mesh.instances[i].rotation[2].ToString()); rotation.Nodes.Add(x); rotation.Nodes.Add(y); rotation.Nodes.Add(z); meshInstance.Nodes.Add(rotation); TreeNode ufScale = new TreeNode("uniformScale"); ufScale.Nodes.Add(new TreeNode(mesh.instances[i].uniformScale.ToString())); meshInstance.Nodes.Add(ufScale); node.Nodes.Add(meshInstance); } }
private void treeNodeToMesh(PrOD.Mesh mesh, TreeNode treeNode) { foreach (TreeNode node in treeNode.Nodes) { mesh.instances.Add(treeNodeToMeshInstance(node)); } }
private PrOD treeViewToPrOD() { List <string> names = new List <string>(); List <PrOD.Mesh> meshes = new List <PrOD.Mesh>(); //names foreach (TreeNode node in root.Nodes) { if (!names.Contains(node.Text)) { names.Add(node.Text); } } names.Sort(); //meshes foreach (TreeNode node in root.Nodes) { PrOD.Mesh mesh = new PrOD.Mesh(); mesh.name = node.Text; mesh.nameOffset = PrOD.getNameOffset(names, mesh.name); mesh.instancesCount = (uint)node.Nodes.Count; treeNodeToMesh(mesh, node); meshes.Add(mesh); } meshes.Sort(customCmp); PrOD prod = new PrOD(names, meshes); return(prod); }
private int customCmp(PrOD.Mesh m1, PrOD.Mesh m2) { if (m1.nameOffset > m2.nameOffset) { return(1); } else { return(-1); } }