BlockBenchModel - Update Texture class to implictly convert to an image

This commit is contained in:
miku-666
2024-05-29 18:13:21 +02:00
parent 8fd5a7b48e
commit 7486f4cc02
2 changed files with 3 additions and 2 deletions

View File

@@ -138,6 +138,7 @@ namespace PckStudio.External.Format
internal class Texture
{
public static implicit operator Texture(Image image) => new Texture(image);
public static implicit operator Image(Texture texture) => texture.GetImage();
private Texture() { }
@@ -154,7 +155,7 @@ namespace PckStudio.External.Format
[JsonProperty("source")]
internal string TextureSource;
internal Image GetTexture()
private Image GetImage()
{
string data = TextureSource;
const string dataHead = "data:image/png;base64,";

View File

@@ -124,7 +124,7 @@ namespace PckStudio.Internal
if (blockBenchModel.Textures.IndexInRange(0))
{
modelInfo.Texture = blockBenchModel.Textures[0].GetTexture();
modelInfo.Texture = blockBenchModel.Textures[0];
modelInfo.ANIM.SetFlag(SkinAnimFlag.RESOLUTION_64x64, modelInfo.Texture.Size.Width == modelInfo.Texture.Size.Height);
}