public void CloseModel(Bin bin) { bin.Dispose(); loadedModels.Remove(bin); tvw_models.Nodes.Remove(tvw_models.Nodes.Cast<TreeNode>().First(node => node.Tag == bin)); if (tvw_models.Nodes.Count == 0) { tvw_models_AfterSelect(null, new TreeViewEventArgs(null)); } gl_frame.Invalidate(); SetTitle(); }
void LoadBINNode(TreeNodeCollection nodes, Bin bin, int index) { for (int childIndex = bin[index].ChildIndex; childIndex >= 0; childIndex = bin[childIndex].NextIndex) { TreeNode node = new TreeNode() { Checked = true, Text = String.Format("Object {0}", childIndex), Tag = bin[childIndex], }; if (bin[childIndex].ChildIndex >= 0) { LoadBINNode(node.Nodes, bin, bin[childIndex].ChildIndex); } nodes.Add(node); } }
public void LoadModel(string fileName, Vector3 pos, Vector3 rot, Vector3 scale) { if (fileName.EndsWith(".bin", StringComparison.InvariantCultureIgnoreCase)) { Bin bin = new Bin(fileName, pos, rot, scale); TreeNode binNode = new TreeNode() { Checked = true, Text = bin.Name, Tag = bin, }; LoadBINNode(binNode.Nodes, bin, 0); tvw_models.BeginUpdate(); tvw_models.Nodes.Add(binNode); tvw_models.EndUpdate(); gl_frame.Invalidate(); loadedModels.Add(bin); } SetTitle(); }