mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-21 23:47:10 +00:00
Added tools to custom skin editor
This commit is contained in:
@@ -203,6 +203,7 @@
|
||||
this.showToolsCheckBox.Name = "showToolsCheckBox";
|
||||
this.showToolsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.showToolsCheckBox.UseSelectable = true;
|
||||
this.showToolsCheckBox.CheckedChanged += new System.EventHandler(this.showToolsCheckBox_CheckedChanged);
|
||||
//
|
||||
// skinNameLabel
|
||||
//
|
||||
|
||||
@@ -331,6 +331,11 @@ namespace PckStudio.Forms.Editor
|
||||
renderer3D1.ShowArmor = showArmorCheckbox.Checked;
|
||||
}
|
||||
|
||||
private void showToolsCheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
renderer3D1.ShowTools = showToolsCheckBox.Checked;
|
||||
}
|
||||
|
||||
private void skinPartListBox_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
|
||||
@@ -566,7 +566,7 @@
|
||||
<value>0, 0</value>
|
||||
</data>
|
||||
<data name="offsetListBox.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>157, 128</value>
|
||||
<value>157, 113</value>
|
||||
</data>
|
||||
<data name="offsetListBox.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>0</value>
|
||||
@@ -587,7 +587,7 @@
|
||||
<value>4, 38</value>
|
||||
</data>
|
||||
<data name="skinOffsetsTabPage.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>157, 128</value>
|
||||
<value>157, 113</value>
|
||||
</data>
|
||||
<data name="skinOffsetsTabPage.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>1</value>
|
||||
|
||||
10
PCK-Studio/Properties/Resources.Designer.cs
generated
10
PCK-Studio/Properties/Resources.Designer.cs
generated
@@ -1125,6 +1125,16 @@ namespace PckStudio.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap tools {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("tools", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
||||
@@ -427,4 +427,7 @@
|
||||
<data name="empty" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\iconImageList\empty.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="tools" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\tools.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -114,6 +114,7 @@ namespace PckStudio.Rendering
|
||||
public bool CenterOnSelect { get; set; } = false;
|
||||
public bool ShowBoundingBox { get; set; }
|
||||
public bool ShowArmor { get; set; } = false;
|
||||
public bool ShowTools { get; set; } = false;
|
||||
public bool Animate { get; set; } = true;
|
||||
public bool RenderCape { get; set; } = true;
|
||||
public bool ShowGuideLines
|
||||
@@ -202,6 +203,7 @@ namespace PckStudio.Rendering
|
||||
private Texture2D skinTexture;
|
||||
private Texture2D capeTexture;
|
||||
private Texture2D armorTexture;
|
||||
private Texture2D toolsTexture;
|
||||
|
||||
private DrawContext _cubicalDrawContext;
|
||||
private DrawContext _skeletonDrawContext;
|
||||
@@ -221,6 +223,8 @@ namespace PckStudio.Rendering
|
||||
private CubeMeshCollection leftArm;
|
||||
private CubeMeshCollection rightLeg;
|
||||
private CubeMeshCollection leftLeg;
|
||||
private CubeMeshCollection tool0;
|
||||
private CubeMeshCollection tool1;
|
||||
|
||||
private float animationCurrentRotationAngle;
|
||||
private float animationRotationSpeed = 16f;
|
||||
@@ -370,12 +374,18 @@ namespace PckStudio.Rendering
|
||||
var pants1 = new CubeMeshCollection("PANTS1", leftLeg.Translation, leftLeg.Pivot);
|
||||
pants1.Add(new(-2, 0, -2), new(4, 12, 4), new(0, 48), inflate: armorInflation, mirrorTexture: true);
|
||||
|
||||
var boot0 = new CubeMeshCollection("BOOT0", rightLeg.Translation, rightLeg.Pivot);
|
||||
var boot0 = new CubeMeshCollection("BOOT0", rightLeg.Translation, rightLeg.Pivot);
|
||||
boot0.Add(new(-2, 0, -2), new(4, 12, 4), new(0, 16), inflate: armorInflation + 0.25f);
|
||||
|
||||
var boot1 = new CubeMeshCollection("BOOT1", leftLeg.Translation, leftLeg.Pivot);
|
||||
var boot1 = new CubeMeshCollection("BOOT1", leftLeg.Translation, leftLeg.Pivot);
|
||||
boot1.Add(new(-2, 0, -2), new(4, 12, 4), new(0, 16), inflate: armorInflation + 0.25f, mirrorTexture: true);
|
||||
|
||||
// Tool boxes handled by UpdateANIM method - May
|
||||
tool0 = new CubeMeshCollection("TOOL0", rightArm.Translation, rightArm.Pivot);
|
||||
tool0.Add(new(0), new(0), new(0));
|
||||
tool1 = new CubeMeshCollection("TOOL1", leftArm.Translation, leftArm.Pivot);
|
||||
tool1.Add(new(0), new(0), new(0));
|
||||
|
||||
offsetSpecificMeshStorage = new Dictionary<string, CubeMeshCollection>
|
||||
{
|
||||
{ helmet.Name, helmet },
|
||||
@@ -386,12 +396,10 @@ namespace PckStudio.Rendering
|
||||
{ pants0.Name, pants0 },
|
||||
{ pants1.Name, pants1 },
|
||||
{ boot0.Name, boot0 },
|
||||
{ boot1.Name, boot1 }
|
||||
{ boot1.Name, boot1 },
|
||||
{ tool0.Name, tool0 },
|
||||
{ tool1.Name, tool1 },
|
||||
};
|
||||
|
||||
//// TODO
|
||||
//{ "TOOL0" , new CubeGroupMesh("TOOL0") },
|
||||
//{ "TOOL1" , new CubeGroupMesh("TOOL1") },
|
||||
}
|
||||
|
||||
private void InitializeShaders()
|
||||
@@ -423,6 +431,16 @@ namespace PckStudio.Rendering
|
||||
armorTexture.SetTexture(Resources.armor);
|
||||
GLErrorCheck();
|
||||
|
||||
toolsTexture = new Texture2D();
|
||||
toolsTexture.PixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Bgra;
|
||||
toolsTexture.InternalPixelFormat = PixelInternalFormat.Rgba8;
|
||||
toolsTexture.MinFilter = TextureMinFilter.Nearest;
|
||||
toolsTexture.MagFilter = TextureMagFilter.Nearest;
|
||||
toolsTexture.WrapS = TextureWrapMode.Repeat;
|
||||
toolsTexture.WrapT = TextureWrapMode.Repeat;
|
||||
toolsTexture.SetTexture(Resources.tools);
|
||||
GLErrorCheck();
|
||||
|
||||
capeTexture = new Texture2D();
|
||||
capeTexture.PixelFormat = OpenTK.Graphics.OpenGL.PixelFormat.Bgra;
|
||||
capeTexture.InternalPixelFormat = PixelInternalFormat.Rgba8;
|
||||
@@ -728,6 +746,9 @@ namespace PckStudio.Rendering
|
||||
|
||||
bool slim = ANIM.GetFlag(SkinAnimFlag.SLIM_MODEL);
|
||||
|
||||
tool0.ReplaceCube(0, new(slim ? -0.75f : -1.75f, -5.35f, -18.35f), new(0, 16, 16), new(0, -16));
|
||||
tool1.ReplaceCube(0, new(slim ? 0.75f : 1.75f, -5.35f, -18.35f), new(0, 16, 16), new(0, -16));
|
||||
|
||||
head.FlipZMapping = true;
|
||||
if (slim || ANIM.GetFlag(SkinAnimFlag.MODERN_WIDE_MODEL))
|
||||
{
|
||||
@@ -968,6 +989,17 @@ namespace PckStudio.Rendering
|
||||
RenderPart(cubeShader, offsetSpecificMeshStorage["WAIST"], Matrix4.Identity, renderTransform);
|
||||
}
|
||||
|
||||
if(ShowTools)
|
||||
{
|
||||
toolsTexture.Bind();
|
||||
cubeShader.SetUniform2("TexSize", Resources.tools.Size);
|
||||
|
||||
Matrix4 handheldRotation = Matrix4.CreateRotationX(MathHelper.DegreesToRadians(45f));
|
||||
|
||||
RenderPart(cubeShader, offsetSpecificMeshStorage["TOOL0"], armRightMatrix * handheldRotation, renderTransform);
|
||||
RenderPart(cubeShader, offsetSpecificMeshStorage["TOOL1"], armLeftMatrix * handheldRotation, renderTransform);
|
||||
}
|
||||
|
||||
if (showWireFrame)
|
||||
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
|
||||
|
||||
|
||||
BIN
PCK-Studio/Resources/tools.png
Normal file
BIN
PCK-Studio/Resources/tools.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user