public static TPL CreateNewFromImage() { OpenFileDialog ofd = new OpenFileDialog(); ofd.Multiselect = false; ofd.Filter = FileFilters.REV_TEX; if (ofd.ShowDialog() != DialogResult.OK) { return(null); } TPL tpl = new TPL(); tpl.IFileInfo = new IFileInfo(); tpl.FileName = Path.GetFileNameWithoutExtension(ofd.FileName) + ".tpl"; tpl.Header = new TPL_IO.Header(); var image = TplTextureWrapper.Create(tpl, tpl.Header, ofd.FileName); if (image == null) //Operation cancelled { return(null); } tpl.Nodes.Add(image); return(tpl); }
public TplTextureWrapper(TPL tpl, TPL_IO.TPLImageHeader header) { TPLParent = tpl; ImageHeader = header; CanReplace = true; }
public static TplTextureWrapper Create(TPL tpl, TPL_IO.Header header, string FileName) { TplTextureWrapper tex = new TplTextureWrapper(tpl); tex.Replace(FileName); if (tex.ImageData == null) //Dialog cancelled if image data not set { return(null); } tex.ImageHeader.Width = (ushort)tex.Width; tex.ImageHeader.Height = (ushort)tex.Height; tex.ImageHeader.Format = Decode_Gamecube.FromGenericFormat(tex.Format); tex.ImageHeader.MaxLOD = (byte)tex.MipCount; header.Images.Add(new TPL_IO.ImageEntry() { Header = tex.ImageHeader, ImageData = tex.ImageData, PaletteHeader = tex.PaletteHeader, }); return(tex); }
public TplTextureWrapper(TPL tpl) { TPLParent = tpl; }