From be44713be29f995726fb8b7b958dc7f2f3b75df7 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Sun, 7 Apr 2024 10:32:20 +0200 Subject: [PATCH] CustomSkinEditor - Fix block bench model import that has no texture attached --- PCK-Studio/Forms/Editor/CustomSkinEditor.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs index dc5da0c3..08e10eeb 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs @@ -229,6 +229,10 @@ namespace PckStudio.Forms.Editor BlockBenchModel blockBenchModel = JsonConvert.DeserializeObject(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: