2019-07-11 21:22:59 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
2019-07-16 21:35:21 +00:00
|
|
|
|
using Toolbox.Library;
|
|
|
|
|
using Toolbox.Library.IO;
|
|
|
|
|
using Toolbox.Library.Forms;
|
2019-07-11 21:22:59 +00:00
|
|
|
|
using SuperBMDLib;
|
|
|
|
|
|
|
|
|
|
namespace FirstPlugin
|
|
|
|
|
{
|
|
|
|
|
public class BMDTextureWrapper : STGenericTexture
|
|
|
|
|
{
|
|
|
|
|
public override bool CanEdit { get; set; } = false;
|
|
|
|
|
|
2019-07-11 21:29:44 +00:00
|
|
|
|
public override TEX_FORMAT[] SupportedFormats
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return new TEX_FORMAT[]
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-11 21:22:59 +00:00
|
|
|
|
|
|
|
|
|
SuperBMDLib.Materials.BinaryTextureImage TextureImage;
|
|
|
|
|
|
|
|
|
|
public BMDTextureWrapper(SuperBMDLib.Materials.BinaryTextureImage Image)
|
|
|
|
|
{
|
|
|
|
|
TextureImage = Image;
|
|
|
|
|
|
|
|
|
|
Text = TextureImage.Name;
|
|
|
|
|
|
2019-07-16 20:54:46 +00:00
|
|
|
|
Format = Decode_Gamecube.ToGenericFormat((Decode_Gamecube.TextureFormats)Image.Format);
|
|
|
|
|
PaletteFormat = Decode_Gamecube.ToGenericPaletteFormat((Decode_Gamecube.PaletteFormats)Image.PaletteFormat);
|
|
|
|
|
PlatformSwizzle = PlatformSwizzle.Platform_Gamecube;
|
|
|
|
|
|
2019-07-11 21:22:59 +00:00
|
|
|
|
Width = TextureImage.Width;
|
|
|
|
|
Height = TextureImage.Height;
|
|
|
|
|
MipCount = TextureImage.MipMapCount;
|
|
|
|
|
|
|
|
|
|
ImageKey = "texture";
|
|
|
|
|
SelectedImageKey = ImageKey;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnClick(TreeView treeview)
|
|
|
|
|
{
|
|
|
|
|
ImageEditorBase editor = (ImageEditorBase)LibraryGUI.GetActiveContent(typeof(ImageEditorBase));
|
|
|
|
|
if (editor == null)
|
|
|
|
|
{
|
|
|
|
|
editor = new ImageEditorBase();
|
|
|
|
|
editor.Dock = DockStyle.Fill;
|
|
|
|
|
LibraryGUI.LoadEditor(editor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
editor.Text = Text;
|
|
|
|
|
editor.LoadProperties(TextureImage);
|
2019-07-12 00:23:47 +00:00
|
|
|
|
editor.LoadImage(this);
|
2019-07-11 21:22:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-16 20:54:46 +00:00
|
|
|
|
public override byte[] GetPaletteData()
|
|
|
|
|
{
|
|
|
|
|
return TextureImage.PaletteData;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-11 21:22:59 +00:00
|
|
|
|
public override byte[] GetImageData(int ArrayLevel = 0, int MipLevel = 0)
|
|
|
|
|
{
|
2019-07-16 20:54:46 +00:00
|
|
|
|
return TextureImage.ImageData;
|
2019-07-11 21:22:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetImageData(Bitmap bitmap, int ArrayLevel)
|
|
|
|
|
{
|
|
|
|
|
TextureImage.EncodeData();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|