private MeshListTreeNode createTIMNode(string name, TIMDocument timDoc) { return(new MeshListTreeNode(name, new List <IRenderable> { timDoc.TextureMesh }, contextMenu: new ContextMenu( new Dictionary <string, Action> { { "Export as TIM", () => { _exportController.OpenDialog( filePath => { _exportController.ExportOriginal(timDoc.Document, filePath); }, ".tim"); } }, { "Export as PNG", () => { _exportController.OpenDialog( filePath => { _exportController.ExportImage(timDoc.Document, filePath, ImageFormat.Png); }, ".png"); } } }))); }
protected MeshListTreeNode createTIMNode(string name, TIMDocument timDoc) { MeshListTreeNode rootNode = new MeshListTreeNode(name, new List <IRenderable> { timDoc.TextureMeshes[0] }, contextMenu: new ContextMenu( new Dictionary <string, Action> { { "Export as TIM", () => { _exportController.OpenDialog( filePath => { _exportController.ExportOriginal(timDoc.Document, filePath); }, ".tim"); } }, { "Export as PNG", () => { _exportController.OpenDialog( filePath => { _exportController.ExportImage(timDoc.Document, 0, filePath, ImageFormat.Png); }, ".png"); } } })); int i = 0; foreach (var mesh in timDoc.TextureMeshes) { int clutIndex = i; MeshListTreeNode clutNode = new MeshListTreeNode($"CLUT {clutIndex}", new List <IRenderable> { mesh }, contextMenu: new ContextMenu( new Dictionary <string, Action> { { "Export as PNG", () => { _exportController.OpenDialog( filePath => { _exportController.ExportImage(timDoc.Document, clutIndex, filePath, ImageFormat.Png); }, ".png"); } } })); i++; rootNode.AddNode(clutNode); } return(rootNode); }
public void LoadTIM(string timPath) { Logger.Log()(LogLevel.INFO, $"Loading TIM from: {timPath}"); TIM tim; using (BinaryReader br = new BinaryReader(File.Open(timPath, FileMode.Open))) { tim = new TIM(br); } Logger.Log()(LogLevel.INFO, $"Successfully loaded TIM"); TIMDocument document = CreateDocument(tim); _treeController.PopulateTreeWithDocument(document, Path.GetFileName(timPath)); }