CustomSkinEditor - Fix block bench model import that has no texture attached

This commit is contained in:
miku-666
2024-04-07 10:32:20 +02:00
parent 1ecf2b99fb
commit be44713be2

View File

@@ -229,6 +229,10 @@ namespace PckStudio.Forms.Editor
BlockBenchModel blockBenchModel = JsonConvert.DeserializeObject<BlockBenchModel>(File.ReadAllText(openFileDialog.FileName));
_skin.AdditionalBoxes.Clear();
_skin.PartOffsets.Clear();
if (blockBenchModel.Textures.IndexInRange(0))
_skin.Texture = blockBenchModel.Textures[0].GetTexture();
// TODO: clean this up -miku
_skin.ANIM.SetFlag(SkinAnimFlag.RESOLUTION_64x64, true);
_skin.ANIM.SetFlag(SkinAnimFlag.SLIM_MODEL, false);
@@ -245,7 +249,6 @@ namespace PckStudio.Forms.Editor
_skin.ANIM.SetFlag(SkinAnimFlag.LEFT_LEG_DISABLED, true);
_skin.ANIM.SetFlag(SkinAnimFlag.LEFT_LEG_OVERLAY_DISABLED, true);
foreach (Outline outline in blockBenchModel.Outliner)
{
string type = outline.Name;
@@ -285,7 +288,6 @@ namespace PckStudio.Forms.Editor
}
}
_skin.Texture = blockBenchModel.Textures[0].GetTexture();
LoadModelData(_skin);
break;
default: