From ec828530efd513623a761af8085d9b1377b6b7b0 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:07:41 +0200 Subject: [PATCH] CustomSkinEditor - Add 'export template' button --- .../Forms/Editor/CustomSkinEditor.Designer.cs | 12 +++ PCK-Studio/Forms/Editor/CustomSkinEditor.cs | 17 ++++ PCK-Studio/Forms/Editor/CustomSkinEditor.resx | 83 ++++++++++++------- 3 files changed, 84 insertions(+), 28 deletions(-) diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs index 45844f97..1c316a6a 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs @@ -66,6 +66,7 @@ this.framerateSlider = new System.Windows.Forms.TrackBar(); this.framerateLabel = new MetroFramework.Controls.MetroLabel(); this.renderSettingsButton = new MetroFramework.Controls.MetroButton(); + this.exportTemplateButton = new MetroFramework.Controls.MetroButton(); labelTextureMapping = new System.Windows.Forms.Label(); groupBox1 = new System.Windows.Forms.GroupBox(); groupBox1.SuspendLayout(); @@ -369,10 +370,20 @@ this.renderSettingsButton.UseSelectable = true; this.renderSettingsButton.Click += new System.EventHandler(this.renderSettingsButton_Click); // + // exportTemplateButton + // + resources.ApplyResources(this.exportTemplateButton, "exportTemplateButton"); + this.exportTemplateButton.ForeColor = System.Drawing.Color.White; + this.exportTemplateButton.Name = "exportTemplateButton"; + this.exportTemplateButton.Theme = MetroFramework.MetroThemeStyle.Dark; + this.exportTemplateButton.UseSelectable = true; + this.exportTemplateButton.Click += new System.EventHandler(this.exportTemplateButton_Click); + // // CustomSkinEditor // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.exportTemplateButton); this.Controls.Add(this.renderSettingsButton); this.Controls.Add(this.framerateLabel); this.Controls.Add(this.framerateSlider); @@ -447,5 +458,6 @@ private System.Windows.Forms.TrackBar framerateSlider; private MetroFramework.Controls.MetroLabel framerateLabel; private MetroFramework.Controls.MetroButton renderSettingsButton; + private MetroFramework.Controls.MetroButton exportTemplateButton; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs index ea00b3fc..acb6ca8c 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs @@ -428,5 +428,22 @@ namespace PckStudio.Forms.Editor using AppSettingsForm settingsForm = new AppSettingsForm("Render Settings", _settingsManager.GetSettings()); settingsForm.ShowDialog(); } + + private void exportTemplateButton_Click(object sender, EventArgs e) + { + Image templateTexture = Resources.classic_template; + string templateFilename = "template"; + SkinAnimMask templateAnimMask = SkinAnimMask.RESOLUTION_64x64; + + SaveFileDialog saveFileDialog = new SaveFileDialog(); + saveFileDialog.Title = "Save Template Model"; + saveFileDialog.Filter = SkinModelImporter.Default.SupportedModelFileFormatsFilter; + saveFileDialog.FileName = templateFilename.TrimEnd(new char[] { '\n', '\r' }).Replace(' ', '_'); + if (saveFileDialog.ShowDialog() == DialogResult.OK) + { + SkinModelInfo modelInfo = new SkinModelInfo(templateTexture, new SkinANIM(templateAnimMask)); + SkinModelImporter.Default.Export(saveFileDialog.FileName, modelInfo); + } + } } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.resx b/PCK-Studio/Forms/Editor/CustomSkinEditor.resx index 4b914f4f..e25cbba9 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.resx +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.resx @@ -154,7 +154,7 @@ $this - 18 + 19 False @@ -238,7 +238,7 @@ $this - 6 + 7 Top, Right @@ -271,7 +271,7 @@ $this - 22 + 23 Top, Right @@ -304,7 +304,7 @@ $this - 21 + 22 Top, Right @@ -337,7 +337,7 @@ $this - 19 + 20 17, 17 @@ -445,7 +445,7 @@ $this - 20 + 21 Bottom, Left @@ -472,7 +472,7 @@ $this - 17 + 18 Bottom, Left @@ -499,7 +499,7 @@ $this - 16 + 17 Bottom, Right @@ -529,7 +529,7 @@ $this - 15 + 16 Bottom, Right @@ -559,7 +559,7 @@ $this - 14 + 15 Bottom, Right @@ -589,7 +589,7 @@ $this - 13 + 14 Fill @@ -616,13 +616,13 @@ 0 - Bottom, Left + Bottom, Right - 190, 553 + 510, 553 - 113, 21 + 111, 21 163 @@ -640,7 +640,7 @@ $this - 10 + 11 Bottom, Right @@ -670,16 +670,16 @@ $this - 9 + 10 - Bottom, Left + Top, Left, Right True - 367, 553 + 364, 36 73, 19 @@ -700,7 +700,7 @@ $this - 8 + 9 4, 38 @@ -817,7 +817,7 @@ $this - 7 + 8 Top, Bottom, Left, Right @@ -841,7 +841,7 @@ $this - 12 + 13 Top, Right @@ -874,7 +874,7 @@ $this - 23 + 24 Bottom, Right @@ -904,7 +904,7 @@ $this - 11 + 12 Top, Right @@ -937,7 +937,7 @@ $this - 5 + 6 Bottom, Right @@ -964,7 +964,7 @@ $this - 4 + 5 Bottom, Right @@ -997,16 +997,16 @@ $this - 3 + 4 Bottom, Right - 527, 553 + 343, 551 - 94, 21 + 94, 23 175 @@ -1024,6 +1024,33 @@ $this + 3 + + + Bottom, Left + + + 190, 553 + + + 94, 21 + + + 176 + + + Export template + + + exportTemplateButton + + + MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + 2