diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs index 490161df..45844f97 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs @@ -47,7 +47,6 @@ this.exportSkinButton = new MetroFramework.Controls.MetroButton(); this.outlineColorButton = new MetroFramework.Controls.MetroButton(); this.generateTextureCheckBox = new MetroFramework.Controls.MetroCheckBox(); - this.checkGuide = new MetroFramework.Controls.MetroCheckBox(); this.showArmorCheckbox = new MetroFramework.Controls.MetroCheckBox(); this.skinPartListBox = new System.Windows.Forms.ListBox(); this.captureScreenshotButton = new MetroFramework.Controls.MetroButton(); @@ -62,9 +61,11 @@ this.removeOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.renderer3D1 = new PckStudio.Rendering.SkinRenderer(); this.uvPictureBox = new PckStudio.ToolboxItems.InterpolationPictureBox(); - this.skinAnimateCheckBox = new MetroFramework.Controls.MetroCheckBox(); this.centerSelectionCheckbox = new MetroFramework.Controls.MetroCheckBox(); this.textureSizeLabel = new System.Windows.Forms.Label(); + this.framerateSlider = new System.Windows.Forms.TrackBar(); + this.framerateLabel = new MetroFramework.Controls.MetroLabel(); + this.renderSettingsButton = new MetroFramework.Controls.MetroButton(); labelTextureMapping = new System.Windows.Forms.Label(); groupBox1 = new System.Windows.Forms.GroupBox(); groupBox1.SuspendLayout(); @@ -74,6 +75,7 @@ this.skinOffsetsTabPage.SuspendLayout(); this.offsetTabContextMenu.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.uvPictureBox)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.framerateSlider)).BeginInit(); this.SuspendLayout(); // // labelTextureMapping @@ -206,14 +208,6 @@ this.generateTextureCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; this.generateTextureCheckBox.UseSelectable = true; // - // checkGuide - // - resources.ApplyResources(this.checkGuide, "checkGuide"); - this.checkGuide.Name = "checkGuide"; - this.checkGuide.Theme = MetroFramework.MetroThemeStyle.Dark; - this.checkGuide.UseSelectable = true; - this.checkGuide.CheckedChanged += new System.EventHandler(this.checkGuide_CheckedChanged); - // // showArmorCheckbox // resources.ApplyResources(this.showArmorCheckbox, "showArmorCheckbox"); @@ -320,7 +314,7 @@ this.renderer3D1.HighlightlingColor = System.Drawing.Color.Aqua; this.renderer3D1.MouseSensetivity = 0.01F; this.renderer3D1.Name = "renderer3D1"; - this.renderer3D1.RefreshRate = 50; + this.renderer3D1.RefreshRate = 120; this.renderer3D1.SelectedIndex = -1; this.renderer3D1.ShowArmor = false; this.renderer3D1.ShowGuideLines = false; @@ -336,16 +330,6 @@ this.uvPictureBox.Name = "uvPictureBox"; this.uvPictureBox.TabStop = false; // - // skinAnimateCheckBox - // - resources.ApplyResources(this.skinAnimateCheckBox, "skinAnimateCheckBox"); - this.skinAnimateCheckBox.Checked = true; - this.skinAnimateCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; - this.skinAnimateCheckBox.Name = "skinAnimateCheckBox"; - this.skinAnimateCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark; - this.skinAnimateCheckBox.UseSelectable = true; - this.skinAnimateCheckBox.CheckedChanged += new System.EventHandler(this.skinAnimateCheckBox_CheckedChanged); - // // centerSelectionCheckbox // resources.ApplyResources(this.centerSelectionCheckbox, "centerSelectionCheckbox"); @@ -360,13 +344,40 @@ this.textureSizeLabel.ForeColor = System.Drawing.Color.White; this.textureSizeLabel.Name = "textureSizeLabel"; // + // framerateSlider + // + this.framerateSlider.AccessibleRole = System.Windows.Forms.AccessibleRole.Slider; + resources.ApplyResources(this.framerateSlider, "framerateSlider"); + this.framerateSlider.LargeChange = 1; + this.framerateSlider.Maximum = 3; + this.framerateSlider.Name = "framerateSlider"; + this.framerateSlider.Tag = ""; + this.framerateSlider.TickStyle = System.Windows.Forms.TickStyle.TopLeft; + this.framerateSlider.ValueChanged += new System.EventHandler(this.framerateSlider_ValueChanged); + // + // framerateLabel + // + resources.ApplyResources(this.framerateLabel, "framerateLabel"); + this.framerateLabel.Name = "framerateLabel"; + this.framerateLabel.Theme = MetroFramework.MetroThemeStyle.Dark; + // + // renderSettingsButton + // + resources.ApplyResources(this.renderSettingsButton, "renderSettingsButton"); + this.renderSettingsButton.Name = "renderSettingsButton"; + this.renderSettingsButton.Theme = MetroFramework.MetroThemeStyle.Dark; + this.renderSettingsButton.UseSelectable = true; + this.renderSettingsButton.Click += new System.EventHandler(this.renderSettingsButton_Click); + // // CustomSkinEditor // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.renderSettingsButton); + this.Controls.Add(this.framerateLabel); + this.Controls.Add(this.framerateSlider); this.Controls.Add(this.textureSizeLabel); this.Controls.Add(groupBox1); - this.Controls.Add(this.skinAnimateCheckBox); this.Controls.Add(this.metroTabControl1); this.Controls.Add(this.skinNameLabel); this.Controls.Add(this.showToolsCheckBox); @@ -374,7 +385,6 @@ this.Controls.Add(this.centerSelectionCheckbox); this.Controls.Add(this.renderer3D1); this.Controls.Add(this.showArmorCheckbox); - this.Controls.Add(this.checkGuide); this.Controls.Add(this.generateTextureCheckBox); this.Controls.Add(this.outlineColorButton); this.Controls.Add(this.exportSkinButton); @@ -396,6 +406,7 @@ this.skinOffsetsTabPage.ResumeLayout(false); this.offsetTabContextMenu.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.uvPictureBox)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.framerateSlider)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -415,7 +426,6 @@ private MetroFramework.Controls.MetroButton importTextureButton; private MetroFramework.Controls.MetroButton exportTextureButton; private MetroFramework.Controls.MetroCheckBox generateTextureCheckBox; - private MetroFramework.Controls.MetroCheckBox checkGuide; private MetroFramework.Controls.MetroCheckBox showArmorCheckbox; private Rendering.SkinRenderer renderer3D1; private System.Windows.Forms.ListBox skinPartListBox; @@ -429,11 +439,13 @@ private MetroFramework.Controls.MetroContextMenu offsetTabContextMenu; private System.Windows.Forms.ToolStripMenuItem addOffsetToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeOffsetToolStripMenuItem; - private MetroFramework.Controls.MetroCheckBox skinAnimateCheckBox; private MetroFramework.Controls.MetroCheckBox centerSelectionCheckbox; private System.Windows.Forms.Label positionLabel; private System.Windows.Forms.Label sizeLabel; private System.Windows.Forms.Label uvLabel; private System.Windows.Forms.Label textureSizeLabel; + private System.Windows.Forms.TrackBar framerateSlider; + private MetroFramework.Controls.MetroLabel framerateLabel; + private MetroFramework.Controls.MetroButton renderSettingsButton; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs index fac4b34e..67e69ea3 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs @@ -12,6 +12,8 @@ using PckStudio.Extensions; using PckStudio.Internal.Skin; using PckStudio.Forms.Additional_Popups; using PckStudio.Properties; +using System.Configuration; +using System.Collections.Generic; namespace PckStudio.Forms.Editor { @@ -57,6 +59,7 @@ namespace PckStudio.Forms.Editor base.OnLoad(e); renderer3D1.Initialize(_inflateOverlayParts); renderer3D1.GuideLineColor = Color.LightCoral; + framerateSlider_ValueChanged(this, EventArgs.Empty); skinNameLabel.Text = _skin.MetaData.Name; if (_skin.HasCape) renderer3D1.CapeTexture = _skin.CapeTexture; @@ -314,11 +317,6 @@ namespace PckStudio.Forms.Editor } } - private void checkGuide_CheckedChanged(object sender, EventArgs e) - { - outlineColorButton.Visible = renderer3D1.ShowGuideLines = checkGuide.Checked; - } - private void showArmorCheckbox_CheckedChanged(object sender, EventArgs e) { renderer3D1.ShowArmor = showArmorCheckbox.Checked; @@ -398,10 +396,6 @@ namespace PckStudio.Forms.Editor uvPictureBox.Image = _skin.Model.Texture; } - private void skinAnimateCheckBox_CheckedChanged(object sender, EventArgs e) - { - renderer3D1.Animate = skinAnimateCheckBox.Checked; - } private void centerSelectionCheckbox_CheckedChanged(object sender, EventArgs e) { @@ -415,5 +409,65 @@ namespace PckStudio.Forms.Editor GenerateUVTextureMap(skinBox); } } + + private void framerateSlider_ValueChanged(object sender, EventArgs e) + { + renderer3D1.RefreshRate = framerateSlider.Value * 30 + 30; + framerateLabel.Text = "FPS: " + renderer3D1.RefreshRate.ToString(); + } + + class RenderSettings : ApplicationSettingsBase + { + internal bool ShouldAnimate + { + get => (bool)this["shouldAnimate"]; + } + + internal bool LockMouse + { + get => (bool)this["lockMouse"]; + } + + internal bool ShowGuidelines + { + get => (bool)this["showGuidelines"]; + } + + public RenderSettings() + { + AddSetting("shouldAnimate", "Animate skin", true); + AddSetting("lockMouse", "Lock mouse when paning or rotating", true); + AddSetting("showGuidelines", "Show guidelines", false); + } + + void AddSetting(string name, string displayName, T value) + { + if (!Context.ContainsKey(AppSettingsForm.keyToStringContextKey)) + { + Context.Add(AppSettingsForm.keyToStringContextKey, new Dictionary()); + } + var settingsProperty = new SettingsProperty(name, typeof(T), null, false, default(T), SettingsSerializeAs.String, null, false, false); + Properties.Add(settingsProperty); + PropertyValues.Add(new SettingsPropertyValue(settingsProperty) { PropertyValue = value}); + if (Context[AppSettingsForm.keyToStringContextKey] is Dictionary dict) + dict.Add(name, displayName); + } + } + + RenderSettings renderSettings = new RenderSettings(); + + private void renderSettingsButton_Click(object sender, EventArgs e) + { + using AppSettingsForm settingsForm = new AppSettingsForm("Render Settings", renderSettings); + settingsForm.ShowDialog(); + LoadRenderSettings(renderSettings); + } + + private void LoadRenderSettings(RenderSettings renderSettings) + { + renderer3D1.Animate = renderSettings.ShouldAnimate; + renderer3D1.LockMousePosition = renderSettings.LockMouse; + outlineColorButton.Visible = renderer3D1.ShowGuideLines = renderSettings.ShowGuidelines; + } } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.resx b/PCK-Studio/Forms/Editor/CustomSkinEditor.resx index ee1361e3..fb11ad5e 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.resx +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.resx @@ -133,7 +133,7 @@ - 702, 43 + 703, 42 87, 13 @@ -154,7 +154,7 @@ $this - 17 + 18 False @@ -165,6 +165,57 @@ True + + importTextureButton + + + MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + groupBox1 + + + 0 + + + exportTextureButton + + + MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + groupBox1 + + + 1 + + + 803, 329 + + + 3, 3, 3, 0 + + + 74, 83 + + + 170 + + + Texture + + + groupBox1 + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 6 + 7, 19 @@ -213,33 +264,6 @@ 1 - - 803, 329 - - - 3, 3, 3, 0 - - - 74, 83 - - - 170 - - - Texture - - - groupBox1 - - - System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 3 - Top, Right @@ -271,7 +295,7 @@ $this - 21 + 22 Top, Right @@ -304,7 +328,7 @@ $this - 20 + 21 Top, Right @@ -337,11 +361,20 @@ $this - 18 + 19 17, 17 + + 202, 108 + + + skinPartTabContextMenu + + + System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO @@ -411,23 +444,14 @@ Re-generate UV Texture - - 202, 130 - - - skinPartTabContextMenu - - - System.Windows.Forms.ContextMenuStrip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Bottom, Right - 627, 557 + 627, 553 - 250, 22 + 250, 21 111 @@ -445,7 +469,7 @@ $this - 19 + 20 Bottom, Left @@ -472,7 +496,7 @@ $this - 16 + 17 Bottom, Left @@ -499,16 +523,16 @@ $this - 15 + 16 Bottom, Right - 777, 485 + 627, 485 - 100, 21 + 250, 21 145 @@ -529,7 +553,7 @@ $this - 14 + 15 Bottom, Right @@ -559,37 +583,7 @@ $this - 13 - - - Bottom, Right - - - True - - - 627, 486 - - - 84, 15 - - - 148 - - - Guide Lines - - - checkGuide - - - MetroFramework.Controls.MetroCheckBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 12 + 14 Bottom, Right @@ -619,7 +613,7 @@ $this - 11 + 13 Fill @@ -670,7 +664,7 @@ $this - 8 + 10 Bottom, Right @@ -700,7 +694,7 @@ $this - 7 + 9 Bottom, Left @@ -730,7 +724,52 @@ $this - 6 + 8 + + + skinPartsTabPage + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + metroTabControl1 + + + 0 + + + skinOffsetsTabPage + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + metroTabControl1 + + + 1 + + + 23, 59 + + + 161, 488 + + + 1 + + + metroTabControl1 + + + MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 7 4, 38 @@ -756,42 +795,6 @@ 0 - - 204, 17 - - - 152, 22 - - - Add Offset - - - 152, 22 - - - Remove Offset - - - 153, 48 - - - offsetTabContextMenu - - - MetroFramework.Controls.MetroContextMenu, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - Fill - - - 0, 0 - - - 153, 446 - - - 0 - offsetListBox @@ -828,26 +831,53 @@ 1 - - 23, 59 + + 204, 17 + + + 153, 48 - - 161, 488 + + offsetTabContextMenu - - 1 + + MetroFramework.Controls.MetroContextMenu, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - metroTabControl1 + + Fill - - MetroFramework.Controls.MetroTabControl, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + 0, 0 - - $this + + 153, 446 - - 5 + + 0 + + + offsetListBox + + + System.Windows.Forms.ListBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + skinOffsetsTabPage + + + 0 + + + 152, 22 + + + Add Offset + + + 152, 22 + + + Remove Offset Top, Bottom, Left, Right @@ -865,13 +895,13 @@ renderer3D1 - PckStudio.Rendering.SkinRenderer, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null + PckStudio.Rendering.SkinRenderer, PCK-Studio, Version=7.0.0.2, Culture=neutral, PublicKeyToken=null $this - 10 + 12 Top, Right @@ -898,43 +928,13 @@ uvPictureBox - PckStudio.ToolboxItems.InterpolationPictureBox, PCK-Studio, Version=7.0.0.0, Culture=neutral, PublicKeyToken=null + PckStudio.ToolboxItems.InterpolationPictureBox, PCK-Studio, Version=7.0.0.2, Culture=neutral, PublicKeyToken=null $this - 22 - - - Bottom, Right - - - True - - - 553, 553 - - - 68, 15 - - - 168 - - - Animate - - - skinAnimateCheckBox - - - MetroFramework.Controls.MetroCheckBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a - - - $this - - - 4 + 23 Bottom, Right @@ -964,7 +964,7 @@ $this - 9 + 11 Top, Right @@ -997,6 +997,90 @@ $this + 5 + + + Bottom, Right + + + False + + + 627, 432 + + + 140, 27 + + + 173 + + + framerateSlider + + + System.Windows.Forms.TrackBar, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + $this + + + 4 + + + Bottom, Right + + + True + + + 668, 410 + + + 67, 19 + + + 174 + + + framerate + + + MiddleCenter + + + framerateLabel + + + MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 3 + + + 527, 553 + + + 94, 21 + + + 175 + + + Render settings + + + renderSettingsButton + + + MetroFramework.Controls.MetroButton, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + 2