public void ImportTexture() { if (Program.OpenFile(FileFilters.Images, out string path)) { if (path.EndsWith(".tplt", StringComparison.OrdinalIgnoreCase) || !path.Contains(".")) { TPLTextureNode t = new TPLTextureNode { Name = "Texture" }; _resource.AddChild(t); t.Replace(path); BaseWrapper w = FindResource(t, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } else { using (TextureConverterDialog dlg = new TextureConverterDialog()) { dlg.ImageSource = path; if (dlg.ShowDialog(MainForm.Instance, Resource as TPLNode) == DialogResult.OK) { BaseWrapper w = FindResource(dlg.TPLTextureNode, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } } } } }
public void ImportTexture() { string path; int index = Program.OpenFile(FileFilters.Images, out path); if (index == 8) { TPLTextureNode t = new TPLTextureNode() { Name = "Texture" }; _resource.AddChild(t); t.Replace(path); BaseWrapper w = this.FindResource(t, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } else if (index > 0) { using (TextureConverterDialog dlg = new TextureConverterDialog()) { dlg.ImageSource = path; if (dlg.ShowDialog(MainForm.Instance, Resource as TPLNode) == DialogResult.OK) { BaseWrapper w = this.FindResource(dlg.TPLTextureNode, true); w.EnsureVisible(); w.TreeView.SelectedNode = w; } } } }
public override void OnPopulate() { VoidPtr p; for (int i = 0; i < Header->_numEntries; i++) { if ((p = Header->GetTextureEntry(i)) != null) { TPLTextureNode t = new TPLTextureNode() { _dataAddr = (VoidPtr)Header + ((TPLTextureHeader *)p)->_data }; t.Initialize(this, p, 0); if ((p = Header->GetPaletteEntry(i)) != null) { new TPLPaletteNode() { _dataAddr = (VoidPtr)Header + ((TPLPaletteHeader *)p)->_data } }