diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs index a1a38c03..c3bebb01 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs @@ -70,6 +70,7 @@ 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(); label5 = new System.Windows.Forms.Label(); label3 = new System.Windows.Forms.Label(); label7 = new System.Windows.Forms.Label(); @@ -411,6 +412,7 @@ // renderer3D1 // resources.ApplyResources(this.renderer3D1, "renderer3D1"); + this.renderer3D1.Animate = true; this.renderer3D1.BackColor = System.Drawing.Color.DimGray; this.renderer3D1.CapeTexture = null; this.renderer3D1.ClampModel = false; @@ -433,10 +435,21 @@ 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); + // // CustomSkinEditor // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.skinAnimateCheckBox); this.Controls.Add(this.metroTabControl1); this.Controls.Add(this.skinNameLabel); this.Controls.Add(this.showToolsCheckBox); @@ -525,5 +538,6 @@ private MetroFramework.Controls.MetroContextMenu offsetTabContextMenu; private System.Windows.Forms.ToolStripMenuItem addOffsetToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem removeOffsetToolStripMenuItem; + private MetroFramework.Controls.MetroCheckBox skinAnimateCheckBox; } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs index d91a06c2..c9d1b8af 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.cs +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.cs @@ -374,5 +374,10 @@ namespace PckStudio.Forms.Editor skinPartListBox.ClearSelected(); renderer3D1.SelectedIndex = skinPartListBox.SelectedIndex; } + + private void skinAnimateCheckBox_CheckedChanged(object sender, EventArgs e) + { + renderer3D1.Animate = skinAnimateCheckBox.Checked; + } } } \ No newline at end of file diff --git a/PCK-Studio/Forms/Editor/CustomSkinEditor.resx b/PCK-Studio/Forms/Editor/CustomSkinEditor.resx index e32e90bd..95c16f98 100644 --- a/PCK-Studio/Forms/Editor/CustomSkinEditor.resx +++ b/PCK-Studio/Forms/Editor/CustomSkinEditor.resx @@ -157,7 +157,7 @@ $this - 28 + 29 False @@ -196,7 +196,7 @@ $this - 27 + 28 False @@ -235,7 +235,7 @@ $this - 25 + 26 False @@ -271,7 +271,7 @@ $this - 23 + 24 17, 17 @@ -382,7 +382,7 @@ $this - 26 + 27 Top, Right @@ -409,7 +409,7 @@ $this - 22 + 23 Top, Right @@ -436,16 +436,16 @@ $this - 24 + 25 Bottom, Left - 190, 558 + 27, 553 - 105, 21 + 80, 21 96 @@ -463,16 +463,16 @@ $this - 21 + 22 Bottom, Left - 301, 558 + 113, 553 - 105, 21 + 67, 21 97 @@ -490,7 +490,7 @@ $this - 20 + 21 Bottom, Right @@ -520,7 +520,7 @@ $this - 19 + 20 Bottom, Right @@ -550,7 +550,7 @@ $this - 18 + 19 Bottom, Right @@ -580,7 +580,7 @@ $this - 17 + 18 Bottom, Right @@ -610,7 +610,7 @@ $this - 16 + 17 Top, Right @@ -640,7 +640,7 @@ $this - 15 + 16 Top, Right @@ -670,7 +670,7 @@ $this - 14 + 15 Top, Right @@ -700,7 +700,7 @@ $this - 13 + 14 Top, Right @@ -727,7 +727,7 @@ $this - 12 + 13 Top, Right @@ -754,7 +754,7 @@ $this - 11 + 12 Top, Right @@ -784,7 +784,7 @@ $this - 7 + 8 Top, Right @@ -814,7 +814,7 @@ $this - 8 + 9 Top, Right @@ -844,7 +844,7 @@ $this - 9 + 10 Fill @@ -898,13 +898,13 @@ $this - 6 + 7 Bottom, Left - 508, 558 + 190, 553 113, 21 @@ -925,7 +925,7 @@ $this - 5 + 6 Bottom, Right @@ -955,7 +955,7 @@ $this - 4 + 5 Bottom, Left @@ -964,7 +964,7 @@ True - 23, 559 + 370, 553 73, 19 @@ -985,7 +985,7 @@ $this - 3 + 4 4, 38 @@ -1102,7 +1102,7 @@ $this - 2 + 3 Top, Bottom, Left, Right @@ -1126,7 +1126,7 @@ $this - 10 + 11 Top, Right @@ -1159,7 +1159,34 @@ $this - 29 + 30 + + + True + + + 553, 553 + + + 68, 15 + + + 168 + + + Animate + + + skinAnimateCheckBox + + + MetroFramework.Controls.MetroCheckBox, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a + + + $this + + + 2 True diff --git a/PCK-Studio/Rendering/SkinRenderer.cs b/PCK-Studio/Rendering/SkinRenderer.cs index 56524e8d..1d16c1fe 100644 --- a/PCK-Studio/Rendering/SkinRenderer.cs +++ b/PCK-Studio/Rendering/SkinRenderer.cs @@ -87,6 +87,7 @@ namespace PckStudio.Rendering public bool ClampModel { get; set; } = false; public bool ShowArmor { get; set; } = false; + public bool Animate { get; set; } = true; public bool ShowGuideLines { get => guidelineMode != GuidelineMode.None; @@ -1002,45 +1003,49 @@ namespace PckStudio.Rendering skinTexture.Bind(); - if (ANIM.GetFlag(SkinAnimFlag.DINNERBONE)) - { - transform = Pivot(head.GetFaceCenter(0, Cube.Face.Top), Vector3.UnitY * 12f, transform * Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(-180f))); - } - var legRightMatrix = Matrix4.Identity; var legLeftMatrix = Matrix4.Identity; var armRightMatrix = Matrix4.Identity; var armLeftMatrix = Matrix4.Identity; - - if (!ANIM.GetFlag(SkinAnimFlag.STATIC_ARMS)) + if (Animate) { - armRightMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(animationCurrentRotationAngle)); - armLeftMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians((ANIM.GetFlag(SkinAnimFlag.SYNCED_ARMS) ? 1f : -1f) * animationCurrentRotationAngle)); - } + if (ANIM.GetFlag(SkinAnimFlag.DINNERBONE)) + { + transform = Pivot(head.GetFaceCenter(0, Cube.Face.Top), Vector3.UnitY * 12f, transform * Matrix4.CreateRotationZ(MathHelper.DegreesToRadians(-180f))); + } - if (ANIM.GetFlag(SkinAnimFlag.ZOMBIE_ARMS)) - { - var rotation = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(-90f)); - armRightMatrix = rotation; - armLeftMatrix = rotation; - } + if (!ANIM.GetFlag(SkinAnimFlag.STATIC_ARMS)) + { + armRightMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(animationCurrentRotationAngle)); + armLeftMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians((ANIM.GetFlag(SkinAnimFlag.SYNCED_ARMS) ? 1f : -1f) * animationCurrentRotationAngle)); + } - if (ANIM.GetFlag(SkinAnimFlag.STATUE_OF_LIBERTY)) - { - armRightMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(-180f)); - armLeftMatrix = Matrix4.CreateRotationX(0f); - } + if (ANIM.GetFlag(SkinAnimFlag.ZOMBIE_ARMS)) + { + var rotation = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(-90f)); + armRightMatrix = rotation; + armLeftMatrix = rotation; + } - if (!ANIM.GetFlag(SkinAnimFlag.STATIC_LEGS)) - { - legRightMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians((ANIM.GetFlag(SkinAnimFlag.SYNCED_LEGS) ? 1f : -1f) * animationCurrentRotationAngle)); - legLeftMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(animationCurrentRotationAngle)); + if (ANIM.GetFlag(SkinAnimFlag.STATUE_OF_LIBERTY)) + { + armRightMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(-180f)); + armLeftMatrix = Matrix4.CreateRotationX(0f); + } + + if (!ANIM.GetFlag(SkinAnimFlag.STATIC_LEGS)) + { + legRightMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians((ANIM.GetFlag(SkinAnimFlag.SYNCED_LEGS) ? 1f : -1f) * animationCurrentRotationAngle)); + legLeftMatrix = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(animationCurrentRotationAngle)); + } + armRightMatrix = RightArmMatrix * armRightMatrix; + armLeftMatrix = LeftArmMatrix * armLeftMatrix; } RenderBodyPart(skinShader, Matrix4.Identity, transform, "HEAD", "HEADWEAR"); RenderBodyPart(skinShader, Matrix4.Identity, transform, "BODY", "JACKET"); - RenderBodyPart(skinShader, RightArmMatrix * armRightMatrix, transform, "ARM0", "SLEEVE0"); - RenderBodyPart(skinShader, LeftArmMatrix * armLeftMatrix, transform, "ARM1", "SLEEVE1"); + RenderBodyPart(skinShader, armRightMatrix, transform, "ARM0", "SLEEVE0"); + RenderBodyPart(skinShader, armLeftMatrix, transform, "ARM1", "SLEEVE1"); RenderBodyPart(skinShader, legRightMatrix, transform, "LEG0", "PANTS0"); RenderBodyPart(skinShader, legLeftMatrix, transform, "LEG1", "PANTS1");