示例#1
0
        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);
        }
示例#2
0
            public TplTextureWrapper(TPL tpl, TPL_IO.TPLImageHeader header)
            {
                TPLParent   = tpl;
                ImageHeader = header;

                CanReplace = true;
            }
示例#3
0
            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);
            }
示例#4
0
 public TplTextureWrapper(TPL tpl)
 {
     TPLParent = tpl;
 }