From fd1f64a5f99bf32e05e1d4a2432ab696953e6058 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Tue, 16 Apr 2024 20:15:27 +0200 Subject: [PATCH] CustomSkinEditor - Rename 'skinModelFileFilters' to 'AvailableModelFileFilters' and add check when importing blockbench model --- PCK-Studio/Forms/Editor/CustomSkinEditor.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs index 53c2adae..ab288346 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs @@ -42,7 +42,7 @@ namespace PckStudio.Forms.Editor new ("Bedrock Legacy Model(*.json)", "*.json"), ]; - private string skinModelFileFilters => string.Join("|", fileFilters); + private string AvailableModelFileFilters => string.Join("|", fileFilters); private BindingSource skinPartListBindingSource; private BindingSource skinOffsetListBindingSource; @@ -176,7 +176,7 @@ namespace PckStudio.Forms.Editor { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Title = "Save Model File"; - saveFileDialog.Filter = skinModelFileFilters; + saveFileDialog.Filter = AvailableModelFileFilters; if (saveFileDialog.ShowDialog() != DialogResult.OK) return; string fileExtension = Path.GetExtension(saveFileDialog.FileName); @@ -195,7 +195,7 @@ namespace PckStudio.Forms.Editor { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = "Select Model File"; - openFileDialog.Filter = skinModelFileFilters; + openFileDialog.Filter = AvailableModelFileFilters; if (MessageBox.Show("Import custom model project file? Your current work will be lost!", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.Yes && openFileDialog.ShowDialog() == DialogResult.OK) { string fileExtension = Path.GetExtension(openFileDialog.FileName); @@ -243,7 +243,7 @@ namespace PckStudio.Forms.Editor if (token.Type == JTokenType.String && Guid.TryParse((string)token, out Guid tokenGuid)) { Element element = blockBenchModel.Elements.First(e => e.Uuid.Equals(tokenGuid)); - if (!SkinBOX.IsValidType(element.Name)) + if (!SkinBOX.IsValidType(element.Name) || element.Type != "cube") continue; LoadElement(element.Name, element); continue;