private void addMesh(Mesh mesh, TreeNode parent) { TreeNode node = new TreeNode(mesh.Name); node.ImageKey = "mesh"; node.SelectedImageKey = "mesh"; node.Tag = mesh; if (parent == null) this.Nodes.Add(node); else parent.Nodes.Add(node); //Add children foreach (Node child in mesh.Children) { if (child is Mesh) addMesh((Mesh)child, node); } }
/// <summary> /// Determines if a given Mesh is assigned to a Bone /// </summary> /// <param name="mesh">The Mesh to check</param> /// <param name="start">The SceneGraph Node to begin searching</param> /// <returns>Whether or not the Mesh is assigned to a Bone</returns> public bool IsMeshAssigned(Mesh mesh, List<Node> start) { bool assigned = false; foreach (Node node in start) { if (node is Bone) { Bone bone = (Bone)node; foreach (Mesh assignedMesh in bone.Meshes) { if (assignedMesh == mesh) { assigned = true; break; } } if (!assigned) { assigned = IsMeshAssigned(mesh, bone.Children); } } } return assigned; }