mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-31 11:44:47 +00:00
Merge branch 'main' into pr/46
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -1,6 +1,6 @@
|
||||
[submodule "OMI-Lib"]
|
||||
path = Vendor/OMI-Lib
|
||||
url = https://github.com/PhoenixARC/-OMI-Filetype-Library.git
|
||||
url = https://github.com/LCERD/OMI-Filetype-Library.git
|
||||
[submodule "Vendor/SharpMss32"]
|
||||
path = Vendor/SharpMss32
|
||||
url = https://github.com/NessieHax/SharpMss32.git
|
||||
|
||||
@@ -77,6 +77,9 @@
|
||||
<setting name="AutoUpdate" serializeAs="String">
|
||||
<value>False</value>
|
||||
</setting>
|
||||
<setting name="ValidateImageDimension" serializeAs="String">
|
||||
<value>True</value>
|
||||
</setting>
|
||||
</PckStudio.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public enum BackgroundTypes
|
||||
{
|
||||
Color,
|
||||
Gradient,
|
||||
Texture
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public enum Backgrounds
|
||||
{
|
||||
LightStone,
|
||||
DarkStone,
|
||||
DaySky,
|
||||
NightSky,
|
||||
Sunset,
|
||||
Transparent
|
||||
}
|
||||
}
|
||||
@@ -1,158 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public class Box : Object3D
|
||||
{
|
||||
public override Image Image
|
||||
{
|
||||
set
|
||||
{
|
||||
SetImage(value);
|
||||
}
|
||||
}
|
||||
|
||||
internal override MinecraftModelView Viewport
|
||||
{
|
||||
set
|
||||
{
|
||||
base.Viewport = value;
|
||||
top.Viewport = value;
|
||||
bottom.Viewport = value;
|
||||
front.Viewport = value;
|
||||
back.Viewport = value;
|
||||
left.Viewport = value;
|
||||
right.Viewport = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Update()
|
||||
{
|
||||
Matrix3D a = globalTransformation * localTransformation;
|
||||
top.LocalTransformation = a * topLocalTransformation;
|
||||
bottom.LocalTransformation = a * bottomLocalTransformation;
|
||||
front.LocalTransformation = a * frontLocalTransformation;
|
||||
back.LocalTransformation = a * backLocalTransformation;
|
||||
left.LocalTransformation = a * leftLocalTransformation;
|
||||
right.LocalTransformation = a * rightLocalTransformation;
|
||||
}
|
||||
|
||||
public Box(Image image, Rectangle srcTopBottom, Rectangle srcSides, Point3D origin, Effects effects = Effects.None)
|
||||
{
|
||||
this.effects = effects;
|
||||
Origin = origin;
|
||||
SetImage(image, srcTopBottom, srcSides);
|
||||
}
|
||||
|
||||
private void SetImage(Image image, Rectangle srcTopBottom, Rectangle srcSides)
|
||||
{
|
||||
int num = srcTopBottom.Width / 2;
|
||||
int height = srcSides.Height;
|
||||
int height2 = srcTopBottom.Height;
|
||||
srcTop = new Rectangle(srcTopBottom.Location, new Size(num, height2));
|
||||
srcBottom = new Rectangle(srcTopBottom.X + num, srcTopBottom.Y, num, height2);
|
||||
srcFront = new Rectangle(srcSides.X + height2, srcSides.Y, num, height);
|
||||
srcBack = new Rectangle(srcSides.X + height2 + num + height2, srcSides.Y, num, height);
|
||||
srcLeft = new Rectangle(srcSides.Location, new Size(height2, height));
|
||||
srcRight = new Rectangle(srcSides.X + height2 + num, srcSides.Y, height2, height);
|
||||
SetImage(image);
|
||||
}
|
||||
|
||||
private void SetImage(Image image)
|
||||
{
|
||||
bool flag = (byte)(effects & Effects.FlipHorizontally) == 1;
|
||||
bool flag2 = (byte)(effects & Effects.FlipVertically) == 2;
|
||||
int width = srcFront.Width;
|
||||
int height = srcFront.Height;
|
||||
int width2 = srcLeft.Width;
|
||||
top = new TexturePlane(image, flag2 ? srcBottom : srcTop, new Point3D(width * 0.5f, width2 * 0.5f, (float)(-(float)height) * 0.5f), new Point3D(0f, 1f, 0f), effects & Effects.FlipHorizontally);
|
||||
bottom = new TexturePlane(image, flag2 ? srcTop : srcBottom, new Point3D(width / 2f, width2 / 2f, height / 2f), new Point3D(0f, -1f, 0f), effects & Effects.FlipHorizontally);
|
||||
front = new TexturePlane(image, srcFront, new Point3D(width * 0.5f, height * 0.5f, (float)(-(float)width2) * 0.5f), new Point3D(0f, 0f, 1f), effects);
|
||||
back = new TexturePlane(image, srcBack, new Point3D(width * 0.5f, height * 0.5f, (float)(-(float)width2) * 0.5f), new Point3D(0f, 0f, -1f), effects);
|
||||
left = new TexturePlane(image, flag ? srcRight : srcLeft, new Point3D(width2 * 0.5f, height * 0.5f, (float)(-(float)width) * 0.5f), new Point3D(-1f, 0f, 0f), effects);
|
||||
right = new TexturePlane(image, flag ? srcLeft : srcRight, new Point3D(width2 * 0.5f, height * 0.5f, (float)(-(float)width) * 0.5f), new Point3D(1f, 0f, 0f), effects);
|
||||
top.Viewport = viewport;
|
||||
bottom.Viewport = viewport;
|
||||
front.Viewport = viewport;
|
||||
back.Viewport = viewport;
|
||||
left.Viewport = viewport;
|
||||
right.Viewport = viewport;
|
||||
}
|
||||
|
||||
public override float HitTest(PointF location)
|
||||
{
|
||||
float num = -1000f;
|
||||
float num2 = top.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
num2 = bottom.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
num2 = front.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
num2 = back.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
num2 = left.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
num2 = right.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private TexturePlane top;
|
||||
|
||||
private TexturePlane bottom;
|
||||
|
||||
private TexturePlane front;
|
||||
|
||||
private TexturePlane back;
|
||||
|
||||
private TexturePlane left;
|
||||
|
||||
private TexturePlane right;
|
||||
|
||||
private Rectangle srcTop;
|
||||
|
||||
private Rectangle srcBottom;
|
||||
|
||||
private Rectangle srcFront;
|
||||
|
||||
private Rectangle srcBack;
|
||||
|
||||
private Rectangle srcLeft;
|
||||
|
||||
private Rectangle srcRight;
|
||||
|
||||
private Matrix3D topLocalTransformation = Matrix3D.CreateRotationX(-1.57079637f);
|
||||
|
||||
private Matrix3D bottomLocalTransformation = Matrix3D.CreateRotationX(-1.57079637f);
|
||||
|
||||
private Matrix3D frontLocalTransformation = Matrix3D.Identity;
|
||||
|
||||
private Matrix3D backLocalTransformation = Matrix3D.CreateRotationY(3.14159274f);
|
||||
|
||||
private Matrix3D leftLocalTransformation = Matrix3D.CreateRotationY(-1.57079637f);
|
||||
|
||||
private Matrix3D rightLocalTransformation = Matrix3D.CreateRotationY(1.57079637f);
|
||||
|
||||
private Effects effects;
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
using System;
|
||||
using PckStudio.Models;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public abstract class ModelBase
|
||||
{
|
||||
public ModelBase()
|
||||
{ }
|
||||
|
||||
protected Image[] textures;
|
||||
|
||||
public EventHandler OnUpdate;
|
||||
protected const float OverlayScale = 1.16f;
|
||||
|
||||
public Image[] Textures => textures;
|
||||
|
||||
public event EventHandler Updatedx
|
||||
{
|
||||
add
|
||||
{
|
||||
EventHandler eventHandler = OnUpdate;
|
||||
EventHandler eventHandler2;
|
||||
do
|
||||
{
|
||||
eventHandler2 = eventHandler;
|
||||
EventHandler value2 = (EventHandler)Delegate.Combine(eventHandler2, value);
|
||||
eventHandler = Interlocked.CompareExchange(ref OnUpdate, value2, eventHandler2);
|
||||
}
|
||||
while (eventHandler != eventHandler2);
|
||||
}
|
||||
remove
|
||||
{
|
||||
EventHandler eventHandler = OnUpdate;
|
||||
EventHandler eventHandler2;
|
||||
do
|
||||
{
|
||||
eventHandler2 = eventHandler;
|
||||
EventHandler value2 = (EventHandler)Delegate.Remove(eventHandler2, value);
|
||||
eventHandler = Interlocked.CompareExchange(ref OnUpdate, value2, eventHandler2);
|
||||
}
|
||||
while (eventHandler != eventHandler2);
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnUpdated()
|
||||
{
|
||||
if (OnUpdate != null)
|
||||
{
|
||||
OnUpdate(this, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void AddToModelView(MinecraftModelView modelView);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using PckStudio.Models;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
internal class Steve64x32Model : ModelBase
|
||||
{
|
||||
public Steve64x32Model(Image texture)
|
||||
{
|
||||
textures = new Image[1] { texture };
|
||||
}
|
||||
|
||||
public override void AddToModelView(MinecraftModelView modelView)
|
||||
{
|
||||
_ = Textures[0] ?? throw new NullReferenceException(nameof(Textures));
|
||||
Image source = Textures[0];
|
||||
Box head = new Box(source, new Rectangle( 8, 0, 16, 8), new Rectangle( 0, 8, 32, 8), new Point3D(0f, 0f, 0f));
|
||||
Box headOverlay = new Box(source, new Rectangle(40, 0, 16, 8), new Rectangle(32, 8, 32, 8), new Point3D(0f, 0f, 0f));
|
||||
headOverlay.Scale = OverlayScale;
|
||||
|
||||
Box body = new Box(source, new Rectangle(20, 16, 16, 4), new Rectangle(16, 20, 24, 12), new Point3D(0f, 0f, 0f));
|
||||
|
||||
Box leftArm = new Box(source, new Rectangle(44, 16, 8, 4), new Rectangle(40, 20, 32, 12), new Point3D(0f, 4f, 0f));
|
||||
Box rightArm = new Box(source, new Rectangle(44, 16, 8, 4), new Rectangle(40, 20, 32, 12), new Point3D(0f, 4f, 0f));
|
||||
|
||||
Box leftLeg = new Box(source, new Rectangle(4, 16, 8, 4), new Rectangle(0, 20, 16, 12), new Point3D(0f, 6f, 0f));
|
||||
Box rightLeg = new Box(source, new Rectangle(4, 16, 8, 4), new Rectangle(0, 20, 16, 12), new Point3D(0f, 6f, 0f));
|
||||
|
||||
Object3DGroup headGroup = new Object3DGroup();
|
||||
|
||||
headGroup.RotationOrder = RotationOrders.XY;
|
||||
headGroup.MinDegrees1 = -80f;
|
||||
headGroup.MaxDegrees1 = 80f;
|
||||
|
||||
headGroup.MinDegrees2 = -57f;
|
||||
headGroup.MaxDegrees2 = 57f;
|
||||
|
||||
headGroup.Add(head);
|
||||
headGroup.Add(headOverlay);
|
||||
|
||||
headGroup.Position = new Point3D(0f, 8f, 0f);
|
||||
headGroup.Origin = new Point3D(0f, -4f, 0f);
|
||||
headGroup.RotationOrder = RotationOrders.XY;
|
||||
|
||||
body.Position = new Point3D(0f, 2f, 0f);
|
||||
|
||||
leftArm.Position = new Point3D(6f, 6f, 0f);
|
||||
leftArm.RotationOrder = RotationOrders.ZX;
|
||||
leftArm.MinDegrees1 = 0f;
|
||||
leftArm.MaxDegrees1 = 160f;
|
||||
leftArm.MinDegrees2 = -170f;
|
||||
leftArm.MaxDegrees2 = 60f;
|
||||
|
||||
rightArm.Position = new Point3D(-6f, 6f, 0f);
|
||||
rightArm.RotationOrder = RotationOrders.ZX;
|
||||
rightArm.MinDegrees1 = -160f;
|
||||
rightArm.MaxDegrees1 = 0f;
|
||||
rightArm.MinDegrees2 = -170f;
|
||||
rightArm.MaxDegrees2 = 60f;
|
||||
|
||||
leftLeg.Position = new Point3D(2f, -4f, 0f);
|
||||
leftLeg.RotationOrder = RotationOrders.ZX;
|
||||
leftLeg.MinDegrees1 = 0f;
|
||||
leftLeg.MaxDegrees1 = 70f;
|
||||
leftLeg.MinDegrees2 = -110f;
|
||||
leftLeg.MaxDegrees2 = 60f;
|
||||
|
||||
rightLeg.Position = new Point3D(-2f, -4f, 0f);
|
||||
rightLeg.RotationOrder = RotationOrders.ZX;
|
||||
rightLeg.MinDegrees1 = -70f;
|
||||
rightLeg.MaxDegrees1 = 0f;
|
||||
rightLeg.MinDegrees2 = -110f;
|
||||
rightLeg.MaxDegrees2 = 60f;
|
||||
|
||||
modelView.AddDynamic(headGroup);
|
||||
modelView.AddStatic(body);
|
||||
modelView.AddDynamic(rightArm);
|
||||
modelView.AddDynamic(leftArm);
|
||||
modelView.AddDynamic(rightLeg);
|
||||
modelView.AddDynamic(leftLeg);
|
||||
}
|
||||
|
||||
public override string ToString() => nameof(Steve64x32Model);
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Models;
|
||||
|
||||
namespace PckStudio.Classes.Models.DefaultModels
|
||||
{
|
||||
internal class Steve64x64Model : ModelBase
|
||||
{
|
||||
SkinANIM _skinANIM;
|
||||
public Steve64x64Model(Image texture, SkinANIM anim)
|
||||
{
|
||||
textures = new Image[1] { texture };
|
||||
_skinANIM = anim;
|
||||
}
|
||||
|
||||
public override void AddToModelView(MinecraftModelView modelView)
|
||||
{
|
||||
_ = Textures[0] ?? throw new NullReferenceException(nameof(Textures));
|
||||
Image source = Textures[0];
|
||||
|
||||
(int top, int side) armWidth = _skinANIM.GetFlag(SkinAnimFlag.SLIM_MODEL) ? (6, 14) : (8, 16);
|
||||
|
||||
Box head = new Box(source, new Rectangle(8, 0, 16, 8), new Rectangle(0, 8, 32, 8), new Point3D(0f, 0f, 0f));
|
||||
Box headOverlay = new Box(source, new Rectangle(40, 0, 16, 8), new Rectangle(32, 8, 32, 8), new Point3D(0f, 0f, 0f));
|
||||
headOverlay.Scale = OverlayScale;
|
||||
|
||||
Box body = new Box(source, new Rectangle(20, 16, 16, 4), new Rectangle(16, 20, 24, 12), new Point3D(0f, 0f, 0f));
|
||||
Box bodyOverlay = new Box(source, new Rectangle(20, 32, 16, 4), new Rectangle(16, 36, 24, 12), new Point3D(0f, 0f, 0f));
|
||||
bodyOverlay.Scale = OverlayScale;
|
||||
|
||||
Box rightArm = new Box(source, new Rectangle(44, 16, armWidth.top, 4), new Rectangle(40, 20, armWidth.side, 12), new Point3D(0f, 4f, 0f));
|
||||
Box rightArmOverlay = new Box(source, new Rectangle(44, 32, armWidth.top, 4), new Rectangle(40, 36, armWidth.side, 12), new Point3D(0f, 4f, 0f));
|
||||
rightArmOverlay.Scale = OverlayScale;
|
||||
|
||||
Box leftArm = new Box(source, new Rectangle(36, 48, armWidth.top, 4), new Rectangle(32, 52, armWidth.side, 12), new Point3D(0f, 4f, 0f));
|
||||
Box leftArmOverlay = new Box(source, new Rectangle(52, 48, armWidth.top, 4), new Rectangle(48, 52, armWidth.side, 12), new Point3D(0f, 4f, 0f));
|
||||
leftArmOverlay.Scale = OverlayScale;
|
||||
|
||||
Box rightLeg = new Box(source, new Rectangle(4, 16, 8, 4), new Rectangle(0, 20, 16, 12), new Point3D(0f, 6f, 0f));
|
||||
Box rightLegOverlay = new Box(source, new Rectangle(4, 32, 8, 4), new Rectangle(0, 52, 16, 12), new Point3D(0f, 6f, 0f));
|
||||
rightLegOverlay.Scale = OverlayScale;
|
||||
|
||||
Box leftLeg = new Box(source, new Rectangle(20, 48, 8, 4), new Rectangle(16, 52, 16, 12), new Point3D(0f, 6f, 0f));
|
||||
Box leftLegOverlay = new Box(source, new Rectangle( 4, 48, 8, 4), new Rectangle( 0, 52, 16, 12), new Point3D(0f, 6f, 0f));
|
||||
leftLegOverlay.Scale = OverlayScale;
|
||||
|
||||
Object3DGroup headGroup = new Object3DGroup();
|
||||
Object3DGroup bodyGroup = new Object3DGroup();
|
||||
Object3DGroup leftArmGroup = new Object3DGroup();
|
||||
Object3DGroup rightArmGroup = new Object3DGroup();
|
||||
Object3DGroup leftLegGroup = new Object3DGroup();
|
||||
Object3DGroup rightLegGroup = new Object3DGroup();
|
||||
|
||||
headGroup.RotationOrder = RotationOrders.XY;
|
||||
headGroup.MinDegrees1 = -80f;
|
||||
headGroup.MaxDegrees1 = 80f;
|
||||
|
||||
headGroup.MinDegrees2 = -57f;
|
||||
headGroup.MaxDegrees2 = 57f;
|
||||
|
||||
headGroup.Origin = new Point3D(0f, -4f, 0f);
|
||||
headGroup.RotationOrder = RotationOrders.XY;
|
||||
|
||||
headGroup.Position = new Point3D(0f, 8f, 0f);
|
||||
headGroup.Add(head);
|
||||
headGroup.Add(headOverlay);
|
||||
|
||||
bodyGroup.Position = new Point3D(0f, 2f, 0f);
|
||||
bodyGroup.Add(body);
|
||||
bodyGroup.Add(bodyOverlay);
|
||||
|
||||
leftArmGroup.Position = new Point3D(6f, 6f, 0f);
|
||||
leftArmGroup.RotationOrder = RotationOrders.ZX;
|
||||
leftArmGroup.MinDegrees1 = 0f;
|
||||
leftArmGroup.MaxDegrees1 = 160f;
|
||||
leftArmGroup.MinDegrees2 = -170f;
|
||||
leftArmGroup.MaxDegrees2 = 60f;
|
||||
leftArmGroup.Add(leftArm);
|
||||
leftArmGroup.Add(leftArmOverlay);
|
||||
|
||||
rightArmGroup.Position = new Point3D(-6f, 6f, 0f);
|
||||
rightArmGroup.RotationOrder = RotationOrders.ZX;
|
||||
rightArmGroup.MinDegrees1 = -160f;
|
||||
rightArmGroup.MaxDegrees1 = 0f;
|
||||
rightArmGroup.MinDegrees2 = -170f;
|
||||
rightArmGroup.MaxDegrees2 = 60f;
|
||||
rightArmGroup.Add(rightArm);
|
||||
rightArmGroup.Add(rightArmOverlay);
|
||||
|
||||
leftLegGroup.Position = new Point3D(2f, -4f, 0f);
|
||||
leftLegGroup.RotationOrder = RotationOrders.ZX;
|
||||
leftLegGroup.MinDegrees1 = 0f;
|
||||
leftLegGroup.MaxDegrees1 = 70f;
|
||||
leftLegGroup.MinDegrees2 = -110f;
|
||||
leftLegGroup.MaxDegrees2 = 60f;
|
||||
leftLegGroup.Add(leftLeg);
|
||||
leftLegGroup.Add(leftLegOverlay);
|
||||
|
||||
rightLegGroup.Position = new Point3D(-2f, -4f, 0f);
|
||||
rightLegGroup.RotationOrder = RotationOrders.ZX;
|
||||
rightLegGroup.MinDegrees1 = -70f;
|
||||
rightLegGroup.MaxDegrees1 = 0f;
|
||||
rightLegGroup.MinDegrees2 = -110f;
|
||||
rightLegGroup.MaxDegrees2 = 60f;
|
||||
rightLegGroup.Add(rightLeg);
|
||||
rightLegGroup.Add(rightLegOverlay);
|
||||
|
||||
modelView.AddDynamic(headGroup);
|
||||
modelView.AddStatic(bodyGroup);
|
||||
modelView.AddDynamic(rightArmGroup);
|
||||
modelView.AddDynamic(leftArmGroup);
|
||||
modelView.AddDynamic(rightLegGroup);
|
||||
modelView.AddDynamic(leftLegGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
[Flags]
|
||||
public enum Effects : byte
|
||||
{
|
||||
None = 0,
|
||||
FlipHorizontally = 1,
|
||||
FlipVertically = 2
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public struct Matrix3D
|
||||
{
|
||||
public Matrix3D(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
|
||||
{
|
||||
M11 = m11;
|
||||
M12 = m12;
|
||||
M13 = m13;
|
||||
M14 = m14;
|
||||
M21 = m21;
|
||||
M22 = m22;
|
||||
M23 = m23;
|
||||
M24 = m24;
|
||||
M31 = m31;
|
||||
M32 = m32;
|
||||
M33 = m33;
|
||||
M34 = m34;
|
||||
M41 = m41;
|
||||
M42 = m42;
|
||||
M43 = m43;
|
||||
M44 = m44;
|
||||
}
|
||||
|
||||
public static Matrix3D CreateRotationX(float radians)
|
||||
{
|
||||
float num = (float)Math.Sin((double)radians);
|
||||
float num2 = (float)Math.Cos((double)radians);
|
||||
return new Matrix3D(1f, 0f, 0f, 0f, 0f, num2, -num, 0f, 0f, num, num2, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateRotationX(float sin, float cos)
|
||||
{
|
||||
return new Matrix3D(1f, 0f, 0f, 0f, 0f, cos, -sin, 0f, 0f, sin, cos, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateRotationY(float radians)
|
||||
{
|
||||
float num = (float)Math.Sin((double)radians);
|
||||
float num2 = (float)Math.Cos((double)radians);
|
||||
return new Matrix3D(num2, 0f, num, 0f, 0f, 1f, 0f, 0f, -num, 0f, num2, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateRotationY(float sin, float cos)
|
||||
{
|
||||
return new Matrix3D(cos, 0f, sin, 0f, 0f, 1f, 0f, 0f, -sin, 0f, cos, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateRotationZ(float radians)
|
||||
{
|
||||
float num = (float)Math.Sin((double)radians);
|
||||
float num2 = (float)Math.Cos((double)radians);
|
||||
return new Matrix3D(num2, -num, 0f, 0f, num, num2, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateRotationZ(float sin, float cos)
|
||||
{
|
||||
return new Matrix3D(cos, -sin, 0f, 0f, sin, cos, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateTranslation(float x, float y, float z)
|
||||
{
|
||||
return new Matrix3D(1f, 0f, 0f, x, 0f, 1f, 0f, y, 0f, 0f, 1f, z, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateTranslation(Point3D point)
|
||||
{
|
||||
return new Matrix3D(1f, 0f, 0f, point.X, 0f, 1f, 0f, point.Y, 0f, 0f, 1f, point.Z, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public static Matrix3D CreateScale(float s)
|
||||
{
|
||||
return new Matrix3D(s, 0f, 0f, 0f, 0f, s, 0f, 0f, 0f, 0f, s, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
|
||||
public float Determinant
|
||||
{
|
||||
get
|
||||
{
|
||||
return M11 * M22 * M33 * M44 + M21 * M32 * M43 * M14 + M31 * M42 * M13 * M24 + M41 * M12 * M23 * M34 - M14 * M23 * M32 * M41 - M24 * M33 * M42 * M11 - M34 * M43 * M12 * M21 - M44 * M13 * M22 * M31;
|
||||
}
|
||||
}
|
||||
|
||||
public static Matrix3D Identity
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Matrix3D(1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f, 0f, 0f, 0f, 0f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public static Matrix3D Transpose(Matrix3D m)
|
||||
{
|
||||
return new Matrix3D(m.M11, m.M21, m.M31, m.M41, m.M12, m.M22, m.M32, m.M42, m.M13, m.M23, m.M33, m.M43, m.M14, m.M24, m.M34, m.M44);
|
||||
}
|
||||
|
||||
public static Matrix3D Invert(Matrix3D m)
|
||||
{
|
||||
float determinant = m.Determinant;
|
||||
return new Matrix3D((m.M22 * m.M33 * m.M44 + m.M32 * m.M43 * m.M24 + m.M42 * m.M23 * m.M34 - m.M24 * m.M33 * m.M42 - m.M34 * m.M43 * m.M22 - m.M44 * m.M23 * m.M32) / determinant, -(m.M12 * m.M33 * m.M44 + m.M32 * m.M43 * m.M14 + m.M42 * m.M13 * m.M34 - m.M14 * m.M33 * m.M42 - m.M34 * m.M43 * m.M12 - m.M44 * m.M13 * m.M32) / determinant, (m.M12 * m.M23 * m.M44 + m.M22 * m.M43 * m.M14 + m.M42 * m.M13 * m.M24 - m.M14 * m.M23 * m.M42 - m.M24 * m.M43 * m.M12 - m.M44 * m.M13 * m.M22) / determinant, -(m.M12 * m.M23 * m.M34 + m.M22 * m.M33 * m.M14 + m.M32 * m.M13 * m.M24 - m.M14 * m.M23 * m.M32 - m.M24 * m.M33 * m.M12 - m.M34 * m.M13 * m.M22) / determinant, -(m.M21 * m.M33 * m.M44 + m.M31 * m.M43 * m.M24 + m.M41 * m.M23 * m.M34 - m.M24 * m.M33 * m.M41 - m.M34 * m.M43 * m.M21 - m.M44 * m.M23 * m.M31) / determinant, (m.M11 * m.M33 * m.M44 + m.M31 * m.M43 * m.M14 + m.M41 * m.M13 * m.M34 - m.M14 * m.M33 * m.M41 - m.M34 * m.M43 * m.M11 - m.M44 * m.M13 * m.M31) / determinant, -(m.M11 * m.M23 * m.M44 + m.M21 * m.M43 * m.M14 + m.M41 * m.M13 * m.M24 - m.M14 * m.M23 * m.M41 - m.M24 * m.M43 * m.M11 - m.M44 * m.M13 * m.M21) / determinant, (m.M11 * m.M23 * m.M34 + m.M21 * m.M33 * m.M14 + m.M31 * m.M13 * m.M24 - m.M14 * m.M23 * m.M31 - m.M24 * m.M33 * m.M11 - m.M34 * m.M13 * m.M21) / determinant, (m.M21 * m.M32 * m.M44 + m.M31 * m.M42 * m.M24 + m.M41 * m.M22 * m.M34 - m.M24 * m.M32 * m.M41 - m.M34 * m.M42 * m.M21 - m.M44 * m.M22 * m.M31) / determinant, -(m.M11 * m.M32 * m.M44 + m.M31 * m.M42 * m.M14 + m.M41 * m.M12 * m.M34 - m.M14 * m.M32 * m.M41 - m.M34 * m.M42 * m.M11 - m.M44 * m.M12 * m.M31) / determinant, (m.M11 * m.M32 * m.M44 + m.M21 * m.M42 * m.M14 + m.M41 * m.M12 * m.M24 - m.M14 * m.M22 * m.M41 - m.M24 * m.M42 * m.M11 - m.M44 * m.M12 * m.M21) / determinant, -(m.M11 * m.M22 * m.M34 + m.M21 * m.M32 * m.M14 + m.M31 * m.M12 * m.M24 - m.M14 * m.M22 * m.M31 - m.M24 * m.M32 * m.M11 - m.M34 * m.M12 * m.M21) / determinant, -(m.M21 * m.M32 * m.M43 + m.M31 * m.M42 * m.M23 + m.M41 * m.M22 * m.M33 - m.M23 * m.M32 * m.M41 - m.M33 * m.M42 * m.M21 - m.M43 * m.M22 * m.M31) / determinant, (m.M11 * m.M32 * m.M43 + m.M31 * m.M42 * m.M13 + m.M41 * m.M12 * m.M33 - m.M13 * m.M32 * m.M41 - m.M33 * m.M42 * m.M11 - m.M43 * m.M12 * m.M31) / determinant, -(m.M11 * m.M22 * m.M43 + m.M21 * m.M42 * m.M13 + m.M41 * m.M12 * m.M23 - m.M13 * m.M22 * m.M41 - m.M23 * m.M42 * m.M11 - m.M43 * m.M12 * m.M21) / determinant, (m.M11 * m.M22 * m.M33 + m.M21 * m.M32 * m.M13 + m.M31 * m.M12 * m.M23 - m.M13 * m.M22 * m.M31 - m.M23 * m.M32 * m.M11 - m.M33 * m.M12 * m.M21) / determinant);
|
||||
}
|
||||
|
||||
public static Matrix3D operator +(Matrix3D a, Matrix3D b)
|
||||
{
|
||||
return new Matrix3D(a.M11 + b.M11, a.M12 + b.M12, a.M13 + b.M13, a.M14 + b.M14, a.M21 + b.M21, a.M22 + b.M22, a.M23 + b.M23, a.M24 + b.M24, a.M31 + b.M31, a.M32 + b.M32, a.M33 + b.M33, a.M34 + b.M34, a.M41 + b.M41, a.M42 + b.M42, a.M43 + b.M43, a.M44 + b.M44);
|
||||
}
|
||||
|
||||
public static Matrix3D operator -(Matrix3D a, Matrix3D b)
|
||||
{
|
||||
return new Matrix3D(a.M11 - b.M11, a.M12 - b.M12, a.M13 - b.M13, a.M14 - b.M14, a.M21 - b.M21, a.M22 - b.M22, a.M23 - b.M23, a.M24 - b.M24, a.M31 - b.M31, a.M32 - b.M32, a.M33 - b.M33, a.M34 - b.M34, a.M41 - b.M41, a.M42 - b.M42, a.M43 - b.M43, a.M44 - b.M44);
|
||||
}
|
||||
|
||||
public static Matrix3D operator *(Matrix3D a, Matrix3D b)
|
||||
{
|
||||
return new Matrix3D(a.M11 * b.M11 + a.M12 * b.M21 + a.M13 * b.M31 + a.M14 * b.M41, a.M11 * b.M12 + a.M12 * b.M22 + a.M13 * b.M32 + a.M14 * b.M42, a.M11 * b.M13 + a.M12 * b.M23 + a.M13 * b.M33 + a.M14 * b.M43, a.M11 * b.M14 + a.M12 * b.M24 + a.M13 * b.M34 + a.M14 * b.M44, a.M21 * b.M11 + a.M22 * b.M21 + a.M23 * b.M31 + a.M24 * b.M41, a.M21 * b.M12 + a.M22 * b.M22 + a.M23 * b.M32 + a.M24 * b.M42, a.M21 * b.M13 + a.M22 * b.M23 + a.M23 * b.M33 + a.M24 * b.M43, a.M21 * b.M14 + a.M22 * b.M24 + a.M23 * b.M34 + a.M24 * b.M44, a.M31 * b.M11 + a.M32 * b.M21 + a.M33 * b.M31 + a.M34 * b.M41, a.M31 * b.M12 + a.M32 * b.M22 + a.M33 * b.M32 + a.M34 * b.M42, a.M31 * b.M13 + a.M32 * b.M23 + a.M33 * b.M33 + a.M34 * b.M43, a.M31 * b.M14 + a.M32 * b.M24 + a.M33 * b.M34 + a.M34 * b.M44, a.M41 * b.M11 + a.M42 * b.M21 + a.M43 * b.M31 + a.M44 * b.M41, a.M41 * b.M12 + a.M42 * b.M22 + a.M43 * b.M32 + a.M44 * b.M42, a.M41 * b.M13 + a.M42 * b.M23 + a.M43 * b.M33 + a.M44 * b.M43, a.M41 * b.M14 + a.M42 * b.M24 + a.M43 * b.M34 + a.M44 * b.M44);
|
||||
}
|
||||
|
||||
public static Point3D operator *(Matrix3D m, Point3D p)
|
||||
{
|
||||
return new Point3D(p.X * m.M11 + p.Y * m.M12 + p.Z * m.M13 + m.M14, p.X * m.M21 + p.Y * m.M22 + p.Z * m.M23 + m.M24, p.X * m.M31 + p.Y * m.M32 + p.Z * m.M33 + m.M34);
|
||||
}
|
||||
|
||||
public static Matrix3D operator +(Matrix3D m, float n)
|
||||
{
|
||||
return new Matrix3D(m.M11 + n, m.M12 + n, m.M13 + n, m.M14 + n, m.M21 + n, m.M22 + n, m.M23 + n, m.M24 + n, m.M31 + n, m.M32 + n, m.M33 + n, m.M34 + n, m.M41 + n, m.M42 + n, m.M43 + n, m.M44 + n);
|
||||
}
|
||||
|
||||
public static Matrix3D operator -(Matrix3D m, float n)
|
||||
{
|
||||
return new Matrix3D(m.M11 - n, m.M12 - n, m.M13 - n, m.M14 - n, m.M21 - n, m.M22 - n, m.M23 - n, m.M24 - n, m.M31 - n, m.M32 - n, m.M33 - n, m.M34 - n, m.M41 - n, m.M42 - n, m.M43 - n, m.M44 - n);
|
||||
}
|
||||
|
||||
public static Matrix3D operator *(Matrix3D m, float n)
|
||||
{
|
||||
return new Matrix3D(m.M11 * n, m.M12 * n, m.M13 * n, m.M14 * n, m.M21 * n, m.M22 * n, m.M23 * n, m.M24 * n, m.M31 * n, m.M32 * n, m.M33 * n, m.M34 * n, m.M41 * n, m.M42 * n, m.M43 * n, m.M44 * n);
|
||||
}
|
||||
|
||||
public static Matrix3D operator /(Matrix3D m, float n)
|
||||
{
|
||||
return new Matrix3D(m.M11 / n, m.M12 / n, m.M13 / n, m.M14 / n, m.M21 / n, m.M22 / n, m.M23 / n, m.M24 / n, m.M31 / n, m.M32 / n, m.M33 / n, m.M34 / n, m.M41 / n, m.M42 / n, m.M43 / n, m.M44 / n);
|
||||
}
|
||||
|
||||
public float M11;
|
||||
|
||||
public float M12;
|
||||
|
||||
public float M13;
|
||||
|
||||
public float M14;
|
||||
|
||||
public float M21;
|
||||
|
||||
public float M22;
|
||||
|
||||
public float M23;
|
||||
|
||||
public float M24;
|
||||
|
||||
public float M31;
|
||||
|
||||
public float M32;
|
||||
|
||||
public float M33;
|
||||
|
||||
public float M34;
|
||||
|
||||
public float M41;
|
||||
|
||||
public float M42;
|
||||
|
||||
public float M43;
|
||||
|
||||
public float M44;
|
||||
}
|
||||
}
|
||||
71
PCK-Studio/Classes/Models/ModelView.Designer.cs
generated
71
PCK-Studio/Classes/Models/ModelView.Designer.cs
generated
@@ -1,71 +0,0 @@
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
partial class MinecraftModelView
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
|
||||
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && this.components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
|
||||
private PckStudio.Models.BackgroundTypes backgroundType;
|
||||
|
||||
private System.Drawing.Brush backgroundBrush = new System.Drawing.SolidBrush(System.Drawing.Color.SkyBlue);
|
||||
|
||||
private System.ComponentModel.BackgroundWorker downloader = new System.ComponentModel.BackgroundWorker();
|
||||
|
||||
private System.Drawing.Point mouseLastLocation;
|
||||
|
||||
private PckStudio.Models.Object3D rotatingObject3D;
|
||||
|
||||
private System.Drawing.Color backgroundColor = System.Drawing.Color.Transparent;
|
||||
|
||||
private System.Drawing.Color backgroundGradientColor1 = System.Drawing.SystemColors.ControlDarkDark;
|
||||
|
||||
private System.Drawing.Color backgroundGradientColor2 = System.Drawing.SystemColors.ControlLightLight;
|
||||
|
||||
private static System.Drawing.Color textShadowColor = System.Drawing.Color.FromArgb(0x3F, 0x3F, 0x3F);
|
||||
|
||||
private System.Drawing.Image backgroundTexture;
|
||||
|
||||
internal PckStudio.Models.Matrix3D GlobalTransformation = PckStudio.Models.Matrix3D.Identity;
|
||||
|
||||
private System.Collections.Generic.List<PckStudio.Models.Texel> texelList = new System.Collections.Generic.List<PckStudio.Models.Texel>();
|
||||
|
||||
private PckStudio.Models.TexelComparer texelComparer = new PckStudio.Models.TexelComparer();
|
||||
|
||||
private System.Collections.Generic.List<PckStudio.Models.Object3D> object3DList = new System.Collections.Generic.List<PckStudio.Models.Object3D>();
|
||||
|
||||
private System.Collections.Generic.List<PckStudio.Models.Object3D> dynamicObject3DtList = new System.Collections.Generic.List<PckStudio.Models.Object3D>();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,431 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public partial class MinecraftModelView : Control
|
||||
{
|
||||
private const int IsometricFOV = 46;
|
||||
|
||||
internal float cameraZ = 31.4285717f;
|
||||
|
||||
private int Fov = 70;
|
||||
|
||||
private float scale = 1f;
|
||||
|
||||
internal float RotationX;
|
||||
|
||||
internal float RotationY;
|
||||
|
||||
private bool perspective = true;
|
||||
|
||||
private float PiBy180 = 0.0174532924f;
|
||||
|
||||
protected override void OnBackColorChanged(EventArgs e)
|
||||
{
|
||||
base.OnBackColorChanged(e);
|
||||
backgroundColor = BackColor;
|
||||
UpdateBackgroundBrush();
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("Appearance")]
|
||||
public System.Drawing.Color BackGradientColor1
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundGradientColor1;
|
||||
}
|
||||
set
|
||||
{
|
||||
backgroundGradientColor1 = value;
|
||||
UpdateBackgroundBrush();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("Appearance")]
|
||||
public System.Drawing.Color BackGradientColor2
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundGradientColor2;
|
||||
}
|
||||
set
|
||||
{
|
||||
backgroundGradientColor2 = value;
|
||||
UpdateBackgroundBrush();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("Appearance")]
|
||||
public new System.Drawing.Image BackgroundImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundTexture;
|
||||
}
|
||||
set
|
||||
{
|
||||
backgroundTexture = value;
|
||||
UpdateBackgroundBrush();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("Appearance")]
|
||||
public BackgroundTypes BackgroundType
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundType;
|
||||
}
|
||||
set
|
||||
{
|
||||
backgroundType = value;
|
||||
UpdateBackgroundBrush();
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("View")]
|
||||
public ProjectionTypes Projection
|
||||
{
|
||||
get
|
||||
{
|
||||
return perspective ? ProjectionTypes.Perspective : ProjectionTypes.Isometric;
|
||||
}
|
||||
set
|
||||
{
|
||||
perspective = value == ProjectionTypes.Perspective;
|
||||
SetupProjection();
|
||||
foreach (Object3D object3D in object3DList)
|
||||
{
|
||||
object3D.Update();
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("View")]
|
||||
public int FOV
|
||||
{
|
||||
get
|
||||
{
|
||||
return Fov;
|
||||
}
|
||||
set
|
||||
{
|
||||
Fov = value;
|
||||
SetupProjection();
|
||||
foreach (Object3D object3D in object3DList)
|
||||
{
|
||||
object3D.Update();
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("View")]
|
||||
public int DegreesX
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)RotationX;
|
||||
}
|
||||
set
|
||||
{
|
||||
RotationX = value;
|
||||
Matrix3D globalTransformation = Matrix3D.CreateRotationX(RotationX * PiBy180) * Matrix3D.CreateRotationY(RotationY * PiBy180);
|
||||
foreach (Object3D object3D in object3DList)
|
||||
{
|
||||
object3D.GlobalTransformation = globalTransformation;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(true)]
|
||||
[Category("View")]
|
||||
public int DegreesY
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int)RotationY;
|
||||
}
|
||||
set
|
||||
{
|
||||
RotationY = value;
|
||||
Matrix3D globalTransformation = Matrix3D.CreateRotationX(RotationX * PiBy180) * Matrix3D.CreateRotationY(RotationY * PiBy180);
|
||||
foreach (Object3D object3D in object3DList)
|
||||
{
|
||||
object3D.GlobalTransformation = globalTransformation;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public ModelBase Model
|
||||
{
|
||||
set
|
||||
{
|
||||
Clear();
|
||||
value.AddToModelView(this);
|
||||
Matrix3D globalTransformation = Matrix3D.CreateRotationX(RotationX * 3.14159274f / 180f) * Matrix3D.CreateRotationY(RotationY * 3.14159274f / 180f);
|
||||
foreach (Object3D object3D in object3DList)
|
||||
{
|
||||
object3D.GlobalTransformation = globalTransformation;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void Clear()
|
||||
{
|
||||
texelList.Clear();
|
||||
object3DList.Clear();
|
||||
dynamicObject3DtList.Clear();
|
||||
rotatingObject3D = null;
|
||||
}
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs pevent)
|
||||
{
|
||||
base.OnPaintBackground(pevent);
|
||||
System.Drawing.Graphics graphics = pevent.Graphics;
|
||||
graphics.CompositingQuality = CompositingQuality.HighSpeed;
|
||||
graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
|
||||
graphics.SmoothingMode = SmoothingMode.HighSpeed;
|
||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
graphics.FillRectangle(backgroundBrush, ClientRectangle);
|
||||
graphics.CompositingMode = CompositingMode.SourceOver;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
texelList.Sort(texelComparer);
|
||||
System.Drawing.Graphics graphics = pe.Graphics;
|
||||
graphics.TranslateTransform(Width / 2, Height / 2);
|
||||
graphics.ScaleTransform(scale, -scale);
|
||||
graphics.CompositingQuality = CompositingQuality.HighSpeed;
|
||||
graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
|
||||
graphics.SmoothingMode = SmoothingMode.HighSpeed;
|
||||
graphics.CompositingMode = CompositingMode.SourceCopy;
|
||||
for (int i = 0; i < texelList.Count; i++)
|
||||
{
|
||||
texelList[i].Draw(graphics);
|
||||
}
|
||||
}
|
||||
|
||||
public System.Drawing.Image RenderToImage(System.Drawing.Size size, System.Drawing.RectangleF crop)
|
||||
{
|
||||
if (size.Width / size.Height != crop.Width / crop.Height)
|
||||
{
|
||||
throw new ArgumentException("Aspect ratio is ambiguous");
|
||||
}
|
||||
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(size.Width, size.Height);
|
||||
using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap))
|
||||
{
|
||||
System.Drawing.Size size2 = new System.Drawing.Size((int)(size.Width / crop.Width), (int)(size.Height / crop.Height));
|
||||
texelList.Sort(texelComparer);
|
||||
graphics.TranslateTransform(-crop.Left * size2.Width, -crop.Top * size2.Height);
|
||||
graphics.TranslateTransform(size2.Width / 2, size2.Height / 2);
|
||||
float num = Math.Min(size2.Width, size2.Height) * 0.01f / (float)Math.Tan((perspective ? Fov : IsometricFOV) * 3.1415926535897931 / 360.0);
|
||||
graphics.ScaleTransform(num, -num);
|
||||
graphics.CompositingQuality = CompositingQuality.HighSpeed;
|
||||
graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.HighSpeed;
|
||||
graphics.SmoothingMode = SmoothingMode.HighSpeed;
|
||||
graphics.Clear(System.Drawing.Color.Transparent);
|
||||
for (int i = 0; i < texelList.Count; i++)
|
||||
{
|
||||
texelList[i].Draw(graphics);
|
||||
}
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
private System.Drawing.Image RenderVersionText()
|
||||
{
|
||||
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(0x154, 0x12);
|
||||
Version version = new Version(Application.ProductVersion);
|
||||
string s = string.Format("{0} {1}.{2}{3}", Application.ProductName, version.Major, version.Minor, (version.Build != 0) ? ("." + version.Build) : "");
|
||||
using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(bitmap))
|
||||
{
|
||||
using (System.Drawing.Brush brush = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(0x7F, System.Drawing.Color.Gray)))
|
||||
{
|
||||
graphics.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
|
||||
graphics.DrawString(s, Font, brush, 1f, 1f);
|
||||
graphics.DrawString(s, Font, System.Drawing.Brushes.White, 0f, 0f);
|
||||
}
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
private void UpdateBackgroundBrush()
|
||||
{
|
||||
backgroundBrush = ((backgroundType == BackgroundTypes.Texture) ? new System.Drawing.TextureBrush(backgroundTexture) : ((backgroundType == BackgroundTypes.Gradient) ? new System.Drawing.Drawing2D.LinearGradientBrush(new System.Drawing.Point(0, 0), new System.Drawing.Point(0, System.Math.Max(1, base.Height)), backgroundGradientColor1, backgroundGradientColor2) : new System.Drawing.SolidBrush(backgroundColor)));
|
||||
}
|
||||
|
||||
public System.Drawing.Brush GetBackgroundBrush(System.Drawing.Size size)
|
||||
{
|
||||
if (backgroundType == BackgroundTypes.Texture)
|
||||
{
|
||||
return new System.Drawing.TextureBrush(backgroundTexture);
|
||||
}
|
||||
if (backgroundType != BackgroundTypes.Gradient)
|
||||
{
|
||||
return new System.Drawing.SolidBrush(backgroundColor);
|
||||
}
|
||||
return new LinearGradientBrush(new System.Drawing.Point(0, 0), new System.Drawing.Point(0, Math.Max(1, size.Height)), backgroundGradientColor1, backgroundGradientColor2);
|
||||
}
|
||||
|
||||
private void SetupProjection()
|
||||
{
|
||||
cameraZ = 2400f / Fov;
|
||||
scale = Math.Min(Width, Height) * 0.01f / (float)Math.Tan((perspective ? Fov : IsometricFOV) * Math.PI / 360.0);
|
||||
}
|
||||
|
||||
protected override void OnResize(EventArgs e)
|
||||
{
|
||||
SetupProjection();
|
||||
UpdateBackgroundBrush();
|
||||
base.OnResize(e);
|
||||
}
|
||||
|
||||
internal void RemoveTexelsOf(TexturePlane texturePlane)
|
||||
{
|
||||
for (int i = 0; i < texelList.Count; i++)
|
||||
{
|
||||
if (texelList[i].TexturePlane == texturePlane)
|
||||
{
|
||||
texelList.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddTexel(Texel texel)
|
||||
{
|
||||
texelList.Add(texel);
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
System.Drawing.PointF location = new System.Drawing.PointF((e.X - Width * 0.5f) / scale, -(e.Y - Height * 0.5f) / scale);
|
||||
rotatingObject3D = null;
|
||||
Object3D item = null;
|
||||
float num = -1000f;
|
||||
foreach (Object3D object3D in object3DList)
|
||||
{
|
||||
float num2 = object3D.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
item = object3D;
|
||||
}
|
||||
}
|
||||
if (num > -1000f && dynamicObject3DtList.Contains(item))
|
||||
{
|
||||
rotatingObject3D = item;
|
||||
}
|
||||
mouseLastLocation = e.Location;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseUp(e);
|
||||
rotatingObject3D = null;
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
if (e.Button != MouseButtons.Left)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (rotatingObject3D != null)
|
||||
{
|
||||
rotatingObject3D.RotateByMouse((e.X - mouseLastLocation.X) * 400f / Height, (e.Y - mouseLastLocation.Y) * 400f / Height);
|
||||
mouseLastLocation = e.Location;
|
||||
Invalidate();
|
||||
return;
|
||||
}
|
||||
RotationY += (e.X - mouseLastLocation.X) * 400f / Height;
|
||||
RotationX += (e.Y - mouseLastLocation.Y) * 400f / Height;
|
||||
mouseLastLocation = e.Location;
|
||||
Matrix3D globalTransformation = Matrix3D.CreateRotationX(RotationX * 3.14159274f / 180f) * Matrix3D.CreateRotationY(RotationY * 3.14159274f / 180f);
|
||||
foreach (Object3D object3D in object3DList)
|
||||
{
|
||||
object3D.GlobalTransformation = globalTransformation;
|
||||
}
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
public void AddStatic(Object3D object3D)
|
||||
{
|
||||
object3D.Viewport = this;
|
||||
object3DList.Add(object3D);
|
||||
foreach (Object3D object3D2 in object3DList)
|
||||
{
|
||||
object3D2.Update();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddDynamic(Object3D object3D)
|
||||
{
|
||||
AddStatic(object3D);
|
||||
dynamicObject3DtList.Add(object3D);
|
||||
}
|
||||
|
||||
internal System.Drawing.PointF Point3DTo2D(Point3D point3D)
|
||||
{
|
||||
if (perspective)
|
||||
{
|
||||
return new System.Drawing.PointF(point3D.X * (-50f / (point3D.Z - cameraZ)), point3D.Y * (-50f / (point3D.Z - cameraZ)));
|
||||
}
|
||||
return new System.Drawing.PointF(point3D.X, point3D.Y);
|
||||
}
|
||||
|
||||
internal float GetZOrder(Point3D point3D)
|
||||
{
|
||||
if (perspective)
|
||||
{
|
||||
return point3D.X * point3D.X + point3D.Y * point3D.Y + (cameraZ - point3D.Z) * (cameraZ - point3D.Z);
|
||||
}
|
||||
return -point3D.Z;
|
||||
}
|
||||
|
||||
public MinecraftModelView()
|
||||
{
|
||||
SetStyle(ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
InitializeComponent();
|
||||
texelComparer = new TexelComparer();
|
||||
}
|
||||
|
||||
public MinecraftModelView(IContainer container) : this()
|
||||
{
|
||||
container.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,461 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public abstract class Object3D
|
||||
{
|
||||
public abstract Image Image { set; }
|
||||
|
||||
public float Angle1
|
||||
{
|
||||
get
|
||||
{
|
||||
return angle1;
|
||||
}
|
||||
set
|
||||
{
|
||||
angle1 = value;
|
||||
OnUpdateRotation();
|
||||
}
|
||||
}
|
||||
|
||||
public float Angle2
|
||||
{
|
||||
get
|
||||
{
|
||||
return angle2;
|
||||
}
|
||||
set
|
||||
{
|
||||
angle2 = value;
|
||||
OnUpdateRotation();
|
||||
}
|
||||
}
|
||||
|
||||
public float MinAngle1
|
||||
{
|
||||
get
|
||||
{
|
||||
return minAngle1;
|
||||
}
|
||||
set
|
||||
{
|
||||
minAngle1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MinAngle2
|
||||
{
|
||||
get
|
||||
{
|
||||
return minAngle2;
|
||||
}
|
||||
set
|
||||
{
|
||||
minAngle2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MaxAngle1
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxAngle1;
|
||||
}
|
||||
set
|
||||
{
|
||||
maxAngle1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float MaxAngle2
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxAngle2;
|
||||
}
|
||||
set
|
||||
{
|
||||
maxAngle2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float AngleRange1
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxAngle1 - minAngle1;
|
||||
}
|
||||
set
|
||||
{
|
||||
minAngle1 = angle1 - value / 2f;
|
||||
maxAngle1 = angle1 + value / 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public float AngleRange2
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxAngle2 - minAngle2;
|
||||
}
|
||||
set
|
||||
{
|
||||
minAngle2 = angle2 - value / 2f;
|
||||
maxAngle2 = angle2 + value / 2f;
|
||||
}
|
||||
}
|
||||
|
||||
public float MinDegrees1
|
||||
{
|
||||
get
|
||||
{
|
||||
return minAngle1 / PIby180;
|
||||
}
|
||||
set
|
||||
{
|
||||
minAngle1 = value * PIby180;
|
||||
}
|
||||
}
|
||||
|
||||
public float MinDegrees2
|
||||
{
|
||||
get
|
||||
{
|
||||
return minAngle2 / PIby180;
|
||||
}
|
||||
set
|
||||
{
|
||||
minAngle2 = value * PIby180;
|
||||
}
|
||||
}
|
||||
|
||||
public float MaxDegrees1
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxAngle1 / PIby180;
|
||||
}
|
||||
set
|
||||
{
|
||||
maxAngle1 = value * PIby180;
|
||||
}
|
||||
}
|
||||
|
||||
public float MaxDegrees2
|
||||
{
|
||||
get
|
||||
{
|
||||
return maxAngle2 / PIby180;
|
||||
}
|
||||
set
|
||||
{
|
||||
maxAngle2 = value * PIby180;
|
||||
}
|
||||
}
|
||||
|
||||
public float DegreesRange1
|
||||
{
|
||||
get
|
||||
{
|
||||
return AngleRange1 / PIby180;
|
||||
}
|
||||
set
|
||||
{
|
||||
AngleRange1 = value * PIby180;
|
||||
}
|
||||
}
|
||||
|
||||
public float DegreesRange2
|
||||
{
|
||||
get
|
||||
{
|
||||
return AngleRange2 / PIby180;
|
||||
}
|
||||
set
|
||||
{
|
||||
AngleRange2 = value * PIby180;
|
||||
}
|
||||
}
|
||||
|
||||
public float Scale
|
||||
{
|
||||
get
|
||||
{
|
||||
return scaleTransformation.M11;
|
||||
}
|
||||
set
|
||||
{
|
||||
scaleTransformation = Matrix3D.CreateScale(value);
|
||||
UpdateRotation();
|
||||
}
|
||||
}
|
||||
|
||||
public RotationOrders RotationOrder
|
||||
{
|
||||
get
|
||||
{
|
||||
return order;
|
||||
}
|
||||
set
|
||||
{
|
||||
order = value;
|
||||
switch (order)
|
||||
{
|
||||
case RotationOrders.XY:
|
||||
Rotate = new RotateMethod(RotateXY);
|
||||
OnUpdateRotation = UpdateRotationXY;
|
||||
return;
|
||||
case RotationOrders.YX:
|
||||
Rotate = new RotateMethod(RotateYX);
|
||||
OnUpdateRotation = UpdateRotationYX;
|
||||
return;
|
||||
case RotationOrders.XZ:
|
||||
Rotate = new RotateMethod(RotateXZ);
|
||||
OnUpdateRotation = UpdateRotationXZ;
|
||||
return;
|
||||
case RotationOrders.ZX:
|
||||
Rotate = new RotateMethod(RotateZX);
|
||||
OnUpdateRotation = UpdateRotationZX;
|
||||
return;
|
||||
case RotationOrders.YZ:
|
||||
Rotate = new RotateMethod(RotateYZ);
|
||||
OnUpdateRotation = UpdateRotationYZ;
|
||||
return;
|
||||
case RotationOrders.ZY:
|
||||
Rotate = new RotateMethod(RotateZY);
|
||||
OnUpdateRotation = UpdateRotationZY;
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal virtual MinecraftModelView Viewport
|
||||
{
|
||||
set
|
||||
{
|
||||
viewport = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Point3D Origin
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Point3D(-originTranslation.M14, -originTranslation.M24, -originTranslation.M34);
|
||||
}
|
||||
set
|
||||
{
|
||||
originTranslation = Matrix3D.CreateTranslation(-value.X, -value.Y, -value.Z);
|
||||
UpdateRotation();
|
||||
}
|
||||
}
|
||||
|
||||
public Point3D Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Point3D(positionTranslation.M14, positionTranslation.M24, positionTranslation.M34);
|
||||
}
|
||||
set
|
||||
{
|
||||
positionTranslation = Matrix3D.CreateTranslation(value);
|
||||
UpdateRotation();
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract void Update();
|
||||
|
||||
public Matrix3D GlobalTransformation
|
||||
{
|
||||
get
|
||||
{
|
||||
return globalTransformation;
|
||||
}
|
||||
set
|
||||
{
|
||||
globalTransformation = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix3D LocalTransformation
|
||||
{
|
||||
get
|
||||
{
|
||||
return localTransformation;
|
||||
}
|
||||
set
|
||||
{
|
||||
localTransformation = value;
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRotation(float angle1, float angle2)
|
||||
{
|
||||
this.angle1 = angle1;
|
||||
this.angle2 = angle2;
|
||||
OnUpdateRotation();
|
||||
}
|
||||
|
||||
public void RotateByMouse(float deltaX, float deltaY)
|
||||
{
|
||||
if (Rotate != null)
|
||||
{
|
||||
Rotate(deltaX, deltaY);
|
||||
Update();
|
||||
}
|
||||
}
|
||||
|
||||
private void CorrectAngles()
|
||||
{
|
||||
if (angle1 > maxAngle1)
|
||||
{
|
||||
angle1 = maxAngle1;
|
||||
}
|
||||
else if (angle1 < minAngle1)
|
||||
{
|
||||
angle1 = minAngle1;
|
||||
}
|
||||
if (angle2 > maxAngle2)
|
||||
{
|
||||
angle2 = maxAngle2;
|
||||
return;
|
||||
}
|
||||
if (angle2 < minAngle2)
|
||||
{
|
||||
angle2 = minAngle2;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract float HitTest(PointF location);
|
||||
|
||||
private void RotateXY(float delta1, float delta2)
|
||||
{
|
||||
angle1 += delta1 * PIby180;
|
||||
angle2 += delta2 * PIby180 * (float)Math.Cos((double)(viewport.RotationY * PIby180));
|
||||
UpdateRotationXY();
|
||||
}
|
||||
|
||||
private void RotateYX(float delta1, float delta2)
|
||||
{
|
||||
angle1 += delta1 * PIby180;
|
||||
angle2 += delta2 * PIby180 * (float)Math.Cos(viewport.RotationY * 3.1415926535897931 / 180.0);
|
||||
UpdateRotationYX();
|
||||
}
|
||||
|
||||
private void RotateXZ(float delta1, float delta2)
|
||||
{
|
||||
angle1 += delta1 * PIby180 * (float)Math.Cos((double)(viewport.RotationY * PIby180)) + delta2 * PIby180 * (float)Math.Sin((double)(viewport.RotationY * PIby180));
|
||||
angle2 += delta2 * PIby180 * (float)Math.Cos((double)(viewport.RotationY * PIby180)) - delta1 * PIby180 * (float)Math.Sin((double)(viewport.RotationY * PIby180));
|
||||
UpdateRotationXZ();
|
||||
}
|
||||
|
||||
private void RotateZX(float delta1, float delta2)
|
||||
{
|
||||
angle1 += delta1 * PIby180 * (float)Math.Cos((double)(viewport.RotationY * PIby180)) + delta2 * PIby180 * (float)Math.Sin((double)(viewport.RotationY * PIby180));
|
||||
angle2 += delta2 * PIby180 * (float)Math.Cos((double)(viewport.RotationY * PIby180)) - delta1 * PIby180 * (float)Math.Sin((double)(viewport.RotationY * PIby180));
|
||||
UpdateRotationZX();
|
||||
}
|
||||
|
||||
private void RotateZY(float delta1, float delta2)
|
||||
{
|
||||
angle1 -= delta2 * PIby180;
|
||||
angle2 += delta1 * PIby180;
|
||||
UpdateRotationZY();
|
||||
}
|
||||
|
||||
private void RotateYZ(float delta1, float delta2)
|
||||
{
|
||||
angle1 += delta1 * PIby180;
|
||||
angle2 += delta2 * PIby180 * (float)Math.Sin((double)(viewport.RotationY * PIby180));
|
||||
UpdateRotationYZ();
|
||||
}
|
||||
|
||||
private void UpdateRotationXY()
|
||||
{
|
||||
CorrectAngles();
|
||||
localRotation = Matrix3D.CreateRotationY(angle1) * Matrix3D.CreateRotationX(angle2);
|
||||
UpdateRotation();
|
||||
}
|
||||
|
||||
private void UpdateRotationYX()
|
||||
{
|
||||
CorrectAngles();
|
||||
localRotation = Matrix3D.CreateRotationX(angle2) * Matrix3D.CreateRotationY(angle1);
|
||||
UpdateRotation();
|
||||
}
|
||||
|
||||
private void UpdateRotationXZ()
|
||||
{
|
||||
CorrectAngles();
|
||||
localRotation = Matrix3D.CreateRotationZ(angle1) * Matrix3D.CreateRotationX(angle2);
|
||||
UpdateRotation();
|
||||
}
|
||||
|
||||
private void UpdateRotationZX()
|
||||
{
|
||||
CorrectAngles();
|
||||
localRotation = Matrix3D.CreateRotationX(angle2) * Matrix3D.CreateRotationZ(angle1);
|
||||
UpdateRotation();
|
||||
}
|
||||
|
||||
private void UpdateRotationZY()
|
||||
{
|
||||
CorrectAngles();
|
||||
localRotation = Matrix3D.CreateRotationY(angle2) * Matrix3D.CreateRotationZ(angle1);
|
||||
UpdateRotation();
|
||||
}
|
||||
|
||||
private void UpdateRotationYZ()
|
||||
{
|
||||
CorrectAngles();
|
||||
localRotation = Matrix3D.CreateRotationZ(angle2) * Matrix3D.CreateRotationY(angle1);
|
||||
UpdateRotation();
|
||||
}
|
||||
|
||||
private void UpdateRotation()
|
||||
{
|
||||
localTransformation = positionTranslation * localRotation * originTranslation * scaleTransformation;
|
||||
}
|
||||
|
||||
public const float PIby180 = 0.0174532924f;
|
||||
|
||||
protected Matrix3D originTranslation = Matrix3D.Identity;
|
||||
|
||||
protected Matrix3D positionTranslation = Matrix3D.Identity;
|
||||
|
||||
protected Matrix3D scaleTransformation = Matrix3D.Identity;
|
||||
|
||||
protected Matrix3D localRotation = Matrix3D.Identity;
|
||||
|
||||
protected Matrix3D localTransformation = Matrix3D.Identity;
|
||||
|
||||
protected Matrix3D globalTransformation = Matrix3D.Identity;
|
||||
|
||||
private float angle1;
|
||||
|
||||
private float angle2;
|
||||
|
||||
private float maxAngle1 = (float)Math.PI;
|
||||
private float minAngle1 = (float)-Math.PI;
|
||||
|
||||
private float maxAngle2 = (float)Math.PI;
|
||||
private float minAngle2 = (float)-Math.PI;
|
||||
|
||||
private RotationOrders order;
|
||||
|
||||
protected MinecraftModelView viewport;
|
||||
|
||||
private RotateMethod Rotate;
|
||||
|
||||
private Action OnUpdateRotation;
|
||||
|
||||
private delegate void RotateMethod(float deltaX, float deltaY);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public class Object3DGroup : Object3D
|
||||
{
|
||||
internal override MinecraftModelView Viewport
|
||||
{
|
||||
set
|
||||
{
|
||||
base.Viewport = value;
|
||||
foreach (Object3D object3D in objects)
|
||||
{
|
||||
object3D.Viewport = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override System.Drawing.Image Image
|
||||
{
|
||||
set
|
||||
{
|
||||
foreach (Object3D object3D in objects)
|
||||
{
|
||||
object3D.Image = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Update()
|
||||
{
|
||||
Matrix3D globalTransformation = this.globalTransformation * localTransformation;
|
||||
for (int i = 0; i < objects.Count; i++)
|
||||
{
|
||||
objects[i].GlobalTransformation = globalTransformation;
|
||||
}
|
||||
}
|
||||
|
||||
public override float HitTest(System.Drawing.PointF location)
|
||||
{
|
||||
float num = -1000f;
|
||||
foreach (Object3D object3D in objects)
|
||||
{
|
||||
float num2 = object3D.HitTest(location);
|
||||
if (num2 > num)
|
||||
{
|
||||
num = num2;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
public void Add(Object3D object3D)
|
||||
{
|
||||
if (object3D == this)
|
||||
{
|
||||
throw new ArgumentException("Cannot add Object3D into itself.");
|
||||
}
|
||||
objects.Add(object3D);
|
||||
}
|
||||
|
||||
private List<Object3D> objects = new List<Object3D>();
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public struct Point3D
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Z;
|
||||
|
||||
public Point3D(float x, float y, float z)
|
||||
{
|
||||
(X, Y, Z) = (x, y, z);
|
||||
}
|
||||
|
||||
public static Point3D Zero => default(Point3D);
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("({0};{1};{2})", X, Y, Z);
|
||||
}
|
||||
|
||||
public static Point3D operator +(Point3D a, Point3D b) => new Point3D(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
|
||||
|
||||
public static Point3D operator -(Point3D a, Point3D b) => new Point3D(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
|
||||
|
||||
public static Point3D operator *(Point3D p, float s) => new Point3D(p.X * s, p.Y * s, p.Z * s);
|
||||
|
||||
public static Point3D operator /(Point3D p, float s) => new Point3D(p.X / s, p.Y / s, p.Z / s);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public enum Positions
|
||||
{
|
||||
Default,
|
||||
Outstretched,
|
||||
Walking,
|
||||
Running,
|
||||
Sitting,
|
||||
Zombie
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public enum ProjectionTypes : byte
|
||||
{
|
||||
Perspective,
|
||||
Isometric
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public enum RotationOrders : byte
|
||||
{
|
||||
XY,
|
||||
YX,
|
||||
XZ,
|
||||
ZX,
|
||||
YZ,
|
||||
ZY
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
internal struct Texel
|
||||
{
|
||||
internal Texel(TexturePlane texturePlane, int x, int y, System.Drawing.Color color)
|
||||
{
|
||||
TexturePlane = texturePlane;
|
||||
X = x;
|
||||
Y = y;
|
||||
this.color = color;
|
||||
brush = new System.Drawing.SolidBrush(color);
|
||||
pen = new System.Drawing.Pen(System.Drawing.Color.White, 0.01f);
|
||||
}
|
||||
|
||||
internal double Z
|
||||
{
|
||||
get
|
||||
{
|
||||
return TexturePlane.ZOrder[X + 1, Y + 1];
|
||||
}
|
||||
}
|
||||
|
||||
internal void Draw(System.Drawing.Graphics g)
|
||||
{
|
||||
System.Drawing.PointF[] points = new System.Drawing.PointF[]
|
||||
{
|
||||
TexturePlane.Points[X, Y],
|
||||
TexturePlane.Points[X + 1, Y],
|
||||
TexturePlane.Points[X + 1, Y + 1],
|
||||
TexturePlane.Points[X, Y + 1]
|
||||
};
|
||||
g.FillPolygon(brush, points);
|
||||
}
|
||||
|
||||
internal TexturePlane TexturePlane;
|
||||
|
||||
internal int X;
|
||||
|
||||
internal int Y;
|
||||
|
||||
private System.Drawing.Color color;
|
||||
|
||||
private System.Drawing.Brush brush;
|
||||
|
||||
private System.Drawing.Pen pen;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
internal class TexelComparer : IComparer<Texel>
|
||||
{
|
||||
public int Compare(Texel x, Texel y)
|
||||
{
|
||||
return -x.Z.CompareTo(y.Z);
|
||||
}
|
||||
|
||||
public TexelComparer()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing;
|
||||
|
||||
namespace PckStudio.Models
|
||||
{
|
||||
public class TexturePlane : Object3D
|
||||
{
|
||||
public override Image Image
|
||||
{
|
||||
set
|
||||
{
|
||||
Bitmap = (Bitmap)value;
|
||||
}
|
||||
}
|
||||
|
||||
internal override MinecraftModelView Viewport
|
||||
{
|
||||
set
|
||||
{
|
||||
base.Viewport = value;
|
||||
if (bitmap != null && value != null)
|
||||
{
|
||||
UpdateBitmap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal override void Update()
|
||||
{
|
||||
if (Points == null || viewport == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Matrix3D m = globalTransformation * localTransformation * originTranslation;
|
||||
for (int i = 0; i <= width; i++)
|
||||
{
|
||||
for (int j = 0; j <= height; j++)
|
||||
{
|
||||
Point3D point3D = m * new Point3D(i, j, 0f);
|
||||
Points[i, j] = viewport.Point3DTo2D(point3D);
|
||||
double num = (double)viewport.GetZOrder(point3D);
|
||||
ZOrder[i, j] += num;
|
||||
ZOrder[i + 1, j] += num;
|
||||
ZOrder[i, j + 1] += num;
|
||||
ZOrder[i + 1, j + 1] = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Bitmap Bitmap
|
||||
{
|
||||
set
|
||||
{
|
||||
if (viewport == null)
|
||||
{
|
||||
bitmap = value;
|
||||
return;
|
||||
}
|
||||
texelList.Clear();
|
||||
if (bitmap != null)
|
||||
{
|
||||
viewport.RemoveTexelsOf(this);
|
||||
Points = null;
|
||||
}
|
||||
bitmap = value;
|
||||
if (bitmap != null)
|
||||
{
|
||||
UpdateBitmap();
|
||||
Update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateBitmap()
|
||||
{
|
||||
width = bitmap.Width;
|
||||
height = bitmap.Height;
|
||||
visibility = new bool[width, height];
|
||||
for (int i = 0; i < width; i++)
|
||||
{
|
||||
for (int j = 0; j < height; j++)
|
||||
{
|
||||
Color pixel = bitmap.GetPixel(i, j);
|
||||
int num = flipHorizontally ? (width - i - 1) : i;
|
||||
int num2 = flipVertically ? j : (height - j - 1);
|
||||
if (pixel.A == 0)
|
||||
{
|
||||
visibility[num, num2] = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
visibility[num, num2] = true;
|
||||
Texel texel = new Texel(this, num, num2, pixel);
|
||||
viewport.AddTexel(texel);
|
||||
texelList.Add(texel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Points = new PointF[width + 1, height + 1];
|
||||
ZOrder = new double[width + 2, height + 2];
|
||||
}
|
||||
|
||||
public TexturePlane(Image bitmap, Rectangle srcRect, Point3D origin, Point3D normal, Effects effects)
|
||||
{
|
||||
Origin = origin;
|
||||
this.normal = normal;
|
||||
if (bitmap == null)
|
||||
{
|
||||
Bitmap = null;
|
||||
return;
|
||||
}
|
||||
Bitmap bitmap2 = new Bitmap(srcRect.Width, srcRect.Height);
|
||||
using (Graphics graphics = Graphics.FromImage(bitmap2))
|
||||
{
|
||||
graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap2.Width, bitmap2.Height), srcRect, GraphicsUnit.Pixel);
|
||||
}
|
||||
flipHorizontally = (byte)(effects & Effects.FlipHorizontally) == 1;
|
||||
flipVertically = (byte)(effects & Effects.FlipVertically) == 2;
|
||||
Bitmap = bitmap2;
|
||||
}
|
||||
|
||||
public override float HitTest(PointF location)
|
||||
{
|
||||
if (Points == null)
|
||||
{
|
||||
return -1000f;
|
||||
}
|
||||
GraphicsPath graphicsPath = new GraphicsPath();
|
||||
graphicsPath.AddPolygon(new PointF[]
|
||||
{
|
||||
Points[0, 0],
|
||||
Points[Points.GetLength(0) - 1, 0],
|
||||
Points[Points.GetLength(0) - 1, Points.GetLength(1) - 1],
|
||||
Points[0, Points.GetLength(1) - 1]
|
||||
});
|
||||
Region region = new Region(graphicsPath);
|
||||
if (region.IsVisible(location))
|
||||
{
|
||||
for (int i = 0; i < Points.GetLength(0) - 1; i++)
|
||||
{
|
||||
for (int j = 0; j < Points.GetLength(1) - 1; j++)
|
||||
{
|
||||
if (visibility[i, j])
|
||||
{
|
||||
graphicsPath.Reset();
|
||||
graphicsPath.AddPolygon(new PointF[]
|
||||
{
|
||||
Points[i, j],
|
||||
Points[i + 1, j],
|
||||
Points[i + 1, j + 1],
|
||||
Points[i, j + 1]
|
||||
});
|
||||
if (graphicsPath.IsVisible(location))
|
||||
{
|
||||
return (globalTransformation * localTransformation * originTranslation * new Point3D(i, j, 0f)).Z;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1000f;
|
||||
}
|
||||
|
||||
private List<Texel> texelList = new List<Texel>();
|
||||
|
||||
internal PointF[,] Points;
|
||||
|
||||
internal double[,] ZOrder;
|
||||
|
||||
internal bool IsVisible = true;
|
||||
|
||||
private bool[,] visibility;
|
||||
|
||||
private Bitmap bitmap;
|
||||
|
||||
private bool flipHorizontally;
|
||||
|
||||
private bool flipVertically;
|
||||
|
||||
private int width;
|
||||
|
||||
private int height;
|
||||
|
||||
private Point3D normal;
|
||||
}
|
||||
}
|
||||
444
PCK-Studio/Controls/BoxEditorControl.Designer.cs
generated
Normal file
444
PCK-Studio/Controls/BoxEditorControl.Designer.cs
generated
Normal file
@@ -0,0 +1,444 @@
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
partial class BoxEditorControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.parentLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.positionLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.sizeLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.uvLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.inflationLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.toolTip = new MetroFramework.Components.MetroToolTip();
|
||||
this.parentComboBox = new MetroFramework.Controls.MetroComboBox();
|
||||
this.PosXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.PosYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.PosZUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeZUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.uvYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.uvXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.helmetCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.mirrorCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.inflationUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.chestplateCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.leggingsCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.bootsCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// parentLabel
|
||||
//
|
||||
this.parentLabel.AutoSize = true;
|
||||
this.parentLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
this.parentLabel.Location = new System.Drawing.Point(47, 55);
|
||||
this.parentLabel.Name = "parentLabel";
|
||||
this.parentLabel.Size = new System.Drawing.Size(50, 25);
|
||||
this.parentLabel.TabIndex = 2;
|
||||
this.parentLabel.Text = "Type:";
|
||||
this.parentLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// positionLabel
|
||||
//
|
||||
this.positionLabel.AutoSize = true;
|
||||
this.positionLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
this.positionLabel.Location = new System.Drawing.Point(22, 84);
|
||||
this.positionLabel.Name = "positionLabel";
|
||||
this.positionLabel.Size = new System.Drawing.Size(75, 25);
|
||||
this.positionLabel.TabIndex = 4;
|
||||
this.positionLabel.Text = "Position:";
|
||||
this.positionLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// sizeLabel
|
||||
//
|
||||
this.sizeLabel.AutoSize = true;
|
||||
this.sizeLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
this.sizeLabel.Location = new System.Drawing.Point(51, 109);
|
||||
this.sizeLabel.Name = "sizeLabel";
|
||||
this.sizeLabel.Size = new System.Drawing.Size(46, 25);
|
||||
this.sizeLabel.TabIndex = 22;
|
||||
this.sizeLabel.Text = "Size:";
|
||||
this.sizeLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// uvLabel
|
||||
//
|
||||
this.uvLabel.AutoSize = true;
|
||||
this.uvLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
this.uvLabel.Location = new System.Drawing.Point(58, 135);
|
||||
this.uvLabel.Name = "uvLabel";
|
||||
this.uvLabel.Size = new System.Drawing.Size(39, 25);
|
||||
this.uvLabel.TabIndex = 26;
|
||||
this.uvLabel.Text = "UV:";
|
||||
this.uvLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// inflationLabel
|
||||
//
|
||||
this.inflationLabel.AutoSize = true;
|
||||
this.inflationLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
this.inflationLabel.Location = new System.Drawing.Point(42, 165);
|
||||
this.inflationLabel.Name = "inflationLabel";
|
||||
this.inflationLabel.Size = new System.Drawing.Size(55, 25);
|
||||
this.inflationLabel.TabIndex = 31;
|
||||
this.inflationLabel.Text = "Scale:";
|
||||
this.inflationLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// toolTip
|
||||
//
|
||||
this.toolTip.StripAmpersands = true;
|
||||
this.toolTip.Style = MetroFramework.MetroColorStyle.Blue;
|
||||
this.toolTip.StyleManager = null;
|
||||
this.toolTip.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// parentComboBox
|
||||
//
|
||||
this.parentComboBox.FormattingEnabled = true;
|
||||
this.parentComboBox.ItemHeight = 23;
|
||||
this.parentComboBox.Items.AddRange(new object[] {
|
||||
"HEAD",
|
||||
"BODY",
|
||||
"ARM0",
|
||||
"ARM1",
|
||||
"LEG0",
|
||||
"LEG1",
|
||||
"HEADWEAR",
|
||||
"JACKET",
|
||||
"SLEEVE0",
|
||||
"SLEEVE1",
|
||||
"PANTS0",
|
||||
"PANTS1",
|
||||
"WAIST",
|
||||
"LEGGING0",
|
||||
"LEGGING1",
|
||||
"SOCK0",
|
||||
"SOCK1",
|
||||
"BOOT0",
|
||||
"BOOT1",
|
||||
"ARMARMOR1",
|
||||
"ARMARMOR0",
|
||||
"BODYARMOR",
|
||||
"BELT"});
|
||||
this.parentComboBox.Location = new System.Drawing.Point(103, 51);
|
||||
this.parentComboBox.Name = "parentComboBox";
|
||||
this.parentComboBox.Size = new System.Drawing.Size(163, 29);
|
||||
this.parentComboBox.TabIndex = 3;
|
||||
this.parentComboBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.parentComboBox.UseSelectable = true;
|
||||
//
|
||||
// PosXUpDown
|
||||
//
|
||||
this.PosXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosXUpDown.DecimalPlaces = 3;
|
||||
this.PosXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.PosXUpDown.Location = new System.Drawing.Point(103, 86);
|
||||
this.PosXUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PosXUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosXUpDown.Name = "PosXUpDown";
|
||||
this.PosXUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.PosXUpDown.TabIndex = 19;
|
||||
//
|
||||
// PosYUpDown
|
||||
//
|
||||
this.PosYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosYUpDown.DecimalPlaces = 3;
|
||||
this.PosYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.PosYUpDown.Location = new System.Drawing.Point(182, 86);
|
||||
this.PosYUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PosYUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosYUpDown.Name = "PosYUpDown";
|
||||
this.PosYUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.PosYUpDown.TabIndex = 20;
|
||||
//
|
||||
// PosZUpDown
|
||||
//
|
||||
this.PosZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosZUpDown.DecimalPlaces = 3;
|
||||
this.PosZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.PosZUpDown.Location = new System.Drawing.Point(261, 86);
|
||||
this.PosZUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PosZUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosZUpDown.Name = "PosZUpDown";
|
||||
this.PosZUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.PosZUpDown.TabIndex = 21;
|
||||
//
|
||||
// SizeZUpDown
|
||||
//
|
||||
this.SizeZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.SizeZUpDown.Location = new System.Drawing.Point(261, 111);
|
||||
this.SizeZUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SizeZUpDown.Name = "SizeZUpDown";
|
||||
this.SizeZUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.SizeZUpDown.TabIndex = 25;
|
||||
//
|
||||
// SizeYUpDown
|
||||
//
|
||||
this.SizeYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.SizeYUpDown.Location = new System.Drawing.Point(182, 111);
|
||||
this.SizeYUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SizeYUpDown.Name = "SizeYUpDown";
|
||||
this.SizeYUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.SizeYUpDown.TabIndex = 24;
|
||||
//
|
||||
// SizeXUpDown
|
||||
//
|
||||
this.SizeXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.SizeXUpDown.Location = new System.Drawing.Point(103, 111);
|
||||
this.SizeXUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SizeXUpDown.Name = "SizeXUpDown";
|
||||
this.SizeXUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.SizeXUpDown.TabIndex = 23;
|
||||
//
|
||||
// uvYUpDown
|
||||
//
|
||||
this.uvYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.uvYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.uvYUpDown.Location = new System.Drawing.Point(182, 137);
|
||||
this.uvYUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.uvYUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.uvYUpDown.Name = "uvYUpDown";
|
||||
this.uvYUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.uvYUpDown.TabIndex = 28;
|
||||
//
|
||||
// uvXUpDown
|
||||
//
|
||||
this.uvXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.uvXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.uvXUpDown.Location = new System.Drawing.Point(103, 137);
|
||||
this.uvXUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.uvXUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.uvXUpDown.Name = "uvXUpDown";
|
||||
this.uvXUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.uvXUpDown.TabIndex = 27;
|
||||
//
|
||||
// helmetCheckBox
|
||||
//
|
||||
this.helmetCheckBox.AutoSize = true;
|
||||
this.helmetCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall;
|
||||
this.helmetCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light;
|
||||
this.helmetCheckBox.Location = new System.Drawing.Point(340, 84);
|
||||
this.helmetCheckBox.Name = "helmetCheckBox";
|
||||
this.helmetCheckBox.Size = new System.Drawing.Size(160, 25);
|
||||
this.helmetCheckBox.TabIndex = 29;
|
||||
this.helmetCheckBox.Text = "Mask with helmet";
|
||||
this.helmetCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.helmetCheckBox.UseSelectable = true;
|
||||
//
|
||||
// mirrorCheckBox
|
||||
//
|
||||
this.mirrorCheckBox.AutoSize = true;
|
||||
this.mirrorCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall;
|
||||
this.mirrorCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light;
|
||||
this.mirrorCheckBox.Location = new System.Drawing.Point(340, 58);
|
||||
this.mirrorCheckBox.Name = "mirrorCheckBox";
|
||||
this.mirrorCheckBox.Size = new System.Drawing.Size(133, 25);
|
||||
this.mirrorCheckBox.TabIndex = 30;
|
||||
this.mirrorCheckBox.Text = "Mirror Texture";
|
||||
this.mirrorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.mirrorCheckBox.UseSelectable = true;
|
||||
//
|
||||
// inflationUpDown
|
||||
//
|
||||
this.inflationUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.inflationUpDown.DecimalPlaces = 3;
|
||||
this.inflationUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.inflationUpDown.Location = new System.Drawing.Point(103, 167);
|
||||
this.inflationUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.inflationUpDown.Name = "inflationUpDown";
|
||||
this.inflationUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.inflationUpDown.TabIndex = 32;
|
||||
//
|
||||
// chestplateCheckBox
|
||||
//
|
||||
this.chestplateCheckBox.AutoSize = true;
|
||||
this.chestplateCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall;
|
||||
this.chestplateCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light;
|
||||
this.chestplateCheckBox.Location = new System.Drawing.Point(340, 109);
|
||||
this.chestplateCheckBox.Name = "chestplateCheckBox";
|
||||
this.chestplateCheckBox.Size = new System.Drawing.Size(184, 25);
|
||||
this.chestplateCheckBox.TabIndex = 33;
|
||||
this.chestplateCheckBox.Text = "Mask with chestplate";
|
||||
this.chestplateCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.chestplateCheckBox.UseSelectable = true;
|
||||
//
|
||||
// leggingsCheckBox
|
||||
//
|
||||
this.leggingsCheckBox.AutoSize = true;
|
||||
this.leggingsCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall;
|
||||
this.leggingsCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light;
|
||||
this.leggingsCheckBox.Location = new System.Drawing.Point(340, 135);
|
||||
this.leggingsCheckBox.Name = "leggingsCheckBox";
|
||||
this.leggingsCheckBox.Size = new System.Drawing.Size(172, 25);
|
||||
this.leggingsCheckBox.TabIndex = 34;
|
||||
this.leggingsCheckBox.Text = "Mask with leggings";
|
||||
this.leggingsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.leggingsCheckBox.UseSelectable = true;
|
||||
//
|
||||
// bootsCheckBox
|
||||
//
|
||||
this.bootsCheckBox.AutoSize = true;
|
||||
this.bootsCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall;
|
||||
this.bootsCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light;
|
||||
this.bootsCheckBox.Location = new System.Drawing.Point(340, 161);
|
||||
this.bootsCheckBox.Name = "bootsCheckBox";
|
||||
this.bootsCheckBox.Size = new System.Drawing.Size(150, 25);
|
||||
this.bootsCheckBox.TabIndex = 35;
|
||||
this.bootsCheckBox.Text = "Mask with boots";
|
||||
this.bootsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.bootsCheckBox.UseSelectable = true;
|
||||
//
|
||||
// BoxEditorControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
||||
this.Controls.Add(this.bootsCheckBox);
|
||||
this.Controls.Add(this.leggingsCheckBox);
|
||||
this.Controls.Add(this.chestplateCheckBox);
|
||||
this.Controls.Add(this.inflationUpDown);
|
||||
this.Controls.Add(this.uvYUpDown);
|
||||
this.Controls.Add(this.uvXUpDown);
|
||||
this.Controls.Add(this.SizeZUpDown);
|
||||
this.Controls.Add(this.SizeYUpDown);
|
||||
this.Controls.Add(this.SizeXUpDown);
|
||||
this.Controls.Add(this.PosZUpDown);
|
||||
this.Controls.Add(this.PosYUpDown);
|
||||
this.Controls.Add(this.PosXUpDown);
|
||||
this.Controls.Add(this.inflationLabel);
|
||||
this.Controls.Add(this.parentComboBox);
|
||||
this.Controls.Add(this.mirrorCheckBox);
|
||||
this.Controls.Add(this.helmetCheckBox);
|
||||
this.Controls.Add(this.uvLabel);
|
||||
this.Controls.Add(this.sizeLabel);
|
||||
this.Controls.Add(this.positionLabel);
|
||||
this.Controls.Add(this.parentLabel);
|
||||
this.Name = "BoxEditorControl";
|
||||
this.Size = new System.Drawing.Size(540, 220);
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private MetroFramework.Components.MetroToolTip toolTip;
|
||||
private MetroFramework.Controls.MetroComboBox parentComboBox;
|
||||
private System.Windows.Forms.NumericUpDown PosXUpDown;
|
||||
private System.Windows.Forms.NumericUpDown PosYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown PosZUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeZUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeXUpDown;
|
||||
private System.Windows.Forms.NumericUpDown uvYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown uvXUpDown;
|
||||
private MetroFramework.Controls.MetroCheckBox helmetCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox mirrorCheckBox;
|
||||
private System.Windows.Forms.NumericUpDown inflationUpDown;
|
||||
private MetroFramework.Controls.MetroCheckBox chestplateCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox leggingsCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox bootsCheckBox;
|
||||
private MetroFramework.Controls.MetroLabel parentLabel;
|
||||
private MetroFramework.Controls.MetroLabel positionLabel;
|
||||
private MetroFramework.Controls.MetroLabel sizeLabel;
|
||||
private MetroFramework.Controls.MetroLabel uvLabel;
|
||||
private MetroFramework.Controls.MetroLabel inflationLabel;
|
||||
}
|
||||
}
|
||||
126
PCK-Studio/Controls/BoxEditorControl.cs
Normal file
126
PCK-Studio/Controls/BoxEditorControl.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using OpenTK;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
internal partial class BoxEditorControl : UserControl
|
||||
{
|
||||
public event EventHandler BoxChanged;
|
||||
|
||||
private SkinBOX result;
|
||||
private int boxVersion = 0;
|
||||
|
||||
public BoxEditorControl(SkinBOX box, int xmlVersion)
|
||||
: this(xmlVersion)
|
||||
{
|
||||
SetBOX(box);
|
||||
}
|
||||
|
||||
public BoxEditorControl()
|
||||
:this(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BoxEditorControl(int xmlVersion = 0)
|
||||
{
|
||||
InitializeComponent();
|
||||
SetBOXVersion(xmlVersion);
|
||||
parentComboBox.SelectedIndexChanged += this.HandleBoxChanged;
|
||||
PosXUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
PosYUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
PosZUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
SizeXUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
SizeYUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
SizeZUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
uvXUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
uvYUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
helmetCheckBox.CheckedChanged += this.HandleBoxChanged;
|
||||
chestplateCheckBox.CheckedChanged += this.HandleBoxChanged;
|
||||
leggingsCheckBox.CheckedChanged += this.HandleBoxChanged;
|
||||
bootsCheckBox.CheckedChanged += this.HandleBoxChanged;
|
||||
mirrorCheckBox.CheckedChanged += this.HandleBoxChanged;
|
||||
inflationUpDown.ValueChanged += this.HandleBoxChanged;
|
||||
}
|
||||
|
||||
public void SetBOXVersion(int xmlVersion)
|
||||
{
|
||||
boxVersion = xmlVersion;
|
||||
Debug.WriteLine(xmlVersion);
|
||||
inflationUpDown.Enabled = boxVersion == 3;
|
||||
}
|
||||
|
||||
public void SetBOX(SkinBOX box)
|
||||
{
|
||||
if (string.IsNullOrEmpty(box.Type) || !parentComboBox.Items.Contains(box.Type))
|
||||
{
|
||||
throw new Exception("Failed to parse BOX value");
|
||||
}
|
||||
|
||||
parentComboBox.SelectedItem = parentComboBox.Items[parentComboBox.Items.IndexOf(box.Type)];
|
||||
PosXUpDown.Value = (decimal)box.Pos.X;
|
||||
PosYUpDown.Value = (decimal)box.Pos.Y;
|
||||
PosZUpDown.Value = (decimal)box.Pos.Z;
|
||||
SizeXUpDown.Value = (decimal)box.Size.X;
|
||||
SizeYUpDown.Value = (decimal)box.Size.Y;
|
||||
SizeZUpDown.Value = (decimal)box.Size.Z;
|
||||
uvXUpDown.Value = (decimal)box.UV.X;
|
||||
uvYUpDown.Value = (decimal)box.UV.Y;
|
||||
helmetCheckBox.Checked = (box.ArmorMaskFlags & 1) != 0;
|
||||
chestplateCheckBox.Checked = (box.ArmorMaskFlags & 2) != 0;
|
||||
leggingsCheckBox.Checked = (box.ArmorMaskFlags & 4) != 0;
|
||||
bootsCheckBox.Checked = (box.ArmorMaskFlags & 8) != 0;
|
||||
mirrorCheckBox.Checked = box.Mirror;
|
||||
inflationUpDown.Value = (decimal)box.Scale;
|
||||
}
|
||||
|
||||
public SkinBOX GetBOX()
|
||||
{
|
||||
int mask = 0;
|
||||
|
||||
if (helmetCheckBox.Checked) mask |= 1;
|
||||
if (chestplateCheckBox.Checked) mask |= 2;
|
||||
if (leggingsCheckBox.Checked) mask |= 4;
|
||||
if (bootsCheckBox.Checked) mask |= 8;
|
||||
|
||||
result = SkinBOX.FromString(
|
||||
$"{parentComboBox.SelectedItem} " +
|
||||
$"{PosXUpDown.Value} {PosYUpDown.Value} {PosZUpDown.Value} " +
|
||||
$"{SizeXUpDown.Value} {SizeYUpDown.Value} {SizeZUpDown.Value} " +
|
||||
$"{uvXUpDown.Value} {uvYUpDown.Value} " +
|
||||
$"{mask} " +
|
||||
$"{Convert.ToInt32(mirrorCheckBox.Checked)} " +
|
||||
$"{inflationUpDown.Value}");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private void HandleBoxChanged(object sender, EventArgs e)
|
||||
{
|
||||
// we'll explain this in a minute
|
||||
this.OnBoxChanged(EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected virtual void OnBoxChanged(EventArgs e)
|
||||
{
|
||||
EventHandler handler = this.BoxChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
123
PCK-Studio/Controls/BoxEditorControl.resx
Normal file
123
PCK-Studio/Controls/BoxEditorControl.resx
Normal file
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
93
PCK-Studio/Controls/CustomTabControl.cs
Normal file
93
PCK-Studio/Controls/CustomTabControl.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using MetroFramework.Controls;
|
||||
using MetroFramework.Drawing;
|
||||
|
||||
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
internal class CustomTabControl : MetroTabControl
|
||||
{
|
||||
private const string CloseChar = "×";
|
||||
private Size CloseButtonSize = new Size(7, 7);
|
||||
private const int StartIndex = 1;
|
||||
|
||||
[Browsable(true)]
|
||||
public event EventHandler<PageClosingEventArgs> PageClosing;
|
||||
|
||||
public CustomTabControl()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
private Rectangle GetCloseButtonArea(Rectangle tabArea)
|
||||
{
|
||||
Size closeBtnSz = CloseButtonSize;
|
||||
var closeBtnPt = new Point(
|
||||
tabArea.Right - closeBtnSz.Width,
|
||||
tabArea.Top + 2 + (tabArea.Height - closeBtnSz.Height) / 2);
|
||||
return new Rectangle(closeBtnPt, closeBtnSz);
|
||||
}
|
||||
|
||||
protected override void OnMouseClick(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseClick(e);
|
||||
if (SelectedIndex < StartIndex)
|
||||
return;
|
||||
Rectangle tabArea = GetTabRect(SelectedIndex);
|
||||
Rectangle buttonArea = GetCloseButtonArea(tabArea);
|
||||
if (buttonArea.Contains(e.Location))
|
||||
{
|
||||
var eventArg = new PageClosingEventArgs(TabPages[SelectedIndex]);
|
||||
PageClosing?.Invoke(this, eventArg);
|
||||
if (!eventArg.Cancel)
|
||||
{
|
||||
SelectedIndex -= 1;
|
||||
TabPages.RemoveAt(SelectedIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnCustomPaintForeground(MetroPaintEventArgs e)
|
||||
{
|
||||
base.OnCustomPaintForeground(e);
|
||||
if (SelectedIndex < StartIndex)
|
||||
return;
|
||||
// Draw Close button
|
||||
Rectangle tabArea = GetTabRect(SelectedIndex);
|
||||
|
||||
Rectangle buttonArea = GetCloseButtonArea(tabArea);
|
||||
|
||||
e.Graphics.FillRectangle(MetroPaint.GetStyleBrush(Style), buttonArea);
|
||||
e.Graphics.DrawString(
|
||||
CloseChar,
|
||||
Font,
|
||||
new SolidBrush(MetroPaint.ForeColor.Title(Theme)),
|
||||
buttonArea.Right - buttonArea.Width - 2, buttonArea.Top - 4);
|
||||
}
|
||||
|
||||
//protected override void OnPaintForeground(PaintEventArgs e)
|
||||
//{
|
||||
// base.OnPaintForeground(e);
|
||||
// for (int i = StartIndex; i < TabPages.Count; i++)
|
||||
// {
|
||||
// // Draw Close button
|
||||
// Rectangle tabArea = GetTabRect(i);
|
||||
|
||||
// Rectangle buttonArea = GetCloseButtonArea(tabArea);
|
||||
|
||||
// e.Graphics.FillRectangle(MetroPaint.GetStyleBrush(Style), buttonArea);
|
||||
// e.Graphics.DrawString(
|
||||
// CloseChar,
|
||||
// Font,
|
||||
// new SolidBrush(MetroPaint.ForeColor.Title(Theme)),
|
||||
// buttonArea.Right - buttonArea.Width - 2, buttonArea.Top - 4);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
61
PCK-Studio/Controls/EditorControl.cs
Normal file
61
PCK-Studio/Controls/EditorControl.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Interfaces;
|
||||
using System.IO;
|
||||
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
internal class EditorControl<T> : UserControl, IEditor<T> where T : class
|
||||
{
|
||||
public T EditorValue { get; }
|
||||
|
||||
public ISaveContext<T> SaveContext { get; private set; }
|
||||
|
||||
public string TitleName { get; }
|
||||
|
||||
public EditorControl()
|
||||
{
|
||||
}
|
||||
|
||||
protected EditorControl(string titleName, T value, ISaveContext<T> saveContext)
|
||||
{
|
||||
_ = value ?? throw new ArgumentNullException(nameof(value));
|
||||
TitleName = titleName;
|
||||
EditorValue = value;
|
||||
SaveContext = saveContext;
|
||||
}
|
||||
|
||||
protected override void OnControlRemoved(ControlEventArgs e)
|
||||
{
|
||||
if (SaveContext.AutoSave)
|
||||
Save();
|
||||
base.OnControlRemoved(e);
|
||||
}
|
||||
|
||||
public void SetSaveContext(ISaveContext<T> saveContext) => SaveContext = saveContext;
|
||||
|
||||
protected virtual void PreSave()
|
||||
{ }
|
||||
|
||||
protected virtual void PostSave()
|
||||
{ }
|
||||
|
||||
public void Save()
|
||||
{
|
||||
PreSave();
|
||||
SaveContext.Save(EditorValue);
|
||||
PostSave();
|
||||
}
|
||||
|
||||
public virtual void Close() => throw new NotImplementedException();
|
||||
|
||||
public virtual void UpdateView() => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
37
PCK-Studio/Controls/EditorForm.cs
Normal file
37
PCK-Studio/Controls/EditorForm.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Interfaces;
|
||||
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
public class EditorForm<T> : MetroForm where T : class
|
||||
{
|
||||
protected T EditorValue;
|
||||
private readonly ISaveContext<T> SaveContext;
|
||||
|
||||
private EditorForm()
|
||||
{
|
||||
}
|
||||
|
||||
protected EditorForm(T value, ISaveContext<T> saveContext)
|
||||
{
|
||||
_ = value ?? throw new ArgumentNullException(nameof(value));
|
||||
EditorValue = value;
|
||||
SaveContext = saveContext;
|
||||
}
|
||||
|
||||
protected void Save() => SaveContext.Save(EditorValue);
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
if (SaveContext.AutoSave)
|
||||
Save();
|
||||
base.OnFormClosing(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
22
PCK-Studio/Controls/PageClosingEventArgs.cs
Normal file
22
PCK-Studio/Controls/PageClosingEventArgs.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
internal class PageClosingEventArgs : CancelEventArgs
|
||||
{
|
||||
private readonly TabPage page;
|
||||
public TabPage Page => page;
|
||||
|
||||
public PageClosingEventArgs(TabPage page)
|
||||
: base()
|
||||
{
|
||||
this.page = page;
|
||||
}
|
||||
}
|
||||
}
|
||||
824
PCK-Studio/Controls/PckEditor.Designer.cs
generated
Normal file
824
PCK-Studio/Controls/PckEditor.Designer.cs
generated
Normal file
@@ -0,0 +1,824 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Controls
|
||||
{
|
||||
partial class PckEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.PictureBox logoPictureBox;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PckEditor));
|
||||
this.pckFileLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.labelImageSize = new MetroFramework.Controls.MetroLabel();
|
||||
this.fileEntryCountLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.PropertiesTabControl = new MetroFramework.Controls.MetroTabControl();
|
||||
this.MetaTab = new MetroFramework.Controls.MetroTabPage();
|
||||
this.metroLabel2 = new MetroFramework.Controls.MetroLabel();
|
||||
this.entryTypeTextBox = new MetroFramework.Controls.MetroTextBox();
|
||||
this.entryDataTextBox = new MetroFramework.Controls.MetroTextBox();
|
||||
this.buttonEdit = new MetroFramework.Controls.MetroButton();
|
||||
this.metroLabel1 = new MetroFramework.Controls.MetroLabel();
|
||||
this.treeMeta = new System.Windows.Forms.TreeView();
|
||||
this.contextMenuMetaTree = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.addEntryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addEntryToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addBOXEntryToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addANIMEntryToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addMultipleEntriesToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteEntryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.editAllEntriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.label11 = new MetroFramework.Controls.MetroLabel();
|
||||
this.treeViewMain = new System.Windows.Forms.TreeView();
|
||||
this.contextMenuPCKEntries = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.createToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.folderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.skinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.createAnimatedTextureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.audiopckToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.colourscolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CreateSkinsPCKToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.behavioursbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.entityMaterialsbinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.importSkinsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.importSkinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.importExtractedSkinsFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addTextureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.addFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.as3DSTextureFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.setFileTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.skinToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.capeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.textureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.languagesFileLOCToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.gameRulesFileGRFToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.audioPCKFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.coloursCOLFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.gameRulesHeaderGRHToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.skinsPCKToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.modelsFileBINToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.behavioursFileBINToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.entityMaterialsFileBINToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.miscFunctionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.generateMipMapTextureToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.viewFileInfoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.correctSkinDecimalsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.setSubPCKEndiannessToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.bigEndianXbox360PS3WiiUToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.littleEndianPS4PSVitaSwitchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.setModelContainerFormatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.version1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.version2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.version3114ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.extractToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.cloneFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.renameFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.imageList = new System.Windows.Forms.ImageList(this.components);
|
||||
this.addMultipleEntriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.LittleEndianCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.previewPictureBox = new PckStudio.ToolboxItems.InterpolationPictureBox();
|
||||
logoPictureBox = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(logoPictureBox)).BeginInit();
|
||||
this.PropertiesTabControl.SuspendLayout();
|
||||
this.MetaTab.SuspendLayout();
|
||||
this.contextMenuMetaTree.SuspendLayout();
|
||||
this.contextMenuPCKEntries.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// logoPictureBox
|
||||
//
|
||||
resources.ApplyResources(logoPictureBox, "logoPictureBox");
|
||||
logoPictureBox.Name = "logoPictureBox";
|
||||
logoPictureBox.TabStop = false;
|
||||
//
|
||||
// pckFileLabel
|
||||
//
|
||||
this.pckFileLabel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
resources.ApplyResources(this.pckFileLabel, "pckFileLabel");
|
||||
this.pckFileLabel.Name = "pckFileLabel";
|
||||
this.pckFileLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// labelImageSize
|
||||
//
|
||||
resources.ApplyResources(this.labelImageSize, "labelImageSize");
|
||||
this.labelImageSize.Name = "labelImageSize";
|
||||
this.labelImageSize.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// fileEntryCountLabel
|
||||
//
|
||||
resources.ApplyResources(this.fileEntryCountLabel, "fileEntryCountLabel");
|
||||
this.fileEntryCountLabel.Name = "fileEntryCountLabel";
|
||||
this.fileEntryCountLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// PropertiesTabControl
|
||||
//
|
||||
this.PropertiesTabControl.Controls.Add(this.MetaTab);
|
||||
resources.ApplyResources(this.PropertiesTabControl, "PropertiesTabControl");
|
||||
this.PropertiesTabControl.Name = "PropertiesTabControl";
|
||||
this.PropertiesTabControl.SelectedIndex = 0;
|
||||
this.PropertiesTabControl.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.PropertiesTabControl.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.PropertiesTabControl.UseSelectable = true;
|
||||
//
|
||||
// MetaTab
|
||||
//
|
||||
this.MetaTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.MetaTab.Controls.Add(this.metroLabel2);
|
||||
this.MetaTab.Controls.Add(this.entryTypeTextBox);
|
||||
this.MetaTab.Controls.Add(this.entryDataTextBox);
|
||||
this.MetaTab.Controls.Add(this.buttonEdit);
|
||||
this.MetaTab.Controls.Add(this.metroLabel1);
|
||||
this.MetaTab.Controls.Add(this.treeMeta);
|
||||
this.MetaTab.HorizontalScrollbarBarColor = true;
|
||||
this.MetaTab.HorizontalScrollbarHighlightOnWheel = false;
|
||||
this.MetaTab.HorizontalScrollbarSize = 10;
|
||||
resources.ApplyResources(this.MetaTab, "MetaTab");
|
||||
this.MetaTab.Name = "MetaTab";
|
||||
this.MetaTab.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.MetaTab.VerticalScrollbarBarColor = true;
|
||||
this.MetaTab.VerticalScrollbarHighlightOnWheel = false;
|
||||
this.MetaTab.VerticalScrollbarSize = 10;
|
||||
//
|
||||
// metroLabel2
|
||||
//
|
||||
resources.ApplyResources(this.metroLabel2, "metroLabel2");
|
||||
this.metroLabel2.Name = "metroLabel2";
|
||||
this.metroLabel2.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// entryTypeTextBox
|
||||
//
|
||||
resources.ApplyResources(this.entryTypeTextBox, "entryTypeTextBox");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.entryTypeTextBox.CustomButton.Image = ((System.Drawing.Image)(resources.GetObject("resource.Image")));
|
||||
this.entryTypeTextBox.CustomButton.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("resource.ImeMode")));
|
||||
this.entryTypeTextBox.CustomButton.Location = ((System.Drawing.Point)(resources.GetObject("resource.Location")));
|
||||
this.entryTypeTextBox.CustomButton.Name = "";
|
||||
this.entryTypeTextBox.CustomButton.Size = ((System.Drawing.Size)(resources.GetObject("resource.Size")));
|
||||
this.entryTypeTextBox.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
|
||||
this.entryTypeTextBox.CustomButton.TabIndex = ((int)(resources.GetObject("resource.TabIndex")));
|
||||
this.entryTypeTextBox.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
|
||||
this.entryTypeTextBox.CustomButton.UseSelectable = true;
|
||||
this.entryTypeTextBox.CustomButton.Visible = ((bool)(resources.GetObject("resource.Visible")));
|
||||
this.entryTypeTextBox.Lines = new string[0];
|
||||
this.entryTypeTextBox.MaxLength = 32767;
|
||||
this.entryTypeTextBox.Name = "entryTypeTextBox";
|
||||
this.entryTypeTextBox.PasswordChar = '\0';
|
||||
this.entryTypeTextBox.ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||
this.entryTypeTextBox.SelectedText = "";
|
||||
this.entryTypeTextBox.SelectionLength = 0;
|
||||
this.entryTypeTextBox.SelectionStart = 0;
|
||||
this.entryTypeTextBox.ShortcutsEnabled = true;
|
||||
this.entryTypeTextBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.entryTypeTextBox.UseSelectable = true;
|
||||
this.entryTypeTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
|
||||
this.entryTypeTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
|
||||
//
|
||||
// entryDataTextBox
|
||||
//
|
||||
resources.ApplyResources(this.entryDataTextBox, "entryDataTextBox");
|
||||
//
|
||||
//
|
||||
//
|
||||
this.entryDataTextBox.CustomButton.Image = ((System.Drawing.Image)(resources.GetObject("resource.Image1")));
|
||||
this.entryDataTextBox.CustomButton.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("resource.ImeMode1")));
|
||||
this.entryDataTextBox.CustomButton.Location = ((System.Drawing.Point)(resources.GetObject("resource.Location1")));
|
||||
this.entryDataTextBox.CustomButton.Name = "";
|
||||
this.entryDataTextBox.CustomButton.Size = ((System.Drawing.Size)(resources.GetObject("resource.Size1")));
|
||||
this.entryDataTextBox.CustomButton.Style = MetroFramework.MetroColorStyle.Blue;
|
||||
this.entryDataTextBox.CustomButton.TabIndex = ((int)(resources.GetObject("resource.TabIndex1")));
|
||||
this.entryDataTextBox.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light;
|
||||
this.entryDataTextBox.CustomButton.UseSelectable = true;
|
||||
this.entryDataTextBox.CustomButton.Visible = ((bool)(resources.GetObject("resource.Visible1")));
|
||||
this.entryDataTextBox.Lines = new string[0];
|
||||
this.entryDataTextBox.MaxLength = 32767;
|
||||
this.entryDataTextBox.Name = "entryDataTextBox";
|
||||
this.entryDataTextBox.PasswordChar = '\0';
|
||||
this.entryDataTextBox.ScrollBars = System.Windows.Forms.ScrollBars.None;
|
||||
this.entryDataTextBox.SelectedText = "";
|
||||
this.entryDataTextBox.SelectionLength = 0;
|
||||
this.entryDataTextBox.SelectionStart = 0;
|
||||
this.entryDataTextBox.ShortcutsEnabled = true;
|
||||
this.entryDataTextBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.entryDataTextBox.UseSelectable = true;
|
||||
this.entryDataTextBox.WaterMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(109)))), ((int)(((byte)(109)))), ((int)(((byte)(109)))));
|
||||
this.entryDataTextBox.WaterMarkFont = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Pixel);
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
resources.ApplyResources(this.buttonEdit, "buttonEdit");
|
||||
this.buttonEdit.Name = "buttonEdit";
|
||||
this.buttonEdit.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonEdit.UseSelectable = true;
|
||||
this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click);
|
||||
//
|
||||
// metroLabel1
|
||||
//
|
||||
resources.ApplyResources(this.metroLabel1, "metroLabel1");
|
||||
this.metroLabel1.Name = "metroLabel1";
|
||||
this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// treeMeta
|
||||
//
|
||||
this.treeMeta.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(13)))), ((int)(((byte)(13)))), ((int)(((byte)(13)))));
|
||||
this.treeMeta.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.treeMeta.ContextMenuStrip = this.contextMenuMetaTree;
|
||||
resources.ApplyResources(this.treeMeta, "treeMeta");
|
||||
this.treeMeta.ForeColor = System.Drawing.SystemColors.Window;
|
||||
this.treeMeta.Name = "treeMeta";
|
||||
this.treeMeta.PathSeparator = "/";
|
||||
this.treeMeta.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeMeta_AfterSelect);
|
||||
this.treeMeta.DoubleClick += new System.EventHandler(this.treeMeta_DoubleClick);
|
||||
this.treeMeta.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeMeta_KeyDown);
|
||||
//
|
||||
// contextMenuMetaTree
|
||||
//
|
||||
this.contextMenuMetaTree.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.addEntryToolStripMenuItem,
|
||||
this.addMultipleEntriesToolStripMenuItem1,
|
||||
this.deleteEntryToolStripMenuItem,
|
||||
this.editAllEntriesToolStripMenuItem});
|
||||
this.contextMenuMetaTree.Name = "contextMenuStrip1";
|
||||
resources.ApplyResources(this.contextMenuMetaTree, "contextMenuMetaTree");
|
||||
//
|
||||
// addEntryToolStripMenuItem
|
||||
//
|
||||
this.addEntryToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.addEntryToolStripMenuItem1,
|
||||
this.addBOXEntryToolStripMenuItem1,
|
||||
this.addANIMEntryToolStripMenuItem1});
|
||||
resources.ApplyResources(this.addEntryToolStripMenuItem, "addEntryToolStripMenuItem");
|
||||
this.addEntryToolStripMenuItem.Name = "addEntryToolStripMenuItem";
|
||||
//
|
||||
// addEntryToolStripMenuItem1
|
||||
//
|
||||
this.addEntryToolStripMenuItem1.Name = "addEntryToolStripMenuItem1";
|
||||
resources.ApplyResources(this.addEntryToolStripMenuItem1, "addEntryToolStripMenuItem1");
|
||||
this.addEntryToolStripMenuItem1.Click += new System.EventHandler(this.addEntryToolStripMenuItem_Click);
|
||||
//
|
||||
// addBOXEntryToolStripMenuItem1
|
||||
//
|
||||
this.addBOXEntryToolStripMenuItem1.Name = "addBOXEntryToolStripMenuItem1";
|
||||
resources.ApplyResources(this.addBOXEntryToolStripMenuItem1, "addBOXEntryToolStripMenuItem1");
|
||||
this.addBOXEntryToolStripMenuItem1.Click += new System.EventHandler(this.addBOXEntryToolStripMenuItem1_Click);
|
||||
//
|
||||
// addANIMEntryToolStripMenuItem1
|
||||
//
|
||||
this.addANIMEntryToolStripMenuItem1.Name = "addANIMEntryToolStripMenuItem1";
|
||||
resources.ApplyResources(this.addANIMEntryToolStripMenuItem1, "addANIMEntryToolStripMenuItem1");
|
||||
this.addANIMEntryToolStripMenuItem1.Click += new System.EventHandler(this.addANIMEntryToolStripMenuItem1_Click);
|
||||
//
|
||||
// addMultipleEntriesToolStripMenuItem1
|
||||
//
|
||||
this.addMultipleEntriesToolStripMenuItem1.Name = "addMultipleEntriesToolStripMenuItem1";
|
||||
resources.ApplyResources(this.addMultipleEntriesToolStripMenuItem1, "addMultipleEntriesToolStripMenuItem1");
|
||||
this.addMultipleEntriesToolStripMenuItem1.Click += new System.EventHandler(this.addMultipleEntriesToolStripMenuItem1_Click);
|
||||
//
|
||||
// deleteEntryToolStripMenuItem
|
||||
//
|
||||
this.deleteEntryToolStripMenuItem.Image = global::PckStudio.Properties.Resources.file_delete;
|
||||
this.deleteEntryToolStripMenuItem.Name = "deleteEntryToolStripMenuItem";
|
||||
resources.ApplyResources(this.deleteEntryToolStripMenuItem, "deleteEntryToolStripMenuItem");
|
||||
this.deleteEntryToolStripMenuItem.Click += new System.EventHandler(this.deleteEntryToolStripMenuItem_Click);
|
||||
//
|
||||
// editAllEntriesToolStripMenuItem
|
||||
//
|
||||
this.editAllEntriesToolStripMenuItem.Name = "editAllEntriesToolStripMenuItem";
|
||||
resources.ApplyResources(this.editAllEntriesToolStripMenuItem, "editAllEntriesToolStripMenuItem");
|
||||
this.editAllEntriesToolStripMenuItem.Click += new System.EventHandler(this.editAllEntriesToolStripMenuItem_Click);
|
||||
//
|
||||
// label11
|
||||
//
|
||||
resources.ApplyResources(this.label11, "label11");
|
||||
this.label11.Name = "label11";
|
||||
//
|
||||
// treeViewMain
|
||||
//
|
||||
this.treeViewMain.AllowDrop = true;
|
||||
this.treeViewMain.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(12)))), ((int)(((byte)(12)))), ((int)(((byte)(12)))));
|
||||
this.treeViewMain.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.treeViewMain.ContextMenuStrip = this.contextMenuPCKEntries;
|
||||
resources.ApplyResources(this.treeViewMain, "treeViewMain");
|
||||
this.treeViewMain.ForeColor = System.Drawing.Color.White;
|
||||
this.treeViewMain.ImageList = this.imageList;
|
||||
this.treeViewMain.LabelEdit = true;
|
||||
this.treeViewMain.Name = "treeViewMain";
|
||||
this.treeViewMain.PathSeparator = "/";
|
||||
this.treeViewMain.BeforeLabelEdit += new System.Windows.Forms.NodeLabelEditEventHandler(this.treeViewMain_BeforeLabelEdit);
|
||||
this.treeViewMain.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeViewMain_ItemDrag);
|
||||
this.treeViewMain.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewMain_AfterSelect);
|
||||
this.treeViewMain.NodeMouseClick += new System.Windows.Forms.TreeNodeMouseClickEventHandler(this.treeViewMain_NodeMouseClick);
|
||||
this.treeViewMain.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeViewMain_DragDrop);
|
||||
this.treeViewMain.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeViewMain_DragEnter);
|
||||
this.treeViewMain.DragOver += new System.Windows.Forms.DragEventHandler(this.treeViewMain_DragOver);
|
||||
this.treeViewMain.DoubleClick += new System.EventHandler(this.treeViewMain_DoubleClick);
|
||||
this.treeViewMain.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeViewMain_KeyDown);
|
||||
//
|
||||
// contextMenuPCKEntries
|
||||
//
|
||||
this.contextMenuPCKEntries.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.createToolStripMenuItem,
|
||||
this.importSkinsToolStripMenuItem,
|
||||
this.exportToolStripMenuItem,
|
||||
this.setFileTypeToolStripMenuItem,
|
||||
this.toolStripSeparator5,
|
||||
this.miscFunctionsToolStripMenuItem,
|
||||
this.extractToolStripMenuItem,
|
||||
this.toolStripSeparator6,
|
||||
this.cloneFileToolStripMenuItem,
|
||||
this.renameFileToolStripMenuItem,
|
||||
this.replaceToolStripMenuItem,
|
||||
this.deleteFileToolStripMenuItem});
|
||||
this.contextMenuPCKEntries.Name = "contextMenuStrip1";
|
||||
resources.ApplyResources(this.contextMenuPCKEntries, "contextMenuPCKEntries");
|
||||
this.contextMenuPCKEntries.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuPCKEntries_Opening);
|
||||
//
|
||||
// createToolStripMenuItem
|
||||
//
|
||||
this.createToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.folderToolStripMenuItem,
|
||||
this.skinToolStripMenuItem,
|
||||
this.createAnimatedTextureToolStripMenuItem,
|
||||
this.audiopckToolStripMenuItem,
|
||||
this.colourscolToolStripMenuItem,
|
||||
this.CreateSkinsPCKToolStripMenuItem1,
|
||||
this.behavioursbinToolStripMenuItem,
|
||||
this.entityMaterialsbinToolStripMenuItem});
|
||||
resources.ApplyResources(this.createToolStripMenuItem, "createToolStripMenuItem");
|
||||
this.createToolStripMenuItem.Name = "createToolStripMenuItem";
|
||||
//
|
||||
// folderToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.folderToolStripMenuItem, "folderToolStripMenuItem");
|
||||
this.folderToolStripMenuItem.Name = "folderToolStripMenuItem";
|
||||
this.folderToolStripMenuItem.Click += new System.EventHandler(this.folderToolStripMenuItem_Click);
|
||||
//
|
||||
// skinToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.skinToolStripMenuItem, "skinToolStripMenuItem");
|
||||
this.skinToolStripMenuItem.Name = "skinToolStripMenuItem";
|
||||
this.skinToolStripMenuItem.Click += new System.EventHandler(this.createSkinToolStripMenuItem_Click);
|
||||
//
|
||||
// createAnimatedTextureToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.createAnimatedTextureToolStripMenuItem, "createAnimatedTextureToolStripMenuItem");
|
||||
this.createAnimatedTextureToolStripMenuItem.Name = "createAnimatedTextureToolStripMenuItem";
|
||||
this.createAnimatedTextureToolStripMenuItem.Click += new System.EventHandler(this.createAnimatedTextureToolStripMenuItem_Click);
|
||||
//
|
||||
// audiopckToolStripMenuItem
|
||||
//
|
||||
this.audiopckToolStripMenuItem.Image = global::PckStudio.Properties.Resources.BINKA_ICON;
|
||||
this.audiopckToolStripMenuItem.Name = "audiopckToolStripMenuItem";
|
||||
resources.ApplyResources(this.audiopckToolStripMenuItem, "audiopckToolStripMenuItem");
|
||||
this.audiopckToolStripMenuItem.Click += new System.EventHandler(this.audiopckToolStripMenuItem_Click);
|
||||
//
|
||||
// colourscolToolStripMenuItem
|
||||
//
|
||||
this.colourscolToolStripMenuItem.Image = global::PckStudio.Properties.Resources.COL_ICON;
|
||||
this.colourscolToolStripMenuItem.Name = "colourscolToolStripMenuItem";
|
||||
resources.ApplyResources(this.colourscolToolStripMenuItem, "colourscolToolStripMenuItem");
|
||||
this.colourscolToolStripMenuItem.Click += new System.EventHandler(this.colourscolToolStripMenuItem_Click);
|
||||
//
|
||||
// CreateSkinsPCKToolStripMenuItem1
|
||||
//
|
||||
this.CreateSkinsPCKToolStripMenuItem1.Image = global::PckStudio.Properties.Resources.SKINS_ICON;
|
||||
this.CreateSkinsPCKToolStripMenuItem1.Name = "CreateSkinsPCKToolStripMenuItem1";
|
||||
resources.ApplyResources(this.CreateSkinsPCKToolStripMenuItem1, "CreateSkinsPCKToolStripMenuItem1");
|
||||
this.CreateSkinsPCKToolStripMenuItem1.Click += new System.EventHandler(this.CreateSkinsPCKToolStripMenuItem1_Click);
|
||||
//
|
||||
// behavioursbinToolStripMenuItem
|
||||
//
|
||||
this.behavioursbinToolStripMenuItem.Image = global::PckStudio.Properties.Resources.BEHAVIOURS_ICON;
|
||||
this.behavioursbinToolStripMenuItem.Name = "behavioursbinToolStripMenuItem";
|
||||
resources.ApplyResources(this.behavioursbinToolStripMenuItem, "behavioursbinToolStripMenuItem");
|
||||
this.behavioursbinToolStripMenuItem.Click += new System.EventHandler(this.behavioursbinToolStripMenuItem_Click);
|
||||
//
|
||||
// entityMaterialsbinToolStripMenuItem
|
||||
//
|
||||
this.entityMaterialsbinToolStripMenuItem.Image = global::PckStudio.Properties.Resources.ENTITY_MATERIALS_ICON;
|
||||
this.entityMaterialsbinToolStripMenuItem.Name = "entityMaterialsbinToolStripMenuItem";
|
||||
resources.ApplyResources(this.entityMaterialsbinToolStripMenuItem, "entityMaterialsbinToolStripMenuItem");
|
||||
this.entityMaterialsbinToolStripMenuItem.Click += new System.EventHandler(this.entityMaterialsbinToolStripMenuItem_Click);
|
||||
//
|
||||
// importSkinsToolStripMenuItem
|
||||
//
|
||||
this.importSkinsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.importSkinToolStripMenuItem,
|
||||
this.importExtractedSkinsFolderToolStripMenuItem,
|
||||
this.addTextureToolStripMenuItem,
|
||||
this.addFileToolStripMenuItem});
|
||||
resources.ApplyResources(this.importSkinsToolStripMenuItem, "importSkinsToolStripMenuItem");
|
||||
this.importSkinsToolStripMenuItem.Name = "importSkinsToolStripMenuItem";
|
||||
//
|
||||
// importSkinToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.importSkinToolStripMenuItem, "importSkinToolStripMenuItem");
|
||||
this.importSkinToolStripMenuItem.Name = "importSkinToolStripMenuItem";
|
||||
this.importSkinToolStripMenuItem.Click += new System.EventHandler(this.importSkinToolStripMenuItem_Click);
|
||||
//
|
||||
// importExtractedSkinsFolderToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.importExtractedSkinsFolderToolStripMenuItem, "importExtractedSkinsFolderToolStripMenuItem");
|
||||
this.importExtractedSkinsFolderToolStripMenuItem.Name = "importExtractedSkinsFolderToolStripMenuItem";
|
||||
this.importExtractedSkinsFolderToolStripMenuItem.Click += new System.EventHandler(this.importExtractedSkinsFolder);
|
||||
//
|
||||
// addTextureToolStripMenuItem
|
||||
//
|
||||
this.addTextureToolStripMenuItem.Image = global::PckStudio.Properties.Resources.AddTexture;
|
||||
this.addTextureToolStripMenuItem.Name = "addTextureToolStripMenuItem";
|
||||
resources.ApplyResources(this.addTextureToolStripMenuItem, "addTextureToolStripMenuItem");
|
||||
this.addTextureToolStripMenuItem.Click += new System.EventHandler(this.addTextureToolStripMenuItem_Click);
|
||||
//
|
||||
// addFileToolStripMenuItem
|
||||
//
|
||||
this.addFileToolStripMenuItem.Image = global::PckStudio.Properties.Resources.blank;
|
||||
this.addFileToolStripMenuItem.Name = "addFileToolStripMenuItem";
|
||||
resources.ApplyResources(this.addFileToolStripMenuItem, "addFileToolStripMenuItem");
|
||||
this.addFileToolStripMenuItem.Click += new System.EventHandler(this.addFileToolStripMenuItem_Click);
|
||||
//
|
||||
// exportToolStripMenuItem
|
||||
//
|
||||
this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.as3DSTextureFileToolStripMenuItem});
|
||||
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
resources.ApplyResources(this.exportToolStripMenuItem, "exportToolStripMenuItem");
|
||||
//
|
||||
// as3DSTextureFileToolStripMenuItem
|
||||
//
|
||||
this.as3DSTextureFileToolStripMenuItem.Name = "as3DSTextureFileToolStripMenuItem";
|
||||
resources.ApplyResources(this.as3DSTextureFileToolStripMenuItem, "as3DSTextureFileToolStripMenuItem");
|
||||
this.as3DSTextureFileToolStripMenuItem.Click += new System.EventHandler(this.as3DSTextureFileToolStripMenuItem_Click);
|
||||
//
|
||||
// setFileTypeToolStripMenuItem
|
||||
//
|
||||
this.setFileTypeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.skinToolStripMenuItem1,
|
||||
this.capeToolStripMenuItem,
|
||||
this.textureToolStripMenuItem,
|
||||
this.languagesFileLOCToolStripMenuItem,
|
||||
this.gameRulesFileGRFToolStripMenuItem,
|
||||
this.audioPCKFileToolStripMenuItem,
|
||||
this.coloursCOLFileToolStripMenuItem,
|
||||
this.gameRulesHeaderGRHToolStripMenuItem,
|
||||
this.skinsPCKToolStripMenuItem,
|
||||
this.modelsFileBINToolStripMenuItem,
|
||||
this.behavioursFileBINToolStripMenuItem,
|
||||
this.entityMaterialsFileBINToolStripMenuItem});
|
||||
this.setFileTypeToolStripMenuItem.Name = "setFileTypeToolStripMenuItem";
|
||||
resources.ApplyResources(this.setFileTypeToolStripMenuItem, "setFileTypeToolStripMenuItem");
|
||||
//
|
||||
// skinToolStripMenuItem1
|
||||
//
|
||||
this.skinToolStripMenuItem1.Image = global::PckStudio.Properties.Resources.SKIN_ICON;
|
||||
this.skinToolStripMenuItem1.Name = "skinToolStripMenuItem1";
|
||||
resources.ApplyResources(this.skinToolStripMenuItem1, "skinToolStripMenuItem1");
|
||||
//
|
||||
// capeToolStripMenuItem
|
||||
//
|
||||
this.capeToolStripMenuItem.Image = global::PckStudio.Properties.Resources.CAPE_ICON;
|
||||
this.capeToolStripMenuItem.Name = "capeToolStripMenuItem";
|
||||
resources.ApplyResources(this.capeToolStripMenuItem, "capeToolStripMenuItem");
|
||||
//
|
||||
// textureToolStripMenuItem
|
||||
//
|
||||
this.textureToolStripMenuItem.Image = global::PckStudio.Properties.Resources.TEXTURE_ICON;
|
||||
this.textureToolStripMenuItem.Name = "textureToolStripMenuItem";
|
||||
resources.ApplyResources(this.textureToolStripMenuItem, "textureToolStripMenuItem");
|
||||
//
|
||||
// languagesFileLOCToolStripMenuItem
|
||||
//
|
||||
this.languagesFileLOCToolStripMenuItem.Image = global::PckStudio.Properties.Resources.LOC_ICON;
|
||||
this.languagesFileLOCToolStripMenuItem.Name = "languagesFileLOCToolStripMenuItem";
|
||||
resources.ApplyResources(this.languagesFileLOCToolStripMenuItem, "languagesFileLOCToolStripMenuItem");
|
||||
//
|
||||
// gameRulesFileGRFToolStripMenuItem
|
||||
//
|
||||
this.gameRulesFileGRFToolStripMenuItem.Image = global::PckStudio.Properties.Resources.GRF_ICON;
|
||||
this.gameRulesFileGRFToolStripMenuItem.Name = "gameRulesFileGRFToolStripMenuItem";
|
||||
resources.ApplyResources(this.gameRulesFileGRFToolStripMenuItem, "gameRulesFileGRFToolStripMenuItem");
|
||||
//
|
||||
// audioPCKFileToolStripMenuItem
|
||||
//
|
||||
this.audioPCKFileToolStripMenuItem.Image = global::PckStudio.Properties.Resources.BINKA_ICON;
|
||||
this.audioPCKFileToolStripMenuItem.Name = "audioPCKFileToolStripMenuItem";
|
||||
resources.ApplyResources(this.audioPCKFileToolStripMenuItem, "audioPCKFileToolStripMenuItem");
|
||||
//
|
||||
// coloursCOLFileToolStripMenuItem
|
||||
//
|
||||
this.coloursCOLFileToolStripMenuItem.Image = global::PckStudio.Properties.Resources.COL_ICON;
|
||||
this.coloursCOLFileToolStripMenuItem.Name = "coloursCOLFileToolStripMenuItem";
|
||||
resources.ApplyResources(this.coloursCOLFileToolStripMenuItem, "coloursCOLFileToolStripMenuItem");
|
||||
//
|
||||
// gameRulesHeaderGRHToolStripMenuItem
|
||||
//
|
||||
this.gameRulesHeaderGRHToolStripMenuItem.Image = global::PckStudio.Properties.Resources.GRH_ICON;
|
||||
this.gameRulesHeaderGRHToolStripMenuItem.Name = "gameRulesHeaderGRHToolStripMenuItem";
|
||||
resources.ApplyResources(this.gameRulesHeaderGRHToolStripMenuItem, "gameRulesHeaderGRHToolStripMenuItem");
|
||||
//
|
||||
// skinsPCKToolStripMenuItem
|
||||
//
|
||||
this.skinsPCKToolStripMenuItem.Image = global::PckStudio.Properties.Resources.SKINS_ICON;
|
||||
this.skinsPCKToolStripMenuItem.Name = "skinsPCKToolStripMenuItem";
|
||||
resources.ApplyResources(this.skinsPCKToolStripMenuItem, "skinsPCKToolStripMenuItem");
|
||||
//
|
||||
// modelsFileBINToolStripMenuItem
|
||||
//
|
||||
this.modelsFileBINToolStripMenuItem.Image = global::PckStudio.Properties.Resources.MODELS_ICON;
|
||||
this.modelsFileBINToolStripMenuItem.Name = "modelsFileBINToolStripMenuItem";
|
||||
resources.ApplyResources(this.modelsFileBINToolStripMenuItem, "modelsFileBINToolStripMenuItem");
|
||||
//
|
||||
// behavioursFileBINToolStripMenuItem
|
||||
//
|
||||
this.behavioursFileBINToolStripMenuItem.Image = global::PckStudio.Properties.Resources.BEHAVIOURS_ICON;
|
||||
this.behavioursFileBINToolStripMenuItem.Name = "behavioursFileBINToolStripMenuItem";
|
||||
resources.ApplyResources(this.behavioursFileBINToolStripMenuItem, "behavioursFileBINToolStripMenuItem");
|
||||
//
|
||||
// entityMaterialsFileBINToolStripMenuItem
|
||||
//
|
||||
this.entityMaterialsFileBINToolStripMenuItem.Image = global::PckStudio.Properties.Resources.ENTITY_MATERIALS_ICON;
|
||||
this.entityMaterialsFileBINToolStripMenuItem.Name = "entityMaterialsFileBINToolStripMenuItem";
|
||||
resources.ApplyResources(this.entityMaterialsFileBINToolStripMenuItem, "entityMaterialsFileBINToolStripMenuItem");
|
||||
//
|
||||
// toolStripSeparator5
|
||||
//
|
||||
this.toolStripSeparator5.Name = "toolStripSeparator5";
|
||||
resources.ApplyResources(this.toolStripSeparator5, "toolStripSeparator5");
|
||||
//
|
||||
// miscFunctionsToolStripMenuItem
|
||||
//
|
||||
this.miscFunctionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.generateMipMapTextureToolStripMenuItem1,
|
||||
this.viewFileInfoToolStripMenuItem,
|
||||
this.correctSkinDecimalsToolStripMenuItem,
|
||||
this.setSubPCKEndiannessToolStripMenuItem,
|
||||
this.setModelContainerFormatToolStripMenuItem});
|
||||
this.miscFunctionsToolStripMenuItem.Name = "miscFunctionsToolStripMenuItem";
|
||||
resources.ApplyResources(this.miscFunctionsToolStripMenuItem, "miscFunctionsToolStripMenuItem");
|
||||
//
|
||||
// generateMipMapTextureToolStripMenuItem1
|
||||
//
|
||||
this.generateMipMapTextureToolStripMenuItem1.Name = "generateMipMapTextureToolStripMenuItem1";
|
||||
resources.ApplyResources(this.generateMipMapTextureToolStripMenuItem1, "generateMipMapTextureToolStripMenuItem1");
|
||||
this.generateMipMapTextureToolStripMenuItem1.Click += new System.EventHandler(this.generateMipMapTextureToolStripMenuItem_Click);
|
||||
//
|
||||
// viewFileInfoToolStripMenuItem
|
||||
//
|
||||
this.viewFileInfoToolStripMenuItem.Name = "viewFileInfoToolStripMenuItem";
|
||||
resources.ApplyResources(this.viewFileInfoToolStripMenuItem, "viewFileInfoToolStripMenuItem");
|
||||
this.viewFileInfoToolStripMenuItem.Click += new System.EventHandler(this.viewFileInfoToolStripMenuItem_Click);
|
||||
//
|
||||
// correctSkinDecimalsToolStripMenuItem
|
||||
//
|
||||
this.correctSkinDecimalsToolStripMenuItem.Name = "correctSkinDecimalsToolStripMenuItem";
|
||||
resources.ApplyResources(this.correctSkinDecimalsToolStripMenuItem, "correctSkinDecimalsToolStripMenuItem");
|
||||
this.correctSkinDecimalsToolStripMenuItem.Click += new System.EventHandler(this.correctSkinDecimalsToolStripMenuItem_Click);
|
||||
//
|
||||
// setSubPCKEndiannessToolStripMenuItem
|
||||
//
|
||||
this.setSubPCKEndiannessToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.bigEndianXbox360PS3WiiUToolStripMenuItem,
|
||||
this.littleEndianPS4PSVitaSwitchToolStripMenuItem});
|
||||
this.setSubPCKEndiannessToolStripMenuItem.Name = "setSubPCKEndiannessToolStripMenuItem";
|
||||
resources.ApplyResources(this.setSubPCKEndiannessToolStripMenuItem, "setSubPCKEndiannessToolStripMenuItem");
|
||||
//
|
||||
// bigEndianXbox360PS3WiiUToolStripMenuItem
|
||||
//
|
||||
this.bigEndianXbox360PS3WiiUToolStripMenuItem.Name = "bigEndianXbox360PS3WiiUToolStripMenuItem";
|
||||
resources.ApplyResources(this.bigEndianXbox360PS3WiiUToolStripMenuItem, "bigEndianXbox360PS3WiiUToolStripMenuItem");
|
||||
this.bigEndianXbox360PS3WiiUToolStripMenuItem.Click += new System.EventHandler(this.bigEndianToolStripMenuItem_Click);
|
||||
//
|
||||
// littleEndianPS4PSVitaSwitchToolStripMenuItem
|
||||
//
|
||||
this.littleEndianPS4PSVitaSwitchToolStripMenuItem.Name = "littleEndianPS4PSVitaSwitchToolStripMenuItem";
|
||||
resources.ApplyResources(this.littleEndianPS4PSVitaSwitchToolStripMenuItem, "littleEndianPS4PSVitaSwitchToolStripMenuItem");
|
||||
this.littleEndianPS4PSVitaSwitchToolStripMenuItem.Click += new System.EventHandler(this.littleEndianToolStripMenuItem_Click);
|
||||
//
|
||||
// setModelContainerFormatToolStripMenuItem
|
||||
//
|
||||
this.setModelContainerFormatToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.version1ToolStripMenuItem,
|
||||
this.version2ToolStripMenuItem,
|
||||
this.version3114ToolStripMenuItem});
|
||||
this.setModelContainerFormatToolStripMenuItem.Name = "setModelContainerFormatToolStripMenuItem";
|
||||
resources.ApplyResources(this.setModelContainerFormatToolStripMenuItem, "setModelContainerFormatToolStripMenuItem");
|
||||
//
|
||||
// version1ToolStripMenuItem
|
||||
//
|
||||
this.version1ToolStripMenuItem.Name = "version1ToolStripMenuItem";
|
||||
resources.ApplyResources(this.version1ToolStripMenuItem, "version1ToolStripMenuItem");
|
||||
this.version1ToolStripMenuItem.Click += new System.EventHandler(this.setModelVersion1ToolStripMenuItem_Click);
|
||||
//
|
||||
// version2ToolStripMenuItem
|
||||
//
|
||||
this.version2ToolStripMenuItem.Name = "version2ToolStripMenuItem";
|
||||
resources.ApplyResources(this.version2ToolStripMenuItem, "version2ToolStripMenuItem");
|
||||
this.version2ToolStripMenuItem.Click += new System.EventHandler(this.setModelVersion2ToolStripMenuItem_Click);
|
||||
//
|
||||
// version3114ToolStripMenuItem
|
||||
//
|
||||
this.version3114ToolStripMenuItem.Name = "version3114ToolStripMenuItem";
|
||||
resources.ApplyResources(this.version3114ToolStripMenuItem, "version3114ToolStripMenuItem");
|
||||
this.version3114ToolStripMenuItem.Click += new System.EventHandler(this.setModelVersion3ToolStripMenuItem_Click);
|
||||
//
|
||||
// extractToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.extractToolStripMenuItem, "extractToolStripMenuItem");
|
||||
this.extractToolStripMenuItem.Name = "extractToolStripMenuItem";
|
||||
this.extractToolStripMenuItem.Click += new System.EventHandler(this.extractToolStripMenuItem_Click);
|
||||
//
|
||||
// toolStripSeparator6
|
||||
//
|
||||
this.toolStripSeparator6.Name = "toolStripSeparator6";
|
||||
resources.ApplyResources(this.toolStripSeparator6, "toolStripSeparator6");
|
||||
//
|
||||
// cloneFileToolStripMenuItem
|
||||
//
|
||||
this.cloneFileToolStripMenuItem.Name = "cloneFileToolStripMenuItem";
|
||||
resources.ApplyResources(this.cloneFileToolStripMenuItem, "cloneFileToolStripMenuItem");
|
||||
this.cloneFileToolStripMenuItem.Click += new System.EventHandler(this.cloneFileToolStripMenuItem_Click);
|
||||
//
|
||||
// renameFileToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.renameFileToolStripMenuItem, "renameFileToolStripMenuItem");
|
||||
this.renameFileToolStripMenuItem.Name = "renameFileToolStripMenuItem";
|
||||
this.renameFileToolStripMenuItem.Click += new System.EventHandler(this.renameFileToolStripMenuItem_Click);
|
||||
//
|
||||
// replaceToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.replaceToolStripMenuItem, "replaceToolStripMenuItem");
|
||||
this.replaceToolStripMenuItem.Name = "replaceToolStripMenuItem";
|
||||
this.replaceToolStripMenuItem.Click += new System.EventHandler(this.replaceToolStripMenuItem_Click);
|
||||
//
|
||||
// deleteFileToolStripMenuItem
|
||||
//
|
||||
this.deleteFileToolStripMenuItem.Image = global::PckStudio.Properties.Resources.file_delete;
|
||||
this.deleteFileToolStripMenuItem.Name = "deleteFileToolStripMenuItem";
|
||||
resources.ApplyResources(this.deleteFileToolStripMenuItem, "deleteFileToolStripMenuItem");
|
||||
this.deleteFileToolStripMenuItem.Click += new System.EventHandler(this.deleteFileToolStripMenuItem_Click);
|
||||
//
|
||||
// imageList
|
||||
//
|
||||
this.imageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
|
||||
resources.ApplyResources(this.imageList, "imageList");
|
||||
this.imageList.TransparentColor = System.Drawing.Color.Transparent;
|
||||
//
|
||||
// addMultipleEntriesToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.addMultipleEntriesToolStripMenuItem, "addMultipleEntriesToolStripMenuItem");
|
||||
this.addMultipleEntriesToolStripMenuItem.Name = "addMultipleEntriesToolStripMenuItem";
|
||||
//
|
||||
// LittleEndianCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.LittleEndianCheckBox, "LittleEndianCheckBox");
|
||||
this.LittleEndianCheckBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.LittleEndianCheckBox.Name = "LittleEndianCheckBox";
|
||||
this.LittleEndianCheckBox.Style = MetroFramework.MetroColorStyle.White;
|
||||
this.LittleEndianCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.LittleEndianCheckBox.UseSelectable = true;
|
||||
//
|
||||
// previewPictureBox
|
||||
//
|
||||
resources.ApplyResources(this.previewPictureBox, "previewPictureBox");
|
||||
this.previewPictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.previewPictureBox.BackgroundInterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.previewPictureBox.Image = global::PckStudio.Properties.Resources.NoImageFound;
|
||||
this.previewPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.previewPictureBox.Name = "previewPictureBox";
|
||||
this.previewPictureBox.TabStop = false;
|
||||
//
|
||||
// PckEditor
|
||||
//
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.Controls.Add(this.previewPictureBox);
|
||||
this.Controls.Add(this.LittleEndianCheckBox);
|
||||
this.Controls.Add(this.pckFileLabel);
|
||||
this.Controls.Add(this.labelImageSize);
|
||||
this.Controls.Add(this.fileEntryCountLabel);
|
||||
this.Controls.Add(this.PropertiesTabControl);
|
||||
this.Controls.Add(this.label11);
|
||||
this.Controls.Add(this.treeViewMain);
|
||||
this.Controls.Add(logoPictureBox);
|
||||
this.ForeColor = System.Drawing.Color.Transparent;
|
||||
this.Name = "PckEditor";
|
||||
this.Load += new System.EventHandler(this.PckEditor_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(logoPictureBox)).EndInit();
|
||||
this.PropertiesTabControl.ResumeLayout(false);
|
||||
this.MetaTab.ResumeLayout(false);
|
||||
this.MetaTab.PerformLayout();
|
||||
this.contextMenuMetaTree.ResumeLayout(false);
|
||||
this.contextMenuPCKEntries.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.previewPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private MetroFramework.Controls.MetroLabel pckFileLabel;
|
||||
private MetroFramework.Controls.MetroLabel labelImageSize;
|
||||
private MetroFramework.Controls.MetroLabel fileEntryCountLabel;
|
||||
private MetroFramework.Controls.MetroTabControl PropertiesTabControl;
|
||||
private MetroFramework.Controls.MetroTabPage MetaTab;
|
||||
private System.Windows.Forms.TreeView treeMeta;
|
||||
private MetroFramework.Controls.MetroLabel label11;
|
||||
private System.Windows.Forms.TreeView treeViewMain;
|
||||
private PckStudio.ToolboxItems.InterpolationPictureBox previewPictureBox;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuMetaTree;
|
||||
private System.Windows.Forms.ToolStripMenuItem addEntryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem addEntryToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem addBOXEntryToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem addANIMEntryToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem addMultipleEntriesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteEntryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem editAllEntriesToolStripMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuPCKEntries;
|
||||
private System.Windows.Forms.ToolStripMenuItem createToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem folderToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem skinToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem createAnimatedTextureToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem audiopckToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem colourscolToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem CreateSkinsPCKToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem behavioursbinToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem entityMaterialsbinToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem importSkinsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem importSkinToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem importExtractedSkinsFolderToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem addTextureToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem addFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem as3DSTextureFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem setFileTypeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem skinToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem capeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem textureToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem languagesFileLOCToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem gameRulesFileGRFToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem audioPCKFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem coloursCOLFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem gameRulesHeaderGRHToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem skinsPCKToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem modelsFileBINToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem behavioursFileBINToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem entityMaterialsFileBINToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem miscFunctionsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem generateMipMapTextureToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem viewFileInfoToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem correctSkinDecimalsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem extractToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem cloneFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem renameFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ImageList imageList;
|
||||
private System.Windows.Forms.ToolStripMenuItem addMultipleEntriesToolStripMenuItem1;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel2;
|
||||
private MetroFramework.Controls.MetroTextBox entryTypeTextBox;
|
||||
private MetroFramework.Controls.MetroTextBox entryDataTextBox;
|
||||
private MetroFramework.Controls.MetroButton buttonEdit;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel1;
|
||||
private MetroFramework.Controls.MetroCheckBox LittleEndianCheckBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem setSubPCKEndiannessToolStripMenuItem;
|
||||
private ToolStripMenuItem bigEndianXbox360PS3WiiUToolStripMenuItem;
|
||||
private ToolStripMenuItem littleEndianPS4PSVitaSwitchToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem setModelContainerFormatToolStripMenuItem;
|
||||
private ToolStripMenuItem version1ToolStripMenuItem;
|
||||
private ToolStripMenuItem version2ToolStripMenuItem;
|
||||
private ToolStripMenuItem version3114ToolStripMenuItem;
|
||||
private ToolStripSeparator toolStripSeparator5;
|
||||
private ToolStripSeparator toolStripSeparator6;
|
||||
}
|
||||
}
|
||||
2232
PCK-Studio/Controls/PckEditor.cs
Normal file
2232
PCK-Studio/Controls/PckEditor.cs
Normal file
File diff suppressed because it is too large
Load Diff
2115
PCK-Studio/Controls/PckEditor.resx
Normal file
2115
PCK-Studio/Controls/PckEditor.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,25 +0,0 @@
|
||||
using System.Drawing;
|
||||
using AnimatedGif;
|
||||
using PckStudio.Internal;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal static class AnimationExtensions
|
||||
{
|
||||
internal static Image CreateAnimationImage(this Animation animation)
|
||||
{
|
||||
if (animation.FrameCount == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
var ms = new System.IO.MemoryStream();
|
||||
var generateor = new AnimatedGifCreator(ms, GameConstants.GameTickInMilliseconds, 0);
|
||||
foreach (Animation.Frame frame in animation.GetInterpolatedFrames())
|
||||
{
|
||||
generateor.AddFrame(frame.Texture, frame.Ticks * GameConstants.GameTickInMilliseconds, GifQuality.Bit8);
|
||||
}
|
||||
ms.Position = 0;
|
||||
return Image.FromStream(ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal enum ImageLayoutDirection
|
||||
{
|
||||
Horizontal,
|
||||
Vertical
|
||||
}
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers;
|
||||
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal.Deserializer;
|
||||
using PckStudio.Internal.Serializer;
|
||||
|
||||
namespace PckStudio.Extensions
|
||||
{
|
||||
internal static class PckAssetExtensions
|
||||
{
|
||||
private const string MipMap = "MipMapLevel";
|
||||
|
||||
internal static PckAsset CreateNewAssetIf(this PckFile pck, bool condition, string filename, PckAssetType filetype, IDataFormatWriter writer)
|
||||
{
|
||||
if (condition)
|
||||
{
|
||||
return pck.CreateNewAsset(filename, filetype, writer);
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
internal static PckAsset CreateNewAsset(this PckFile pck, string filename, PckAssetType filetype, IDataFormatWriter writer)
|
||||
{
|
||||
PckAsset asset = pck.CreateNewAsset(filename, filetype);
|
||||
asset.SetData(writer);
|
||||
return asset;
|
||||
}
|
||||
|
||||
internal static Image GetTexture(this PckAsset asset)
|
||||
{
|
||||
if (asset.Type != PckAssetType.SkinFile &&
|
||||
asset.Type != PckAssetType.CapeFile &&
|
||||
asset.Type != PckAssetType.TextureFile)
|
||||
{
|
||||
throw new Exception("Asset is not suitable to contain image data.");
|
||||
}
|
||||
return asset.GetDeserializedData(ImageDeserializer.DefaultDeserializer);
|
||||
}
|
||||
|
||||
internal static T GetDeserializedData<T>(this PckAsset asset, IPckAssetDeserializer<T> deserializer)
|
||||
{
|
||||
return deserializer.Deserialize(asset);
|
||||
}
|
||||
|
||||
internal static T GetData<T>(this PckAsset asset, IDataFormatReader<T> formatReader) where T : class
|
||||
{
|
||||
using var ms = new MemoryStream(asset.Data);
|
||||
return formatReader.FromStream(ms);
|
||||
}
|
||||
|
||||
internal static void SetSerializedData<T>(this PckAsset asset, T obj, IPckAssetSerializer<T> serializer)
|
||||
{
|
||||
serializer.Serialize(obj, ref asset);
|
||||
}
|
||||
|
||||
internal static void SetData(this PckAsset asset, IDataFormatWriter formatWriter)
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
formatWriter.WriteToStream(stream);
|
||||
asset.SetData(stream.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
internal static void SetTexture(this PckAsset asset, Image image)
|
||||
{
|
||||
if (asset.Type != PckAssetType.SkinFile &&
|
||||
asset.Type != PckAssetType.CapeFile &&
|
||||
asset.Type != PckAssetType.TextureFile)
|
||||
{
|
||||
throw new Exception("Asset is not suitable to contain image data.");
|
||||
}
|
||||
asset.SetSerializedData(image, ImageSerializer.DefaultSerializer);
|
||||
}
|
||||
|
||||
internal static bool IsMipmappedFile(this PckAsset asset)
|
||||
{
|
||||
// We only want to test the file name itself. ex: "terrainMipMapLevel2"
|
||||
string name = Path.GetFileNameWithoutExtension(asset.Filename);
|
||||
|
||||
// check if last character is a digit (0-9). If not return false
|
||||
if (!char.IsDigit(name[name.Length - 1]))
|
||||
return false;
|
||||
|
||||
// If string does not end with MipMapLevel, then it's not MipMapped
|
||||
if (!name.Remove(name.Length - 1, 1).EndsWith(MipMap))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static string GetNormalPath(this PckAsset asset)
|
||||
{
|
||||
if (!asset.IsMipmappedFile())
|
||||
return asset.Filename;
|
||||
string ext = Path.GetExtension(asset.Filename);
|
||||
return asset.Filename.Remove(asset.Filename.Length - (MipMap.Length + 1) - ext.Length) + ext;
|
||||
}
|
||||
|
||||
internal static void DeserializeProperties(this PckAsset asset, IEnumerable<string> serializedData)
|
||||
{
|
||||
IEnumerable<KeyValuePair<string, string>> lines = serializedData
|
||||
.Select(line => line.Split([' '], 2))
|
||||
.Where (keyValue => keyValue.Length == 2)
|
||||
.Select(keyValue => new KeyValuePair<string, string>(keyValue[0].Replace(":", ""), keyValue[1]));
|
||||
foreach (KeyValuePair<string, string> kv in lines)
|
||||
{
|
||||
asset.AddProperty(kv);
|
||||
}
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> SerializeProperties(this PckAsset asset, string seperater = ":")
|
||||
{
|
||||
IReadOnlyList<KeyValuePair<string, string>> properties = asset.GetProperties();
|
||||
return properties.Select(property => property.Key + seperater + property.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
PCK-Studio/External/API/Miles/Binka.cs
vendored
2
PCK-Studio/External/API/Miles/Binka.cs
vendored
@@ -2,7 +2,7 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.App;
|
||||
using SharpMSS;
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PckStudio.FileFormats
|
||||
{
|
||||
#region File Structure
|
||||
/*
|
||||
Version - 4 bytes[int32]
|
||||
NumberOfParts - 4 bytes[int32]
|
||||
{
|
||||
Part name length - 2 bytes[int16]
|
||||
part name - x bytes
|
||||
part parent - 4 bytes[int32] (HEAD=1, BODY=2, LEG0=3, LEG1=4, ARM0=5, ARM1=6)
|
||||
Position-X - 4 bytes[float]
|
||||
Position-Y - 4 bytes[float]
|
||||
Position-Z - 4 bytes[float]
|
||||
Size-X - 4 bytes[float]
|
||||
Size-Y - 4 bytes[float]
|
||||
Size-Z - 4 bytes[float]
|
||||
UV-Y - 4 bytes[int32]
|
||||
UV-X - 4 bytes[int32]
|
||||
mirror texture - 1 byte[bool]
|
||||
Hide with armour - 1 byte[bool]
|
||||
inflation/scale value - 4 bytes[float]
|
||||
}
|
||||
NumberOfOffsets - 4 bytes[int32]
|
||||
{
|
||||
offset part - 4 bytes[int32]
|
||||
vertical offset - 4 bytes[float]
|
||||
}
|
||||
*/
|
||||
#endregion
|
||||
class CSMBFile
|
||||
{
|
||||
public List<CSMBPart> Parts = new List<CSMBPart>();
|
||||
public List<CSMBOffset> Offsets = new List<CSMBOffset>();
|
||||
}
|
||||
|
||||
public class CSMBPart
|
||||
{
|
||||
public string Name = "Partname";
|
||||
public CSMBParentPart Parent = 0;
|
||||
public float posX, posY, posZ = 0.0f;
|
||||
public float sizeX, sizeY, sizeZ = 0.0f;
|
||||
public int uvX, uvY = 0;
|
||||
public bool HideWArmour, MirrorTexture = false;
|
||||
public float Inflation = 0.0f;
|
||||
}
|
||||
public class CSMBOffset
|
||||
{
|
||||
public CSMBOffsetPart offsetPart = 0;
|
||||
public float VerticalOffset = 0.0f;
|
||||
}
|
||||
|
||||
public enum CSMBOffsetPart
|
||||
{
|
||||
HEAD = 0,
|
||||
BODY = 1,
|
||||
ARM0 = 2,
|
||||
ARM1 = 3,
|
||||
LEG0 = 4,
|
||||
LEG1 = 5,
|
||||
HEADWEAR = 6,
|
||||
JACKET = 7,
|
||||
SLEEVE0 = 8,
|
||||
SLEEVE1 = 9,
|
||||
PANTS0 = 10,
|
||||
PANTS1 = 11,
|
||||
WAIST = 12,
|
||||
LEGGING0 = 13,
|
||||
LEGGING1 = 14,
|
||||
SOCK0 = 15,
|
||||
SOCK1 = 16,
|
||||
BOOT0 = 17,
|
||||
BOOT1 = 18,
|
||||
ARMARMOR1 = 19,
|
||||
ARMARMOR0 = 20,
|
||||
BODYARMOR = 21,
|
||||
BELT = 22,
|
||||
TOOL0 = 23,
|
||||
TOOL1 = 24,
|
||||
HELMET = 25,
|
||||
SHOULDER0 = 26,
|
||||
SHOULDER1 = 27,
|
||||
CHEST = 28
|
||||
}
|
||||
|
||||
public enum CSMBParentPart
|
||||
{
|
||||
HEAD = 0,
|
||||
BODY = 1,
|
||||
ARM0 = 2,
|
||||
ARM1 = 3,
|
||||
LEG0 = 4,
|
||||
LEG1 = 5,
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,6 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddSkinPrompt));
|
||||
System.Windows.Forms.Label label2;
|
||||
System.Windows.Forms.Label label1;
|
||||
this.textTheme = new System.Windows.Forms.TextBox();
|
||||
this.contextMenuSkin = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.replaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuCape = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
@@ -81,11 +80,6 @@
|
||||
label1.ForeColor = System.Drawing.Color.White;
|
||||
label1.Name = "label1";
|
||||
//
|
||||
// textTheme
|
||||
//
|
||||
resources.ApplyResources(this.textTheme, "textTheme");
|
||||
this.textTheme.Name = "textTheme";
|
||||
//
|
||||
// contextMenuSkin
|
||||
//
|
||||
this.contextMenuSkin.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -289,6 +283,7 @@
|
||||
// capePictureBox
|
||||
//
|
||||
resources.ApplyResources(this.capePictureBox, "capePictureBox");
|
||||
this.capePictureBox.BackgroundInterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.capePictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.capePictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.capePictureBox.Name = "capePictureBox";
|
||||
@@ -298,6 +293,7 @@
|
||||
// skinPictureBox
|
||||
//
|
||||
resources.ApplyResources(this.skinPictureBox, "skinPictureBox");
|
||||
this.skinPictureBox.BackgroundInterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.skinPictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.skinPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.skinPictureBox.Name = "skinPictureBox";
|
||||
@@ -343,7 +339,6 @@
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.TextBox textTheme;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuSkin;
|
||||
private System.Windows.Forms.ToolStripMenuItem replaceToolStripMenuItem;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuCape;
|
||||
|
||||
@@ -8,127 +8,92 @@ using OMI.Formats.Languages;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Forms.Editor;
|
||||
using PckStudio.Internal.IO._3DST;
|
||||
using PckStudio.Core.IO._3DST;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Core;
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups
|
||||
{
|
||||
public partial class AddSkinPrompt : MetroFramework.Forms.MetroForm
|
||||
{
|
||||
public PckAsset SkinAsset => _skin;
|
||||
public PckAsset CapeAsset => _cape;
|
||||
public bool HasCape => _cape is not null;
|
||||
public Skin NewSkin => newSkin;
|
||||
|
||||
private LOCFile currentLoc;
|
||||
private PckAsset _skin = new PckAsset("dlcskinXYXYXYXY", PckAssetType.SkinFile);
|
||||
private PckAsset _cape;
|
||||
private SkinANIM _anim = SkinANIM.Empty;
|
||||
private Skin newSkin;
|
||||
private Random rng = new Random();
|
||||
private int _xmlVersion = 0;
|
||||
|
||||
private eSkinType skinType;
|
||||
|
||||
private enum eSkinType
|
||||
{
|
||||
Invalid = -1,
|
||||
_64x64,
|
||||
_64x32,
|
||||
_64x64HD,
|
||||
_64x32HD,
|
||||
Custom,
|
||||
}
|
||||
|
||||
public AddSkinPrompt(LOCFile loc)
|
||||
public AddSkinPrompt(int xmlVersion = 0)
|
||||
{
|
||||
InitializeComponent();
|
||||
currentLoc = loc;
|
||||
_xmlVersion = xmlVersion;
|
||||
newSkin = new Skin("", new SkinANIM(SkinAnimMask.MODERN_WIDE_MODEL), Resources.classic_template, Enumerable.Empty<SkinBOX>(), Enumerable.Empty<SkinPartOffset>());
|
||||
}
|
||||
|
||||
private void CheckImage(Image img)
|
||||
private void SetNewTexture(Image img)
|
||||
{
|
||||
switch (img.Height)
|
||||
Debug.Assert(img is not null, "Image is null.");
|
||||
|
||||
if (img.Width != img.Height && img.Height != img.Width / 2)
|
||||
{
|
||||
case 64:
|
||||
_anim = _anim.SetFlag(SkinAnimFlag.RESOLUTION_64x64, true);
|
||||
MessageBox.Show(this, "64x64 Skin Detected");
|
||||
skinType = eSkinType._64x64;
|
||||
break;
|
||||
case 32:
|
||||
_anim = _anim.SetFlag(SkinAnimFlag.RESOLUTION_64x64 | SkinAnimFlag.SLIM_MODEL, false);
|
||||
MessageBox.Show(this, "64x32 Skin Detected");
|
||||
skinType = eSkinType._64x32;
|
||||
break;
|
||||
default:
|
||||
if (img.Width == img.Height)
|
||||
{
|
||||
_anim = _anim.SetFlag(SkinAnimFlag.RESOLUTION_64x64, true);
|
||||
MessageBox.Show(this, "64x64 HD Skin Detected");
|
||||
skinType = eSkinType._64x64HD;
|
||||
break;
|
||||
}
|
||||
|
||||
if (img.Height == img.Width / 2)
|
||||
{
|
||||
_anim = _anim.SetFlag(SkinAnimFlag.RESOLUTION_64x64 | SkinAnimFlag.SLIM_MODEL, false);
|
||||
MessageBox.Show(this, "64x32 HD Skin Detected");
|
||||
skinType = eSkinType._64x32HD;
|
||||
break;
|
||||
}
|
||||
|
||||
MessageBox.Show(this, "Not a Valid Skin File");
|
||||
skinType = eSkinType.Invalid;
|
||||
return;
|
||||
MessageBox.Show("The selected image does not suit a skin texture.", "Invalid image dimensions.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
newSkin.Anim.SetFlag(SkinAnimFlag.MODERN_WIDE_MODEL, img.Width == img.Height);
|
||||
|
||||
skinPictureBox.Image = img;
|
||||
skinPictureBox.Image = newSkin.Texture = img;
|
||||
labelSelectTexture.Visible = false;
|
||||
capePictureBox.Visible = true;
|
||||
buttonCape.Visible = true;
|
||||
capeLabel.Visible = true;
|
||||
buttonDone.Enabled = true;
|
||||
buttonAnimGen.Enabled = true;
|
||||
labelSelectTexture.Visible = false;
|
||||
}
|
||||
|
||||
private void DrawModel()
|
||||
{
|
||||
bool isSlim = _anim.GetFlag(SkinAnimFlag.SLIM_MODEL);
|
||||
bool isSlim = newSkin.Anim.GetFlag(SkinAnimFlag.SLIM_MODEL);
|
||||
Pen outlineColor = Pens.LightGray;
|
||||
Brush fillColor = Brushes.Gray;
|
||||
Image previewTexture = new Bitmap(displayBox.Width, displayBox.Height);
|
||||
using (Graphics g = Graphics.FromImage(previewTexture))
|
||||
{
|
||||
if(!_anim.GetFlag(SkinAnimFlag.HEAD_DISABLED))
|
||||
if(!newSkin.Anim.GetFlag(SkinAnimFlag.HEAD_DISABLED))
|
||||
{
|
||||
//Head
|
||||
g.DrawRectangle(outlineColor, 70, 15, 40, 40);
|
||||
g.FillRectangle(fillColor, 71, 16, 39, 39);
|
||||
}
|
||||
if (!_anim.GetFlag(SkinAnimFlag.BODY_DISABLED))
|
||||
if (!newSkin.Anim.GetFlag(SkinAnimFlag.TORSO_DISABLED))
|
||||
{
|
||||
//Body
|
||||
g.DrawRectangle(outlineColor, 70, 55, 40, 60);
|
||||
g.FillRectangle(fillColor, 71, 56, 39, 59);
|
||||
}
|
||||
if (!_anim.GetFlag(SkinAnimFlag.RIGHT_ARM_DISABLED))
|
||||
if (!newSkin.Anim.GetFlag(SkinAnimFlag.RIGHT_ARM_DISABLED))
|
||||
{
|
||||
//Arm0
|
||||
g.DrawRectangle(outlineColor, isSlim ? 55 : 50, 55, isSlim ? 15 : 20, 60);
|
||||
g.FillRectangle(fillColor , isSlim ? 56 : 51, 56, isSlim ? 14 : 19, 59);
|
||||
}
|
||||
if (!_anim.GetFlag(SkinAnimFlag.LEFT_ARM_DISABLED))
|
||||
if (!newSkin.Anim.GetFlag(SkinAnimFlag.LEFT_ARM_DISABLED))
|
||||
{
|
||||
//Arm1
|
||||
g.DrawRectangle(outlineColor, 110, 55, isSlim ? 15 : 20, 60);
|
||||
g.FillRectangle(fillColor, 111, 56, isSlim ? 14 : 19, 59);
|
||||
}
|
||||
if (!_anim.GetFlag(SkinAnimFlag.RIGHT_LEG_DISABLED))
|
||||
if (!newSkin.Anim.GetFlag(SkinAnimFlag.RIGHT_LEG_DISABLED))
|
||||
{
|
||||
//Leg0
|
||||
g.DrawRectangle(outlineColor, 70, 115, 20, 60);
|
||||
g.FillRectangle(fillColor, 71, 116, 19, 59);
|
||||
}
|
||||
if (!_anim.GetFlag(SkinAnimFlag.LEFT_LEG_DISABLED))
|
||||
if (!newSkin.Anim.GetFlag(SkinAnimFlag.LEFT_LEG_DISABLED))
|
||||
{
|
||||
//Leg1
|
||||
g.DrawRectangle(outlineColor, 90, 115, 20, 60);
|
||||
@@ -158,7 +123,7 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
CheckImage(Image.FromFile(ofd.FileName));
|
||||
SetNewTexture(Image.FromFile(ofd.FileName).ReleaseFromFile());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,12 +153,14 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
using (FileStream fs = File.OpenRead(ofd.FileName))
|
||||
{
|
||||
var reader = new _3DSTextureReader();
|
||||
CheckImage(reader.FromStream(fs));
|
||||
SetNewTexture(reader.FromStream(fs));
|
||||
}
|
||||
textSkinName.Text = Path.GetFileNameWithoutExtension(ofd.FileName);
|
||||
return;
|
||||
}
|
||||
CheckImage(Image.FromFile(ofd.FileName));
|
||||
|
||||
Image img = Image.FromFile(ofd.FileName).ReleaseFromFile();
|
||||
SetNewTexture(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -219,15 +186,13 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
ofd.Title = "Select a PNG File";
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var img = Image.FromFile(ofd.FileName);
|
||||
Image img = Image.FromFile(ofd.FileName).ReleaseFromFile();
|
||||
if (img.RawFormat != ImageFormat.Png && img.Width != img.Height * 2)
|
||||
{
|
||||
MessageBox.Show(this, "Not a Valid Cape File");
|
||||
return;
|
||||
}
|
||||
capePictureBox.Image = Image.FromFile(ofd.FileName);
|
||||
_cape ??= new PckAsset("dlccapeXYXYXYXY", PckAssetType.CapeFile);
|
||||
_cape.SetData(File.ReadAllBytes(ofd.FileName));
|
||||
newSkin.CapeTexture = capePictureBox.Image = img;
|
||||
contextMenuCape.Items[0].Text = "Replace";
|
||||
capeLabel.Visible = false;
|
||||
contextMenuCape.Visible = true;
|
||||
@@ -237,43 +202,17 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
|
||||
private void CreateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!int.TryParse(textSkinID.Text, out int skinId))
|
||||
if (radioButtonManual.Checked)
|
||||
{
|
||||
MessageBox.Show(this, "The Skin ID Must be a Unique 8 Digit Number Thats Not Already in Use", "Invalid Skin ID", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
string skinIdStr = skinId.ToString("d08");
|
||||
_skin.Filename = $"dlcskin{skinIdStr}.png";
|
||||
_skin.AddProperty("DISPLAYNAME", textSkinName.Text);
|
||||
|
||||
if (currentLoc is not null)
|
||||
{
|
||||
string skinDisplayNameLocKey = $"IDS_dlcskin{skinIdStr}_DISPLAYNAME";
|
||||
_skin.AddProperty("DISPLAYNAMEID", skinDisplayNameLocKey);
|
||||
currentLoc.AddLocKey(skinDisplayNameLocKey, textSkinName.Text);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(textThemeName.Text))
|
||||
{
|
||||
_skin.AddProperty("THEMENAME", textThemeName.Text);
|
||||
if (currentLoc is not null)
|
||||
if (!int.TryParse(textSkinID.Text, out int skinId))
|
||||
{
|
||||
_skin.AddProperty("THEMENAMEID", $"IDS_dlcskin{skinIdStr}_THEMENAME");
|
||||
currentLoc.AddLocKey($"IDS_dlcskin{skinIdStr}_THEMENAME", textThemeName.Text);
|
||||
MessageBox.Show("The Skin Id must be a unique 8 digit number that is not already in use", "Invalid Skin Id", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
newSkin.Identifier = new SkinIdentifier(skinId);
|
||||
}
|
||||
_skin.AddProperty("ANIM", _anim);
|
||||
_skin.AddProperty("GAME_FLAGS", "0x18");
|
||||
_skin.AddProperty("FREE", "1");
|
||||
|
||||
if (HasCape)
|
||||
{
|
||||
_cape.Filename = $"dlccape{skinIdStr}.png";
|
||||
_skin.AddProperty("CAPEPATH", _cape.Filename);
|
||||
}
|
||||
_skin.SetTexture(skinPictureBox.Image);
|
||||
newSkin.MetaData = new SkinMetaData(textSkinName.Text, textThemeName.Text);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void textSkinID_TextChanged(object sender, EventArgs e)
|
||||
@@ -284,24 +223,21 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
|
||||
private void CreateCustomModel_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Prompt for skin model generator
|
||||
if (MessageBox.Show(this, "Create your own custom skin model?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
|
||||
if (MessageBox.Show("Create your own custom skin model?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
_skin.SetTexture(Resources.classic_template);
|
||||
newSkin.MetaData = new SkinMetaData(textSkinName.Text, textThemeName.Text);
|
||||
|
||||
using generateModel generate = new generateModel(_skin);
|
||||
ISaveContext<Skin> saveContext = new DelegatedSaveContext<Skin>(Settings.Default.AutoSaveChanges, (customSkin) => newSkin = customSkin);
|
||||
|
||||
if (generate.ShowDialog() == DialogResult.OK)
|
||||
using CustomSkinEditor customSkinEditor = new CustomSkinEditor(newSkin, saveContext, _xmlVersion);
|
||||
|
||||
if (customSkinEditor.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
displayBox.Image = generate.PreviewImage;
|
||||
skinPictureBox.Image = newSkin.Texture;
|
||||
buttonDone.Enabled = true;
|
||||
labelSelectTexture.Visible = false;
|
||||
if (skinType != eSkinType._64x64 && skinType != eSkinType._64x64HD)
|
||||
{
|
||||
buttonSkin.Location = new Point(buttonSkin.Location.X - skinPictureBox.Width, buttonSkin.Location.Y);
|
||||
skinType = eSkinType._64x64;
|
||||
}
|
||||
DrawModel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,8 +245,8 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
{
|
||||
if (radioButtonAuto.Checked)
|
||||
{
|
||||
int num = rng.Next(100000, 99999999);
|
||||
textSkinID.Text = num.ToString();
|
||||
newSkin.Identifier = new(rng.Next(100000, 99999999));
|
||||
textSkinID.Text = newSkin.Identifier.ToString();
|
||||
textSkinID.Enabled = false;
|
||||
}
|
||||
}
|
||||
@@ -322,10 +258,10 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
|
||||
private void buttonAnimGen_Click(object sender, EventArgs e)
|
||||
{
|
||||
using ANIMEditor diag = new ANIMEditor(_anim);
|
||||
using ANIMEditor diag = new ANIMEditor(newSkin.Anim);
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
_anim = diag.ResultAnim;
|
||||
newSkin.Anim = diag.ResultAnim;
|
||||
DrawModel();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,21 +219,6 @@
|
||||
<data name=">>label1.ZOrder" xml:space="preserve">
|
||||
<value>19</value>
|
||||
</data>
|
||||
<data name="textTheme.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>102, 78</value>
|
||||
</data>
|
||||
<data name="textTheme.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>239, 20</value>
|
||||
</data>
|
||||
<data name="textTheme.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>32</value>
|
||||
</data>
|
||||
<data name=">>textTheme.Name" xml:space="preserve">
|
||||
<value>textTheme</value>
|
||||
</data>
|
||||
<data name=">>textTheme.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<metadata name="contextMenuSkin.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
@@ -654,9 +639,6 @@
|
||||
<data name=">>capeLabel.ZOrder" xml:space="preserve">
|
||||
<value>4</value>
|
||||
</data>
|
||||
<data name="buttonAnimGen.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="buttonAnimGen.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>108, 259</value>
|
||||
</data>
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Controls;
|
||||
using System.Xml.Linq;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Json;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
{
|
||||
@@ -32,10 +28,8 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
|
||||
private void InitializeTreeviews()
|
||||
{
|
||||
Profiler.Start();
|
||||
GetTileDataToView(ResourceCategory.BlockAnimation);
|
||||
GetTileDataToView(ResourceCategory.ItemAnimation);
|
||||
Profiler.Stop();
|
||||
}
|
||||
|
||||
public DialogResult ShowDialog(IWin32Window owner)
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Json;
|
||||
|
||||
|
||||
namespace PckStudio.Forms.Additional_Popups.EntityForms
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace PckStudio.Forms.Additional_Popups.Animation
|
||||
|
||||
private void filter_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Some code in this function is modified code from this StackOverflow answer - MattNL
|
||||
// Some code in this function is modified code from this StackOverflow answer - MayNL
|
||||
// https://stackoverflow.com/questions/8260322/filter-a-treeview-with-a-textbox-in-a-c-sharp-winforms-app
|
||||
|
||||
// block re-painting control until all objects are loaded
|
||||
|
||||
@@ -27,8 +27,11 @@ namespace PckStudio.Forms.Additional_Popups
|
||||
|
||||
private void okBtn_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(ComboBox.SelectedIndex > -1)
|
||||
if(ComboBox.SelectedIndex <= -1)
|
||||
{
|
||||
cancelButton_Click(sender, e);
|
||||
return;
|
||||
}
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NumericPrompt));
|
||||
this.TextLabel = new System.Windows.Forms.Label();
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
this.ContextLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.ValueUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.toolTipLabel = new MetroFramework.Controls.MetroLabel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.ValueUpDown)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -50,26 +50,28 @@
|
||||
this.OKButton.UseVisualStyleBackColor = true;
|
||||
this.OKButton.Click += new System.EventHandler(this.OKBtn_Click);
|
||||
//
|
||||
// ContextLabel
|
||||
//
|
||||
resources.ApplyResources(this.ContextLabel, "ContextLabel");
|
||||
this.ContextLabel.FontSize = MetroFramework.MetroLabelSize.Small;
|
||||
this.ContextLabel.Name = "ContextLabel";
|
||||
this.ContextLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.ContextLabel.WrapToLine = true;
|
||||
//
|
||||
// ValueUpDown
|
||||
//
|
||||
resources.ApplyResources(this.ValueUpDown, "ValueUpDown");
|
||||
this.ValueUpDown.BackColor = System.Drawing.SystemColors.WindowText;
|
||||
this.ValueUpDown.ForeColor = System.Drawing.SystemColors.Window;
|
||||
this.ValueUpDown.Name = "ValueUpDown";
|
||||
//
|
||||
// toolTipLabel
|
||||
//
|
||||
resources.ApplyResources(this.toolTipLabel, "toolTipLabel");
|
||||
this.toolTipLabel.FontSize = MetroFramework.MetroLabelSize.Small;
|
||||
this.toolTipLabel.Name = "toolTipLabel";
|
||||
this.toolTipLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTipLabel.WrapToLine = true;
|
||||
//
|
||||
// NumericPrompt
|
||||
//
|
||||
this.AcceptButton = this.OKButton;
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.ValueUpDown);
|
||||
this.Controls.Add(this.ContextLabel);
|
||||
this.Controls.Add(this.toolTipLabel);
|
||||
this.Controls.Add(this.OKButton);
|
||||
this.Controls.Add(this.TextLabel);
|
||||
this.MaximizeBox = false;
|
||||
@@ -89,7 +91,7 @@
|
||||
#endregion
|
||||
public System.Windows.Forms.Button OKButton;
|
||||
public System.Windows.Forms.Label TextLabel;
|
||||
public MetroFramework.Controls.MetroLabel ContextLabel;
|
||||
private System.Windows.Forms.NumericUpDown ValueUpDown;
|
||||
private MetroFramework.Controls.MetroLabel toolTipLabel;
|
||||
}
|
||||
}
|
||||
@@ -6,23 +6,66 @@ namespace PckStudio
|
||||
{
|
||||
public partial class NumericPrompt : MetroForm
|
||||
{
|
||||
public int SelectedValue => (int)ValueUpDown.Value;
|
||||
public decimal SelectedValue => ValueUpDown.Value;
|
||||
|
||||
public int SelectedValueAsInt => (int)SelectedValue;
|
||||
|
||||
public int Minimum { set => ValueUpDown.Minimum = value; }
|
||||
public int Maximum { set => ValueUpDown.Maximum = value; }
|
||||
public string ToolTipText
|
||||
{
|
||||
get => toolTipLabel.Text;
|
||||
set => toolTipLabel.Text = value;
|
||||
}
|
||||
|
||||
public decimal ValueStep
|
||||
{
|
||||
get => ValueUpDown.Increment;
|
||||
set => ValueUpDown.Increment = value;
|
||||
}
|
||||
|
||||
public int DecimalPlaces
|
||||
{
|
||||
get => ValueUpDown.DecimalPlaces;
|
||||
set => ValueUpDown.DecimalPlaces = value;
|
||||
}
|
||||
|
||||
public decimal Minimum
|
||||
{
|
||||
get => ValueUpDown.Minimum;
|
||||
set => ValueUpDown.Minimum = value;
|
||||
}
|
||||
|
||||
public decimal Maximum
|
||||
{
|
||||
get => ValueUpDown.Maximum;
|
||||
set => ValueUpDown.Maximum = value;
|
||||
}
|
||||
|
||||
private NumericPrompt()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public NumericPrompt(int initialValue)
|
||||
: this(initialValue, int.MinValue, int.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
public NumericPrompt(decimal initialValue, decimal minimum, decimal maximum)
|
||||
: this()
|
||||
{
|
||||
Minimum = minimum;
|
||||
Maximum = maximum;
|
||||
ValueUpDown.Value = initialValue;
|
||||
}
|
||||
|
||||
public NumericPrompt(int initialValue, int minimum, int maximum)
|
||||
: this((decimal)initialValue, minimum, maximum)
|
||||
{
|
||||
}
|
||||
|
||||
public NumericPrompt(float initialValue, float minimum, float maximum)
|
||||
: this((decimal)initialValue, (decimal)minimum, (decimal)maximum)
|
||||
{
|
||||
InitializeComponent();
|
||||
ValueUpDown.Value = initialValue;
|
||||
Minimum = minimum;
|
||||
Maximum = maximum;
|
||||
}
|
||||
|
||||
private void OKBtn_Click(object sender, EventArgs e)
|
||||
@@ -32,9 +75,9 @@ namespace PckStudio
|
||||
|
||||
private void RenamePrompt_Load(object sender, EventArgs e)
|
||||
{
|
||||
if(string.IsNullOrEmpty(ContextLabel.Text))
|
||||
if (string.IsNullOrEmpty(toolTipLabel.Text))
|
||||
{
|
||||
ContextLabel.Visible = false;
|
||||
toolTipLabel.Visible = false;
|
||||
Size = new System.Drawing.Size(264, 85);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,15 +119,18 @@
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="TextLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom</value>
|
||||
<value>Bottom, Left</value>
|
||||
</data>
|
||||
<assembly alias="mscorlib" name="mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="TextLabel.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="TextLabel.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="TextLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>19, 90</value>
|
||||
<value>19, 38</value>
|
||||
</data>
|
||||
<data name="TextLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>34, 13</value>
|
||||
@@ -163,7 +166,7 @@
|
||||
<value>NoControl</value>
|
||||
</data>
|
||||
<data name="OKButton.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>95, 118</value>
|
||||
<value>83, 66</value>
|
||||
</data>
|
||||
<data name="OKButton.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>75, 23</value>
|
||||
@@ -186,38 +189,14 @@
|
||||
<data name=">>OKButton.ZOrder" xml:space="preserve">
|
||||
<value>2</value>
|
||||
</data>
|
||||
<data name="ContextLabel.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top</value>
|
||||
</data>
|
||||
<data name="ContextLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>28, 27</value>
|
||||
</data>
|
||||
<data name="ContextLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>208, 58</value>
|
||||
</data>
|
||||
<data name="ContextLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="ContextLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>TopCenter</value>
|
||||
</data>
|
||||
<data name=">>ContextLabel.Name" xml:space="preserve">
|
||||
<value>ContextLabel</value>
|
||||
</data>
|
||||
<data name=">>ContextLabel.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>ContextLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>ContextLabel.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
<data name="ValueUpDown.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="ValueUpDown.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>71, 88</value>
|
||||
<value>71, 36</value>
|
||||
</data>
|
||||
<data name="ValueUpDown.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>164, 20</value>
|
||||
<value>141, 20</value>
|
||||
</data>
|
||||
<data name="ValueUpDown.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>7</value>
|
||||
@@ -234,14 +213,47 @@
|
||||
<data name=">>ValueUpDown.ZOrder" xml:space="preserve">
|
||||
<value>0</value>
|
||||
</data>
|
||||
<data name="toolTipLabel.Enabled" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="toolTipLabel.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>3, 11</value>
|
||||
</data>
|
||||
<data name="toolTipLabel.MinimumSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>235, 22</value>
|
||||
</data>
|
||||
<data name="toolTipLabel.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>235, 22</value>
|
||||
</data>
|
||||
<data name="toolTipLabel.TabIndex" type="System.Int32, mscorlib">
|
||||
<value>6</value>
|
||||
</data>
|
||||
<data name="toolTipLabel.TextAlign" type="System.Drawing.ContentAlignment, System.Drawing">
|
||||
<value>TopCenter</value>
|
||||
</data>
|
||||
<data name=">>toolTipLabel.Name" xml:space="preserve">
|
||||
<value>toolTipLabel</value>
|
||||
</data>
|
||||
<data name=">>toolTipLabel.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Controls.MetroLabel, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
</data>
|
||||
<data name=">>toolTipLabel.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
</data>
|
||||
<data name=">>toolTipLabel.ZOrder" xml:space="preserve">
|
||||
<value>1</value>
|
||||
</data>
|
||||
<metadata name="$this.Localizable" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<data name="$this.AutoScaleDimensions" type="System.Drawing.SizeF, System.Drawing">
|
||||
<value>6, 13</value>
|
||||
</data>
|
||||
<data name="$this.AutoSizeMode" type="System.Windows.Forms.AutoSizeMode, System.Windows.Forms">
|
||||
<value>GrowAndShrink</value>
|
||||
</data>
|
||||
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>264, 150</value>
|
||||
<value>241, 98</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
@@ -2749,6 +2761,12 @@
|
||||
AP//AAA=
|
||||
</value>
|
||||
</data>
|
||||
<data name="$this.Margin" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>4, 2, 4, 2</value>
|
||||
</data>
|
||||
<data name="$this.Padding" type="System.Windows.Forms.Padding, System.Windows.Forms">
|
||||
<value>0, 60, 0, 0</value>
|
||||
</data>
|
||||
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
|
||||
<value>CenterParent</value>
|
||||
</data>
|
||||
|
||||
1
PCK-Studio/Forms/AppSettingsForm.Designer.cs
generated
1
PCK-Studio/Forms/AppSettingsForm.Designer.cs
generated
@@ -63,7 +63,6 @@
|
||||
this.Resizable = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Style = MetroFramework.MetroColorStyle.Black;
|
||||
this.Text = "Application Settings";
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AppBehaviorSettingsForm_FormClosing);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@@ -5,6 +5,8 @@ using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Controls;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Core.App;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Forms
|
||||
@@ -12,57 +14,84 @@ namespace PckStudio.Forms
|
||||
public partial class AppSettingsForm : MetroForm
|
||||
{
|
||||
private ApplicationSettingsBase _applicationSettings;
|
||||
internal const string keyToStringContextKey = "keyToString";
|
||||
|
||||
public AppSettingsForm()
|
||||
: this(Settings.Default)
|
||||
: this("Application Settings", Settings.Default, new Dictionary<string, string>()
|
||||
{
|
||||
["ShowRichPresence"] = "Show Rich Presence",
|
||||
["AutoSaveChanges"] = "Auto Save",
|
||||
["UseLittleEndianAsDefault"] = "Open as Little Endian",
|
||||
["AutoUpdate"] = "Auto Update",
|
||||
["LoadSubPcks"] = "Load Sub Pcks",
|
||||
["UsePrerelease"] = "Use Prerelease",
|
||||
["ValidateImageDimension"] = "Validate skin dimension",
|
||||
})
|
||||
{
|
||||
}
|
||||
|
||||
public AppSettingsForm(ApplicationSettingsBase applicationSettings)
|
||||
public AppSettingsForm(string title, ApplicationSettingsBase applicationSettings, Dictionary<string, string> keyToStringMap = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
Text = title;
|
||||
_applicationSettings = applicationSettings;
|
||||
if (keyToStringMap is not null && !_applicationSettings.Context.ContainsKey(SettingsManager.KeyToStringContextKeyConst))
|
||||
_applicationSettings.Context.Add(SettingsManager.KeyToStringContextKeyConst, keyToStringMap);
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> CheckBoxText = new Dictionary<string, string>()
|
||||
static bool ContextTryGetKeyToString(SettingsContext context, string key, out string value)
|
||||
{
|
||||
["ShowRichPresence"] = "Show Rich Presence",
|
||||
["AutoSaveChanges"] = "Auto Save",
|
||||
["UseLittleEndianAsDefault"] = "Open as Little Endian",
|
||||
["AutoUpdate"] = "Auto Update",
|
||||
["LoadSubPcks"] = "Load Sub Pcks",
|
||||
["UsePrerelease"] = "Use Prerelease",
|
||||
};
|
||||
|
||||
private void CheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is CheckBox checkBox && checkBox.Tag is string settingsKey && _applicationSettings[settingsKey] is bool)
|
||||
{
|
||||
_applicationSettings[settingsKey] = checkBox.Checked;
|
||||
}
|
||||
value = default;
|
||||
return
|
||||
context.ContainsKey(SettingsManager.KeyToStringContextKeyConst) &&
|
||||
context[SettingsManager.KeyToStringContextKeyConst] is Dictionary<string, string> keyToString &&
|
||||
keyToString.TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
static Control CreateCheckBox(SettingsPropertyValue propertyValue, SettingsBase settings)
|
||||
{
|
||||
var control = new MetroCheckBox
|
||||
{
|
||||
Name = propertyValue.Name,
|
||||
Tag = propertyValue.Name,
|
||||
Text = ContextTryGetKeyToString(settings.Context, propertyValue.Name, out string name) ? name : propertyValue.Name,
|
||||
Checked = (bool)propertyValue.PropertyValue,
|
||||
|
||||
AutoSize = true,
|
||||
Theme = MetroFramework.MetroThemeStyle.Dark,
|
||||
Style = MetroFramework.MetroColorStyle.White,
|
||||
};
|
||||
|
||||
void CheckBox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is CheckBox checkBox && checkBox.Tag is string settingsKey && settings[settingsKey] is bool)
|
||||
{
|
||||
settings[settingsKey] = checkBox.Checked;
|
||||
}
|
||||
}
|
||||
|
||||
control.CheckedChanged += CheckBox_CheckedChanged;
|
||||
return control;
|
||||
}
|
||||
|
||||
delegate Control ControlCreateDelegate(SettingsPropertyValue propertyValue, SettingsBase settings);
|
||||
|
||||
Dictionary<Type, ControlCreateDelegate> _typeToControl = new Dictionary<Type, ControlCreateDelegate>()
|
||||
{
|
||||
[typeof(bool)] = CreateCheckBox,
|
||||
};
|
||||
|
||||
private void LoadSettings()
|
||||
{
|
||||
foreach (SettingsPropertyValue item in _applicationSettings.PropertyValues)
|
||||
{
|
||||
Debug.WriteLine($"{item.Property.Name}: {item.Property.PropertyType}");
|
||||
if (!item.Property.Attributes.ContainsKey(typeof(UserScopedSettingAttribute)) || item.Property.PropertyType != typeof(bool))
|
||||
bool isUserScoped = item.Property.Attributes?.ContainsKey(typeof(UserScopedSettingAttribute)) ?? true;
|
||||
if (!isUserScoped || !_typeToControl.ContainsKey(item.Property.PropertyType) || item.Property.IsReadOnly)
|
||||
continue;
|
||||
var checkBox = new MetroCheckBox
|
||||
{
|
||||
Name = item.Name,
|
||||
Tag = item.Name,
|
||||
Text = CheckBoxText.ContainsKey(item.Name) ? CheckBoxText[item.Name] : item.Name,
|
||||
Checked = (bool)item.PropertyValue,
|
||||
|
||||
AutoSize = true,
|
||||
Theme = MetroFramework.MetroThemeStyle.Dark,
|
||||
Style = MetroFramework.MetroColorStyle.White,
|
||||
};
|
||||
checkBox.CheckedChanged += CheckBox_CheckedChanged;
|
||||
flowLayoutPanel.Controls.Add(checkBox);
|
||||
Control control = _typeToControl[item.Property.PropertyType](item, _applicationSettings);
|
||||
flowLayoutPanel.Controls.Add(control);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
PCK-Studio/Forms/ContributorsForm.Designer.cs
generated
4
PCK-Studio/Forms/ContributorsForm.Designer.cs
generated
@@ -70,9 +70,9 @@
|
||||
metroLabel5.Enabled = false;
|
||||
metroLabel5.Location = new System.Drawing.Point(397, 456);
|
||||
metroLabel5.Name = "metroLabel5";
|
||||
metroLabel5.Size = new System.Drawing.Size(300, 19);
|
||||
metroLabel5.Size = new System.Drawing.Size(298, 19);
|
||||
metroLabel5.TabIndex = 5;
|
||||
metroLabel5.Text = "Additional development by MattNL and Miku-666";
|
||||
metroLabel5.Text = "Additional development by Miku-666 and MayNL";
|
||||
metroLabel5.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// metroLabel6
|
||||
|
||||
107
PCK-Studio/Forms/Editor/ANIMEditor.Designer.cs
generated
107
PCK-Studio/Forms/Editor/ANIMEditor.Designer.cs
generated
@@ -53,7 +53,7 @@
|
||||
this.leftArmorCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.chestplateCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.unknownCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.animationOverrideCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.crouchCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.dinnerboneCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.noArmorCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
@@ -120,9 +120,9 @@
|
||||
this.rightLegOCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.rightLegOCheckBox.Location = new System.Drawing.Point(180, 208);
|
||||
this.rightLegOCheckBox.Name = "rightLegOCheckBox";
|
||||
this.rightLegOCheckBox.Size = new System.Drawing.Size(199, 19);
|
||||
this.rightLegOCheckBox.Size = new System.Drawing.Size(174, 19);
|
||||
this.rightLegOCheckBox.TabIndex = 13;
|
||||
this.rightLegOCheckBox.Text = "Remove Right Leg Layer Box";
|
||||
this.rightLegOCheckBox.Text = "Remove Right Pants Box";
|
||||
this.rightLegOCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.rightLegOCheckBox, " Removes the parent Box for this part. You can still make new boxes f" +
|
||||
"or this part. Armor will be disabled for this part, but can be rendered again wi" +
|
||||
@@ -135,9 +135,9 @@
|
||||
this.headOCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.headOCheckBox.Location = new System.Drawing.Point(180, 50);
|
||||
this.headOCheckBox.Name = "headOCheckBox";
|
||||
this.headOCheckBox.Size = new System.Drawing.Size(173, 19);
|
||||
this.headOCheckBox.Size = new System.Drawing.Size(165, 19);
|
||||
this.headOCheckBox.TabIndex = 12;
|
||||
this.headOCheckBox.Text = "Remove Head Layer Box";
|
||||
this.headOCheckBox.Text = "Remove Headwear Box";
|
||||
this.headOCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.headOCheckBox, " Removes the parent Box for this part. You can still make new boxes f" +
|
||||
"or this part. Armor will be disabled for this part, but can be rendered again wi" +
|
||||
@@ -150,9 +150,9 @@
|
||||
this.leftLegOCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.leftLegOCheckBox.Location = new System.Drawing.Point(180, 174);
|
||||
this.leftLegOCheckBox.Name = "leftLegOCheckBox";
|
||||
this.leftLegOCheckBox.Size = new System.Drawing.Size(190, 19);
|
||||
this.leftLegOCheckBox.Size = new System.Drawing.Size(165, 19);
|
||||
this.leftLegOCheckBox.TabIndex = 11;
|
||||
this.leftLegOCheckBox.Text = "Remove Left Leg Layer Box";
|
||||
this.leftLegOCheckBox.Text = "Remove Left Pants Box";
|
||||
this.leftLegOCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.leftLegOCheckBox, " Removes the parent Box for this part. You can still make new boxes f" +
|
||||
"or this part. Armor will be disabled for this part, but can be rendered again wi" +
|
||||
@@ -165,9 +165,9 @@
|
||||
this.leftArmOCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.leftArmOCheckBox.Location = new System.Drawing.Point(180, 112);
|
||||
this.leftArmOCheckBox.Name = "leftArmOCheckBox";
|
||||
this.leftArmOCheckBox.Size = new System.Drawing.Size(194, 19);
|
||||
this.leftArmOCheckBox.Size = new System.Drawing.Size(169, 19);
|
||||
this.leftArmOCheckBox.TabIndex = 9;
|
||||
this.leftArmOCheckBox.Text = "Remove Left Arm Layer Box";
|
||||
this.leftArmOCheckBox.Text = "Remove Left Sleeve Box";
|
||||
this.leftArmOCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.leftArmOCheckBox, " Removes the parent Box for this part. You can still make new boxes f" +
|
||||
"or this part. Armor will be disabled for this part, but can be rendered again wi" +
|
||||
@@ -180,9 +180,9 @@
|
||||
this.bodyOCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.bodyOCheckBox.Location = new System.Drawing.Point(180, 81);
|
||||
this.bodyOCheckBox.Name = "bodyOCheckBox";
|
||||
this.bodyOCheckBox.Size = new System.Drawing.Size(172, 19);
|
||||
this.bodyOCheckBox.Size = new System.Drawing.Size(141, 19);
|
||||
this.bodyOCheckBox.TabIndex = 8;
|
||||
this.bodyOCheckBox.Text = "Remove Body Layer Box";
|
||||
this.bodyOCheckBox.Text = "Remove Jacket Box";
|
||||
this.bodyOCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.bodyOCheckBox, " Removes the parent Box for this part. You can still make new boxes f" +
|
||||
"or this part. Armor will be disabled for this part, but can be rendered again wi" +
|
||||
@@ -210,9 +210,9 @@
|
||||
this.slimCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.slimCheckBox.Location = new System.Drawing.Point(180, 19);
|
||||
this.slimCheckBox.Name = "slimCheckBox";
|
||||
this.slimCheckBox.Size = new System.Drawing.Size(151, 19);
|
||||
this.slimCheckBox.Size = new System.Drawing.Size(164, 19);
|
||||
this.slimCheckBox.TabIndex = 6;
|
||||
this.slimCheckBox.Text = "64x64 Alex/Slim Skin";
|
||||
this.slimCheckBox.Text = "64x64 Slim Skin Model";
|
||||
this.slimCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.slimCheckBox, " The 1.8 style skin type with slim arms, overlays for each part, and sep" +
|
||||
"arate textures for right and left limbs. Resolution is also set to 64x64. " +
|
||||
@@ -285,9 +285,9 @@
|
||||
this.bodyCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.bodyCheckBox.Location = new System.Drawing.Point(6, 81);
|
||||
this.bodyCheckBox.Name = "bodyCheckBox";
|
||||
this.bodyCheckBox.Size = new System.Drawing.Size(135, 19);
|
||||
this.bodyCheckBox.Size = new System.Drawing.Size(137, 19);
|
||||
this.bodyCheckBox.TabIndex = 1;
|
||||
this.bodyCheckBox.Text = "Remove Body Box";
|
||||
this.bodyCheckBox.Text = "Remove Torso Box";
|
||||
this.bodyCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.bodyCheckBox, " Removes the parent Box for this part. You can still make new boxes f" +
|
||||
"or this part. Armor will be disabled for this part, but can be rendered again wi" +
|
||||
@@ -300,9 +300,9 @@
|
||||
this.classicCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.classicCheckBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.classicCheckBox.Name = "classicCheckBox";
|
||||
this.classicCheckBox.Size = new System.Drawing.Size(136, 19);
|
||||
this.classicCheckBox.Size = new System.Drawing.Size(170, 19);
|
||||
this.classicCheckBox.TabIndex = 0;
|
||||
this.classicCheckBox.Text = "64x64 Classic Skin";
|
||||
this.classicCheckBox.Text = "64x64 Wide Skin Model";
|
||||
this.classicCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.classicCheckBox, " The 1.8 style skin type with overlays for each part and separate textur" +
|
||||
"es for right and left limbs. Resolution is also set to 64x64. ");
|
||||
@@ -315,9 +315,9 @@
|
||||
this.rightArmOCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.rightArmOCheckBox.Location = new System.Drawing.Point(180, 143);
|
||||
this.rightArmOCheckBox.Name = "rightArmOCheckBox";
|
||||
this.rightArmOCheckBox.Size = new System.Drawing.Size(203, 19);
|
||||
this.rightArmOCheckBox.Size = new System.Drawing.Size(178, 19);
|
||||
this.rightArmOCheckBox.TabIndex = 10;
|
||||
this.rightArmOCheckBox.Text = "Remove Right Arm Layer Box";
|
||||
this.rightArmOCheckBox.Text = "Remove Right Sleeve Box";
|
||||
this.rightArmOCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.rightArmOCheckBox, " Removes the parent Box for this part. You can still make new boxes f" +
|
||||
"or this part. Armor will be disabled for this part, but can be rendered again wi" +
|
||||
@@ -347,9 +347,9 @@
|
||||
this.rightLeggingCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.rightLeggingCheckBox.Location = new System.Drawing.Point(6, 174);
|
||||
this.rightLeggingCheckBox.Name = "rightLeggingCheckBox";
|
||||
this.rightLeggingCheckBox.Size = new System.Drawing.Size(173, 19);
|
||||
this.rightLeggingCheckBox.Size = new System.Drawing.Size(163, 19);
|
||||
this.rightLeggingCheckBox.TabIndex = 7;
|
||||
this.rightLeggingCheckBox.Text = "Render Right Leg Armor";
|
||||
this.rightLeggingCheckBox.Text = "Show Right Leg Armor";
|
||||
this.rightLeggingCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.rightLeggingCheckBox, " Forcefully enables the specified armor piece.");
|
||||
this.rightLeggingCheckBox.UseSelectable = true;
|
||||
@@ -361,9 +361,9 @@
|
||||
this.helmetCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.helmetCheckBox.Location = new System.Drawing.Point(6, 19);
|
||||
this.helmetCheckBox.Name = "helmetCheckBox";
|
||||
this.helmetCheckBox.Size = new System.Drawing.Size(147, 19);
|
||||
this.helmetCheckBox.Size = new System.Drawing.Size(137, 19);
|
||||
this.helmetCheckBox.TabIndex = 5;
|
||||
this.helmetCheckBox.Text = "Render Head Armor";
|
||||
this.helmetCheckBox.Text = "Show Head Armor";
|
||||
this.helmetCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.helmetCheckBox, " Forcefully enables the specified armor piece.");
|
||||
this.helmetCheckBox.UseSelectable = true;
|
||||
@@ -375,9 +375,9 @@
|
||||
this.leftLeggingCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.leftLeggingCheckBox.Location = new System.Drawing.Point(6, 143);
|
||||
this.leftLeggingCheckBox.Name = "leftLeggingCheckBox";
|
||||
this.leftLeggingCheckBox.Size = new System.Drawing.Size(164, 19);
|
||||
this.leftLeggingCheckBox.Size = new System.Drawing.Size(154, 19);
|
||||
this.leftLeggingCheckBox.TabIndex = 4;
|
||||
this.leftLeggingCheckBox.Text = "Render Left Leg Armor";
|
||||
this.leftLeggingCheckBox.Text = "Show Left Leg Armor";
|
||||
this.leftLeggingCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.leftLeggingCheckBox, " Forcefully enables the specified armor piece.");
|
||||
this.leftLeggingCheckBox.UseSelectable = true;
|
||||
@@ -389,9 +389,9 @@
|
||||
this.rightArmorCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.rightArmorCheckBox.Location = new System.Drawing.Point(6, 112);
|
||||
this.rightArmorCheckBox.Name = "rightArmorCheckBox";
|
||||
this.rightArmorCheckBox.Size = new System.Drawing.Size(177, 19);
|
||||
this.rightArmorCheckBox.Size = new System.Drawing.Size(167, 19);
|
||||
this.rightArmorCheckBox.TabIndex = 3;
|
||||
this.rightArmorCheckBox.Text = "Render Right Arm Armor";
|
||||
this.rightArmorCheckBox.Text = "Show Right Arm Armor";
|
||||
this.rightArmorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.rightArmorCheckBox, " Forcefully enables the specified armor piece.");
|
||||
this.rightArmorCheckBox.UseSelectable = true;
|
||||
@@ -403,9 +403,9 @@
|
||||
this.leftArmorCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.leftArmorCheckBox.Location = new System.Drawing.Point(6, 81);
|
||||
this.leftArmorCheckBox.Name = "leftArmorCheckBox";
|
||||
this.leftArmorCheckBox.Size = new System.Drawing.Size(168, 19);
|
||||
this.leftArmorCheckBox.Size = new System.Drawing.Size(158, 19);
|
||||
this.leftArmorCheckBox.TabIndex = 2;
|
||||
this.leftArmorCheckBox.Text = "Render Left Arm Armor";
|
||||
this.leftArmorCheckBox.Text = "Show Left Arm Armor";
|
||||
this.leftArmorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.leftArmorCheckBox, " Forcefully enables the specified armor piece.");
|
||||
this.leftArmorCheckBox.UseSelectable = true;
|
||||
@@ -413,20 +413,21 @@
|
||||
// chestplateCheckBox
|
||||
//
|
||||
this.chestplateCheckBox.AutoSize = true;
|
||||
this.chestplateCheckBox.BackColor = System.Drawing.Color.IndianRed;
|
||||
this.chestplateCheckBox.Enabled = false;
|
||||
this.chestplateCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.chestplateCheckBox.Location = new System.Drawing.Point(6, 50);
|
||||
this.chestplateCheckBox.Name = "chestplateCheckBox";
|
||||
this.chestplateCheckBox.Size = new System.Drawing.Size(146, 19);
|
||||
this.chestplateCheckBox.Size = new System.Drawing.Size(138, 19);
|
||||
this.chestplateCheckBox.TabIndex = 1;
|
||||
this.chestplateCheckBox.Text = "Render Body Armor";
|
||||
this.chestplateCheckBox.Text = "Show Torso Armor";
|
||||
this.chestplateCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.chestplateCheckBox, " Forcefully enables the specified armor piece.");
|
||||
this.chestplateCheckBox.UseSelectable = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.unknownCheckBox);
|
||||
this.groupBox1.Controls.Add(this.animationOverrideCheckBox);
|
||||
this.groupBox1.Controls.Add(this.crouchCheckBox);
|
||||
this.groupBox1.Controls.Add(this.dinnerboneCheckBox);
|
||||
this.groupBox1.Controls.Add(this.noArmorCheckBox);
|
||||
@@ -446,19 +447,19 @@
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Special Animations";
|
||||
//
|
||||
// unknownCheckBox
|
||||
// animationOverrideCheckBox
|
||||
//
|
||||
this.unknownCheckBox.AutoSize = true;
|
||||
this.unknownCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.unknownCheckBox.Location = new System.Drawing.Point(126, 81);
|
||||
this.unknownCheckBox.Name = "unknownCheckBox";
|
||||
this.unknownCheckBox.Size = new System.Drawing.Size(84, 19);
|
||||
this.unknownCheckBox.TabIndex = 13;
|
||||
this.unknownCheckBox.Text = "Unknown";
|
||||
this.unknownCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.unknownCheckBox, " If you figure out what this is. Please reach out to MNL#8935 on Discord. (: " +
|
||||
"");
|
||||
this.unknownCheckBox.UseSelectable = true;
|
||||
this.animationOverrideCheckBox.AutoSize = true;
|
||||
this.animationOverrideCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.animationOverrideCheckBox.Location = new System.Drawing.Point(126, 81);
|
||||
this.animationOverrideCheckBox.Name = "animationOverrideCheckBox";
|
||||
this.animationOverrideCheckBox.Size = new System.Drawing.Size(145, 19);
|
||||
this.animationOverrideCheckBox.TabIndex = 13;
|
||||
this.animationOverrideCheckBox.Text = "Animation Override";
|
||||
this.animationOverrideCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.animationOverrideCheckBox, "Forcefully display skin effects despite the game\'s \"Custom Skin Animation\" settin" +
|
||||
"g");
|
||||
this.animationOverrideCheckBox.UseSelectable = true;
|
||||
//
|
||||
// crouchCheckBox
|
||||
//
|
||||
@@ -498,7 +499,7 @@
|
||||
this.noArmorCheckBox.TabIndex = 10;
|
||||
this.noArmorCheckBox.Text = "Disable All Armor";
|
||||
this.noArmorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.noArmorCheckBox, " Disables all armor desptie the armor flags. ");
|
||||
this.toolTip.SetToolTip(this.noArmorCheckBox, " Disables all armor. Overrides the individual armor flags.");
|
||||
this.noArmorCheckBox.UseSelectable = true;
|
||||
//
|
||||
// bobbingCheckBox
|
||||
@@ -507,11 +508,12 @@
|
||||
this.bobbingCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.bobbingCheckBox.Location = new System.Drawing.Point(272, 50);
|
||||
this.bobbingCheckBox.Name = "bobbingCheckBox";
|
||||
this.bobbingCheckBox.Size = new System.Drawing.Size(124, 19);
|
||||
this.bobbingCheckBox.Size = new System.Drawing.Size(98, 19);
|
||||
this.bobbingCheckBox.TabIndex = 9;
|
||||
this.bobbingCheckBox.Text = "Disable Bobbing";
|
||||
this.bobbingCheckBox.Text = "No Bobbing";
|
||||
this.bobbingCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.bobbingCheckBox, " Disables the bobbing effect in first person.");
|
||||
this.toolTip.SetToolTip(this.bobbingCheckBox, " Disables the bobbing effect in first person. Overrides the \"View Bobbing\" settin" +
|
||||
"g.");
|
||||
this.bobbingCheckBox.UseSelectable = true;
|
||||
//
|
||||
// santaCheckBox
|
||||
@@ -520,12 +522,11 @@
|
||||
this.santaCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Medium;
|
||||
this.santaCheckBox.Location = new System.Drawing.Point(420, 50);
|
||||
this.santaCheckBox.Name = "santaCheckBox";
|
||||
this.santaCheckBox.Size = new System.Drawing.Size(86, 19);
|
||||
this.santaCheckBox.Size = new System.Drawing.Size(133, 19);
|
||||
this.santaCheckBox.TabIndex = 8;
|
||||
this.santaCheckBox.Text = "Bad Santa";
|
||||
this.santaCheckBox.Text = "Sit Idle Animation";
|
||||
this.santaCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.toolTip.SetToolTip(this.santaCheckBox, " The skin sits down after about 10 seconds of no controller input. Made for" +
|
||||
" Bad Santa in the \"Festive\" skin pack. ");
|
||||
this.toolTip.SetToolTip(this.santaCheckBox, " The skin sits down after about 10 seconds of no controller input.");
|
||||
this.santaCheckBox.UseSelectable = true;
|
||||
//
|
||||
// syncLegsCheckBox
|
||||
@@ -779,7 +780,7 @@
|
||||
private MetroFramework.Controls.MetroCheckBox noArmorCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox dinnerboneCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox crouchCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox unknownCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox animationOverrideCheckBox;
|
||||
private MetroFramework.Controls.MetroButton copyButton;
|
||||
private MetroFramework.Controls.MetroButton importButton;
|
||||
private MetroFramework.Controls.MetroButton exportButton;
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Core.Skin;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
@@ -74,15 +75,15 @@ namespace PckStudio.Forms.Editor
|
||||
checkbox.Checked = state;
|
||||
switch(checkBoxLinkage[checkbox])
|
||||
{
|
||||
case SkinAnimFlag.FORCE_HEAD_ARMOR:
|
||||
case SkinAnimFlag.FORCE_BODY_ARMOR:
|
||||
case SkinAnimFlag.FORCE_LEFT_ARM_ARMOR:
|
||||
case SkinAnimFlag.FORCE_RIGHT_ARM_ARMOR:
|
||||
case SkinAnimFlag.FORCE_LEFT_LEG_ARMOR:
|
||||
case SkinAnimFlag.FORCE_RIGHT_LEG_ARMOR:
|
||||
case SkinAnimFlag.SHOW_HEAD_ARMOR:
|
||||
case SkinAnimFlag.SHOW_CHESTPLATE_CENTER:
|
||||
case SkinAnimFlag.SHOW_CHESTPLATE_LEFT:
|
||||
case SkinAnimFlag.SHOW_CHESTPLATE_RIGHT:
|
||||
case SkinAnimFlag.SHOW_LEFT_LEG_ARMOR:
|
||||
case SkinAnimFlag.SHOW_RIGHT_LEG_ARMOR:
|
||||
checkbox.Enabled = state;
|
||||
break;
|
||||
case SkinAnimFlag.RESOLUTION_64x64:
|
||||
case SkinAnimFlag.MODERN_WIDE_MODEL:
|
||||
checkbox.Enabled = !state;
|
||||
// Prioritize slim model > classic model, LCE would
|
||||
if(state)
|
||||
@@ -104,7 +105,7 @@ namespace PckStudio.Forms.Editor
|
||||
* not the best way to do this but whatever lol
|
||||
* fix for both model flags being unset when both are set to true, with slim model prioritized of course
|
||||
*/
|
||||
if (item.Value == SkinAnimFlag.RESOLUTION_64x64 && anim.GetFlag(SkinAnimFlag.SLIM_MODEL))
|
||||
if (item.Value == SkinAnimFlag.MODERN_WIDE_MODEL && anim.GetFlag(SkinAnimFlag.SLIM_MODEL))
|
||||
continue;
|
||||
|
||||
item.Key.Checked = anim.GetFlag(item.Value);
|
||||
@@ -118,38 +119,38 @@ namespace PckStudio.Forms.Editor
|
||||
switch (checkBoxLinkage[checkBox])
|
||||
{
|
||||
case SkinAnimFlag.HEAD_DISABLED:
|
||||
checkBoxLinkage[SkinAnimFlag.FORCE_HEAD_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.FORCE_HEAD_ARMOR]);
|
||||
checkBoxLinkage[SkinAnimFlag.SHOW_HEAD_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.SHOW_HEAD_ARMOR]);
|
||||
break;
|
||||
case SkinAnimFlag.BODY_DISABLED:
|
||||
checkBoxLinkage[SkinAnimFlag.FORCE_BODY_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.FORCE_BODY_ARMOR]);
|
||||
case SkinAnimFlag.TORSO_DISABLED:
|
||||
checkBoxLinkage[SkinAnimFlag.SHOW_CHESTPLATE_CENTER].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.SHOW_CHESTPLATE_CENTER]);
|
||||
break;
|
||||
case SkinAnimFlag.LEFT_LEG_DISABLED:
|
||||
checkBoxLinkage[SkinAnimFlag.FORCE_LEFT_LEG_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.FORCE_LEFT_LEG_ARMOR]);
|
||||
checkBoxLinkage[SkinAnimFlag.SHOW_LEFT_LEG_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.SHOW_LEFT_LEG_ARMOR]);
|
||||
break;
|
||||
case SkinAnimFlag.RIGHT_LEG_DISABLED:
|
||||
checkBoxLinkage[SkinAnimFlag.FORCE_RIGHT_LEG_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.FORCE_RIGHT_LEG_ARMOR]);
|
||||
checkBoxLinkage[SkinAnimFlag.SHOW_RIGHT_LEG_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.SHOW_RIGHT_LEG_ARMOR]);
|
||||
break;
|
||||
case SkinAnimFlag.LEFT_ARM_DISABLED:
|
||||
checkBoxLinkage[SkinAnimFlag.FORCE_LEFT_ARM_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.FORCE_LEFT_ARM_ARMOR]);
|
||||
checkBoxLinkage[SkinAnimFlag.SHOW_CHESTPLATE_LEFT].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.SHOW_CHESTPLATE_LEFT]);
|
||||
break;
|
||||
case SkinAnimFlag.RIGHT_ARM_DISABLED:
|
||||
checkBoxLinkage[SkinAnimFlag.FORCE_RIGHT_ARM_ARMOR].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.FORCE_RIGHT_ARM_ARMOR]);
|
||||
checkBoxLinkage[SkinAnimFlag.SHOW_CHESTPLATE_LEFT].Enabled = checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.SHOW_CHESTPLATE_LEFT]);
|
||||
break;
|
||||
|
||||
case SkinAnimFlag.RESOLUTION_64x64:
|
||||
case SkinAnimFlag.MODERN_WIDE_MODEL:
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.SLIM_MODEL]);
|
||||
checkBoxLinkage[SkinAnimFlag.SLIM_MODEL].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
|
||||
case SkinAnimFlag.SLIM_MODEL:
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.RESOLUTION_64x64]);
|
||||
checkBoxLinkage[SkinAnimFlag.RESOLUTION_64x64].Enabled = !checkBox.Checked;
|
||||
Uncheck(checkBoxLinkage[SkinAnimFlag.MODERN_WIDE_MODEL]);
|
||||
checkBoxLinkage[SkinAnimFlag.MODERN_WIDE_MODEL].Enabled = !checkBox.Checked;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -189,37 +190,37 @@ namespace PckStudio.Forms.Editor
|
||||
private void InitializeRuleSet()
|
||||
{
|
||||
ruleset = new ANIMRuleSet(
|
||||
(bobbingCheckBox, SkinAnimFlag.HEAD_BOBBING_DISABLED),
|
||||
(bodyCheckBox, SkinAnimFlag.BODY_DISABLED),
|
||||
(bodyOCheckBox, SkinAnimFlag.BODY_OVERLAY_DISABLED),
|
||||
(chestplateCheckBox, SkinAnimFlag.FORCE_BODY_ARMOR),
|
||||
(classicCheckBox, SkinAnimFlag.RESOLUTION_64x64),
|
||||
(bobbingCheckBox, SkinAnimFlag.NO_BOBBING_OVERRIDE),
|
||||
(bodyCheckBox, SkinAnimFlag.TORSO_DISABLED),
|
||||
(bodyOCheckBox, SkinAnimFlag.JACKET_DISABLED),
|
||||
(chestplateCheckBox, SkinAnimFlag.SHOW_CHESTPLATE_CENTER),
|
||||
(classicCheckBox, SkinAnimFlag.MODERN_WIDE_MODEL),
|
||||
(crouchCheckBox, SkinAnimFlag.DO_BACKWARDS_CROUCH),
|
||||
(dinnerboneCheckBox, SkinAnimFlag.DINNERBONE),
|
||||
(headCheckBox, SkinAnimFlag.HEAD_DISABLED),
|
||||
(headOCheckBox, SkinAnimFlag.HEAD_OVERLAY_DISABLED),
|
||||
(helmetCheckBox, SkinAnimFlag.FORCE_HEAD_ARMOR),
|
||||
(headOCheckBox, SkinAnimFlag.HEADWEAR_DISABLED),
|
||||
(helmetCheckBox, SkinAnimFlag.SHOW_HEAD_ARMOR),
|
||||
(leftArmCheckBox, SkinAnimFlag.LEFT_ARM_DISABLED),
|
||||
(leftArmOCheckBox, SkinAnimFlag.LEFT_ARM_OVERLAY_DISABLED),
|
||||
(leftArmorCheckBox, SkinAnimFlag.FORCE_LEFT_ARM_ARMOR),
|
||||
(leftArmOCheckBox, SkinAnimFlag.LEFT_SLEEVE_DISABLED),
|
||||
(leftArmorCheckBox, SkinAnimFlag.SHOW_CHESTPLATE_LEFT),
|
||||
(leftLegCheckBox, SkinAnimFlag.LEFT_LEG_DISABLED),
|
||||
(leftLeggingCheckBox, SkinAnimFlag.FORCE_LEFT_LEG_ARMOR),
|
||||
(leftLegOCheckBox, SkinAnimFlag.LEFT_LEG_OVERLAY_DISABLED),
|
||||
(leftLeggingCheckBox, SkinAnimFlag.SHOW_LEFT_LEG_ARMOR),
|
||||
(leftLegOCheckBox, SkinAnimFlag.LEFT_PANTS_DISABLED),
|
||||
(noArmorCheckBox, SkinAnimFlag.ALL_ARMOR_DISABLED),
|
||||
(rightArmCheckBox, SkinAnimFlag.RIGHT_ARM_DISABLED),
|
||||
(rightArmOCheckBox, SkinAnimFlag.RIGHT_ARM_OVERLAY_DISABLED),
|
||||
(rightArmorCheckBox, SkinAnimFlag.FORCE_RIGHT_ARM_ARMOR),
|
||||
(rightArmOCheckBox, SkinAnimFlag.RIGHT_SLEEVE_DISABLED),
|
||||
(rightArmorCheckBox, SkinAnimFlag.SHOW_CHESTPLATE_LEFT),
|
||||
(rightLegCheckBox, SkinAnimFlag.RIGHT_LEG_DISABLED),
|
||||
(rightLeggingCheckBox, SkinAnimFlag.FORCE_RIGHT_LEG_ARMOR),
|
||||
(rightLegOCheckBox, SkinAnimFlag.RIGHT_LEG_OVERLAY_DISABLED),
|
||||
(santaCheckBox, SkinAnimFlag.BAD_SANTA),
|
||||
(rightLeggingCheckBox, SkinAnimFlag.SHOW_RIGHT_LEG_ARMOR),
|
||||
(rightLegOCheckBox, SkinAnimFlag.RIGHT_PANTS_DISABLED),
|
||||
(santaCheckBox, SkinAnimFlag.SIT_IDLE_ANIMATION),
|
||||
(slimCheckBox, SkinAnimFlag.SLIM_MODEL),
|
||||
(staticArmsCheckBox, SkinAnimFlag.STATIC_ARMS),
|
||||
(staticLegsCheckBox, SkinAnimFlag.STATIC_LEGS),
|
||||
(statueCheckBox, SkinAnimFlag.STATUE_OF_LIBERTY),
|
||||
(syncArmsCheckBox, SkinAnimFlag.SYNCED_ARMS),
|
||||
(syncLegsCheckBox, SkinAnimFlag.SYNCED_LEGS),
|
||||
(unknownCheckBox, SkinAnimFlag.__BIT_4),
|
||||
(animationOverrideCheckBox, SkinAnimFlag.CUSTOM_ANIMATION_OVERRIDE),
|
||||
(zombieCheckBox, SkinAnimFlag.ZOMBIE_ARMS)
|
||||
);
|
||||
ruleset.OnCheckboxChanged = setDisplayAnim;
|
||||
@@ -280,7 +281,7 @@ namespace PckStudio.Forms.Editor
|
||||
if (saveFileDialog.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
bool isSlim = ruleset.Value.GetFlag(SkinAnimFlag.SLIM_MODEL);
|
||||
bool is64x64 = ruleset.Value.GetFlag(SkinAnimFlag.RESOLUTION_64x64);
|
||||
bool is64x64 = ruleset.Value.GetFlag(SkinAnimFlag.MODERN_WIDE_MODEL);
|
||||
bool isClassic32 = !isSlim && !is64x64;
|
||||
|
||||
Image skin = isSlim ? Properties.Resources.slim_template : Properties.Resources.classic_template;
|
||||
@@ -291,11 +292,11 @@ namespace PckStudio.Forms.Editor
|
||||
using (Graphics graphic = Graphics.FromImage(img))
|
||||
{
|
||||
graphic.DrawImage(skin, new Rectangle(Point.Empty, imgSize), new Rectangle(Point.Empty, imgSize), GraphicsUnit.Pixel);
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.HEAD_OVERLAY_DISABLED))
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.HEADWEAR_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(32, 0, 32, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.HEAD_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 0, 32, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.BODY_DISABLED))
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.TORSO_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(16, 16, 24, 16));
|
||||
if (img.Height == 64)
|
||||
{
|
||||
@@ -303,19 +304,19 @@ namespace PckStudio.Forms.Editor
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(40, 16, 16, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.RIGHT_LEG_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 16, 16, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.BODY_OVERLAY_DISABLED))
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.JACKET_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(16, 32, 24, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.RIGHT_ARM_OVERLAY_DISABLED))
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.RIGHT_SLEEVE_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(40, 32, 16, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.RIGHT_LEG_OVERLAY_DISABLED))
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.RIGHT_PANTS_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 32, 16, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.LEFT_LEG_OVERLAY_DISABLED))
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.LEFT_PANTS_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(0, 48, 16, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.LEFT_LEG_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(16, 48, 16, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.LEFT_ARM_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(32, 48, 16, 16));
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.LEFT_ARM_OVERLAY_DISABLED))
|
||||
if (ruleset.Value.GetFlag(SkinAnimFlag.LEFT_SLEEVE_DISABLED))
|
||||
graphic.FillRectangle(Brushes.Magenta, new Rectangle(48, 48, 16, 16));
|
||||
}
|
||||
else
|
||||
@@ -342,7 +343,7 @@ namespace PckStudio.Forms.Editor
|
||||
static readonly Dictionary<string, SkinAnimMask> Templates = new Dictionary<string, SkinAnimMask>()
|
||||
{
|
||||
{ "Steve (64x32)", SkinAnimMask.NONE },
|
||||
{ "Steve (64x64)", SkinAnimMask.RESOLUTION_64x64 },
|
||||
{ "Steve (64x64)", SkinAnimMask.MODERN_WIDE_MODEL },
|
||||
{ "Alex (64x64)", SkinAnimMask.SLIM_MODEL },
|
||||
{ "Zombie Skins", SkinAnimMask.ZOMBIE_ARMS },
|
||||
{ "Cetacean Skins", SkinAnimMask.SYNCED_ARMS | SkinAnimMask.SYNCED_LEGS },
|
||||
|
||||
@@ -319,7 +319,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.animationPictureBox.BlendColor = System.Drawing.Color.White;
|
||||
this.animationPictureBox.BlendMode = PckStudio.Extensions.BlendMode.Multiply;
|
||||
this.animationPictureBox.BlendMode = PckStudio.Core.Extensions.BlendMode.Multiply;
|
||||
this.animationPictureBox.Image = null;
|
||||
this.animationPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.animationPictureBox.Location = new System.Drawing.Point(157, 88);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2023-present miku-666, MattNL
|
||||
/* Copyright (c) 2023-present miku-666, MayNL
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
@@ -29,39 +29,32 @@ using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using PckStudio.Forms.Additional_Popups.Animation;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Deserializer;
|
||||
using PckStudio.Internal.Serializer;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Core.Deserializer;
|
||||
using PckStudio.Core.Serializer;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Controls;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class AnimationEditor : MetroForm
|
||||
public partial class AnimationEditor : EditorForm<Animation>
|
||||
{
|
||||
public Animation Result => _animation;
|
||||
private bool _editable;
|
||||
|
||||
private Animation _animation;
|
||||
private bool _isSpecialTile;
|
||||
|
||||
private AnimationEditor()
|
||||
internal AnimationEditor(Animation animation, ISaveContext<Animation> saveContext, string displayName, bool editable = true)
|
||||
: base(animation, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
toolStripSeparator1.Visible = saveToolStripMenuItem1.Visible = !Settings.Default.AutoSaveChanges;
|
||||
}
|
||||
|
||||
internal AnimationEditor(Animation animation, string displayName, bool isSpecialTile = false)
|
||||
: this()
|
||||
{
|
||||
_ = animation ?? throw new ArgumentNullException(nameof(animation));
|
||||
_animation = animation;
|
||||
saveToolStripMenuItem1.Available = !saveContext.AutoSave;
|
||||
toolStripSeparator1.Available = !saveContext.AutoSave;
|
||||
tileLabel.Text = displayName;
|
||||
_isSpecialTile = isSpecialTile;
|
||||
_editable = editable;
|
||||
animationPictureBox.Image = animation.CreateAnimationImage();
|
||||
}
|
||||
|
||||
internal AnimationEditor(Animation animation, string displayName, Color blendColor)
|
||||
: this(animation, displayName)
|
||||
internal AnimationEditor(Animation animation, ISaveContext<Animation> saveContext, string displayName, Color blendColor)
|
||||
: this(animation, saveContext, displayName)
|
||||
{
|
||||
animationPictureBox.UseBlendColor = true;
|
||||
animationPictureBox.BlendColor = blendColor;
|
||||
@@ -69,10 +62,9 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void ValidateToolStrip()
|
||||
{
|
||||
bulkAnimationSpeedToolStripMenuItem.Enabled =
|
||||
importToolStripMenuItem.Enabled =
|
||||
exportAsToolStripMenuItem.Enabled =
|
||||
InterpolationCheckbox.Visible = !_isSpecialTile;
|
||||
editToolStripMenuItem.Visible =
|
||||
importToolStripMenuItem.Visible =
|
||||
InterpolationCheckbox.Visible = _editable;
|
||||
}
|
||||
|
||||
private void AnimationEditor_Load(object sender, EventArgs e)
|
||||
@@ -83,20 +75,20 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void LoadAnimationTreeView()
|
||||
{
|
||||
if (_animation is null)
|
||||
if (EditorValue is null)
|
||||
{
|
||||
AnimationStartStopBtn.Enabled = false;
|
||||
AnimationStartStopBtn.Visible = false;
|
||||
return;
|
||||
}
|
||||
AnimationStartStopBtn.Enabled = true;
|
||||
InterpolationCheckbox.Checked = _animation.Interpolate;
|
||||
AnimationStartStopBtn.Visible = true;
|
||||
InterpolationCheckbox.Checked = EditorValue.Interpolate;
|
||||
TextureIcons.Images.Clear();
|
||||
TextureIcons.Images.AddRange(_animation.GetTextures().ToArray());
|
||||
TextureIcons.Images.AddRange(EditorValue.GetTextures().ToArray());
|
||||
UpdateTreeView();
|
||||
|
||||
animationPictureBox.Image ??= _animation.CreateAnimationImage();
|
||||
animationPictureBox.Image ??= EditorValue.CreateAnimationImage();
|
||||
|
||||
if (_animation.FrameCount > 0)
|
||||
if (EditorValue.FrameCount > 0)
|
||||
{
|
||||
animationPictureBox.Image.SelectActiveFrame(FrameDimension.Page, 0);
|
||||
}
|
||||
@@ -106,11 +98,11 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
frameTreeView.Nodes.Clear();
|
||||
frameTreeView.Nodes.AddRange(
|
||||
_animation.GetFrames()
|
||||
EditorValue.GetFrames()
|
||||
.Select(frame =>
|
||||
{
|
||||
var imageIndex = _animation.GetTextureIndex(frame.Texture);
|
||||
return new TreeNode($"for {frame.Ticks} ticks", imageIndex, imageIndex);
|
||||
var imageIndex = EditorValue.GetTextureIndex(frame.Texture);
|
||||
return new TreeNode($"for {frame.Ticks} tick(s)", imageIndex, imageIndex);
|
||||
})
|
||||
.ToArray()
|
||||
);
|
||||
@@ -122,7 +114,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
StopAnimation();
|
||||
}
|
||||
animationPictureBox.Image = _animation.GetFrame(frameTreeView.SelectedNode.Index).Texture;
|
||||
animationPictureBox.Image = EditorValue.GetFrame(frameTreeView.SelectedNode.Index).Texture;
|
||||
}
|
||||
|
||||
private void StopAnimation()
|
||||
@@ -139,9 +131,9 @@ namespace PckStudio.Forms.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
if (_animation.FrameCount > 1)
|
||||
if (EditorValue.FrameCount > 1)
|
||||
{
|
||||
animationPictureBox.Image = _animation.CreateAnimationImage();
|
||||
animationPictureBox.Image = EditorValue.CreateAnimationImage();
|
||||
animationPictureBox.Start();
|
||||
AnimationStartStopBtn.Text = "Stop Animation";
|
||||
}
|
||||
@@ -166,8 +158,9 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!_isSpecialTile && _animation is not null && _animation.FrameCount > 0)
|
||||
if (_editable && EditorValue is not null && EditorValue.FrameCount > 0)
|
||||
{
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
return;
|
||||
}
|
||||
@@ -175,7 +168,7 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
|
||||
// Most of the code below is modified code from this link: https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.treeview.itemdrag?view=windowsdesktop-6.0
|
||||
// - MattNL
|
||||
// - MayNL
|
||||
|
||||
private void frameTreeView_ItemDrag(object sender, ItemDragEventArgs e)
|
||||
{
|
||||
@@ -231,7 +224,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
int draggedIndex = draggedNode.Index;
|
||||
int targetIndex = targetNode.Index;
|
||||
_animation.SwapFrames(draggedIndex, targetIndex);
|
||||
EditorValue.SwapFrames(draggedIndex, targetIndex);
|
||||
UpdateTreeView();
|
||||
}
|
||||
}
|
||||
@@ -255,18 +248,18 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void treeView1_doubleClick(object sender, EventArgs e)
|
||||
{
|
||||
Animation.Frame frame = _animation.GetFrame(frameTreeView.SelectedNode.Index);
|
||||
using FrameEditor diag = new FrameEditor(frame.Ticks, _animation.GetTextureIndex(frame.Texture), TextureIcons);
|
||||
Animation.Frame frame = EditorValue.GetFrame(frameTreeView.SelectedNode.Index);
|
||||
using FrameEditor diag = new FrameEditor(frame.Ticks, EditorValue.GetTextureIndex(frame.Texture), TextureIcons);
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
/* Found a bug here. When passing the frame variable,
|
||||
* it would replace the first instance of that frame and time
|
||||
* rather than the actual frame that was clicked.
|
||||
* I've just switched to passing the index to fix this for now.
|
||||
* - Matt
|
||||
* - MayNL
|
||||
*/
|
||||
|
||||
_animation.SetFrame(frameTreeView.SelectedNode.Index, diag.FrameTextureIndex, diag.FrameTime);
|
||||
EditorValue.SetFrame(frameTreeView.SelectedNode.Index, diag.FrameTextureIndex, diag.FrameTime);
|
||||
UpdateTreeView();
|
||||
}
|
||||
}
|
||||
@@ -277,14 +270,14 @@ namespace PckStudio.Forms.Editor
|
||||
diag.SaveBtn.Text = "Add";
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
_animation.AddFrame(diag.FrameTextureIndex, _isSpecialTile ? Animation.MinimumFrameTime : diag.FrameTime);
|
||||
EditorValue.AddFrame(diag.FrameTextureIndex, _editable ? diag.FrameTime : Animation.MinimumFrameTime);
|
||||
UpdateTreeView();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFrameToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (frameTreeView.SelectedNode is TreeNode t && _animation.RemoveFrame(t.Index))
|
||||
if (frameTreeView.SelectedNode is TreeNode t && EditorValue.RemoveFrame(t.Index))
|
||||
{
|
||||
frameTreeView.SelectedNode.Remove();
|
||||
}
|
||||
@@ -297,7 +290,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
if (animationPictureBox.IsPlaying)
|
||||
animationPictureBox.Stop();
|
||||
_animation.SetFrameTicks(diag.Ticks);
|
||||
EditorValue.SetFrameTicks(diag.Ticks);
|
||||
UpdateTreeView();
|
||||
}
|
||||
diag.Dispose();
|
||||
@@ -319,7 +312,7 @@ namespace PckStudio.Forms.Editor
|
||||
Title = "Please select a valid Minecaft: Java Edition animation script",
|
||||
// It's marked as .png.mcmeta just in case
|
||||
// some weirdo tries to pass a pack.mcmeta or something
|
||||
// -MattNL
|
||||
// -MayNL
|
||||
Filter = "Animation Scripts (*.mcmeta)|*.png.mcmeta"
|
||||
};
|
||||
if (fileDialog.ShowDialog(this) != DialogResult.OK)
|
||||
@@ -334,10 +327,10 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
try
|
||||
{
|
||||
var img = Image.FromFile(textureFile);
|
||||
Image img = Image.FromFile(textureFile).ReleaseFromFile();
|
||||
JObject mcmeta = JObject.Parse(File.ReadAllText(fileDialog.FileName));
|
||||
Animation javaAnimation = AnimationDeserializer.DefaultDeserializer.DeserializeJavaAnimation(mcmeta, img);
|
||||
_animation = javaAnimation;
|
||||
EditorValue = javaAnimation;
|
||||
LoadAnimationTreeView();
|
||||
}
|
||||
catch (JsonException j_ex)
|
||||
@@ -354,11 +347,11 @@ namespace PckStudio.Forms.Editor
|
||||
fileDialog.Filter = "Animation Scripts (*.mcmeta)|*.png.mcmeta";
|
||||
if (fileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
JObject mcmeta = AnimationSerializer.SerializeJavaAnimation(_animation);
|
||||
JObject mcmeta = AnimationSerializer.SerializeJavaAnimation(EditorValue);
|
||||
string jsondata = JsonConvert.SerializeObject(mcmeta, Formatting.Indented);
|
||||
string filename = fileDialog.FileName;
|
||||
File.WriteAllText(filename, jsondata);
|
||||
Image finalTexture = AnimationSerializer.SerializeTexture(_animation);
|
||||
Image finalTexture = AnimationSerializer.SerializeTexture(EditorValue);
|
||||
// removes ".mcmeta" from filename
|
||||
string texturePath = Path.Combine(Path.GetDirectoryName(filename), Path.GetFileNameWithoutExtension(filename));
|
||||
finalTexture.Save(texturePath);
|
||||
@@ -390,8 +383,8 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void InterpolationCheckbox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_animation is not null)
|
||||
_animation.Interpolate = InterpolationCheckbox.Checked;
|
||||
if (EditorValue is not null)
|
||||
EditorValue.Interpolate = InterpolationCheckbox.Checked;
|
||||
}
|
||||
|
||||
private void AnimationEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
@@ -400,7 +393,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
animationPictureBox.Stop();
|
||||
}
|
||||
if (Settings.Default.AutoSaveChanges)
|
||||
if (!saveToolStripMenuItem1.Available)
|
||||
{
|
||||
saveToolStripMenuItem1_Click(sender, EventArgs.Empty);
|
||||
}
|
||||
@@ -415,14 +408,14 @@ namespace PckStudio.Forms.Editor
|
||||
if (fileDialog.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var gif = Image.FromFile(fileDialog.FileName);
|
||||
Image gif = Image.FromFile(fileDialog.FileName).ReleaseFromFile();
|
||||
if (!gif.RawFormat.Equals(ImageFormat.Gif))
|
||||
{
|
||||
MessageBox.Show(this, "Selected file is not a gif", "Invalid file", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var oldResolution = _animation.GetFrame(0).Texture.Width;
|
||||
var oldResolution = EditorValue.GetFrame(0).Texture.Width;
|
||||
|
||||
FrameDimension dimension = new FrameDimension(gif.FrameDimensionsList[0]);
|
||||
int frameCount = gif.GetFrameCount(dimension);
|
||||
@@ -436,8 +429,8 @@ namespace PckStudio.Forms.Editor
|
||||
textures.Add(new Bitmap(gif, oldResolution, oldResolution));
|
||||
}
|
||||
|
||||
_animation = new Animation(textures, initFramesFromTextures: true);
|
||||
_animation.Interpolate = InterpolationCheckbox.Checked;
|
||||
EditorValue = new Animation(textures, initFramesFromTextures: true);
|
||||
EditorValue.Interpolate = InterpolationCheckbox.Checked;
|
||||
LoadAnimationTreeView();
|
||||
}
|
||||
|
||||
@@ -452,7 +445,7 @@ namespace PckStudio.Forms.Editor
|
||||
return;
|
||||
using Image img = Image.FromFile(ofd.FileName);
|
||||
IEnumerable<Image> textures = img.Split(ImageLayoutDirection.Vertical);
|
||||
_animation = new Animation(textures, initFramesFromTextures: true);
|
||||
EditorValue = new Animation(textures, initFramesFromTextures: true);
|
||||
LoadAnimationTreeView();
|
||||
}
|
||||
|
||||
@@ -465,7 +458,7 @@ namespace PckStudio.Forms.Editor
|
||||
};
|
||||
if (fileDialog.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
_animation.CreateAnimationImage().Save(fileDialog.FileName);
|
||||
EditorValue.CreateAnimationImage().Save(fileDialog.FileName);
|
||||
}
|
||||
|
||||
private void frameTimeandTicksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
||||
132
PCK-Studio/Forms/Editor/AudioEditor.Designer.cs
generated
132
PCK-Studio/Forms/Editor/AudioEditor.Designer.cs
generated
@@ -40,26 +40,14 @@ namespace PckStudio.Forms.Editor
|
||||
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteUnusedBINKAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.openDataFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.bulkReplaceExistingTracksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.organizeTracksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.howToAddSongsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.whatAreTheCategoriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.howToEditCreditsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.optimizeDataFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.bINKACompressionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.treeView2 = new System.Windows.Forms.TreeView();
|
||||
this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.addEntryMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeEntryMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.verifyFileLocationToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.convertToWAVToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.playOverworldInCreative = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.compressionUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.metroLabel1 = new MetroFramework.Controls.MetroLabel();
|
||||
this.editEntryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.menuStrip.SuspendLayout();
|
||||
this.contextMenuStrip2.SuspendLayout();
|
||||
@@ -124,9 +112,7 @@ namespace PckStudio.Forms.Editor
|
||||
resources.ApplyResources(this.menuStrip, "menuStrip");
|
||||
this.menuStrip.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.toolsToolStripMenuItem,
|
||||
this.helpToolStripMenuItem});
|
||||
this.fileToolStripMenuItem});
|
||||
this.menuStrip.Name = "menuStrip";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
@@ -143,83 +129,6 @@ namespace PckStudio.Forms.Editor
|
||||
this.saveToolStripMenuItem1.Name = "saveToolStripMenuItem1";
|
||||
this.saveToolStripMenuItem1.Click += new System.EventHandler(this.saveToolStripMenuItem1_Click);
|
||||
//
|
||||
// toolsToolStripMenuItem
|
||||
//
|
||||
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.deleteUnusedBINKAsToolStripMenuItem,
|
||||
this.openDataFolderToolStripMenuItem,
|
||||
this.bulkReplaceExistingTracksToolStripMenuItem,
|
||||
this.organizeTracksToolStripMenuItem});
|
||||
this.toolsToolStripMenuItem.ForeColor = System.Drawing.Color.White;
|
||||
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
|
||||
resources.ApplyResources(this.toolsToolStripMenuItem, "toolsToolStripMenuItem");
|
||||
//
|
||||
// deleteUnusedBINKAsToolStripMenuItem
|
||||
//
|
||||
this.deleteUnusedBINKAsToolStripMenuItem.Name = "deleteUnusedBINKAsToolStripMenuItem";
|
||||
resources.ApplyResources(this.deleteUnusedBINKAsToolStripMenuItem, "deleteUnusedBINKAsToolStripMenuItem");
|
||||
this.deleteUnusedBINKAsToolStripMenuItem.Click += new System.EventHandler(this.deleteUnusedBINKAsToolStripMenuItem_Click);
|
||||
//
|
||||
// openDataFolderToolStripMenuItem
|
||||
//
|
||||
this.openDataFolderToolStripMenuItem.Name = "openDataFolderToolStripMenuItem";
|
||||
resources.ApplyResources(this.openDataFolderToolStripMenuItem, "openDataFolderToolStripMenuItem");
|
||||
this.openDataFolderToolStripMenuItem.Click += new System.EventHandler(this.openDataFolderToolStripMenuItem_Click);
|
||||
//
|
||||
// bulkReplaceExistingTracksToolStripMenuItem
|
||||
//
|
||||
this.bulkReplaceExistingTracksToolStripMenuItem.Name = "bulkReplaceExistingTracksToolStripMenuItem";
|
||||
resources.ApplyResources(this.bulkReplaceExistingTracksToolStripMenuItem, "bulkReplaceExistingTracksToolStripMenuItem");
|
||||
this.bulkReplaceExistingTracksToolStripMenuItem.Click += new System.EventHandler(this.bulkReplaceExistingFilesToolStripMenuItem_Click);
|
||||
//
|
||||
// organizeTracksToolStripMenuItem
|
||||
//
|
||||
this.organizeTracksToolStripMenuItem.Name = "organizeTracksToolStripMenuItem";
|
||||
resources.ApplyResources(this.organizeTracksToolStripMenuItem, "organizeTracksToolStripMenuItem");
|
||||
this.organizeTracksToolStripMenuItem.Click += new System.EventHandler(this.organizeTracksToolStripMenuItem_Click);
|
||||
//
|
||||
// helpToolStripMenuItem
|
||||
//
|
||||
this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.howToAddSongsToolStripMenuItem,
|
||||
this.whatAreTheCategoriesToolStripMenuItem,
|
||||
this.howToEditCreditsToolStripMenuItem,
|
||||
this.optimizeDataFolderToolStripMenuItem,
|
||||
this.bINKACompressionToolStripMenuItem});
|
||||
this.helpToolStripMenuItem.ForeColor = System.Drawing.Color.White;
|
||||
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
|
||||
resources.ApplyResources(this.helpToolStripMenuItem, "helpToolStripMenuItem");
|
||||
//
|
||||
// howToAddSongsToolStripMenuItem
|
||||
//
|
||||
this.howToAddSongsToolStripMenuItem.Name = "howToAddSongsToolStripMenuItem";
|
||||
resources.ApplyResources(this.howToAddSongsToolStripMenuItem, "howToAddSongsToolStripMenuItem");
|
||||
this.howToAddSongsToolStripMenuItem.Click += new System.EventHandler(this.howToAddSongsToolStripMenuItem_Click);
|
||||
//
|
||||
// whatAreTheCategoriesToolStripMenuItem
|
||||
//
|
||||
this.whatAreTheCategoriesToolStripMenuItem.Name = "whatAreTheCategoriesToolStripMenuItem";
|
||||
resources.ApplyResources(this.whatAreTheCategoriesToolStripMenuItem, "whatAreTheCategoriesToolStripMenuItem");
|
||||
this.whatAreTheCategoriesToolStripMenuItem.Click += new System.EventHandler(this.whatAreTheCategoriesToolStripMenuItem_Click);
|
||||
//
|
||||
// howToEditCreditsToolStripMenuItem
|
||||
//
|
||||
this.howToEditCreditsToolStripMenuItem.Name = "howToEditCreditsToolStripMenuItem";
|
||||
resources.ApplyResources(this.howToEditCreditsToolStripMenuItem, "howToEditCreditsToolStripMenuItem");
|
||||
this.howToEditCreditsToolStripMenuItem.Click += new System.EventHandler(this.howToEditCreditsToolStripMenuItem_Click);
|
||||
//
|
||||
// optimizeDataFolderToolStripMenuItem
|
||||
//
|
||||
this.optimizeDataFolderToolStripMenuItem.Name = "optimizeDataFolderToolStripMenuItem";
|
||||
resources.ApplyResources(this.optimizeDataFolderToolStripMenuItem, "optimizeDataFolderToolStripMenuItem");
|
||||
this.optimizeDataFolderToolStripMenuItem.Click += new System.EventHandler(this.optimizeDataFolderToolStripMenuItem_Click);
|
||||
//
|
||||
// bINKACompressionToolStripMenuItem
|
||||
//
|
||||
this.bINKACompressionToolStripMenuItem.Name = "bINKACompressionToolStripMenuItem";
|
||||
resources.ApplyResources(this.bINKACompressionToolStripMenuItem, "bINKACompressionToolStripMenuItem");
|
||||
this.bINKACompressionToolStripMenuItem.Click += new System.EventHandler(this.BINKACompressionToolStripMenuItem_Click);
|
||||
//
|
||||
// treeView2
|
||||
//
|
||||
this.treeView2.AllowDrop = true;
|
||||
@@ -236,9 +145,8 @@ namespace PckStudio.Forms.Editor
|
||||
//
|
||||
this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.addEntryMenuItem,
|
||||
this.removeEntryMenuItem,
|
||||
this.verifyFileLocationToolStripMenuItem,
|
||||
this.convertToWAVToolStripMenuItem});
|
||||
this.editEntryToolStripMenuItem,
|
||||
this.removeEntryMenuItem});
|
||||
this.contextMenuStrip2.Name = "contextMenuStrip1";
|
||||
resources.ApplyResources(this.contextMenuStrip2, "contextMenuStrip2");
|
||||
//
|
||||
@@ -254,18 +162,6 @@ namespace PckStudio.Forms.Editor
|
||||
resources.ApplyResources(this.removeEntryMenuItem, "removeEntryMenuItem");
|
||||
this.removeEntryMenuItem.Click += new System.EventHandler(this.removeEntryMenuItem_Click);
|
||||
//
|
||||
// verifyFileLocationToolStripMenuItem
|
||||
//
|
||||
this.verifyFileLocationToolStripMenuItem.Name = "verifyFileLocationToolStripMenuItem";
|
||||
resources.ApplyResources(this.verifyFileLocationToolStripMenuItem, "verifyFileLocationToolStripMenuItem");
|
||||
this.verifyFileLocationToolStripMenuItem.Click += new System.EventHandler(this.verifyFileLocationToolStripMenuItem_Click);
|
||||
//
|
||||
// convertToWAVToolStripMenuItem
|
||||
//
|
||||
this.convertToWAVToolStripMenuItem.Name = "convertToWAVToolStripMenuItem";
|
||||
resources.ApplyResources(this.convertToWAVToolStripMenuItem, "convertToWAVToolStripMenuItem");
|
||||
this.convertToWAVToolStripMenuItem.Click += new System.EventHandler(this.convertToWAVToolStripMenuItem_Click);
|
||||
//
|
||||
// playOverworldInCreative
|
||||
//
|
||||
resources.ApplyResources(this.playOverworldInCreative, "playOverworldInCreative");
|
||||
@@ -305,6 +201,12 @@ namespace PckStudio.Forms.Editor
|
||||
this.metroLabel1.Name = "metroLabel1";
|
||||
this.metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// editEntryToolStripMenuItem
|
||||
//
|
||||
this.editEntryToolStripMenuItem.Name = "editEntryToolStripMenuItem";
|
||||
resources.ApplyResources(this.editEntryToolStripMenuItem, "editEntryToolStripMenuItem");
|
||||
this.editEntryToolStripMenuItem.Click += new System.EventHandler(this.editEntryToolStripMenuItem_Click);
|
||||
//
|
||||
// AudioEditor
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
@@ -345,23 +247,11 @@ namespace PckStudio.Forms.Editor
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
|
||||
private System.Windows.Forms.ToolStripMenuItem addEntryMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeEntryMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
|
||||
private System.Windows.Forms.ImageList catImages;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem verifyFileLocationToolStripMenuItem;
|
||||
private MetroFramework.Controls.MetroCheckBox playOverworldInCreative;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteUnusedBINKAsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem howToAddSongsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem whatAreTheCategoriesToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem howToEditCreditsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem optimizeDataFolderToolStripMenuItem;
|
||||
private System.Windows.Forms.NumericUpDown compressionUpDown;
|
||||
private System.Windows.Forms.ToolStripMenuItem bINKACompressionToolStripMenuItem;
|
||||
private MetroFramework.Controls.MetroLabel metroLabel1;
|
||||
private System.Windows.Forms.ToolStripMenuItem openDataFolderToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem bulkReplaceExistingTracksToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem changeCategoryToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem organizeTracksToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem convertToWAVToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem editEntryToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -7,30 +7,23 @@ using System.Windows.Forms;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Diagnostics;
|
||||
|
||||
using MetroFramework.Forms;
|
||||
using NAudio.Wave;
|
||||
|
||||
using OMI.Formats.Pck;
|
||||
|
||||
using PckStudio.FileFormats;
|
||||
using PckStudio.Internal.IO.PckAudio;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.External.API.Miles;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Core.FileFormats;
|
||||
|
||||
// Audio Editor by MattNL and Miku-666
|
||||
// Audio Editor by MayNL and Miku-666
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class AudioEditor : MetroForm
|
||||
public partial class AudioEditor : EditorForm<PckAudioFile>
|
||||
{
|
||||
public string defaultType = "yes";
|
||||
PckAudioFile _audioFile = null;
|
||||
PckAsset _audioAsset;
|
||||
bool _isLittleEndian = false;
|
||||
MainForm parent = null;
|
||||
|
||||
private static readonly List<string> Categories = new List<string>
|
||||
@@ -46,13 +39,20 @@ namespace PckStudio.Forms.Editor
|
||||
"Build Off (Unused)"
|
||||
|
||||
/* If the SetMusicID function within the game is ever set to 0x9,
|
||||
* it actually attempts to play a "MG04_01.binka" file in the vanilla music folder.
|
||||
* Therefore it's safe to assume that the last audio category was indeed
|
||||
* supposed to be for the cancelled Build Off mini game (MG04). - May
|
||||
* it actually plays a tracklist for MG04, with all of the Creative
|
||||
* Tracks and the "MG04_01.binka" file in it. The 9th category is MG04 - May
|
||||
*/
|
||||
};
|
||||
|
||||
private string GetCategoryFromId(PckAudioFile.AudioCategory.EAudioType categoryId)
|
||||
public AudioEditor(PckAudioFile audioFile, ISaveContext<PckAudioFile> saveContext)
|
||||
: base(audioFile, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
saveToolStripMenuItem1.Visible = !saveContext.AutoSave;
|
||||
SetUpTree();
|
||||
}
|
||||
|
||||
private string GetCategoryFromId(PckAudioFile.AudioCategory.EAudioType categoryId)
|
||||
=> categoryId >= PckAudioFile.AudioCategory.EAudioType.Overworld &&
|
||||
categoryId <= PckAudioFile.AudioCategory.EAudioType.BuildOff
|
||||
? Categories[(int)categoryId]
|
||||
@@ -63,26 +63,12 @@ namespace PckStudio.Forms.Editor
|
||||
return (PckAudioFile.AudioCategory.EAudioType)Categories.IndexOf(category);
|
||||
}
|
||||
|
||||
public AudioEditor(PckAsset asset, bool isLittleEndian)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
saveToolStripMenuItem1.Visible = !Settings.Default.AutoSaveChanges;
|
||||
|
||||
_isLittleEndian = isLittleEndian;
|
||||
|
||||
_audioAsset = asset;
|
||||
_audioFile = _audioAsset.GetData(new PckAudioFileReader(isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
|
||||
SetUpTree();
|
||||
}
|
||||
|
||||
public void SetUpTree()
|
||||
{
|
||||
treeView1.BeginUpdate();
|
||||
treeView1.Nodes.Clear();
|
||||
|
||||
foreach (PckAudioFile.AudioCategory category in _audioFile.Categories)
|
||||
foreach (PckAudioFile.AudioCategory category in EditorValue.Categories)
|
||||
{
|
||||
// fix songs with directories using backslash instead of forward slash
|
||||
// Songs with a backslash instead of a forward slash would not play in RPCS3
|
||||
@@ -92,7 +78,7 @@ namespace PckStudio.Forms.Editor
|
||||
if (category.AudioType == PckAudioFile.AudioCategory.EAudioType.Creative)
|
||||
{
|
||||
if (category.Name == "include_overworld" &&
|
||||
_audioFile.TryGetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld, out PckAudioFile.AudioCategory overworldCategory))
|
||||
EditorValue.TryGetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld, out PckAudioFile.AudioCategory overworldCategory))
|
||||
{
|
||||
foreach (var name in category.SongNames.ToList())
|
||||
{
|
||||
@@ -108,24 +94,26 @@ namespace PckStudio.Forms.Editor
|
||||
treeNode.Tag = category;
|
||||
treeView1.Nodes.Add(treeNode);
|
||||
}
|
||||
playOverworldInCreative.Enabled = _audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Creative);
|
||||
playOverworldInCreative.Enabled = EditorValue.HasCategory(PckAudioFile.AudioCategory.EAudioType.Creative);
|
||||
treeView1.EndUpdate();
|
||||
}
|
||||
|
||||
private void verifyFileLocationToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
/*
|
||||
if (treeView1.SelectedNode == null || treeView2.SelectedNode == null)
|
||||
return;
|
||||
TreeNode entry = treeView2.SelectedNode;
|
||||
|
||||
if (!parent.CreateDataFolder())
|
||||
return;
|
||||
string FileName = Path.Combine(parent.GetDataPath(), entry.Text + ".binka");
|
||||
string fileName = Path.Combine(parent., entry.Text + ".binka");
|
||||
|
||||
if (File.Exists(FileName))
|
||||
if (File.Exists(fileName))
|
||||
MessageBox.Show(this, $"\"{entry.Text}.binka\" exists in the \"Data\" folder", "File found");
|
||||
else
|
||||
MessageBox.Show(this, $"\"{entry.Text}.binka\" does not exist in the \"Data\" folder. The game will crash when attempting to load this track.", "File missing");
|
||||
*/
|
||||
|
||||
// Disabling this for now until location stuff is fixed
|
||||
}
|
||||
|
||||
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
@@ -144,7 +132,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void addCategoryStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[] available = Categories.FindAll(str => !_audioFile.HasCategory(GetCategoryId(str))).ToArray();
|
||||
string[] available = Categories.FindAll(str => !EditorValue.HasCategory(GetCategoryId(str))).ToArray();
|
||||
if (available.Length == 0)
|
||||
{
|
||||
MessageBox.Show(this, "There are no more categories that could be added", "All possible categories are used");
|
||||
@@ -154,8 +142,8 @@ namespace PckStudio.Forms.Editor
|
||||
if (add.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
_audioFile.AddCategory(GetCategoryId(add.SelectedItem));
|
||||
PckAudioFile.AudioCategory category = _audioFile.GetCategory(GetCategoryId(add.SelectedItem));
|
||||
EditorValue.AddCategory(GetCategoryId(add.SelectedItem));
|
||||
PckAudioFile.AudioCategory category = EditorValue.GetCategory(GetCategoryId(add.SelectedItem));
|
||||
|
||||
if (GetCategoryId(add.SelectedItem) == PckAudioFile.AudioCategory.EAudioType.Creative)
|
||||
{
|
||||
@@ -170,31 +158,50 @@ namespace PckStudio.Forms.Editor
|
||||
SetUpTree();
|
||||
}
|
||||
|
||||
private void addTrack(PckAudioFile.AudioCategory category, String trackname)
|
||||
{
|
||||
category.SongNames.Add(trackname);
|
||||
treeView2.Nodes.Add(trackname);
|
||||
}
|
||||
|
||||
private void addEntryMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory)
|
||||
if (treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category)
|
||||
{
|
||||
if (!parent.CreateDataFolder())
|
||||
return;
|
||||
|
||||
OpenFileDialog ofn = new OpenFileDialog();
|
||||
ofn.Multiselect = true;
|
||||
ofn.Filter = "Supported audio files (*.binka,*.wav)|*.binka;*.wav";
|
||||
ofn.Title = "Please choose WAV or BINKA files to add to your pack";
|
||||
ofn.ShowDialog(this);
|
||||
ofn.Dispose();
|
||||
// Return if name is null or if the user cancels
|
||||
if (string.IsNullOrEmpty(ofn.FileName))
|
||||
return;
|
||||
|
||||
ProcessEntries(ofn.FileNames);
|
||||
TextPrompt audioEntry = new TextPrompt();
|
||||
audioEntry.contextLabel.Text = "Please enter the relative file path without an extension. (i.e; \"music/song\" => \"DLC/{Pack}/Data/music/song.binka\")";
|
||||
audioEntry.LabelText = "Path";
|
||||
audioEntry.OKButtonText = "Add";
|
||||
if (audioEntry.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
addTrack(category, audioEntry.NewText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeCategoryStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void editEntryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category && treeView2.SelectedNode is TreeNode track)
|
||||
{
|
||||
TextPrompt audioEntry = new TextPrompt(track.Text);
|
||||
audioEntry.contextLabel.Text = "Please enter the relative file path without an extension. (i.e; \"music/song\" => \"DLC/{Pack}/Data/music/song.binka\")";
|
||||
audioEntry.LabelText = "Path";
|
||||
audioEntry.OKButtonText = "Save";
|
||||
if (audioEntry.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
int index = category.SongNames.IndexOf(track.Text);
|
||||
if (index != -1) // Check if the item was found
|
||||
{
|
||||
track.Text = category.SongNames[index] = audioEntry.NewText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeCategoryStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode is TreeNode main &&
|
||||
_audioFile.RemoveCategory(GetCategoryId(treeView1.SelectedNode.Text)))
|
||||
EditorValue.RemoveCategory(GetCategoryId(treeView1.SelectedNode.Text)))
|
||||
{
|
||||
if(GetCategoryId(treeView1.SelectedNode.Text) == PckAudioFile.AudioCategory.EAudioType.Creative)
|
||||
{
|
||||
@@ -227,161 +234,31 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
}
|
||||
|
||||
async void ProcessEntries(string[] fileList)
|
||||
{
|
||||
int success = 0;
|
||||
int exitCode = 0;
|
||||
InProgressPrompt waitDiag = new InProgressPrompt();
|
||||
waitDiag.Show(this);
|
||||
|
||||
// TODO: rewrite ALL of this
|
||||
|
||||
Directory.CreateDirectory(ApplicationScope.DataCacher.CacheDirectory); // create directory in case it doesn't exist
|
||||
|
||||
foreach (string file in fileList)
|
||||
{
|
||||
if (Path.GetExtension(file) == ".binka" || Path.GetExtension(file) == ".wav")
|
||||
{
|
||||
string songName = string.Join("_", Path.GetFileNameWithoutExtension(file).Split(Path.GetInvalidFileNameChars()));
|
||||
songName = Regex.Replace(songName, @"[^\u0000-\u007F]+", "_"); // Replace UTF characters
|
||||
string cacheSongFile = Path.Combine(ApplicationScope.DataCacher.CacheDirectory, songName + Path.GetExtension(file));
|
||||
|
||||
if (File.Exists(cacheSongFile))
|
||||
File.Delete(cacheSongFile);
|
||||
|
||||
string new_loc = Path.Combine(parent.GetDataPath(), songName + ".binka");
|
||||
bool is_duplicate_file = false; // To handle if a file already in the pack is dropped back in
|
||||
bool loc_is_occupied = File.Exists(new_loc);
|
||||
if (loc_is_occupied)
|
||||
{
|
||||
FileStream fs1 = File.OpenRead(file);
|
||||
FileStream fs2 = File.OpenRead(new_loc);
|
||||
|
||||
string hash1_str = BitConverter.ToString(MD5.Create().ComputeHash(fs1));
|
||||
string hash2_str = BitConverter.ToString(MD5.Create().ComputeHash(fs2));
|
||||
|
||||
// close the file streams after calculating the hash
|
||||
fs1.Close();
|
||||
fs2.Close();
|
||||
|
||||
is_duplicate_file = hash1_str == hash2_str;
|
||||
|
||||
string diag_text = "A file named \"" + Path.GetFileNameWithoutExtension(file) + ".binka\" already exists in the Data folder.";
|
||||
|
||||
if (is_duplicate_file)
|
||||
diag_text = "\"" + Path.GetFileNameWithoutExtension(file) + ".binka\" has an identical copy present in the Data folder.";
|
||||
|
||||
diag_text += " Pressing yes will replace the existing file. By pressing no, the song entry will be added without affecting the file." +
|
||||
"You can also cancel this operation and all files in queue.";
|
||||
|
||||
DialogResult user_prompt = MessageBox.Show(this, diag_text, "File already exists", MessageBoxButtons.YesNoCancel);
|
||||
while (user_prompt == DialogResult.None) // Stops the editor from adding or processing the file until the user has made their choice
|
||||
if (user_prompt == DialogResult.Cancel)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (user_prompt == DialogResult.No)
|
||||
{
|
||||
if (treeView1.SelectedNode is TreeNode node && node.Tag is PckAudioFile.AudioCategory cat)
|
||||
{
|
||||
//adds song without affecting the binka file
|
||||
cat.SongNames.Add(songName);
|
||||
treeView2.Nodes.Add(songName);
|
||||
success++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (user_prompt == DialogResult.Yes)
|
||||
{
|
||||
// deletes the file so that the copy function can happen safely
|
||||
// and ignore duplicate files because well... they're duplicates lol
|
||||
if (File.Exists(new_loc) && !is_duplicate_file)
|
||||
File.Delete(new_loc);
|
||||
}
|
||||
}
|
||||
|
||||
if (Path.GetExtension(file) == ".wav") // Convert Wave to BINKA
|
||||
{
|
||||
using (var reader = new WaveFileReader(file)) //read from original location
|
||||
{
|
||||
var newFormat = new WaveFormat(reader.WaveFormat.SampleRate, 16, reader.WaveFormat.Channels);
|
||||
using (var conversionStream = new WaveFormatConversionStream(newFormat, reader))
|
||||
{
|
||||
WaveFileWriter.CreateWaveFile(cacheSongFile, conversionStream); //write to new location
|
||||
}
|
||||
reader.Close();
|
||||
reader.Dispose();
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
exitCode = Binka.ToBinka(cacheSongFile, new_loc, (int)compressionUpDown.Value);
|
||||
});
|
||||
|
||||
if (!File.Exists(cacheSongFile))
|
||||
MessageBox.Show(this, $"\"{songName}.wav\" failed to convert for some reason. Please report this on the communtiy Discord server, which can be found under \"More\" in the toolbar at the top of the program.", "Conversion failed");
|
||||
else
|
||||
{
|
||||
success++;
|
||||
File.Delete(cacheSongFile); //cleanup song
|
||||
}
|
||||
|
||||
Cursor.Current = Cursors.Default;
|
||||
|
||||
if (exitCode != 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
// if the file is NOT a .wav and doesn't exist, copy the file
|
||||
else if (!File.Exists(new_loc))
|
||||
{
|
||||
File.Copy(file, new_loc);
|
||||
success++;
|
||||
}
|
||||
|
||||
// this is repeated again becuase this is meant to prevent any files that fail to convert from being added to the category
|
||||
if (treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category)
|
||||
{
|
||||
category.SongNames.Add(songName);
|
||||
treeView2.Nodes.Add(songName);
|
||||
}
|
||||
}
|
||||
}
|
||||
waitDiag.Close();
|
||||
waitDiag.Dispose();
|
||||
|
||||
MessageBox.Show(this, $"Successfully processed and/or converted {success}/{fileList.Length} file{(fileList.Length != 1 ? "s" : "" )}", "Done!");
|
||||
}
|
||||
|
||||
private void Binka_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
//MessageBox.Show((Owner.Owner as MainForm).saveLocation);
|
||||
// Gets the MainForm so we can access the Save Location
|
||||
if (treeView1.SelectedNode != null)
|
||||
if (treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category)
|
||||
{
|
||||
if (!parent.CreateDataFolder())
|
||||
return;
|
||||
|
||||
ProcessEntries((string[])e.Data.GetData(DataFormats.FileDrop, false));
|
||||
foreach(String s in (string[])e.Data.GetData(DataFormats.FileDrop, false))
|
||||
{
|
||||
addTrack(category, Path.GetFileNameWithoutExtension(s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!_audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Overworld) ||
|
||||
!_audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.Nether) ||
|
||||
!_audioFile.HasCategory(PckAudioFile.AudioCategory.EAudioType.End))
|
||||
if (!EditorValue.HasCategory(PckAudioFile.AudioCategory.EAudioType.Overworld) ||
|
||||
!EditorValue.HasCategory(PckAudioFile.AudioCategory.EAudioType.Nether) ||
|
||||
!EditorValue.HasCategory(PckAudioFile.AudioCategory.EAudioType.End))
|
||||
{
|
||||
MessageBox.Show(this, "Your changes were not saved. The game will crash when loading your pack if the Overworld, Nether and End categories don't all exist with at least one valid song.", "Mandatory Categories Missing");
|
||||
return;
|
||||
}
|
||||
|
||||
PckAudioFile.AudioCategory overworldCategory = _audioFile.GetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld);
|
||||
PckAudioFile.AudioCategory overworldCategory = EditorValue.GetCategory(PckAudioFile.AudioCategory.EAudioType.Overworld);
|
||||
|
||||
bool songs_missing = false;
|
||||
foreach (PckAudioFile.AudioCategory category in _audioFile.Categories)
|
||||
foreach (PckAudioFile.AudioCategory category in EditorValue.Categories)
|
||||
{
|
||||
if (category.SongNames.Count < 1)
|
||||
{
|
||||
@@ -389,16 +266,6 @@ namespace PckStudio.Forms.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(var song in category.SongNames)
|
||||
{
|
||||
string FileName = Path.Combine(parent.GetDataPath(), song + ".binka");
|
||||
if (!File.Exists(FileName))
|
||||
{
|
||||
songs_missing = true;
|
||||
MessageBox.Show(this, "\"" + song + ".binka\" does not exist in the \"Data\" folder. The game will crash when attempting to load this track.", "File missing");
|
||||
}
|
||||
}
|
||||
|
||||
category.Name = "";
|
||||
if (playOverworldInCreative.Checked && category.AudioType == PckAudioFile.AudioCategory.EAudioType.Creative)
|
||||
{
|
||||
@@ -420,7 +287,7 @@ namespace PckStudio.Forms.Editor
|
||||
return;
|
||||
}
|
||||
|
||||
_audioAsset.SetData(new PckAudioFileWriter(_audioFile, _isLittleEndian ? OMI.Endianness.LittleEndian : OMI.Endianness.BigEndian));
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
@@ -429,93 +296,6 @@ namespace PckStudio.Forms.Editor
|
||||
e.Effect = DragDropEffects.All;
|
||||
}
|
||||
|
||||
private void helpToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Simply drag and drop BINKA or WAV audio files into the right tree to add them to the category selected on the left tree.\n\n" +
|
||||
"The \"Menu\" category will only play once when loading the pack, and never again.\n\n" +
|
||||
"The \"Creative\" category will only play songs listed in that category, and unlike other editions of Minecraft, will NOT play songs from the Overworld category. You can fix this by clicking the checkbox found at the top of the form.\n\n" +
|
||||
"The mini game categories will only play if you have your pack loaded in those mini games.\n\n" +
|
||||
"You can edit the credits for the PCK in the Credits editor! No more managing credit IDs!\n\n", "Help");
|
||||
}
|
||||
|
||||
private void deleteUnusedBINKAsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult dr = MessageBox.Show(this, "This will delete all unused BINKA songs in the Data directory. This cannot be undone. Are you sure you want to continue?", "Warning", MessageBoxButtons.YesNo);
|
||||
if (dr != DialogResult.Yes)
|
||||
return;
|
||||
var totalSongList = new List<string>();
|
||||
foreach (string song in _audioFile.Categories.SelectMany(cat => cat.SongNames))
|
||||
{
|
||||
Console.WriteLine(song);
|
||||
totalSongList.Add(song);
|
||||
}
|
||||
|
||||
if (!parent.CreateDataFolder())
|
||||
return;
|
||||
int totalDeleted = 0;
|
||||
foreach (string song in Directory.GetFiles(parent.GetDataPath(), "*.binka"))
|
||||
{
|
||||
if (!totalSongList.Contains(Path.GetFileNameWithoutExtension(song)))
|
||||
{
|
||||
Console.WriteLine("Deleted " + song);
|
||||
try
|
||||
{
|
||||
File.Delete(song);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
continue;
|
||||
}
|
||||
totalDeleted++;
|
||||
}
|
||||
}
|
||||
MessageBox.Show(this, "Successfully deleted " + totalDeleted + " files", "Done");
|
||||
}
|
||||
|
||||
private void howToAddSongsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Right click the right window and press \"Add Entry\" or drag and drop a valid WAV file into the editor's right window. You can also drop other BINKA files, either from the main game or using a tool like BinkMan. The editor will automatically put the song in the Data folder for you.", "How to add a song");
|
||||
}
|
||||
|
||||
private void whatAreTheCategoriesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Categories are pretty self explanatory. The game controls when each category should play.\n" +
|
||||
"\nGAMEPLAY - Plays in the specified dimensions and game modes.\n" +
|
||||
"-Overworld: Plays in survival mode and in Creative if no songs are set\n" +
|
||||
"-Nether: Plays in the Nether.\n" +
|
||||
"-End: Plays in the End. Prioritizes the final track when the dragon is alive.\n" +
|
||||
"-Creative: Does not play survival tracks unless they're included.\n" +
|
||||
"-Menu: Plays on the title screen and only once when the pack is loading. Perfect for intro songs.\n" +
|
||||
"\nMINI GAMES - Will only play if you change the map grf files to load your pack and set the ThemeID to 0 for Vanilla maps.\n" +
|
||||
"-Battle: Plays in the Battle Mini Game.\n" +
|
||||
"-Tumble: Plays in the Tumble Mini Game.\n" +
|
||||
"-Glide: Plays in the Glide Mini Game.\n",
|
||||
"What are the categories?");
|
||||
}
|
||||
|
||||
private void howToEditCreditsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Click Tools -> Credits Editor. This will allow you to edit all the credits easily in the pack easily. Only supports English credits at the moment. ","How to edit credits?");
|
||||
}
|
||||
|
||||
private void optimizeDataFolderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "Click Tools -> Delete Unused BINKA files. This will clean your folder of any unused songs.", "How to optimize the Data folder");
|
||||
}
|
||||
|
||||
private void BINKACompressionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show(this, "The numerical up/down control is responsible for the level of compression used when converting WAV files. The default is 4, which was commonly used by 4J for the game's files.","BINKA Compression Level");
|
||||
}
|
||||
|
||||
private void openDataFolderToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!parent.CreateDataFolder())
|
||||
return;
|
||||
Process.Start("explorer.exe", parent.GetDataPath());
|
||||
}
|
||||
|
||||
private void AudioEditor_Shown(object sender, EventArgs e)
|
||||
{
|
||||
if (Owner.Owner is MainForm p)
|
||||
@@ -524,70 +304,11 @@ namespace PckStudio.Forms.Editor
|
||||
Close();
|
||||
}
|
||||
|
||||
private async void bulkReplaceExistingFilesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!parent.CreateDataFolder())
|
||||
return;
|
||||
|
||||
int exitCode = 0;
|
||||
|
||||
|
||||
OpenFileDialog ofn = new OpenFileDialog();
|
||||
ofn.Multiselect = true;
|
||||
ofn.Filter = "Supported audio files (*.binka,*.wav)|*.binka;*.wav";
|
||||
ofn.Title = "Please choose WAV or BINKA files to replace existing track files";
|
||||
ofn.ShowDialog(this);
|
||||
ofn.Dispose();
|
||||
|
||||
// Return if name is null or if the user cancels
|
||||
if (string.IsNullOrEmpty(ofn.FileName))
|
||||
return;
|
||||
|
||||
var totalSongList = new List<string>();
|
||||
foreach (string song in _audioFile.Categories.SelectMany(cat => cat.SongNames))
|
||||
{
|
||||
totalSongList.Add(song);
|
||||
}
|
||||
|
||||
foreach (string file in ofn.FileNames)
|
||||
{
|
||||
string song_name = Path.GetFileNameWithoutExtension(file);
|
||||
string file_ext = Path.GetExtension(file).ToLower();
|
||||
string new_loc = Path.Combine(parent.GetDataPath(), Path.GetFileNameWithoutExtension(file) + ".binka");
|
||||
if (!totalSongList.Contains(song_name) || file == new_loc)
|
||||
continue;
|
||||
|
||||
Console.WriteLine(file);
|
||||
File.Delete(new_loc);
|
||||
|
||||
if (file_ext == ".wav") // Convert Wave to BINKA
|
||||
{
|
||||
Cursor.Current = Cursors.WaitCursor;
|
||||
InProgressPrompt waitDiag = new InProgressPrompt();
|
||||
waitDiag.Show(this);
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
exitCode = Binka.ToBinka(file, new_loc, (int)compressionUpDown.Value);
|
||||
});
|
||||
|
||||
waitDiag.Close();
|
||||
waitDiag.Dispose();
|
||||
Cursor.Current = Cursors.Default;
|
||||
|
||||
if (exitCode != 0)
|
||||
continue;
|
||||
}
|
||||
else if(file_ext == ".binka")
|
||||
File.Copy(file, Path.Combine(parent.GetDataPath(), Path.GetFileName(file)));
|
||||
}
|
||||
}
|
||||
|
||||
private void convertToWAVToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView2.SelectedNode != null && treeView1.SelectedNode.Tag is PckAudioFile.AudioCategory)
|
||||
{
|
||||
Binka.ToWav(Path.Combine(parent.GetDataPath(), treeView2.SelectedNode.Text + ".binka"), Path.Combine(parent.GetDataPath()));
|
||||
//Binka.ToWav(Path.Combine(parent.GetDataPath(), treeView2.SelectedNode.Text + ".binka"), Path.Combine(parent.GetDataPath()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +317,7 @@ namespace PckStudio.Forms.Editor
|
||||
if (!(treeView1.SelectedNode is TreeNode t && t.Tag is PckAudioFile.AudioCategory category))
|
||||
return;
|
||||
|
||||
string[] available = Categories.FindAll(str => !_audioFile.HasCategory(GetCategoryId(str))).ToArray();
|
||||
string[] available = Categories.FindAll(str => !EditorValue.HasCategory(GetCategoryId(str))).ToArray();
|
||||
if (available.Length > 0)
|
||||
{
|
||||
using ItemSelectionPopUp add = new ItemSelectionPopUp(available);
|
||||
@@ -604,11 +325,11 @@ namespace PckStudio.Forms.Editor
|
||||
if (add.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
_audioFile.RemoveCategory(category.AudioType);
|
||||
EditorValue.RemoveCategory(category.AudioType);
|
||||
|
||||
_audioFile.AddCategory(category.parameterType, GetCategoryId(add.SelectedItem), category.AudioType == PckAudioFile.AudioCategory.EAudioType.Overworld && playOverworldInCreative.Checked ? "include_overworld" : "");
|
||||
EditorValue.AddCategory(category.parameterType, GetCategoryId(add.SelectedItem), category.AudioType == PckAudioFile.AudioCategory.EAudioType.Overworld && playOverworldInCreative.Checked ? "include_overworld" : "");
|
||||
|
||||
PckAudioFile.AudioCategory newCategory = _audioFile.GetCategory(GetCategoryId(add.SelectedItem));
|
||||
PckAudioFile.AudioCategory newCategory = EditorValue.GetCategory(GetCategoryId(add.SelectedItem));
|
||||
|
||||
category.SongNames.ForEach(c => newCategory.SongNames.Add(c));
|
||||
|
||||
@@ -620,35 +341,6 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private void organizeTracksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(MessageBox.Show(this, "This function will move all binka files in the \"Data\" folder into a \"Music\" folder, to keep your data better organized. Would you like to continue?", "Move tracks?", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
||||
{
|
||||
if (treeView1.Nodes.Count < 1 || !parent.CreateDataFolder())
|
||||
return;
|
||||
string musicdir = Path.Combine(parent.GetDataPath(), "Music");
|
||||
Directory.CreateDirectory(musicdir);
|
||||
foreach (PckAudioFile.AudioCategory category in _audioFile.Categories)
|
||||
{
|
||||
for (var i = 0; i < category.SongNames.Count; i++) // using standard for loop so the list can be modified
|
||||
{
|
||||
string song = category.SongNames[i];
|
||||
string songpath = Path.Combine(parent.GetDataPath(), song + ".binka");
|
||||
string new_path = Path.Combine(musicdir, Path.GetFileName(song) + ".binka");
|
||||
if (File.Exists(songpath) && !File.Exists(new_path))
|
||||
{
|
||||
File.Move(songpath, new_path);
|
||||
|
||||
// Songs with a backslash instead of a forward slash were not playing in RPCS3
|
||||
category.SongNames[i] = "Music/" + song.Replace(song, Path.GetFileNameWithoutExtension(songpath));
|
||||
}
|
||||
}
|
||||
}
|
||||
treeView2.Nodes.Clear();
|
||||
treeView1.SelectedNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void AudioEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Settings.Default.AutoSaveChanges)
|
||||
|
||||
@@ -125,32 +125,6 @@
|
||||
<value>127, 8</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="addCategoryStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x
|
||||
DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5
|
||||
jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="addCategoryStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 22</value>
|
||||
</data>
|
||||
<data name="addCategoryStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Add Category</value>
|
||||
</data>
|
||||
<data name="removeCategoryStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 22</value>
|
||||
</data>
|
||||
<data name="removeCategoryStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Remove Category</value>
|
||||
</data>
|
||||
<data name="changeCategoryToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 22</value>
|
||||
</data>
|
||||
<data name="changeCategoryToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Set Category</value>
|
||||
</data>
|
||||
<data name="contextMenuStrip1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>169, 70</value>
|
||||
</data>
|
||||
@@ -172,7 +146,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAACK
|
||||
NAAAAk1TRnQBSQFMAgEBCQEAAeABAAHgAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
NAAAAk1TRnQBSQFMAgEBCQEAAfABAAHwAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
AwABMAMAAQEBAAEgBgABMBIAATkBXgFzAf8BOQFeAXMB/wE5AV4BcwH/AT4BYgF8Af8BMwFUAWkB/wEz
|
||||
AVQBaQH/AT4BYgF8Af8BMwFUAWkB/wE5AV4BcwH/ATkBXgFzAf8BOQFeAXMB/wEzAVQBaQH/ASYBPQFM
|
||||
Af8BMwFUAWkB/wEzAVQBaQH/ATkBXgFzAf/AAAFiAZgBvAH/AWIBmAG8Af8BTQGEAZ8B/wFNAYQBnwH/
|
||||
@@ -426,100 +400,38 @@
|
||||
<data name=">>treeView1.ZOrder" xml:space="preserve">
|
||||
<value>5</value>
|
||||
</data>
|
||||
<data name="addCategoryStripMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABPSURBVDhP5ZAx
|
||||
DgAgCAMZ/f+HMcbYYOmg0UmHY2ibGzB3txNSgMKsHcD9ksBL5wcBPwyPCwLFJBjjVe4LFHGsgEDBAu6x
|
||||
4+AxAT9MkYJdKi90axNkwjxWAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="addCategoryStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 22</value>
|
||||
</data>
|
||||
<data name="addCategoryStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Add Category</value>
|
||||
</data>
|
||||
<data name="removeCategoryStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 22</value>
|
||||
</data>
|
||||
<data name="removeCategoryStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Remove Category</value>
|
||||
</data>
|
||||
<data name="changeCategoryToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>168, 22</value>
|
||||
</data>
|
||||
<data name="changeCategoryToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Set Category</value>
|
||||
</data>
|
||||
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>19, 8</value>
|
||||
</metadata>
|
||||
<data name="menuStrip.AutoSize" type="System.Boolean, mscorlib">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADfSURBVDhPYxg8
|
||||
QLt++3yTGbf/Fm599P/Nh49wfPXxq/+rTt37f+Dak/8gOSBgAGEMANIMxGBFyAasPf/0v8GE8//z1t8C
|
||||
y4HU4DIALIluwLpLL+HiMANAGKoNAWASCavv/n/57gPcgOvP3oENOXj7NViOoAFGU6791+k4ghWD5Aga
|
||||
QCyGakMAkODcU89R/I8Ng9TgNADk14dPn/8/c+kqVgySgwUqVBsCwAx49urN/zsPHmPFIDmaGvAXJInN
|
||||
38gYasBfqDYE0K7dOn/Wvut/sfkdGYPUgJI9VNuAAwYGAGn6yvdevWgPAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>98, 22</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Text" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
</data>
|
||||
<data name="fileToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>37, 20</value>
|
||||
</data>
|
||||
<data name="fileToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>File</value>
|
||||
</data>
|
||||
<data name="deleteUnusedBINKAsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>220, 22</value>
|
||||
</data>
|
||||
<data name="deleteUnusedBINKAsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Delete Unused BINKAs</value>
|
||||
</data>
|
||||
<data name="openDataFolderToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>220, 22</value>
|
||||
</data>
|
||||
<data name="openDataFolderToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Open Data Folder</value>
|
||||
</data>
|
||||
<data name="bulkReplaceExistingTracksToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>220, 22</value>
|
||||
</data>
|
||||
<data name="bulkReplaceExistingTracksToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Bulk Replace Existing Tracks</value>
|
||||
</data>
|
||||
<data name="organizeTracksToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>220, 22</value>
|
||||
</data>
|
||||
<data name="organizeTracksToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Organize Tracks</value>
|
||||
</data>
|
||||
<data name="toolsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>46, 20</value>
|
||||
</data>
|
||||
<data name="toolsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Tools</value>
|
||||
</data>
|
||||
<data name="howToAddSongsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 22</value>
|
||||
</data>
|
||||
<data name="howToAddSongsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>How to add songs</value>
|
||||
</data>
|
||||
<data name="whatAreTheCategoriesToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 22</value>
|
||||
</data>
|
||||
<data name="whatAreTheCategoriesToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>What are the categories?</value>
|
||||
</data>
|
||||
<data name="howToEditCreditsToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 22</value>
|
||||
</data>
|
||||
<data name="howToEditCreditsToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>How to edit credits</value>
|
||||
</data>
|
||||
<data name="optimizeDataFolderToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 22</value>
|
||||
</data>
|
||||
<data name="optimizeDataFolderToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>How to optimize the Data folder</value>
|
||||
</data>
|
||||
<data name="bINKACompressionToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>243, 22</value>
|
||||
</data>
|
||||
<data name="bINKACompressionToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>BINKA Compression</value>
|
||||
</data>
|
||||
<data name="helpToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>44, 20</value>
|
||||
</data>
|
||||
<data name="helpToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Help</value>
|
||||
</data>
|
||||
<data name="menuStrip.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>20, 60</value>
|
||||
</data>
|
||||
@@ -544,6 +456,28 @@
|
||||
<data name=">>menuStrip.ZOrder" xml:space="preserve">
|
||||
<value>7</value>
|
||||
</data>
|
||||
<data name="fileToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>37, 20</value>
|
||||
</data>
|
||||
<data name="fileToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>File</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4yMfEgaZUAAADdSURBVDhPzZJB
|
||||
CoJQEIa9jy0iPFAnCDpAtG3ZooUE4b6oVtIuClpJIAgqZEVlKpqEHUAm5pGPmhTbRA18G//5P5iHgvA3
|
||||
I7ZniiQ7aVM9QZzcOKYbwVDbw8I6A2YAICBvg2VJdtjSs2Cse1Dt6tCYbliGO0UCFlLBxAj590yA0D4X
|
||||
1Ec7CK8JF9j+lUmWzoVlpYJaz4JKZ5ULZqWCT6F9Jhhowcv9eeBOoQBvPXoBrA0zF8yyR6V9LvCjGLYH
|
||||
NxfMvipIMaQ3Ux6ClPYFsaUq/bmd0rspuIO/Pe3/bu5p+sr3gTvFEQAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="saveToolStripMenuItem1.Text" xml:space="preserve">
|
||||
<value>Save</value>
|
||||
</data>
|
||||
<data name="treeView2.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Top, Bottom, Left, Right</value>
|
||||
</data>
|
||||
@@ -553,37 +487,31 @@
|
||||
<data name="addEntryMenuItem.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABSSURBVDhP5c0x
|
||||
DsAgDENRxt7/wmkNSpRGf0CCCZAegxNMM7MlGMp3dIU6dxhKf/QMNxRogeQC8ivw5Vn7C0heJlFA+kL5
|
||||
jWAohxRkde4wnGftBS90axNmphIGAAAAAElFTkSuQmCC
|
||||
vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xMkMEa+wAAABPSURBVDhP5ZAx
|
||||
DgAgCAMZ/f+HMcbYYOmg0UmHY2ibGzB3txNSgMKsHcD9ksBL5wcBPwyPCwLFJBjjVe4LFHGsgEDBAu6x
|
||||
4+AxAT9MkYJdKi90axNkwjxWAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="addEntryMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>173, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="addEntryMenuItem.Text" xml:space="preserve">
|
||||
<value>Add Entry</value>
|
||||
<value>Add Track</value>
|
||||
</data>
|
||||
<data name="editEntryToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="editEntryToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Edit Track</value>
|
||||
</data>
|
||||
<data name="removeEntryMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>173, 22</value>
|
||||
<value>180, 22</value>
|
||||
</data>
|
||||
<data name="removeEntryMenuItem.Text" xml:space="preserve">
|
||||
<value>Remove Entry</value>
|
||||
</data>
|
||||
<data name="verifyFileLocationToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>173, 22</value>
|
||||
</data>
|
||||
<data name="verifyFileLocationToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Verify File Location</value>
|
||||
</data>
|
||||
<data name="convertToWAVToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>173, 22</value>
|
||||
</data>
|
||||
<data name="convertToWAVToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Convert To WAV</value>
|
||||
<value>Remove Track</value>
|
||||
</data>
|
||||
<data name="contextMenuStrip2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>174, 92</value>
|
||||
<value>181, 92</value>
|
||||
</data>
|
||||
<data name=">>contextMenuStrip2.Name" xml:space="preserve">
|
||||
<value>contextMenuStrip2</value>
|
||||
@@ -3256,72 +3184,6 @@
|
||||
<data name=">>saveToolStripMenuItem1.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>toolsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>toolsToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>toolsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>deleteUnusedBINKAsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>deleteUnusedBINKAsToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>deleteUnusedBINKAsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>openDataFolderToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>openDataFolderToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>openDataFolderToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>bulkReplaceExistingTracksToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>bulkReplaceExistingTracksToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>bulkReplaceExistingTracksToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>organizeTracksToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>organizeTracksToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>organizeTracksToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>helpToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>helpToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>helpToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>howToAddSongsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>howToAddSongsToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>howToAddSongsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>whatAreTheCategoriesToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>whatAreTheCategoriesToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>whatAreTheCategoriesToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>howToEditCreditsToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>howToEditCreditsToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>howToEditCreditsToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>optimizeDataFolderToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>optimizeDataFolderToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>optimizeDataFolderToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>bINKACompressionToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>bINKACompressionToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>bINKACompressionToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>addEntryMenuItem.Name" xml:space="preserve">
|
||||
<value>addEntryMenuItem</value>
|
||||
</data>
|
||||
@@ -3334,22 +3196,16 @@
|
||||
<data name=">>removeEntryMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>verifyFileLocationToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>verifyFileLocationToolStripMenuItem</value>
|
||||
<data name=">>editEntryToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>editEntryToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>verifyFileLocationToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>convertToWAVToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>convertToWAVToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>convertToWAVToolStripMenuItem.Type" xml:space="preserve">
|
||||
<data name=">>editEntryToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>$this.Name" xml:space="preserve">
|
||||
<value>AudioEditor</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
<value>PckStudio.Controls.EditorForm`1[[PckStudio.Core.FileFormats.PckAudioFile, PckStudio.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]], PCK-Studio, Version=7.0.0.2, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -299,7 +299,6 @@
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Text = "Behaviour Editor";
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BehaviourEditor_FormClosing);
|
||||
this.metroContextMenu1.ResumeLayout(false);
|
||||
this.menuStrip.ResumeLayout(false);
|
||||
this.menuStrip.PerformLayout();
|
||||
|
||||
@@ -1,75 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Forms.Additional_Popups.EntityForms;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
using OMI.Formats.Behaviour;
|
||||
using OMI.Workers.Behaviour;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Forms.Additional_Popups.EntityForms;
|
||||
using PckStudio.Json;
|
||||
using PckStudio.Core.Json;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class BehaviourEditor : MetroForm
|
||||
// Behaviours File Format research by Miku and MayNL
|
||||
public partial class BehaviourEditor : EditorForm<BehaviourFile>
|
||||
{
|
||||
// Behaviours File Format research by Miku and MattNL
|
||||
private readonly PckAsset _asset;
|
||||
BehaviourFile _behaviourFile;
|
||||
private const string BehaviourEntryDataType = "behaviours";
|
||||
private readonly List<EntityInfo> BehaviourData = Entities.BehaviourInfos;
|
||||
|
||||
private readonly List<EntityInfo> BehaviourData = Entities.BehaviourInfos;
|
||||
public BehaviourEditor(BehaviourFile behaviourFile, ISaveContext<BehaviourFile> saveContext)
|
||||
: base(behaviourFile, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
void SetUpTree()
|
||||
saveToolStripMenuItem1.Visible = !saveContext.AutoSave;
|
||||
|
||||
treeView1.ImageList = new ImageList();
|
||||
treeView1.ImageList.Images.AddRange(ApplicationScope.EntityImages);
|
||||
treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
SetUpTree();
|
||||
}
|
||||
|
||||
void SetUpTree()
|
||||
{
|
||||
treeView1.BeginUpdate();
|
||||
treeView1.Nodes.Clear();
|
||||
foreach (var entry in _behaviourFile.entries)
|
||||
foreach (BehaviourFile.RiderPositionOverride entry in EditorValue.entries)
|
||||
{
|
||||
TreeNode EntryNode = new TreeNode(entry.name);
|
||||
TreeNode entryNode = new TreeNode(entry.name);
|
||||
|
||||
var behaviour = BehaviourData.Find(b => b.InternalName == entry.name);
|
||||
EntryNode.Text = behaviour.DisplayName;
|
||||
EntryNode.ImageIndex = BehaviourData.IndexOf(behaviour);
|
||||
EntryNode.SelectedImageIndex = EntryNode.ImageIndex;
|
||||
EntryNode.Tag = entry;
|
||||
EntityInfo behaviour = BehaviourData.Find(b => b.InternalName == entry.name);
|
||||
entryNode.Text = behaviour.DisplayName;
|
||||
entryNode.ImageIndex = BehaviourData.IndexOf(behaviour);
|
||||
entryNode.SelectedImageIndex = entryNode.ImageIndex;
|
||||
entryNode.Tag = entry;
|
||||
|
||||
foreach (var posOverride in entry.overrides)
|
||||
foreach (BehaviourFile.RiderPositionOverride.PositionOverride posOverride in entry.overrides)
|
||||
{
|
||||
TreeNode OverrideNode = new TreeNode("Position Override");
|
||||
OverrideNode.Tag = posOverride;
|
||||
EntryNode.Nodes.Add(OverrideNode);
|
||||
OverrideNode.ImageIndex = 103;
|
||||
OverrideNode.SelectedImageIndex = OverrideNode.ImageIndex;
|
||||
TreeNode overrideNode = new TreeNode("Position Override");
|
||||
overrideNode.Tag = posOverride;
|
||||
entryNode.Nodes.Add(overrideNode);
|
||||
overrideNode.ImageIndex = 103;
|
||||
overrideNode.SelectedImageIndex = overrideNode.ImageIndex;
|
||||
}
|
||||
|
||||
treeView1.Nodes.Add(EntryNode);
|
||||
treeView1.Nodes.Add(entryNode);
|
||||
}
|
||||
treeView1.EndUpdate();
|
||||
}
|
||||
|
||||
public BehaviourEditor(PckAsset asset)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
saveToolStripMenuItem1.Visible = !Settings.Default.AutoSaveChanges;
|
||||
|
||||
_asset = asset;
|
||||
_behaviourFile = asset.GetData(new BehavioursReader());
|
||||
|
||||
treeView1.ImageList = new ImageList();
|
||||
treeView1.ImageList.Images.AddRange(ApplicationScope.EntityImages);
|
||||
treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
SetUpTree();
|
||||
}
|
||||
|
||||
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode is null)
|
||||
@@ -149,13 +138,13 @@ namespace PckStudio.Forms.Editor
|
||||
if (!(treeView1.SelectedNode.Tag is BehaviourFile.RiderPositionOverride entry))
|
||||
return;
|
||||
|
||||
var diag = new AddEntry("behaviours", ApplicationScope.EntityImages);
|
||||
var diag = new AddEntry(BehaviourEntryDataType, ApplicationScope.EntityImages);
|
||||
|
||||
if (diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (string.IsNullOrEmpty(diag.SelectedEntity))
|
||||
return;
|
||||
if (_behaviourFile.entries.FindAll(behaviour => behaviour.name == diag.SelectedEntity).Count() > 0)
|
||||
if (EditorValue.entries.FindAll(behaviour => behaviour.name == diag.SelectedEntity).Count() > 0)
|
||||
{
|
||||
MessageBox.Show(this, "You cannot have two entries for one entity. Please use the \"Add New Position Override\" tool to add multiple overrides for entities", "Error", MessageBoxButtons.OK);
|
||||
return;
|
||||
@@ -186,41 +175,46 @@ namespace PckStudio.Forms.Editor
|
||||
if (treeView1.SelectedNode.Tag is BehaviourFile.RiderPositionOverride.PositionOverride)
|
||||
treeView1.SelectedNode = treeView1.SelectedNode.Parent;
|
||||
|
||||
if (treeView1.SelectedNode.Tag is BehaviourFile.RiderPositionOverride)
|
||||
if (treeView1.SelectedNode.Tag is BehaviourFile.RiderPositionOverride positionOverride)
|
||||
{
|
||||
TreeNode OverrideNode = new TreeNode("Position Override");
|
||||
OverrideNode.Tag = new BehaviourFile.RiderPositionOverride.PositionOverride();
|
||||
OverrideNode.ImageIndex = 103;
|
||||
OverrideNode.SelectedImageIndex = 103;
|
||||
treeView1.SelectedNode.Nodes.Add(OverrideNode);
|
||||
}
|
||||
BehaviourFile.RiderPositionOverride.PositionOverride newPositionOverride = new BehaviourFile.RiderPositionOverride.PositionOverride();
|
||||
TreeNode overrideNode = new TreeNode("Position Override");
|
||||
overrideNode.Tag = newPositionOverride;
|
||||
overrideNode.ImageIndex = 103;
|
||||
overrideNode.SelectedImageIndex = 103;
|
||||
treeView1.SelectedNode.Nodes.Add(overrideNode);
|
||||
positionOverride.overrides.Add(newPositionOverride);
|
||||
}
|
||||
}
|
||||
|
||||
private void addNewEntryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var diag = new AddEntry("behaviours", ApplicationScope.EntityImages);
|
||||
var diag = new AddEntry(BehaviourEntryDataType, ApplicationScope.EntityImages);
|
||||
|
||||
if(diag.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (string.IsNullOrEmpty(diag.SelectedEntity))
|
||||
return;
|
||||
if (_behaviourFile.entries.FindAll(behaviour => behaviour.name == diag.SelectedEntity).Count() > 0)
|
||||
if (EditorValue.entries.FindAll(behaviour => behaviour.name == diag.SelectedEntity).Count() > 0)
|
||||
{
|
||||
MessageBox.Show(this, "You cannot have two entries for one entity. Please use the \"Add New Position Override\" tool to add multiple overrides for entities", "Error", MessageBoxButtons.OK);
|
||||
return;
|
||||
}
|
||||
BehaviourFile.RiderPositionOverride NewOverride = new BehaviourFile.RiderPositionOverride(diag.SelectedEntity);
|
||||
BehaviourFile.RiderPositionOverride newOverride = new BehaviourFile.RiderPositionOverride(diag.SelectedEntity);
|
||||
EditorValue.entries.Add(newOverride);
|
||||
|
||||
TreeNode NewOverrideNode = new TreeNode(NewOverride.name);
|
||||
NewOverrideNode.Tag = NewOverride;
|
||||
TreeNode newOverrideNode = new TreeNode(newOverride.name);
|
||||
newOverrideNode.Tag = newOverride;
|
||||
|
||||
EntityInfo behaviour = BehaviourData.Find(b => b.InternalName == NewOverride.name);
|
||||
NewOverrideNode.Text = behaviour.DisplayName;
|
||||
NewOverrideNode.ImageIndex = BehaviourData.IndexOf(behaviour);
|
||||
NewOverrideNode.SelectedImageIndex = NewOverrideNode.ImageIndex;
|
||||
// potentially null de-reference
|
||||
EntityInfo behaviour = BehaviourData.Find(b => b.InternalName == newOverride.name);
|
||||
|
||||
treeView1.Nodes.Add(NewOverrideNode);
|
||||
treeView1.SelectedNode = NewOverrideNode;
|
||||
newOverrideNode.Text = behaviour.DisplayName;
|
||||
newOverrideNode.ImageIndex = BehaviourData.IndexOf(behaviour);
|
||||
newOverrideNode.SelectedImageIndex = newOverrideNode.ImageIndex;
|
||||
|
||||
treeView1.Nodes.Add(newOverrideNode);
|
||||
treeView1.SelectedNode = newOverrideNode;
|
||||
|
||||
addNewPositionOverrideToolStripMenuItem_Click(sender, e); // adds a Position Override to the new Override
|
||||
}
|
||||
@@ -239,36 +233,8 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
_behaviourFile = new BehaviourFile();
|
||||
foreach (TreeNode node in treeView1.Nodes)
|
||||
{
|
||||
if(node.Tag is BehaviourFile.RiderPositionOverride entry)
|
||||
{
|
||||
entry.overrides.Clear();
|
||||
Console.WriteLine();
|
||||
foreach (TreeNode overrideNode in node.Nodes)
|
||||
{
|
||||
if(overrideNode.Tag is BehaviourFile.RiderPositionOverride.PositionOverride overrideEntry)
|
||||
{
|
||||
entry.overrides.Add(overrideEntry);
|
||||
}
|
||||
}
|
||||
|
||||
_behaviourFile.entries.Add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
_asset.SetData(new BehavioursWriter(_behaviourFile));
|
||||
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void BehaviourEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Settings.Default.AutoSaveChanges)
|
||||
{
|
||||
saveToolStripMenuItem1_Click(sender, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
408
PCK-Studio/Forms/Editor/BoxEditor.Designer.cs
generated
408
PCK-Studio/Forms/Editor/BoxEditor.Designer.cs
generated
@@ -28,100 +28,15 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
MetroFramework.Controls.MetroLabel parentLabel;
|
||||
MetroFramework.Controls.MetroLabel positionLabel;
|
||||
MetroFramework.Controls.MetroLabel sizeLabel;
|
||||
MetroFramework.Controls.MetroLabel uvLabel;
|
||||
MetroFramework.Controls.MetroLabel inflationLabel;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BoxEditor));
|
||||
this.closeButton = new MetroFramework.Controls.MetroButton();
|
||||
this.toolTip = new MetroFramework.Components.MetroToolTip();
|
||||
this.parentComboBox = new MetroFramework.Controls.MetroComboBox();
|
||||
this.PosXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.PosYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.PosZUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeZUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.uvYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.uvXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.armorCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.mirrorCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.inflationUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
parentLabel = new MetroFramework.Controls.MetroLabel();
|
||||
positionLabel = new MetroFramework.Controls.MetroLabel();
|
||||
sizeLabel = new MetroFramework.Controls.MetroLabel();
|
||||
uvLabel = new MetroFramework.Controls.MetroLabel();
|
||||
inflationLabel = new MetroFramework.Controls.MetroLabel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).BeginInit();
|
||||
this.boxEditorControl1 = new PckStudio.Controls.BoxEditorControl();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// parentLabel
|
||||
//
|
||||
parentLabel.AutoSize = true;
|
||||
parentLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
parentLabel.Location = new System.Drawing.Point(357, 72);
|
||||
parentLabel.Name = "parentLabel";
|
||||
parentLabel.Size = new System.Drawing.Size(64, 25);
|
||||
parentLabel.TabIndex = 2;
|
||||
parentLabel.Text = "Parent:";
|
||||
parentLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// positionLabel
|
||||
//
|
||||
positionLabel.AutoSize = true;
|
||||
positionLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
positionLabel.Location = new System.Drawing.Point(33, 72);
|
||||
positionLabel.Name = "positionLabel";
|
||||
positionLabel.Size = new System.Drawing.Size(75, 25);
|
||||
positionLabel.TabIndex = 4;
|
||||
positionLabel.Text = "Position:";
|
||||
positionLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// sizeLabel
|
||||
//
|
||||
sizeLabel.AutoSize = true;
|
||||
sizeLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
sizeLabel.Location = new System.Drawing.Point(33, 97);
|
||||
sizeLabel.Name = "sizeLabel";
|
||||
sizeLabel.Size = new System.Drawing.Size(46, 25);
|
||||
sizeLabel.TabIndex = 22;
|
||||
sizeLabel.Text = "Size:";
|
||||
sizeLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// uvLabel
|
||||
//
|
||||
uvLabel.AutoSize = true;
|
||||
uvLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
uvLabel.Location = new System.Drawing.Point(33, 123);
|
||||
uvLabel.Name = "uvLabel";
|
||||
uvLabel.Size = new System.Drawing.Size(39, 25);
|
||||
uvLabel.TabIndex = 26;
|
||||
uvLabel.Text = "UV:";
|
||||
uvLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// inflationLabel
|
||||
//
|
||||
inflationLabel.AutoSize = true;
|
||||
inflationLabel.FontSize = MetroFramework.MetroLabelSize.Tall;
|
||||
inflationLabel.Location = new System.Drawing.Point(33, 149);
|
||||
inflationLabel.Name = "inflationLabel";
|
||||
inflationLabel.Size = new System.Drawing.Size(55, 25);
|
||||
inflationLabel.TabIndex = 31;
|
||||
inflationLabel.Text = "Scale:";
|
||||
inflationLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// closeButton
|
||||
//
|
||||
this.closeButton.Location = new System.Drawing.Point(252, 187);
|
||||
this.closeButton.Location = new System.Drawing.Point(207, 187);
|
||||
this.closeButton.Name = "closeButton";
|
||||
this.closeButton.Size = new System.Drawing.Size(126, 23);
|
||||
this.closeButton.TabIndex = 1;
|
||||
@@ -137,300 +52,26 @@
|
||||
this.toolTip.StyleManager = null;
|
||||
this.toolTip.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// parentComboBox
|
||||
// boxEditorControl1
|
||||
//
|
||||
this.parentComboBox.FormattingEnabled = true;
|
||||
this.parentComboBox.ItemHeight = 23;
|
||||
this.parentComboBox.Items.AddRange(new object[] {
|
||||
"HEAD",
|
||||
"BODY",
|
||||
"ARM0",
|
||||
"ARM1",
|
||||
"LEG0",
|
||||
"LEG1",
|
||||
"HEADWEAR",
|
||||
"JACKET",
|
||||
"SLEEVE0",
|
||||
"SLEEVE1",
|
||||
"PANTS0",
|
||||
"PANTS1",
|
||||
"WAIST",
|
||||
"LEGGING0",
|
||||
"LEGGING1",
|
||||
"SOCK0",
|
||||
"SOCK1",
|
||||
"BOOT0",
|
||||
"BOOT1",
|
||||
"ARMARMOR1",
|
||||
"ARMARMOR0",
|
||||
"BODYARMOR",
|
||||
"BELT"});
|
||||
this.parentComboBox.Location = new System.Drawing.Point(417, 72);
|
||||
this.parentComboBox.Name = "parentComboBox";
|
||||
this.parentComboBox.Size = new System.Drawing.Size(163, 29);
|
||||
this.parentComboBox.TabIndex = 3;
|
||||
this.parentComboBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.parentComboBox.UseSelectable = true;
|
||||
//
|
||||
// PosXUpDown
|
||||
//
|
||||
this.PosXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosXUpDown.DecimalPlaces = 3;
|
||||
this.PosXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.PosXUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.PosXUpDown.Location = new System.Drawing.Point(120, 76);
|
||||
this.PosXUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PosXUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosXUpDown.Name = "PosXUpDown";
|
||||
this.PosXUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.PosXUpDown.TabIndex = 19;
|
||||
//
|
||||
// PosYUpDown
|
||||
//
|
||||
this.PosYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosYUpDown.DecimalPlaces = 3;
|
||||
this.PosYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.PosYUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.PosYUpDown.Location = new System.Drawing.Point(199, 76);
|
||||
this.PosYUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PosYUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosYUpDown.Name = "PosYUpDown";
|
||||
this.PosYUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.PosYUpDown.TabIndex = 20;
|
||||
//
|
||||
// PosZUpDown
|
||||
//
|
||||
this.PosZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosZUpDown.DecimalPlaces = 3;
|
||||
this.PosZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.PosZUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.PosZUpDown.Location = new System.Drawing.Point(278, 76);
|
||||
this.PosZUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.PosZUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosZUpDown.Name = "PosZUpDown";
|
||||
this.PosZUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.PosZUpDown.TabIndex = 21;
|
||||
//
|
||||
// SizeZUpDown
|
||||
//
|
||||
this.SizeZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeZUpDown.DecimalPlaces = 3;
|
||||
this.SizeZUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.SizeZUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.SizeZUpDown.Location = new System.Drawing.Point(278, 102);
|
||||
this.SizeZUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SizeZUpDown.Name = "SizeZUpDown";
|
||||
this.SizeZUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.SizeZUpDown.TabIndex = 25;
|
||||
//
|
||||
// SizeYUpDown
|
||||
//
|
||||
this.SizeYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeYUpDown.DecimalPlaces = 3;
|
||||
this.SizeYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.SizeYUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.SizeYUpDown.Location = new System.Drawing.Point(199, 102);
|
||||
this.SizeYUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SizeYUpDown.Name = "SizeYUpDown";
|
||||
this.SizeYUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.SizeYUpDown.TabIndex = 24;
|
||||
//
|
||||
// SizeXUpDown
|
||||
//
|
||||
this.SizeXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeXUpDown.DecimalPlaces = 3;
|
||||
this.SizeXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.SizeXUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.SizeXUpDown.Location = new System.Drawing.Point(120, 102);
|
||||
this.SizeXUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.SizeXUpDown.Name = "SizeXUpDown";
|
||||
this.SizeXUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.SizeXUpDown.TabIndex = 23;
|
||||
//
|
||||
// uvYUpDown
|
||||
//
|
||||
this.uvYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.uvYUpDown.DecimalPlaces = 3;
|
||||
this.uvYUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.uvYUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.uvYUpDown.Location = new System.Drawing.Point(199, 128);
|
||||
this.uvYUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.uvYUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.uvYUpDown.Name = "uvYUpDown";
|
||||
this.uvYUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.uvYUpDown.TabIndex = 28;
|
||||
//
|
||||
// uvXUpDown
|
||||
//
|
||||
this.uvXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.uvXUpDown.DecimalPlaces = 3;
|
||||
this.uvXUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.uvXUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.uvXUpDown.Location = new System.Drawing.Point(120, 128);
|
||||
this.uvXUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.uvXUpDown.Minimum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.uvXUpDown.Name = "uvXUpDown";
|
||||
this.uvXUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.uvXUpDown.TabIndex = 27;
|
||||
//
|
||||
// armorCheckBox
|
||||
//
|
||||
this.armorCheckBox.AutoSize = true;
|
||||
this.armorCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall;
|
||||
this.armorCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light;
|
||||
this.armorCheckBox.Location = new System.Drawing.Point(363, 101);
|
||||
this.armorCheckBox.Name = "armorCheckBox";
|
||||
this.armorCheckBox.Size = new System.Drawing.Size(245, 25);
|
||||
this.armorCheckBox.TabIndex = 29;
|
||||
this.armorCheckBox.Text = "Hide when wearing a helmet";
|
||||
this.armorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.armorCheckBox.UseSelectable = true;
|
||||
//
|
||||
// mirrorCheckBox
|
||||
//
|
||||
this.mirrorCheckBox.AutoSize = true;
|
||||
this.mirrorCheckBox.FontSize = MetroFramework.MetroCheckBoxSize.Tall;
|
||||
this.mirrorCheckBox.FontWeight = MetroFramework.MetroCheckBoxWeight.Light;
|
||||
this.mirrorCheckBox.Location = new System.Drawing.Point(363, 130);
|
||||
this.mirrorCheckBox.Name = "mirrorCheckBox";
|
||||
this.mirrorCheckBox.Size = new System.Drawing.Size(133, 25);
|
||||
this.mirrorCheckBox.TabIndex = 30;
|
||||
this.mirrorCheckBox.Text = "Mirror Texture";
|
||||
this.mirrorCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.mirrorCheckBox.UseSelectable = true;
|
||||
//
|
||||
// inflationUpDown
|
||||
//
|
||||
this.inflationUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.inflationUpDown.DecimalPlaces = 3;
|
||||
this.inflationUpDown.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(204)))), ((int)(((byte)(204)))), ((int)(((byte)(204)))));
|
||||
this.inflationUpDown.Increment = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
65536});
|
||||
this.inflationUpDown.Location = new System.Drawing.Point(120, 154);
|
||||
this.inflationUpDown.Maximum = new decimal(new int[] {
|
||||
9999,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.inflationUpDown.Name = "inflationUpDown";
|
||||
this.inflationUpDown.Size = new System.Drawing.Size(73, 20);
|
||||
this.inflationUpDown.TabIndex = 32;
|
||||
this.boxEditorControl1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.boxEditorControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.boxEditorControl1.Name = "boxEditorControl1";
|
||||
this.boxEditorControl1.Size = new System.Drawing.Size(540, 220);
|
||||
this.boxEditorControl1.TabIndex = 2;
|
||||
//
|
||||
// BoxEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(630, 220);
|
||||
this.Controls.Add(this.inflationUpDown);
|
||||
this.Controls.Add(this.uvYUpDown);
|
||||
this.Controls.Add(this.uvXUpDown);
|
||||
this.Controls.Add(this.SizeZUpDown);
|
||||
this.Controls.Add(this.SizeYUpDown);
|
||||
this.Controls.Add(this.SizeXUpDown);
|
||||
this.Controls.Add(this.PosZUpDown);
|
||||
this.Controls.Add(this.PosYUpDown);
|
||||
this.Controls.Add(this.PosXUpDown);
|
||||
this.Controls.Add(inflationLabel);
|
||||
this.Controls.Add(this.parentComboBox);
|
||||
this.Controls.Add(this.mirrorCheckBox);
|
||||
this.Controls.Add(this.armorCheckBox);
|
||||
this.Controls.Add(uvLabel);
|
||||
this.Controls.Add(sizeLabel);
|
||||
this.Controls.Add(positionLabel);
|
||||
this.Controls.Add(parentLabel);
|
||||
this.ClientSize = new System.Drawing.Size(540, 220);
|
||||
this.Controls.Add(this.closeButton);
|
||||
this.Controls.Add(this.boxEditorControl1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(630, 554);
|
||||
this.MaximumSize = new System.Drawing.Size(540, 554);
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(630, 220);
|
||||
this.MinimumSize = new System.Drawing.Size(540, 220);
|
||||
this.Name = "BoxEditor";
|
||||
this.Resizable = false;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
@@ -438,34 +79,13 @@
|
||||
this.Text = "BOX Editor";
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.BoxEditor_FormClosing);
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.inflationUpDown)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private MetroFramework.Controls.MetroButton closeButton;
|
||||
private MetroFramework.Components.MetroToolTip toolTip;
|
||||
private MetroFramework.Controls.MetroComboBox parentComboBox;
|
||||
private System.Windows.Forms.NumericUpDown PosXUpDown;
|
||||
private System.Windows.Forms.NumericUpDown PosYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown PosZUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeZUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeXUpDown;
|
||||
private System.Windows.Forms.NumericUpDown uvYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown uvXUpDown;
|
||||
private MetroFramework.Controls.MetroCheckBox armorCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox mirrorCheckBox;
|
||||
private System.Windows.Forms.NumericUpDown inflationUpDown;
|
||||
}
|
||||
private Controls.BoxEditorControl boxEditorControl1;
|
||||
}
|
||||
}
|
||||
@@ -1,56 +1,31 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Internal;
|
||||
using OpenTK;
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Properties;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class BoxEditor : MetroFramework.Forms.MetroForm
|
||||
{
|
||||
public string Result;
|
||||
private SkinBOX result;
|
||||
public SkinBOX Result => result;
|
||||
|
||||
public BoxEditor(string box, bool hasInflation)
|
||||
: this(SkinBOX.FromString(box), hasInflation)
|
||||
public BoxEditor(string formattedBoxString, int xmlVersion)
|
||||
: this(SkinBOX.FromString(formattedBoxString), xmlVersion)
|
||||
{
|
||||
}
|
||||
|
||||
public BoxEditor(SkinBOX box, bool hasInflation)
|
||||
public BoxEditor(SkinBOX box, int xmlVersion)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (string.IsNullOrEmpty(box.Type) || !parentComboBox.Items.Contains(box.Type))
|
||||
{
|
||||
throw new Exception("Failed to parse BOX value");
|
||||
}
|
||||
|
||||
closeButton.Visible = !Settings.Default.AutoSaveChanges;
|
||||
|
||||
inflationUpDown.Enabled = hasInflation;
|
||||
|
||||
parentComboBox.SelectedItem = parentComboBox.Items[parentComboBox.Items.IndexOf(box.Type)];
|
||||
PosXUpDown.Value = (decimal)box.Pos.X;
|
||||
PosYUpDown.Value = (decimal)box.Pos.Y;
|
||||
PosZUpDown.Value = (decimal)box.Pos.Z;
|
||||
SizeXUpDown.Value = (decimal)box.Size.X;
|
||||
SizeYUpDown.Value = (decimal)box.Size.Y;
|
||||
SizeZUpDown.Value = (decimal)box.Size.Z;
|
||||
uvXUpDown.Value = (decimal)box.UV.X;
|
||||
uvYUpDown.Value = (decimal)box.UV.Y;
|
||||
armorCheckBox.Checked = box.HideWithArmor;
|
||||
mirrorCheckBox.Checked = box.Mirror;
|
||||
inflationUpDown.Value = (decimal)box.Scale;
|
||||
}
|
||||
boxEditorControl1.SetBOXVersion(xmlVersion);
|
||||
boxEditorControl1.SetBOX(box);
|
||||
}
|
||||
|
||||
private void saveButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Result =
|
||||
$"{parentComboBox.SelectedItem} " +
|
||||
$"{PosXUpDown.Value} {PosYUpDown.Value} {PosZUpDown.Value} " +
|
||||
$"{SizeXUpDown.Value} {SizeYUpDown.Value} {SizeZUpDown.Value} " +
|
||||
$"{uvXUpDown.Value} {uvYUpDown.Value} " +
|
||||
$"{Convert.ToInt32(armorCheckBox.Checked)} " +
|
||||
$"{Convert.ToInt32(mirrorCheckBox.Checked)} " +
|
||||
$"{inflationUpDown.Value}";
|
||||
result = boxEditorControl1.GetBOX();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,21 +117,6 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="parentLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="positionLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="sizeLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="uvLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="inflationLabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
|
||||
1
PCK-Studio/Forms/Editor/COLEditor.Designer.cs
generated
1
PCK-Studio/Forms/Editor/COLEditor.Designer.cs
generated
@@ -547,7 +547,6 @@ namespace PckStudio.Forms.Editor
|
||||
this.Name = "COLEditor";
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.COLEditor_FormClosing);
|
||||
this.metroPanel1.ResumeLayout(false);
|
||||
this.metroPanel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.blueUpDown)).EndInit();
|
||||
|
||||
@@ -8,32 +8,39 @@ using MetroFramework.Forms;
|
||||
using OMI.Formats.Color;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Color;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Interfaces;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class COLEditor : MetroForm
|
||||
public partial class COLEditor : EditorForm<ColorContainer>
|
||||
{
|
||||
ColorContainer _defaultColourfile;
|
||||
ColorContainer _colourfile;
|
||||
string _clipboard_color = "#FFFFFF";
|
||||
|
||||
private readonly PckAsset _asset;
|
||||
|
||||
List<TreeNode> colorCache = new List<TreeNode>();
|
||||
List<TreeNode> waterCache = new List<TreeNode>();
|
||||
List<TreeNode> underwaterCache = new List<TreeNode>();
|
||||
List<TreeNode> fogCache = new List<TreeNode>();
|
||||
|
||||
public COLEditor(PckAsset asset)
|
||||
private static readonly ICollection<string> PS4Biomes = new List<string>
|
||||
{
|
||||
"bamboo_jungle",
|
||||
"bamboo_jungle_hills",
|
||||
"mesa_mutated",
|
||||
"mega_spruce_taiga_mutated",
|
||||
"mega_taiga_mutated"
|
||||
};
|
||||
|
||||
public COLEditor(ColorContainer colorContainer, ISaveContext<ColorContainer> saveContext)
|
||||
: base(colorContainer, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
saveToolStripMenuItem1.Visible = !Settings.Default.AutoSaveChanges;
|
||||
|
||||
_asset = asset;
|
||||
_colourfile = asset.GetData(new COLFileReader());
|
||||
saveToolStripMenuItem1.Visible = !saveContext.AutoSave;
|
||||
|
||||
TU12ToolStripMenuItem.Click += (sender, e) => SetUpDefaultFile(sender, e, 0);
|
||||
TU13ToolStripMenuItem.Click += (sender, e) => SetUpDefaultFile(sender, e, 1);
|
||||
@@ -111,9 +118,9 @@ namespace PckStudio.Forms.Editor
|
||||
underwaterTreeView.Nodes.Clear();
|
||||
fogTreeView.Nodes.Clear();
|
||||
|
||||
ColorContainer temp = targetVersion ? _defaultColourfile : _colourfile;
|
||||
ColorContainer temp = targetVersion ? _defaultColourfile : EditorValue;
|
||||
|
||||
List<string> CurrentEntries = new List<string>();
|
||||
List<string> currentEntries = new List<string>();
|
||||
|
||||
colorCache.Clear();
|
||||
fogCache.Clear();
|
||||
@@ -123,33 +130,33 @@ namespace PckStudio.Forms.Editor
|
||||
// fixes the duplicate entry bug
|
||||
if (targetVersion)
|
||||
{
|
||||
foreach(ColorContainer.Color col in _colourfile.Colors)
|
||||
foreach(ColorContainer.Color col in EditorValue.Colors)
|
||||
{
|
||||
if (_defaultColourfile.Colors.Find(c => c.Name == col.Name) == null)
|
||||
continue;
|
||||
CurrentEntries.Add(col.Name);
|
||||
currentEntries.Add(col.Name);
|
||||
AddEntry(colorTreeView, colorCache, col.Name, col);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (ColorContainer.Color col in temp.Colors)
|
||||
{
|
||||
ColorContainer.Color entry = _colourfile.Colors.Find(color => color.Name == col.Name);
|
||||
if (CurrentEntries.Contains(col.Name))
|
||||
ColorContainer.Color entry = EditorValue.Colors.Find(color => color.Name == col.Name);
|
||||
if (currentEntries.Contains(col.Name))
|
||||
continue;
|
||||
ColorContainer.Color color = entry ?? col;
|
||||
AddEntry(colorTreeView, colorCache, color.Name, color);
|
||||
}
|
||||
CurrentEntries.Clear();
|
||||
currentEntries.Clear();
|
||||
|
||||
// fixes the duplicate entry bug
|
||||
if (targetVersion)
|
||||
{
|
||||
foreach (ColorContainer.WaterColor col in _colourfile.WaterColors)
|
||||
foreach (ColorContainer.WaterColor col in EditorValue.WaterColors)
|
||||
{
|
||||
if (_defaultColourfile.WaterColors.Find(c => c.Name == col.Name) == null)
|
||||
continue;
|
||||
ColorContainer.WaterColor entry = _colourfile.WaterColors.Find(color => color.Name == col.Name);
|
||||
ColorContainer.WaterColor entry = EditorValue.WaterColors.Find(color => color.Name == col.Name);
|
||||
ColorContainer.WaterColor color = entry ?? col;
|
||||
AddEntry(waterTreeView, waterCache, color.Name, color);
|
||||
AddEntry(underwaterTreeView, underwaterCache, color.Name, color);
|
||||
@@ -159,8 +166,8 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
foreach (ColorContainer.WaterColor col in temp.WaterColors)
|
||||
{
|
||||
ColorContainer.WaterColor entry = _colourfile.WaterColors.Find(color => color.Name == col.Name);
|
||||
if (CurrentEntries.Contains(col.Name))
|
||||
ColorContainer.WaterColor entry = EditorValue.WaterColors.Find(color => color.Name == col.Name);
|
||||
if (currentEntries.Contains(col.Name))
|
||||
continue;
|
||||
ColorContainer.WaterColor color = entry ?? col;
|
||||
AddEntry(waterTreeView, waterCache, color.Name, color);
|
||||
@@ -201,14 +208,14 @@ namespace PckStudio.Forms.Editor
|
||||
fogTreeView.SelectedNode = null;
|
||||
|
||||
var colorEntry = (ColorContainer.Color)colorTreeView.SelectedNode.Tag;
|
||||
var color = colorEntry.ColorPallette.ToArgb();
|
||||
Color color = colorEntry.ColorPallette;
|
||||
SetUpValueChanged(false);
|
||||
alphaUpDown.Visible = false;
|
||||
alphaLabel.Visible = false;
|
||||
redUpDown.Value = color >> 16 & 0xff;
|
||||
greenUpDown.Value = color >> 8 & 0xff;
|
||||
blueUpDown.Value = color & 0xff;
|
||||
pictureBox1.BackColor = Color.FromArgb(0xff << 24 | color);
|
||||
redUpDown.Value = color.R;
|
||||
greenUpDown.Value = color.G;
|
||||
blueUpDown.Value = color.B;
|
||||
pictureBox1.BackColor = Color.FromArgb(0xff, color);
|
||||
colorTextbox.Text = ColorTranslator.ToHtml(colorEntry.ColorPallette).TrimStart('#');
|
||||
SetUpValueChanged(true);
|
||||
}
|
||||
@@ -226,15 +233,17 @@ namespace PckStudio.Forms.Editor
|
||||
fogTreeView.SelectedNode = null;
|
||||
|
||||
var colorEntry = (ColorContainer.WaterColor)waterTreeView.SelectedNode.Tag;
|
||||
int color = colorEntry.SurfaceColor.ToArgb();
|
||||
Color color = colorEntry.SurfaceColor;
|
||||
SetUpValueChanged(false);
|
||||
|
||||
alphaUpDown.Value = color.A;
|
||||
redUpDown.Value = color.R;
|
||||
greenUpDown.Value = color.G;
|
||||
blueUpDown.Value = color.B;
|
||||
|
||||
alphaUpDown.Enabled = true;
|
||||
alphaUpDown.Visible = true;
|
||||
alphaLabel.Visible = true;
|
||||
alphaUpDown.Value = color >> 24 & 0xff;
|
||||
redUpDown.Value = color >> 16 & 0xff;
|
||||
greenUpDown.Value = color >> 8 & 0xff;
|
||||
blueUpDown.Value = color & 0xff;
|
||||
pictureBox1.BackColor = colorEntry.SurfaceColor;
|
||||
colorTextbox.Text = ColorTranslator.ToHtml(colorEntry.SurfaceColor).TrimStart('#');
|
||||
SetUpValueChanged(true);
|
||||
@@ -253,14 +262,14 @@ namespace PckStudio.Forms.Editor
|
||||
fogTreeView.SelectedNode = null;
|
||||
|
||||
var colorEntry = (ColorContainer.WaterColor)underwaterTreeView.SelectedNode.Tag;
|
||||
int color = colorEntry.UnderwaterColor.ToArgb();
|
||||
Color color = colorEntry.UnderwaterColor;
|
||||
SetUpValueChanged(false);
|
||||
alphaUpDown.Visible = false;
|
||||
alphaLabel.Visible = false;
|
||||
redUpDown.Value = color >> 16 & 0xff;
|
||||
greenUpDown.Value = color >> 8 & 0xff;
|
||||
blueUpDown.Value = color & 0xff;
|
||||
pictureBox1.BackColor = Color.FromArgb(255, Color.FromArgb(0xff << 24 | color));
|
||||
redUpDown.Value = color.R;
|
||||
greenUpDown.Value = color.G;
|
||||
blueUpDown.Value = color.B;
|
||||
pictureBox1.BackColor = Color.FromArgb(0xff, color);
|
||||
colorTextbox.Text = ColorTranslator.ToHtml(colorEntry.UnderwaterColor).TrimStart('#');
|
||||
SetUpValueChanged(true);
|
||||
}
|
||||
@@ -278,22 +287,21 @@ namespace PckStudio.Forms.Editor
|
||||
underwaterTreeView.SelectedNode = null;
|
||||
|
||||
var colorEntry = (ColorContainer.WaterColor)fogTreeView.SelectedNode.Tag;
|
||||
int color = colorEntry.FogColor.ToArgb();
|
||||
Color color = colorEntry.FogColor;
|
||||
SetUpValueChanged(false);
|
||||
alphaUpDown.Visible = false;
|
||||
alphaLabel.Visible = false;
|
||||
redUpDown.Value = color >> 16 & 0xff;
|
||||
greenUpDown.Value = color >> 8 & 0xff;
|
||||
blueUpDown.Value = color & 0xff;
|
||||
pictureBox1.BackColor = Color.FromArgb(255, Color.FromArgb(0xff << 24 | color));
|
||||
redUpDown.Value = color.R;
|
||||
greenUpDown.Value = color.G;
|
||||
blueUpDown.Value = color.B;
|
||||
pictureBox1.BackColor = Color.FromArgb(0xff, color);
|
||||
colorTextbox.Text = ColorTranslator.ToHtml(colorEntry.FogColor).TrimStart('#');
|
||||
SetUpValueChanged(true);
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
_asset.SetData(new COLFileWriter(_colourfile));
|
||||
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
@@ -485,14 +493,14 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
ColorContainer.WaterColor WaterEntry = _defaultColourfile.WaterColors.Find(color => color.Name == node.Text);
|
||||
ColorContainer.WaterColor waterEntry = _defaultColourfile.WaterColors.Find(color => color.Name == node.Text);
|
||||
|
||||
if (WaterEntry == null)
|
||||
if (waterEntry == null)
|
||||
return;
|
||||
|
||||
color =
|
||||
tab == waterTab ? WaterEntry.SurfaceColor :
|
||||
tab == underwaterTab ? WaterEntry.UnderwaterColor : WaterEntry.FogColor;
|
||||
tab == waterTab ? waterEntry.SurfaceColor :
|
||||
tab == underwaterTab ? waterEntry.UnderwaterColor : waterEntry.FogColor;
|
||||
|
||||
if (tab == waterTab)
|
||||
{
|
||||
@@ -509,7 +517,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void metroTextBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
// Some code in this function is modified code from this StackOverflow answer - MattNL
|
||||
// Some code in this function is modified code from this StackOverflow answer - MayNL
|
||||
//https://stackoverflow.com/questions/8260322/filter-a-treeview-with-a-textbox-in-a-c-sharp-winforms-app
|
||||
|
||||
//blocks repainting tree until all objects loaded
|
||||
@@ -523,52 +531,52 @@ namespace PckStudio.Forms.Editor
|
||||
fogTreeView.Nodes.Clear();
|
||||
if (!string.IsNullOrEmpty(metroTextBox1.Text))
|
||||
{
|
||||
foreach (TreeNode _node in colorCache)
|
||||
foreach (TreeNode node in colorCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
colorTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
colorTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
foreach (TreeNode _node in waterCache)
|
||||
foreach (TreeNode node in waterCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
waterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
waterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
foreach (TreeNode _node in underwaterCache)
|
||||
foreach (TreeNode node in underwaterCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
underwaterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
underwaterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
foreach (TreeNode _node in fogCache)
|
||||
foreach (TreeNode node in fogCache)
|
||||
{
|
||||
if (_node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
if (node.Text.ToLower().Contains(metroTextBox1.Text.ToLower()))
|
||||
{
|
||||
fogTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
fogTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (TreeNode _node in colorCache)
|
||||
foreach (TreeNode node in colorCache)
|
||||
{
|
||||
colorTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
colorTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
foreach (TreeNode _node in waterCache)
|
||||
foreach (TreeNode node in waterCache)
|
||||
{
|
||||
waterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
waterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
foreach (TreeNode _node in underwaterCache)
|
||||
foreach (TreeNode node in underwaterCache)
|
||||
{
|
||||
underwaterTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
underwaterTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
foreach (TreeNode _node in fogCache)
|
||||
foreach (TreeNode node in fogCache)
|
||||
{
|
||||
fogTreeView.Nodes.Add((TreeNode)_node.Clone());
|
||||
fogTreeView.Nodes.Add((TreeNode)node.Clone());
|
||||
}
|
||||
}
|
||||
//enables redrawing tree after all objects have been added
|
||||
@@ -588,14 +596,6 @@ namespace PckStudio.Forms.Editor
|
||||
colorTextbox.Text = _clipboard_color;
|
||||
}
|
||||
|
||||
private void COLEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Settings.Default.AutoSaveChanges)
|
||||
{
|
||||
saveToolStripMenuItem1_Click(sender, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
private void colorTextbox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
string hexCheck = "0123456789abcdefABCDEF\b";
|
||||
@@ -605,21 +605,12 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void stripPS4BiomesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(_colourfile.WaterColors.Count > 0)
|
||||
if(EditorValue.WaterColors.Count > 0)
|
||||
{
|
||||
List<string> PS4Biomes = new List<string>
|
||||
{
|
||||
"bamboo_jungle",
|
||||
"bamboo_jungle_hills",
|
||||
"mesa_mutated",
|
||||
"mega_spruce_taiga_mutated",
|
||||
"mega_taiga_mutated"
|
||||
};
|
||||
|
||||
foreach (ColorContainer.WaterColor col in _colourfile.WaterColors.ToList())
|
||||
foreach (ColorContainer.WaterColor col in EditorValue.WaterColors.ToList())
|
||||
{
|
||||
if (PS4Biomes.Contains(col.Name))
|
||||
_colourfile.WaterColors.Remove(col);
|
||||
EditorValue.WaterColors.Remove(col);
|
||||
}
|
||||
|
||||
SetUpTable(false);
|
||||
@@ -640,12 +631,12 @@ namespace PckStudio.Forms.Editor
|
||||
entry.Name = prompt.NewText;
|
||||
entry.ColorPallette = Color.FromArgb(0xFFFFFF);
|
||||
|
||||
if(_colourfile.Colors.Find(c => c.Name == entry.Name) != null)
|
||||
if(EditorValue.Colors.Find(c => c.Name == entry.Name) != null)
|
||||
{
|
||||
MessageBox.Show(this, $"\"{entry.Name}\" already exists in this color table", "Color not added");
|
||||
}
|
||||
|
||||
_colourfile.Colors.Add(entry);
|
||||
EditorValue.Colors.Add(entry);
|
||||
AddEntry(colorTreeView, colorCache, entry.Name, entry);
|
||||
}
|
||||
}
|
||||
@@ -659,7 +650,7 @@ namespace PckStudio.Forms.Editor
|
||||
&& entry != null
|
||||
&& entry.Tag is ColorContainer.Color color)
|
||||
{
|
||||
_colourfile.Colors.Remove(color);
|
||||
EditorValue.Colors.Remove(color);
|
||||
RemoveEntry(entry, colorCache);
|
||||
}
|
||||
}
|
||||
|
||||
416
PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs
generated
Normal file
416
PCK-Studio/Forms/Editor/CustomSkinEditor.Designer.cs
generated
Normal file
@@ -0,0 +1,416 @@
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
partial class CustomSkinEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomSkinEditor));
|
||||
this.importTextureButton = new MetroFramework.Controls.MetroButton();
|
||||
this.exportTextureButton = new MetroFramework.Controls.MetroButton();
|
||||
this.skinPartTabContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.createToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cloneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.generateUvTextureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buttonDone = new MetroFramework.Controls.MetroButton();
|
||||
this.importSkinButton = new MetroFramework.Controls.MetroButton();
|
||||
this.exportSkinButton = new MetroFramework.Controls.MetroButton();
|
||||
this.outlineColorButton = new MetroFramework.Controls.MetroButton();
|
||||
this.generateTextureCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.showArmorCheckbox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.skinPartListBox = new System.Windows.Forms.ListBox();
|
||||
this.captureScreenshotButton = new MetroFramework.Controls.MetroButton();
|
||||
this.showToolsCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.skinNameLabel = new MetroFramework.Controls.MetroLabel();
|
||||
this.metroTabControl1 = new MetroFramework.Controls.MetroTabControl();
|
||||
this.skinPartsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.skinOffsetsTabPage = new System.Windows.Forms.TabPage();
|
||||
this.offsetListBox = new System.Windows.Forms.ListBox();
|
||||
this.offsetTabContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components);
|
||||
this.addOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeOffsetToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.renderer3D1 = new PckStudio.Rendering.SkinRenderer();
|
||||
this.uvPictureBox = new PckStudio.ToolboxItems.InterpolationPictureBox();
|
||||
this.centerSelectionCheckbox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.textureSizeLabel = new System.Windows.Forms.Label();
|
||||
this.renderSettingsButton = new MetroFramework.Controls.MetroButton();
|
||||
this.exportTemplateButton = new MetroFramework.Controls.MetroButton();
|
||||
this.animEditorButton = new MetroFramework.Controls.MetroButton();
|
||||
this.boxEditorControl1 = new PckStudio.Controls.BoxEditorControl();
|
||||
this.skinPartTabContextMenu.SuspendLayout();
|
||||
this.metroTabControl1.SuspendLayout();
|
||||
this.skinPartsTabPage.SuspendLayout();
|
||||
this.skinOffsetsTabPage.SuspendLayout();
|
||||
this.offsetTabContextMenu.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// importTextureButton
|
||||
//
|
||||
resources.ApplyResources(this.importTextureButton, "importTextureButton");
|
||||
this.importTextureButton.ForeColor = System.Drawing.Color.White;
|
||||
this.importTextureButton.Name = "importTextureButton";
|
||||
this.importTextureButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.importTextureButton.UseSelectable = true;
|
||||
this.importTextureButton.Click += new System.EventHandler(this.importTextureButton_Click);
|
||||
//
|
||||
// exportTextureButton
|
||||
//
|
||||
resources.ApplyResources(this.exportTextureButton, "exportTextureButton");
|
||||
this.exportTextureButton.ForeColor = System.Drawing.Color.White;
|
||||
this.exportTextureButton.Name = "exportTextureButton";
|
||||
this.exportTextureButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.exportTextureButton.UseSelectable = true;
|
||||
this.exportTextureButton.Click += new System.EventHandler(this.exportTextureButton_Click);
|
||||
//
|
||||
// skinPartTabContextMenu
|
||||
//
|
||||
this.skinPartTabContextMenu.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.skinPartTabContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.createToolStripMenuItem,
|
||||
this.cloneToolStripMenuItem,
|
||||
this.deleteToolStripMenuItem,
|
||||
this.generateUvTextureToolStripMenuItem});
|
||||
this.skinPartTabContextMenu.Name = "contextMenuStrip1";
|
||||
resources.ApplyResources(this.skinPartTabContextMenu, "skinPartTabContextMenu");
|
||||
//
|
||||
// createToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.createToolStripMenuItem, "createToolStripMenuItem");
|
||||
this.createToolStripMenuItem.Name = "createToolStripMenuItem";
|
||||
this.createToolStripMenuItem.Click += new System.EventHandler(this.createToolStripMenuItem_Click);
|
||||
//
|
||||
// cloneToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.cloneToolStripMenuItem, "cloneToolStripMenuItem");
|
||||
this.cloneToolStripMenuItem.Name = "cloneToolStripMenuItem";
|
||||
this.cloneToolStripMenuItem.Click += new System.EventHandler(this.cloneToolStripMenuItem_Click);
|
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.deleteToolStripMenuItem, "deleteToolStripMenuItem");
|
||||
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
|
||||
//
|
||||
// generateUvTextureToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.generateUvTextureToolStripMenuItem, "generateUvTextureToolStripMenuItem");
|
||||
this.generateUvTextureToolStripMenuItem.Name = "generateUvTextureToolStripMenuItem";
|
||||
this.generateUvTextureToolStripMenuItem.Click += new System.EventHandler(this.generateUvTextureToolStripMenuItem_Click);
|
||||
//
|
||||
// buttonDone
|
||||
//
|
||||
resources.ApplyResources(this.buttonDone, "buttonDone");
|
||||
this.buttonDone.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.buttonDone.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonDone.Name = "buttonDone";
|
||||
this.buttonDone.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonDone.UseSelectable = true;
|
||||
this.buttonDone.Click += new System.EventHandler(this.buttonDone_Click);
|
||||
//
|
||||
// importSkinButton
|
||||
//
|
||||
resources.ApplyResources(this.importSkinButton, "importSkinButton");
|
||||
this.importSkinButton.ForeColor = System.Drawing.Color.White;
|
||||
this.importSkinButton.Name = "importSkinButton";
|
||||
this.importSkinButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.importSkinButton.UseSelectable = true;
|
||||
this.importSkinButton.Click += new System.EventHandler(this.importSkinButton_Click);
|
||||
//
|
||||
// exportSkinButton
|
||||
//
|
||||
resources.ApplyResources(this.exportSkinButton, "exportSkinButton");
|
||||
this.exportSkinButton.ForeColor = System.Drawing.Color.White;
|
||||
this.exportSkinButton.Name = "exportSkinButton";
|
||||
this.exportSkinButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.exportSkinButton.UseSelectable = true;
|
||||
this.exportSkinButton.Click += new System.EventHandler(this.exportSkinButton_Click);
|
||||
//
|
||||
// outlineColorButton
|
||||
//
|
||||
resources.ApplyResources(this.outlineColorButton, "outlineColorButton");
|
||||
this.outlineColorButton.ForeColor = System.Drawing.Color.White;
|
||||
this.outlineColorButton.Name = "outlineColorButton";
|
||||
this.outlineColorButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.outlineColorButton.UseSelectable = true;
|
||||
this.outlineColorButton.Click += new System.EventHandler(this.outlineColorButton_Click);
|
||||
//
|
||||
// generateTextureCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.generateTextureCheckBox, "generateTextureCheckBox");
|
||||
this.generateTextureCheckBox.Name = "generateTextureCheckBox";
|
||||
this.generateTextureCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.generateTextureCheckBox.UseSelectable = true;
|
||||
//
|
||||
// showArmorCheckbox
|
||||
//
|
||||
resources.ApplyResources(this.showArmorCheckbox, "showArmorCheckbox");
|
||||
this.showArmorCheckbox.Name = "showArmorCheckbox";
|
||||
this.showArmorCheckbox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.showArmorCheckbox.UseSelectable = true;
|
||||
this.showArmorCheckbox.CheckedChanged += new System.EventHandler(this.showArmorCheckbox_CheckedChanged);
|
||||
//
|
||||
// skinPartListBox
|
||||
//
|
||||
this.skinPartListBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.skinPartListBox.ContextMenuStrip = this.skinPartTabContextMenu;
|
||||
resources.ApplyResources(this.skinPartListBox, "skinPartListBox");
|
||||
this.skinPartListBox.FormattingEnabled = true;
|
||||
this.skinPartListBox.Name = "skinPartListBox";
|
||||
this.skinPartListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
|
||||
this.skinPartListBox.Tag = "";
|
||||
this.skinPartListBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.skinPartListBox_MouseClick);
|
||||
this.skinPartListBox.SelectedIndexChanged += new System.EventHandler(this.skinPartListBox_SelectedIndexChanged);
|
||||
this.skinPartListBox.KeyUp += new System.Windows.Forms.KeyEventHandler(this.skinPartListBox_KeyUp);
|
||||
//
|
||||
// captureScreenshotButton
|
||||
//
|
||||
resources.ApplyResources(this.captureScreenshotButton, "captureScreenshotButton");
|
||||
this.captureScreenshotButton.ForeColor = System.Drawing.Color.White;
|
||||
this.captureScreenshotButton.Name = "captureScreenshotButton";
|
||||
this.captureScreenshotButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.captureScreenshotButton.UseSelectable = true;
|
||||
this.captureScreenshotButton.Click += new System.EventHandler(this.captureScreenshotButton_Click);
|
||||
//
|
||||
// showToolsCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.showToolsCheckBox, "showToolsCheckBox");
|
||||
this.showToolsCheckBox.Name = "showToolsCheckBox";
|
||||
this.showToolsCheckBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.showToolsCheckBox.UseSelectable = true;
|
||||
//
|
||||
// skinNameLabel
|
||||
//
|
||||
resources.ApplyResources(this.skinNameLabel, "skinNameLabel");
|
||||
this.skinNameLabel.Name = "skinNameLabel";
|
||||
this.skinNameLabel.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// metroTabControl1
|
||||
//
|
||||
resources.ApplyResources(this.metroTabControl1, "metroTabControl1");
|
||||
this.metroTabControl1.Controls.Add(this.skinPartsTabPage);
|
||||
this.metroTabControl1.Controls.Add(this.skinOffsetsTabPage);
|
||||
this.metroTabControl1.Multiline = true;
|
||||
this.metroTabControl1.Name = "metroTabControl1";
|
||||
this.metroTabControl1.SelectedIndex = 0;
|
||||
this.metroTabControl1.Style = MetroFramework.MetroColorStyle.Pink;
|
||||
this.metroTabControl1.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.metroTabControl1.UseSelectable = true;
|
||||
//
|
||||
// skinPartsTabPage
|
||||
//
|
||||
this.skinPartsTabPage.Controls.Add(this.skinPartListBox);
|
||||
resources.ApplyResources(this.skinPartsTabPage, "skinPartsTabPage");
|
||||
this.skinPartsTabPage.Name = "skinPartsTabPage";
|
||||
//
|
||||
// skinOffsetsTabPage
|
||||
//
|
||||
this.skinOffsetsTabPage.Controls.Add(this.offsetListBox);
|
||||
resources.ApplyResources(this.skinOffsetsTabPage, "skinOffsetsTabPage");
|
||||
this.skinOffsetsTabPage.Name = "skinOffsetsTabPage";
|
||||
//
|
||||
// offsetListBox
|
||||
//
|
||||
this.offsetListBox.ContextMenuStrip = this.offsetTabContextMenu;
|
||||
resources.ApplyResources(this.offsetListBox, "offsetListBox");
|
||||
this.offsetListBox.FormattingEnabled = true;
|
||||
this.offsetListBox.Name = "offsetListBox";
|
||||
this.offsetListBox.DoubleClick += new System.EventHandler(this.offsetListBox_DoubleClick);
|
||||
//
|
||||
// offsetTabContextMenu
|
||||
//
|
||||
this.offsetTabContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.addOffsetToolStripMenuItem,
|
||||
this.removeOffsetToolStripMenuItem});
|
||||
this.offsetTabContextMenu.Name = "offsetTabContextMenu";
|
||||
resources.ApplyResources(this.offsetTabContextMenu, "offsetTabContextMenu");
|
||||
this.offsetTabContextMenu.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// addOffsetToolStripMenuItem
|
||||
//
|
||||
this.addOffsetToolStripMenuItem.Name = "addOffsetToolStripMenuItem";
|
||||
resources.ApplyResources(this.addOffsetToolStripMenuItem, "addOffsetToolStripMenuItem");
|
||||
this.addOffsetToolStripMenuItem.Click += new System.EventHandler(this.addOffsetToolStripMenuItem_Click);
|
||||
//
|
||||
// removeOffsetToolStripMenuItem
|
||||
//
|
||||
this.removeOffsetToolStripMenuItem.Name = "removeOffsetToolStripMenuItem";
|
||||
resources.ApplyResources(this.removeOffsetToolStripMenuItem, "removeOffsetToolStripMenuItem");
|
||||
this.removeOffsetToolStripMenuItem.Click += new System.EventHandler(this.removeOffsetToolStripMenuItem_Click);
|
||||
//
|
||||
// renderer3D1
|
||||
//
|
||||
resources.ApplyResources(this.renderer3D1, "renderer3D1");
|
||||
this.renderer3D1.Animate = true;
|
||||
this.renderer3D1.BackColor = System.Drawing.Color.DimGray;
|
||||
this.renderer3D1.CapeTexture = null;
|
||||
this.renderer3D1.CenterOnSelect = false;
|
||||
this.renderer3D1.GuideLineColor = System.Drawing.Color.Empty;
|
||||
this.renderer3D1.HighlightlingColor = System.Drawing.Color.Aqua;
|
||||
this.renderer3D1.MouseSensetivity = 0.01F;
|
||||
this.renderer3D1.Name = "renderer3D1";
|
||||
this.renderer3D1.RefreshRate = 60;
|
||||
this.renderer3D1.SelectedIndex = -1;
|
||||
this.renderer3D1.SelectedIndices = new int[] {
|
||||
-1};
|
||||
this.renderer3D1.ShowArmor = false;
|
||||
this.renderer3D1.ShowBoundingBox = false;
|
||||
this.renderer3D1.ShowGuideLines = false;
|
||||
this.renderer3D1.Texture = null;
|
||||
this.renderer3D1.VSync = true;
|
||||
this.renderer3D1.TextureChanging += new System.EventHandler<PckStudio.Rendering.TextureChangingEventArgs>(this.renderer3D1_TextureChanging);
|
||||
//
|
||||
// uvPictureBox
|
||||
//
|
||||
resources.ApplyResources(this.uvPictureBox, "uvPictureBox");
|
||||
this.uvPictureBox.BackgroundInterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.uvPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.uvPictureBox.Name = "uvPictureBox";
|
||||
this.uvPictureBox.TabStop = false;
|
||||
//
|
||||
// centerSelectionCheckbox
|
||||
//
|
||||
resources.ApplyResources(this.centerSelectionCheckbox, "centerSelectionCheckbox");
|
||||
this.centerSelectionCheckbox.Name = "centerSelectionCheckbox";
|
||||
this.centerSelectionCheckbox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.centerSelectionCheckbox.UseSelectable = true;
|
||||
this.centerSelectionCheckbox.CheckedChanged += new System.EventHandler(this.centerSelectionCheckbox_CheckedChanged);
|
||||
//
|
||||
// textureSizeLabel
|
||||
//
|
||||
resources.ApplyResources(this.textureSizeLabel, "textureSizeLabel");
|
||||
this.textureSizeLabel.ForeColor = System.Drawing.Color.White;
|
||||
this.textureSizeLabel.Name = "textureSizeLabel";
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// animEditorButton
|
||||
//
|
||||
resources.ApplyResources(this.animEditorButton, "animEditorButton");
|
||||
this.animEditorButton.Name = "animEditorButton";
|
||||
this.animEditorButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.animEditorButton.UseSelectable = true;
|
||||
this.animEditorButton.Click += new System.EventHandler(this.animEditorButton_Click);
|
||||
//
|
||||
// boxEditorControl1
|
||||
//
|
||||
this.boxEditorControl1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18)))));
|
||||
this.boxEditorControl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
resources.ApplyResources(this.boxEditorControl1, "boxEditorControl1");
|
||||
this.boxEditorControl1.Name = "boxEditorControl1";
|
||||
this.boxEditorControl1.BoxChanged += new System.EventHandler(this.boxEditorControl1_BoxChanged);
|
||||
//
|
||||
// CustomSkinEditor
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.metroTabControl1);
|
||||
this.Controls.Add(this.boxEditorControl1);
|
||||
this.Controls.Add(this.exportTextureButton);
|
||||
this.Controls.Add(this.importTextureButton);
|
||||
this.Controls.Add(this.textureSizeLabel);
|
||||
this.Controls.Add(this.showToolsCheckBox);
|
||||
this.Controls.Add(this.centerSelectionCheckbox);
|
||||
this.Controls.Add(this.showArmorCheckbox);
|
||||
this.Controls.Add(this.generateTextureCheckBox);
|
||||
this.Controls.Add(this.outlineColorButton);
|
||||
this.Controls.Add(this.uvPictureBox);
|
||||
this.Controls.Add(this.animEditorButton);
|
||||
this.Controls.Add(this.exportTemplateButton);
|
||||
this.Controls.Add(this.renderSettingsButton);
|
||||
this.Controls.Add(this.skinNameLabel);
|
||||
this.Controls.Add(this.captureScreenshotButton);
|
||||
this.Controls.Add(this.renderer3D1);
|
||||
this.Controls.Add(this.exportSkinButton);
|
||||
this.Controls.Add(this.importSkinButton);
|
||||
this.Controls.Add(this.buttonDone);
|
||||
this.Name = "CustomSkinEditor";
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CustomSkinEditor_FormClosing);
|
||||
this.skinPartTabContextMenu.ResumeLayout(false);
|
||||
this.metroTabControl1.ResumeLayout(false);
|
||||
this.skinPartsTabPage.ResumeLayout(false);
|
||||
this.skinOffsetsTabPage.ResumeLayout(false);
|
||||
this.offsetTabContextMenu.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.ContextMenuStrip skinPartTabContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem createToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem cloneToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem generateUvTextureToolStripMenuItem;
|
||||
private MetroFramework.Controls.MetroButton buttonDone;
|
||||
private MetroFramework.Controls.MetroButton outlineColorButton;
|
||||
private MetroFramework.Controls.MetroButton exportSkinButton;
|
||||
private MetroFramework.Controls.MetroButton importSkinButton;
|
||||
private PckStudio.ToolboxItems.InterpolationPictureBox uvPictureBox;
|
||||
private MetroFramework.Controls.MetroButton importTextureButton;
|
||||
private MetroFramework.Controls.MetroButton exportTextureButton;
|
||||
private MetroFramework.Controls.MetroCheckBox generateTextureCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox showArmorCheckbox;
|
||||
private Rendering.SkinRenderer renderer3D1;
|
||||
private System.Windows.Forms.ListBox skinPartListBox;
|
||||
private MetroFramework.Controls.MetroButton captureScreenshotButton;
|
||||
private MetroFramework.Controls.MetroCheckBox showToolsCheckBox;
|
||||
private MetroFramework.Controls.MetroLabel skinNameLabel;
|
||||
private MetroFramework.Controls.MetroTabControl metroTabControl1;
|
||||
private System.Windows.Forms.TabPage skinPartsTabPage;
|
||||
private System.Windows.Forms.TabPage skinOffsetsTabPage;
|
||||
private System.Windows.Forms.ListBox offsetListBox;
|
||||
private MetroFramework.Controls.MetroContextMenu offsetTabContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem addOffsetToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeOffsetToolStripMenuItem;
|
||||
private MetroFramework.Controls.MetroCheckBox centerSelectionCheckbox;
|
||||
private System.Windows.Forms.Label textureSizeLabel;
|
||||
private MetroFramework.Controls.MetroButton renderSettingsButton;
|
||||
private MetroFramework.Controls.MetroButton exportTemplateButton;
|
||||
private MetroFramework.Controls.MetroButton animEditorButton;
|
||||
private Controls.BoxEditorControl boxEditorControl1;
|
||||
}
|
||||
}
|
||||
459
PCK-Studio/Forms/Editor/CustomSkinEditor.cs
Normal file
459
PCK-Studio/Forms/Editor/CustomSkinEditor.cs
Normal file
@@ -0,0 +1,459 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Forms.Additional_Popups;
|
||||
|
||||
using PckStudio.Core.Skin;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.ModelSupport;
|
||||
using PckStudio.ModelSupport.Extension;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class CustomSkinEditor : EditorForm<Skin>
|
||||
{
|
||||
private const float cOffsetMaximum = 100_000f;
|
||||
private Random _rng;
|
||||
private bool _inflateOverlayParts;
|
||||
private int _xmlVersion;
|
||||
|
||||
private BindingSource _skinPartListBindingSource;
|
||||
private BindingSource _skinOffsetListBindingSource;
|
||||
|
||||
private Core.App.SettingsManager _settingsManager;
|
||||
|
||||
private static GraphicsConfig _graphicsConfig = new GraphicsConfig()
|
||||
{
|
||||
InterpolationMode = InterpolationMode.NearestNeighbor,
|
||||
PixelOffsetMode = PixelOffsetMode.HighQuality,
|
||||
};
|
||||
|
||||
private CustomSkinEditor() : this(null, null, 0)
|
||||
{ }
|
||||
|
||||
public CustomSkinEditor(Skin skin, ISaveContext<Skin> saveContext, int xmlVersion)
|
||||
: base(skin, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeRenderSettings();
|
||||
_rng = new Random();
|
||||
_skinPartListBindingSource = new BindingSource(renderer3D1.ModelData, null);
|
||||
skinPartListBox.DataSource = _skinPartListBindingSource;
|
||||
skinPartListBox.DisplayMember = "Type";
|
||||
_xmlVersion = xmlVersion;
|
||||
boxEditorControl1.SetBOXVersion(xmlVersion);
|
||||
_inflateOverlayParts = _xmlVersion > 0;
|
||||
}
|
||||
|
||||
private void InitializeRenderSettings()
|
||||
{
|
||||
_settingsManager = Core.App.SettingsManager.CreateSettings();
|
||||
_settingsManager.AddSetting("shouldAnimate" , true , "Animate skin" , state => renderer3D1.Animate = state);
|
||||
_settingsManager.AddSetting("lockMouse" , true , "Lock mouse when paning/rotating", state => renderer3D1.LockMousePosition = state);
|
||||
_settingsManager.AddSetting("showGuidelines" , false, "Show guidelines" , state => renderer3D1.ShowGuideLines = state);
|
||||
_settingsManager.AddSetting("showBoundingBox", false, "Show Bounding Box" , state => renderer3D1.ShowBoundingBox = state);
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
renderer3D1.Initialize(_inflateOverlayParts);
|
||||
renderer3D1.GuideLineColor = Color.LightCoral;
|
||||
skinNameLabel.Text = EditorValue.MetaData.Name;
|
||||
if (EditorValue.HasCape)
|
||||
renderer3D1.CapeTexture = EditorValue.CapeTexture;
|
||||
LoadModelData();
|
||||
}
|
||||
|
||||
protected override bool ProcessDialogKey(Keys keyData)
|
||||
{
|
||||
if (keyData == Keys.A)
|
||||
{
|
||||
using var animeditor = new ANIMEditor(EditorValue.Anim);
|
||||
if (animeditor.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
renderer3D1.ANIM = EditorValue.Anim = animeditor.ResultAnim;
|
||||
skinPartListBox_SelectedIndexChanged(this, EventArgs.Empty);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return base.ProcessDialogKey(keyData);
|
||||
}
|
||||
|
||||
private void LoadModelData()
|
||||
{
|
||||
SkinModel modelInfo = EditorValue.Model;
|
||||
|
||||
List<SkinBOX> boxProperties = modelInfo.AdditionalBoxes;
|
||||
List<SkinPartOffset> offsetProperties = modelInfo.PartOffsets;
|
||||
|
||||
renderer3D1.ANIM = EditorValue.Anim;
|
||||
|
||||
renderer3D1.ModelData.Clear();
|
||||
foreach (SkinBOX box in boxProperties)
|
||||
{
|
||||
renderer3D1.ModelData.Add(box);
|
||||
}
|
||||
renderer3D1.ResetOffsets();
|
||||
foreach (SkinPartOffset offset in offsetProperties)
|
||||
{
|
||||
renderer3D1.SetPartOffset(offset);
|
||||
}
|
||||
|
||||
if (EditorValue.Texture is not null)
|
||||
{
|
||||
renderer3D1.Texture = EditorValue.Texture;
|
||||
}
|
||||
|
||||
if (EditorValue.Texture is null && renderer3D1.Texture is not null)
|
||||
{
|
||||
EditorValue.Texture = renderer3D1.Texture;
|
||||
}
|
||||
|
||||
_skinOffsetListBindingSource = new BindingSource(renderer3D1.GetOffsets().ToArray(), null);
|
||||
offsetListBox.DataSource = _skinOffsetListBindingSource;
|
||||
offsetListBox.DisplayMember = "Type";
|
||||
offsetListBox.ValueMember = "Value";
|
||||
|
||||
_skinPartListBindingSource.ResetBindings(false);
|
||||
_skinOffsetListBindingSource.ResetBindings(false);
|
||||
}
|
||||
|
||||
private void GenerateUVTextureMap(SkinBOX skinBox)
|
||||
{
|
||||
if (EditorValue?.Texture is null)
|
||||
{
|
||||
Trace.TraceWarning($"[{nameof(CustomSkinEditor)}@{nameof(GenerateUVTextureMap)}] Failed to generate uv for {skinBox}. Reason: Model.Texture was null");
|
||||
return;
|
||||
}
|
||||
using (Graphics graphics = Graphics.FromImage(EditorValue.Texture))
|
||||
{
|
||||
graphics.ApplyConfig(_graphicsConfig);
|
||||
int argb = _rng.Next(unchecked((int)0xFF000000), -1);
|
||||
var color = Color.FromArgb(argb);
|
||||
Brush brush = new SolidBrush(color);
|
||||
graphics.FillPath(brush, skinBox.GetUVGraphicsPath());
|
||||
}
|
||||
renderer3D1.Texture = EditorValue.Texture;
|
||||
}
|
||||
|
||||
private void createToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
SkinBOX newBox = SkinBOX.DefaultHead;
|
||||
renderer3D1.ModelData.Add(newBox);
|
||||
EditorValue.Model.AdditionalBoxes.Add(newBox);
|
||||
_skinPartListBindingSource.ResetBindings(false);
|
||||
if (generateTextureCheckBox.Checked)
|
||||
GenerateUVTextureMap(newBox);
|
||||
}
|
||||
|
||||
private void exportTextureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (EditorValue?.Texture is null)
|
||||
{
|
||||
Trace.TraceWarning($"[{nameof(CustomSkinEditor)}@{nameof(exportTextureButton_Click)}] Failed to export texture. Reason: skin.Model.Texture was null");
|
||||
return;
|
||||
}
|
||||
using SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Filter = "PNG Image Files | *.png";
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
EditorValue.Texture.Save(saveFileDialog.FileName, ImageFormat.Png);
|
||||
}
|
||||
}
|
||||
|
||||
private void importTextureButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filter = "PNG Image Files | *.png";
|
||||
openFileDialog.Title = "Select Skin Texture";
|
||||
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
generateTextureCheckBox.Checked = false;
|
||||
renderer3D1.Texture = Image.FromFile(openFileDialog.FileName).ReleaseFromFile();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonDone_Click(object sender, EventArgs e)
|
||||
{
|
||||
EditorValue.Model.AdditionalBoxes.Clear();
|
||||
EditorValue.Model.AdditionalBoxes.AddRange(renderer3D1.ModelData);
|
||||
EditorValue.Model.PartOffsets.Clear();
|
||||
EditorValue.Model.PartOffsets.AddRange(renderer3D1.GetOffsets());
|
||||
// just in case they're not the same instance
|
||||
EditorValue.Anim = renderer3D1.ANIM;
|
||||
DialogResult = DialogResult.OK;
|
||||
Save();
|
||||
}
|
||||
|
||||
private void exportSkinButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Title = "Save Model File";
|
||||
saveFileDialog.Filter = SkinModelImporter.Default.SupportedModelFileFormatsFilter;
|
||||
saveFileDialog.FileName = EditorValue.MetaData.Name.TrimEnd(new char[] { '\n', '\r' }).Replace(' ', '_');
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
SkinModelImporter.Default.Export(saveFileDialog.FileName, EditorValue.GetModelInfo());
|
||||
}
|
||||
|
||||
private void importSkinButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Title = "Select Model File";
|
||||
openFileDialog.Filter = SkinModelImporter.Default.SupportedModelFileFormatsFilter;
|
||||
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)
|
||||
{
|
||||
SkinModelInfo modelInfo = SkinModelImporter.Default.Import(openFileDialog.FileName);
|
||||
if (modelInfo is not null)
|
||||
{
|
||||
EditorValue.SetModelInfo(modelInfo);
|
||||
LoadModelData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void cloneToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (skinPartListBox.SelectedItem is SkinBOX box)
|
||||
{
|
||||
SkinBOX clone = box;
|
||||
renderer3D1.ModelData.Add(clone);
|
||||
EditorValue.Model.AdditionalBoxes.Add(clone);
|
||||
_skinPartListBindingSource.ResetBindings(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (skinPartListBox.SelectedItem is SkinBOX box)
|
||||
{
|
||||
renderer3D1.ModelData.Remove(box);
|
||||
EditorValue.Model.AdditionalBoxes.Remove(box);
|
||||
_skinPartListBindingSource.ResetBindings(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void CustomSkinEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
renderer3D1.Dispose();
|
||||
}
|
||||
|
||||
private void outlineColorButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ColorDialog colorDialog = new ColorDialog();
|
||||
colorDialog.SolidColorOnly = true;
|
||||
if (colorDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
renderer3D1.GuideLineColor = colorDialog.Color;
|
||||
skinPartListBox_SelectedIndexChanged(sender, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderer3D1_TextureChanging(object sender, Rendering.TextureChangingEventArgs e)
|
||||
{
|
||||
Image texture = e.NewTexture;
|
||||
// Skins can only be a 1:1 ratio (base 64x64) or a 2:1 ratio (base 64x32)
|
||||
if (Settings.Default.ValidateImageDimension && texture.Width != texture.Height && texture.Height != texture.Width / 2)
|
||||
{
|
||||
e.Cancel = true;
|
||||
MessageBox.Show("The selected image does not suit a skin texture.", "Invalid image dimensions.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
uvPictureBox.Image = EditorValue.Texture = texture;
|
||||
textureSizeLabel.Text = $"{texture.Width}x{texture.Height}";
|
||||
}
|
||||
|
||||
// TODO: fixed outline rendering
|
||||
private void skinPartListBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
int scale = 1;
|
||||
renderer3D1.SelectedIndices = skinPartListBox.SelectedIndices.Cast<int>().ToArray();
|
||||
|
||||
// TODO: highlight all selected boxes
|
||||
if (skinPartListBox.SelectedItem is SkinBOX box)
|
||||
{
|
||||
boxEditorControl1.SetBOX(box);
|
||||
Image uvArea = EditorValue.Texture.GetArea(Rectangle.Truncate(new RectangleF(box.UV.X, box.UV.Y, box.Size.X * 2 + box.Size.Z * 2, box.Size.Z + box.Size.Y)));
|
||||
|
||||
Bitmap refImg = new Bitmap(1, 1);
|
||||
|
||||
using (var g = Graphics.FromImage(refImg))
|
||||
{
|
||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
g.DrawImage(uvArea, new Rectangle(0, 0, 1, 1));
|
||||
}
|
||||
|
||||
Color avgColor = refImg.GetPixel(0, 0);
|
||||
renderer3D1.HighlightlingColor = avgColor.Inversed();
|
||||
|
||||
Size scaleSize = new Size(EditorValue.Texture.Width * scale, EditorValue.Texture.Height * scale);
|
||||
uvPictureBox.Image = new Bitmap(scaleSize.Width, scaleSize.Height);
|
||||
using (Graphics g = Graphics.FromImage(uvPictureBox.Image))
|
||||
{
|
||||
GraphicsPath graphicsPath = box.GetUVGraphicsPath(new System.Numerics.Vector2(scaleSize.Width * renderer3D1.TillingFactor.X, scaleSize.Height * renderer3D1.TillingFactor.Y));
|
||||
var brush = new SolidBrush(Color.FromArgb(127, avgColor.GreyScaled()));
|
||||
g.ApplyConfig(_graphicsConfig);
|
||||
g.DrawImage(EditorValue.Texture, new Rectangle(Point.Empty, scaleSize), new Rectangle(Point.Empty, EditorValue.Texture.Size), GraphicsUnit.Pixel);
|
||||
g.FillPath(brush, graphicsPath);
|
||||
}
|
||||
uvPictureBox.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
private void captureScreenshotButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using SaveFileDialog saveFileDialog = new SaveFileDialog()
|
||||
{
|
||||
Filter = "PNG|*.png"
|
||||
};
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
renderer3D1.GetThumbnail().Save(saveFileDialog.FileName, ImageFormat.Png);
|
||||
}
|
||||
}
|
||||
|
||||
private void showArmorCheckbox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
renderer3D1.ShowArmor = showArmorCheckbox.Checked;
|
||||
}
|
||||
|
||||
private void skinPartListBox_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
switch (e.KeyCode)
|
||||
{
|
||||
case Keys.Delete:
|
||||
deleteToolStripMenuItem_Click(sender, e);
|
||||
break;
|
||||
case Keys.Escape:
|
||||
ClearSelection();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReloadOffsetList()
|
||||
{
|
||||
_skinOffsetListBindingSource = new BindingSource(renderer3D1.GetOffsets().ToArray(), null);
|
||||
offsetListBox.DataSource = _skinOffsetListBindingSource;
|
||||
_skinOffsetListBindingSource.ResetBindings(false);
|
||||
}
|
||||
|
||||
private void addOffsetToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var offsets = renderer3D1.GetOffsets().Select(offset => offset.Type).ToList();
|
||||
string[] available = SkinPartOffset.ValidModelOffsetTypes.Where(s => !offsets.Contains(s)).ToArray();
|
||||
using ItemSelectionPopUp typeSelection = new ItemSelectionPopUp(available);
|
||||
using NumericPrompt valuePrompt = new NumericPrompt(0f, -cOffsetMaximum, cOffsetMaximum);
|
||||
valuePrompt.DecimalPlaces = 1;
|
||||
valuePrompt.ValueStep = (decimal)0.1f;
|
||||
if (typeSelection.ShowDialog() == DialogResult.OK && valuePrompt.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
renderer3D1.SetPartOffset(typeSelection.SelectedItem, (float)valuePrompt.SelectedValue);
|
||||
ReloadOffsetList();
|
||||
}
|
||||
}
|
||||
|
||||
private void removeOffsetToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (offsetListBox.SelectedItem is not SkinPartOffset offset)
|
||||
return;
|
||||
renderer3D1.SetPartOffset(offset.Type, 0f);
|
||||
ReloadOffsetList();
|
||||
}
|
||||
|
||||
private void offsetListBox_DoubleClick(object sender, EventArgs e)
|
||||
{
|
||||
if (offsetListBox.SelectedItem is not SkinPartOffset offset)
|
||||
return;
|
||||
|
||||
using NumericPrompt valuePrompt = new NumericPrompt(offset.Value, -cOffsetMaximum, cOffsetMaximum);
|
||||
valuePrompt.ToolTipText = "Set new Value for " + offset.Type;
|
||||
valuePrompt.DecimalPlaces = 1;
|
||||
valuePrompt.ValueStep = (decimal)0.1f;
|
||||
if (valuePrompt.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
renderer3D1.SetPartOffset(offset.Type, (float)valuePrompt.SelectedValue);
|
||||
ReloadOffsetList();
|
||||
}
|
||||
}
|
||||
|
||||
private void skinPartListBox_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (skinPartListBox.IndexFromPoint(e.X, e.Y) == -1)
|
||||
ClearSelection();
|
||||
}
|
||||
|
||||
private void ClearSelection()
|
||||
{
|
||||
skinPartListBox.ClearSelected();
|
||||
uvPictureBox.Image = EditorValue.Texture;
|
||||
}
|
||||
|
||||
|
||||
private void centerSelectionCheckbox_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
renderer3D1.CenterOnSelect = centerSelectionCheckbox.Checked;
|
||||
}
|
||||
|
||||
private void generateUvTextureToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (skinPartListBox.SelectedItem is SkinBOX skinBox)
|
||||
{
|
||||
GenerateUVTextureMap(skinBox);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderSettingsButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
using AppSettingsForm settingsForm = new AppSettingsForm("Render Settings", _settingsManager.GetSettings());
|
||||
settingsForm.ShowDialog();
|
||||
}
|
||||
|
||||
private string SanitizeModelFilename(in string modelFilename)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(modelFilename) ? "template" : modelFilename.TrimEnd(new char[] { '\n', '\r' }).Replace(' ', '_');
|
||||
}
|
||||
|
||||
private void exportTemplateButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Image templateTexture = Resources.classic_template;
|
||||
SkinAnimMask templateAnimMask = SkinAnimMask.MODERN_WIDE_MODEL;
|
||||
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog();
|
||||
saveFileDialog.Title = "Save Template Model";
|
||||
saveFileDialog.Filter = SkinModelImporter.Default.SupportedModelFileFormatsFilter;
|
||||
saveFileDialog.FileName = SanitizeModelFilename(EditorValue.MetaData.Name);
|
||||
if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
SkinModelInfo modelInfo = new SkinModelInfo(templateTexture, templateAnimMask, new SkinModel());
|
||||
SkinModelImporter.Default.Export(saveFileDialog.FileName, modelInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void animEditorButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ProcessDialogKey(Keys.A);
|
||||
}
|
||||
|
||||
private void boxEditorControl1_BoxChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(skinPartListBox.SelectedIndex > 0)
|
||||
{
|
||||
renderer3D1.ModelData[skinPartListBox.SelectedIndex] = boxEditorControl1.GetBOX();
|
||||
_skinPartListBindingSource.ResetItem(skinPartListBox.SelectedIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -324,7 +324,6 @@
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Text = "GRF Editor";
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GameRuleFileEditor_FormClosing);
|
||||
this.Load += new System.EventHandler(this.OnLoad);
|
||||
this.MessageContextMenu.ResumeLayout(false);
|
||||
this.DetailContextMenu.ResumeLayout(false);
|
||||
|
||||
@@ -23,28 +23,21 @@ using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using PckStudio.Forms.Additional_Popups.Grf;
|
||||
using PckStudio.Internal.Misc;
|
||||
using OMI.Formats.GameRule;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.ToolboxItems;
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class GameRuleFileEditor : MetroFramework.Forms.MetroForm
|
||||
public partial class GameRuleFileEditor : EditorForm<GameRuleFile>
|
||||
{
|
||||
private GameRuleFile _file;
|
||||
|
||||
public GameRuleFile Result => _file;
|
||||
|
||||
private GameRuleFileEditor()
|
||||
public GameRuleFileEditor(GameRuleFile gameRuleFile, ISaveContext<GameRuleFile> saveContext)
|
||||
: base(gameRuleFile, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
saveToolStripMenuItem.Visible = !Settings.Default.AutoSaveChanges;
|
||||
}
|
||||
|
||||
public GameRuleFileEditor(GameRuleFile gameRuleFile) : this()
|
||||
{
|
||||
_file = gameRuleFile;
|
||||
saveToolStripMenuItem.Visible = !saveContext.AutoSave;
|
||||
}
|
||||
|
||||
private void OnLoad(object sender, EventArgs e)
|
||||
@@ -55,7 +48,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void LoadGameRuleTree(TreeNodeCollection root, GameRuleFile.GameRule parentRule)
|
||||
{
|
||||
foreach (GameRuleFile.GameRule rule in parentRule.ChildRules)
|
||||
foreach (GameRuleFile.GameRule rule in parentRule.GetRules())
|
||||
{
|
||||
TreeNode node = new TreeNode(rule.Name);
|
||||
node.Tag = rule;
|
||||
@@ -67,16 +60,16 @@ namespace PckStudio.Forms.Editor
|
||||
private void ReloadGameRuleTree()
|
||||
{
|
||||
GrfTreeView.Nodes.Clear();
|
||||
if (_file is not null)
|
||||
if (EditorValue is not null)
|
||||
{
|
||||
SetCompressionLevel();
|
||||
LoadGameRuleTree(GrfTreeView.Nodes, _file.Root);
|
||||
LoadGameRuleTree(GrfTreeView.Nodes, EditorValue.Root);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCompressionLevel()
|
||||
{
|
||||
switch (_file.Header.CompressionLevel)
|
||||
switch (EditorValue.Header.CompressionLevel)
|
||||
{
|
||||
case GameRuleFile.CompressionLevel.None:
|
||||
noneToolStripMenuItem.Checked = true;
|
||||
@@ -103,7 +96,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
GrfParametersTreeView.Nodes.Clear();
|
||||
if (GrfTreeView.SelectedNode is TreeNode t && t.Tag is GameRuleFile.GameRule rule)
|
||||
foreach (KeyValuePair<string, string> param in rule.Parameters)
|
||||
foreach (KeyValuePair<string, string> param in rule.GetParameters())
|
||||
{
|
||||
GrfParametersTreeView.Nodes.Add(new TreeNode($"{param.Key}: {param.Value}") { Tag = param});
|
||||
}
|
||||
@@ -117,12 +110,12 @@ namespace PckStudio.Forms.Editor
|
||||
AddParameter prompt = new AddParameter();
|
||||
if (prompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
if (grfTag.Parameters.ContainsKey(prompt.ParameterName))
|
||||
if (grfTag.ContainsParameter(prompt.ParameterName))
|
||||
{
|
||||
MessageBox.Show(this, "Can't add detail that already exists.", "Error");
|
||||
return;
|
||||
}
|
||||
grfTag.Parameters.Add(prompt.ParameterName, prompt.ParameterValue);
|
||||
grfTag.AddParameter(prompt.ParameterName, prompt.ParameterValue);
|
||||
ReloadParameterTreeView();
|
||||
}
|
||||
}
|
||||
@@ -131,7 +124,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
if (GrfTreeView.SelectedNode is TreeNode t && t.Tag is GameRuleFile.GameRule rule &&
|
||||
GrfParametersTreeView.SelectedNode is TreeNode paramNode && paramNode.Tag is KeyValuePair<string, string> pair &&
|
||||
rule.Parameters.ContainsKey(pair.Key) && rule.Parameters.Remove(pair.Key))
|
||||
rule.ContainsParameter(pair.Key) && rule.RemoveParameter(pair.Key))
|
||||
{
|
||||
ReloadParameterTreeView();
|
||||
return;
|
||||
@@ -153,7 +146,7 @@ namespace PckStudio.Forms.Editor
|
||||
AddParameter prompt = new AddParameter(param.Key, param.Value, false);
|
||||
if (prompt.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
rule.Parameters[prompt.ParameterName] = prompt.ParameterValue;
|
||||
rule.SetParameter(prompt.ParameterName, prompt.ParameterValue);
|
||||
ReloadParameterTreeView();
|
||||
}
|
||||
}
|
||||
@@ -164,7 +157,7 @@ namespace PckStudio.Forms.Editor
|
||||
bool isValidNode = GrfTreeView.SelectedNode is TreeNode t && t.Tag is GameRuleFile.GameRule;
|
||||
GameRuleFile.GameRule parentRule = isValidNode
|
||||
? GrfTreeView.SelectedNode.Tag as GameRuleFile.GameRule
|
||||
: _file.Root;
|
||||
: EditorValue.Root;
|
||||
|
||||
TreeNodeCollection root = isValidNode
|
||||
? GrfTreeView.SelectedNode.Nodes
|
||||
@@ -195,9 +188,9 @@ namespace PckStudio.Forms.Editor
|
||||
private bool RemoveTag(GameRuleFile.GameRule rule)
|
||||
{
|
||||
_ = rule.Parent ?? throw new ArgumentNullException(nameof(rule.Parent));
|
||||
foreach (GameRuleFile.GameRule subTag in rule.ChildRules.ToList())
|
||||
foreach (GameRuleFile.GameRule subTag in rule.GetRules().ToList())
|
||||
return RemoveTag(subTag);
|
||||
return rule.Parent.ChildRules.Remove(rule);
|
||||
return rule.Parent.RemoveRule(rule);
|
||||
}
|
||||
|
||||
private void GrfTreeView_KeyDown(object sender, KeyEventArgs e)
|
||||
@@ -208,11 +201,12 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (_file.Header.unknownData[3] != 0)
|
||||
if (EditorValue.Header.unknownData[3] != 0)
|
||||
{
|
||||
MessageBox.Show(this, "World grf saving is currently unsupported");
|
||||
return;
|
||||
}
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
MessageBox.Show("Saved!");
|
||||
}
|
||||
@@ -225,51 +219,43 @@ namespace PckStudio.Forms.Editor
|
||||
private void noneToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is ToolStripRadioButtonMenuItem radioButton && radioButton.Checked)
|
||||
_file.Header.CompressionLevel = GameRuleFile.CompressionLevel.None;
|
||||
EditorValue.Header.CompressionLevel = GameRuleFile.CompressionLevel.None;
|
||||
}
|
||||
|
||||
private void compressedToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is ToolStripRadioButtonMenuItem radioButton && radioButton.Checked)
|
||||
_file.Header.CompressionLevel = GameRuleFile.CompressionLevel.Compressed;
|
||||
EditorValue.Header.CompressionLevel = GameRuleFile.CompressionLevel.Compressed;
|
||||
}
|
||||
|
||||
private void compressedRLEToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is ToolStripRadioButtonMenuItem radioButton && radioButton.Checked)
|
||||
_file.Header.CompressionLevel = GameRuleFile.CompressionLevel.CompressedRle;
|
||||
EditorValue.Header.CompressionLevel = GameRuleFile.CompressionLevel.CompressedRle;
|
||||
}
|
||||
|
||||
private void compressedRLECRCToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is ToolStripRadioButtonMenuItem radioButton && radioButton.Checked)
|
||||
_file.Header.CompressionLevel = GameRuleFile.CompressionLevel.CompressedRleCrc;
|
||||
EditorValue.Header.CompressionLevel = GameRuleFile.CompressionLevel.CompressedRleCrc;
|
||||
}
|
||||
|
||||
private void wiiUPSVitaToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is ToolStripRadioButtonMenuItem radioButton && radioButton.Checked)
|
||||
_file.Header.CompressionType = GameRuleFile.CompressionType.Zlib;
|
||||
EditorValue.Header.CompressionType = GameRuleFile.CompressionType.Zlib;
|
||||
}
|
||||
|
||||
private void pS3ToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is ToolStripRadioButtonMenuItem radioButton && radioButton.Checked)
|
||||
_file.Header.CompressionType = GameRuleFile.CompressionType.Deflate;
|
||||
EditorValue.Header.CompressionType = GameRuleFile.CompressionType.Deflate;
|
||||
}
|
||||
|
||||
private void xbox360ToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is ToolStripRadioButtonMenuItem radioButton && radioButton.Checked)
|
||||
_file.Header.CompressionType = GameRuleFile.CompressionType.XMem;
|
||||
}
|
||||
|
||||
private void GameRuleFileEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Settings.Default.AutoSaveChanges)
|
||||
{
|
||||
saveToolStripMenuItem_Click(sender, EventArgs.Empty);
|
||||
}
|
||||
EditorValue.Header.CompressionType = GameRuleFile.CompressionType.XMem;
|
||||
}
|
||||
|
||||
private void exportToJSONToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
|
||||
40
PCK-Studio/Forms/Editor/LOCEditor.Designer.cs
generated
40
PCK-Studio/Forms/Editor/LOCEditor.Designer.cs
generated
@@ -34,6 +34,7 @@
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.addDisplayIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteDisplayIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.copyIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GridContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components);
|
||||
this.addLanguageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeLanguageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -43,10 +44,10 @@
|
||||
this.locSort = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.buttonReplaceAll = new System.Windows.Forms.Button();
|
||||
this.dataGridViewLocEntryData = new System.Windows.Forms.DataGridView();
|
||||
this.textBoxReplaceAll = new System.Windows.Forms.TextBox();
|
||||
this.treeViewLocKeys = new System.Windows.Forms.TreeView();
|
||||
this.Language = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.DisplayName = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.textBoxReplaceAll = new System.Windows.Forms.TextBox();
|
||||
this.treeViewLocKeys = new System.Windows.Forms.TreeView();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.GridContextMenu.SuspendLayout();
|
||||
this.menuStrip.SuspendLayout();
|
||||
@@ -58,7 +59,8 @@
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.addDisplayIDToolStripMenuItem,
|
||||
this.deleteDisplayIDToolStripMenuItem});
|
||||
this.deleteDisplayIDToolStripMenuItem,
|
||||
this.copyIDToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1");
|
||||
//
|
||||
@@ -74,6 +76,12 @@
|
||||
resources.ApplyResources(this.deleteDisplayIDToolStripMenuItem, "deleteDisplayIDToolStripMenuItem");
|
||||
this.deleteDisplayIDToolStripMenuItem.Click += new System.EventHandler(this.deleteDisplayIDToolStripMenuItem_Click);
|
||||
//
|
||||
// copyIDToolStripMenuItem
|
||||
//
|
||||
this.copyIDToolStripMenuItem.Name = "copyIDToolStripMenuItem";
|
||||
resources.ApplyResources(this.copyIDToolStripMenuItem, "copyIDToolStripMenuItem");
|
||||
this.copyIDToolStripMenuItem.Click += new System.EventHandler(this.copyIDToolStripMenuItem_Click);
|
||||
//
|
||||
// GridContextMenu
|
||||
//
|
||||
this.GridContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
@@ -162,6 +170,18 @@
|
||||
this.dataGridViewLocEntryData.RowHeadersVisible = false;
|
||||
this.dataGridViewLocEntryData.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
|
||||
//
|
||||
// Language
|
||||
//
|
||||
this.Language.FillWeight = 15F;
|
||||
resources.ApplyResources(this.Language, "Language");
|
||||
this.Language.Name = "Language";
|
||||
this.Language.ReadOnly = true;
|
||||
//
|
||||
// DisplayName
|
||||
//
|
||||
resources.ApplyResources(this.DisplayName, "DisplayName");
|
||||
this.DisplayName.Name = "DisplayName";
|
||||
//
|
||||
// textBoxReplaceAll
|
||||
//
|
||||
resources.ApplyResources(this.textBoxReplaceAll, "textBoxReplaceAll");
|
||||
@@ -180,18 +200,6 @@
|
||||
this.treeViewLocKeys.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeViewLocKeys_AfterSelect);
|
||||
this.treeViewLocKeys.KeyDown += new System.Windows.Forms.KeyEventHandler(this.treeView1_KeyDown);
|
||||
//
|
||||
// Language
|
||||
//
|
||||
this.Language.FillWeight = 15F;
|
||||
resources.ApplyResources(this.Language, "Language");
|
||||
this.Language.Name = "Language";
|
||||
this.Language.ReadOnly = true;
|
||||
//
|
||||
// DisplayName
|
||||
//
|
||||
resources.ApplyResources(this.DisplayName, "DisplayName");
|
||||
this.DisplayName.Name = "DisplayName";
|
||||
//
|
||||
// LOCEditor
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
@@ -200,7 +208,6 @@
|
||||
this.Name = "LOCEditor";
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LOCEditor_FormClosing);
|
||||
this.Load += new System.EventHandler(this.LOCEditor_Load);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.GridContextMenu.ResumeLayout(false);
|
||||
@@ -231,5 +238,6 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Language;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn DisplayName;
|
||||
private System.Windows.Forms.ToolStripMenuItem copyIDToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -4,34 +4,27 @@ using System.Data;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
using PckStudio.Internal.Misc;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Forms.Additional_Popups.Loc;
|
||||
using OMI.Formats.Languages;
|
||||
using OMI.Workers.Language;
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Controls;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class LOCEditor : MetroForm
|
||||
public partial class LOCEditor : EditorForm<LOCFile>
|
||||
{
|
||||
LOCFile _currentLoc;
|
||||
PckAsset _asset;
|
||||
|
||||
public LOCEditor(PckAsset asset)
|
||||
public LOCEditor(LOCFile locFile, ISaveContext<LOCFile> context)
|
||||
: base(locFile, context)
|
||||
{
|
||||
InitializeComponent();
|
||||
_asset = asset;
|
||||
_currentLoc = asset.GetData(new LOCFileReader());
|
||||
saveToolStripMenuItem.Visible = !Settings.Default.AutoSaveChanges;
|
||||
saveToolStripMenuItem.Visible = !context.AutoSave;
|
||||
}
|
||||
|
||||
private void LOCEditor_Load(object sender, EventArgs e)
|
||||
{
|
||||
RPC.SetPresence("LOC Editor", "Editing localization File.");
|
||||
foreach(string locKey in _currentLoc.LocKeys.Keys)
|
||||
foreach(string locKey in EditorValue.LocKeys.Keys)
|
||||
treeViewLocKeys.Nodes.Add(locKey);
|
||||
}
|
||||
|
||||
@@ -39,7 +32,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
TreeNode node = e.Node;
|
||||
if (node == null ||
|
||||
!_currentLoc.LocKeys.ContainsKey(node.Text))
|
||||
!EditorValue.LocKeys.ContainsKey(node.Text))
|
||||
{
|
||||
MessageBox.Show(this, "Selected Node does not seem to be in the loc file");
|
||||
return;
|
||||
@@ -53,7 +46,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
prompt.OKButtonText = "Add";
|
||||
if (prompt.ShowDialog(this) == DialogResult.OK &&
|
||||
_currentLoc.AddLocKey(prompt.NewText, ""))
|
||||
EditorValue.AddLocKey(prompt.NewText, ""))
|
||||
{
|
||||
treeViewLocKeys.Nodes.Add(prompt.NewText);
|
||||
}
|
||||
@@ -62,7 +55,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void deleteDisplayIDToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeViewLocKeys.SelectedNode is TreeNode t && _currentLoc.RemoveLocKey(t.Text))
|
||||
if (treeViewLocKeys.SelectedNode is TreeNode t && EditorValue.RemoveLocKey(t.Text))
|
||||
{
|
||||
treeViewLocKeys.SelectedNode.Remove();
|
||||
ReloadTranslationTable();
|
||||
@@ -81,7 +74,7 @@ namespace PckStudio.Forms.Editor
|
||||
string locKey = treeViewLocKeys.SelectedNode.Text;
|
||||
string language = row.Cells[0].Value.ToString();
|
||||
string value = row.Cells[1].Value.ToString();
|
||||
_currentLoc.SetLocEntry(locKey, language, value);
|
||||
EditorValue.SetLocEntry(locKey, language, value);
|
||||
}
|
||||
|
||||
private void treeView1_KeyDown(object sender, KeyEventArgs e)
|
||||
@@ -97,7 +90,7 @@ namespace PckStudio.Forms.Editor
|
||||
dataGridViewLocEntryData.Rows[i].Cells[1].Value = textBoxReplaceAll.Text;
|
||||
}
|
||||
|
||||
_currentLoc.SetLocEntry(treeViewLocKeys.SelectedNode.Text, textBoxReplaceAll.Text);
|
||||
EditorValue.SetLocEntry(treeViewLocKeys.SelectedNode.Text, textBoxReplaceAll.Text);
|
||||
}
|
||||
|
||||
private void ReloadTranslationTable()
|
||||
@@ -105,7 +98,7 @@ namespace PckStudio.Forms.Editor
|
||||
dataGridViewLocEntryData.Rows.Clear();
|
||||
if (treeViewLocKeys.SelectedNode is null)
|
||||
return;
|
||||
foreach (KeyValuePair<string, string> locEntry in _currentLoc.GetLocEntries(treeViewLocKeys.SelectedNode.Text))
|
||||
foreach (KeyValuePair<string, string> locEntry in EditorValue.GetLocEntries(treeViewLocKeys.SelectedNode.Text))
|
||||
dataGridViewLocEntryData.Rows.Add(locEntry.Key, locEntry.Value);
|
||||
}
|
||||
|
||||
@@ -113,7 +106,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
foreach (var lang in LOCFile.ValidLanguages)
|
||||
{
|
||||
if (_currentLoc.Languages.Contains(lang))
|
||||
if (EditorValue.Languages.Contains(lang))
|
||||
continue;
|
||||
yield return lang;
|
||||
}
|
||||
@@ -126,23 +119,20 @@ namespace PckStudio.Forms.Editor
|
||||
using (var dialog = new AddLanguage(avalibleLang))
|
||||
if (dialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
_currentLoc.AddLanguage(dialog.SelectedLanguage);
|
||||
EditorValue.AddLanguage(dialog.SelectedLanguage);
|
||||
ReloadTranslationTable();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
_asset.SetData(new LOCFileWriter(_currentLoc, 2));
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void LOCEditor_FormClosing(object sender, FormClosingEventArgs e)
|
||||
private void copyIDToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Settings.Default.AutoSaveChanges)
|
||||
{
|
||||
saveToolStripMenuItem_Click(sender, EventArgs.Empty);
|
||||
}
|
||||
Clipboard.SetText(treeViewLocKeys.SelectedNode.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,8 +133,14 @@
|
||||
<data name="deleteDisplayIDToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Delete Display ID</value>
|
||||
</data>
|
||||
<data name="copyIDToolStripMenuItem.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>162, 22</value>
|
||||
</data>
|
||||
<data name="copyIDToolStripMenuItem.Text" xml:space="preserve">
|
||||
<value>Copy ID</value>
|
||||
</data>
|
||||
<data name="contextMenuStrip1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>163, 48</value>
|
||||
<value>163, 70</value>
|
||||
</data>
|
||||
<data name=">>contextMenuStrip1.Name" xml:space="preserve">
|
||||
<value>contextMenuStrip1</value>
|
||||
@@ -2890,6 +2896,12 @@
|
||||
<data name=">>deleteDisplayIDToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>copyIDToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>copyIDToolStripMenuItem</value>
|
||||
</data>
|
||||
<data name=">>copyIDToolStripMenuItem.Type" xml:space="preserve">
|
||||
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name=">>addLanguageToolStripMenuItem.Name" xml:space="preserve">
|
||||
<value>addLanguageToolStripMenuItem</value>
|
||||
</data>
|
||||
@@ -2930,6 +2942,6 @@
|
||||
<value>LOCEditor</value>
|
||||
</data>
|
||||
<data name=">>$this.Type" xml:space="preserve">
|
||||
<value>MetroFramework.Forms.MetroForm, MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a</value>
|
||||
<value>PckStudio.Controls.EditorForm`1[[OMI.Formats.Languages.LOCFile, OMI Filetypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], PCK-Studio, Version=7.0.0.2, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,94 +1,72 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Formats.Material;
|
||||
using OMI.Workers.Material;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Json;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class MaterialsEditor : MetroForm
|
||||
// Materials File Format research by PhoenixARC
|
||||
public partial class MaterialsEditor : EditorForm<MaterialContainer>
|
||||
{
|
||||
// Materials File Format research by PhoenixARC
|
||||
private readonly PckAsset _asset;
|
||||
MaterialContainer _materialFile;
|
||||
|
||||
private readonly List<EntityInfo> MaterialData = Entities.BehaviourInfos;
|
||||
|
||||
private bool showInvalidEntries;
|
||||
private bool ShowInvalidEntries;
|
||||
|
||||
//Holds invalid entries so they can be added back to the material file on save should the user decide to hide them
|
||||
List<MaterialContainer.Material> hiddenInvalidEntries = new List<MaterialContainer.Material>();
|
||||
public MaterialsEditor(MaterialContainer materials, ISaveContext<MaterialContainer> saveContext)
|
||||
: base(materials, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (EditorValue.HasInvalidEntries())
|
||||
{
|
||||
DialogResult dr = MessageBox.Show(this, "Unsupported entities were found in this file. Would you like to display them?", "Invalid data found", MessageBoxButtons.YesNo);
|
||||
|
||||
void SetUpTree()
|
||||
ShowInvalidEntries = dr == DialogResult.Yes;
|
||||
}
|
||||
|
||||
treeView1.ImageList = new ImageList();
|
||||
ApplicationScope.EntityImages.ToList().ForEach(treeView1.ImageList.Images.Add);
|
||||
treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
UpdateTreeview();
|
||||
}
|
||||
|
||||
void UpdateTreeview()
|
||||
{
|
||||
treeView1.BeginUpdate();
|
||||
treeView1.Nodes.Clear();
|
||||
foreach (MaterialContainer.Material entry in _materialFile)
|
||||
foreach (MaterialContainer.Material entry in EditorValue)
|
||||
{
|
||||
TreeNode EntryNode = new TreeNode(entry.Name);
|
||||
TreeNode entryNode = new TreeNode(entry.Name);
|
||||
// index for invalid entry
|
||||
entryNode.ImageIndex = 127;
|
||||
entryNode.SelectedImageIndex = 127;
|
||||
entryNode.Tag = entry;
|
||||
|
||||
EntityInfo material = MaterialData.Find(m => m.InternalName == entry.Name);
|
||||
if(material != null)
|
||||
{
|
||||
EntryNode.Text = material.DisplayName;
|
||||
EntryNode.ImageIndex = MaterialData.IndexOf(material);
|
||||
EntryNode.Tag = entry;
|
||||
}
|
||||
|
||||
// check for invalid material entry
|
||||
else
|
||||
if (material is null)
|
||||
{
|
||||
EntryNode.ImageIndex = 127; // icon for invalid entry
|
||||
EntryNode.Text += " (Invalid)";
|
||||
|
||||
if (!showInvalidEntries)
|
||||
{
|
||||
hiddenInvalidEntries.Add(entry);
|
||||
entryNode.Text += " (Invalid)";
|
||||
if (!ShowInvalidEntries)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
EntryNode.SelectedImageIndex = EntryNode.ImageIndex;
|
||||
|
||||
treeView1.Nodes.Add(EntryNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
entryNode.Text = material.DisplayName;
|
||||
entryNode.SelectedImageIndex = entryNode.ImageIndex = MaterialData.IndexOf(material);
|
||||
}
|
||||
treeView1.Nodes.Add(entryNode);
|
||||
}
|
||||
treeView1.EndUpdate();
|
||||
}
|
||||
|
||||
public MaterialsEditor(PckAsset asset)
|
||||
{
|
||||
InitializeComponent();
|
||||
_asset = asset;
|
||||
|
||||
using (var stream = new MemoryStream(asset.Data))
|
||||
{
|
||||
var reader = new MaterialFileReader();
|
||||
_materialFile = reader.FromStream(stream);
|
||||
|
||||
if (_materialFile.HasInvalidEntries())
|
||||
{
|
||||
DialogResult dr = MessageBox.Show(this, "Unsupported entities were found in this file. Would you like to display them?", "Invalid data found", MessageBoxButtons.YesNo);
|
||||
|
||||
showInvalidEntries = dr == DialogResult.Yes;
|
||||
}
|
||||
|
||||
treeView1.ImageList = new ImageList();
|
||||
ApplicationScope.EntityImages.ToList().ForEach(treeView1.ImageList.Images.Add);
|
||||
treeView1.ImageList.ColorDepth = ColorDepth.Depth32Bit;
|
||||
SetUpTree();
|
||||
}
|
||||
}
|
||||
|
||||
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
if (e.Node == null)
|
||||
@@ -106,10 +84,11 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (treeView1.SelectedNode == null)
|
||||
return;
|
||||
|
||||
treeView1.SelectedNode.Remove();
|
||||
if (treeView1?.SelectedNode?.Tag is MaterialContainer.Material material)
|
||||
{
|
||||
EditorValue.Remove(material);
|
||||
UpdateTreeview();
|
||||
}
|
||||
}
|
||||
|
||||
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
|
||||
@@ -125,23 +104,7 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void saveToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
_materialFile = new MaterialContainer();
|
||||
|
||||
foreach (TreeNode node in treeView1.Nodes)
|
||||
{
|
||||
if(node.Tag is MaterialContainer.Material entry)
|
||||
{
|
||||
_materialFile.Add(entry);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (MaterialContainer.Material mat in hiddenInvalidEntries)
|
||||
{
|
||||
_materialFile.Add(mat);
|
||||
}
|
||||
|
||||
_asset.SetData(new MaterialFileWriter(_materialFile));
|
||||
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
@@ -153,21 +116,15 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
if (string.IsNullOrEmpty(diag.SelectedEntity))
|
||||
return;
|
||||
if (_materialFile.FindAll(mat => mat.Name == diag.SelectedEntity).Count() > 0)
|
||||
if (EditorValue.FindAll(mat => mat.Name == diag.SelectedEntity).Count() > 0)
|
||||
{
|
||||
MessageBox.Show(this, "You cannot have two entries for one entity. Please use the \"Add New Position Override\" tool to add multiple overrides for entities", "Error", MessageBoxButtons.OK);
|
||||
MessageBox.Show(this, "You cannot have two entries for one entity.", "Error", MessageBoxButtons.OK);
|
||||
return;
|
||||
}
|
||||
var newEntry = new MaterialContainer.Material(diag.SelectedEntity, "entity_alphatest");
|
||||
|
||||
TreeNode newEntryNode = new TreeNode(newEntry.Name);
|
||||
newEntryNode.Tag = newEntry;
|
||||
|
||||
EntityInfo material = MaterialData.Find(m => m.InternalName == newEntry.Name);
|
||||
newEntryNode.Text = material.DisplayName;
|
||||
newEntryNode.ImageIndex = MaterialData.IndexOf(material);
|
||||
newEntryNode.SelectedImageIndex = newEntryNode.ImageIndex;
|
||||
treeView1.Nodes.Add(newEntryNode);
|
||||
EditorValue.Add(newEntry);
|
||||
UpdateTreeview();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
254
PCK-Studio/Forms/Editor/ModelEditor.Designer.cs
generated
Normal file
254
PCK-Studio/Forms/Editor/ModelEditor.Designer.cs
generated
Normal file
@@ -0,0 +1,254 @@
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
partial class ModelEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.modelTreeView = new System.Windows.Forms.TreeView();
|
||||
this.modelContextMenu = new MetroFramework.Controls.MetroContextMenu(this.components);
|
||||
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.importToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.showModelBoundsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.modelViewport = new PckStudio.Rendering.ModelRenderer();
|
||||
this.namedTexturesTreeView = new System.Windows.Forms.TreeView();
|
||||
this.textureImageList = new System.Windows.Forms.ImageList(this.components);
|
||||
this.modelContextMenu.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// modelTreeView
|
||||
//
|
||||
this.modelTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.modelTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
this.modelTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.modelTreeView.ContextMenuStrip = this.modelContextMenu;
|
||||
this.modelTreeView.ForeColor = System.Drawing.SystemColors.Window;
|
||||
this.modelTreeView.HideSelection = false;
|
||||
this.modelTreeView.Location = new System.Drawing.Point(3, 3);
|
||||
this.modelTreeView.Name = "modelTreeView";
|
||||
this.modelTreeView.PathSeparator = ".";
|
||||
this.tableLayoutPanel1.SetRowSpan(this.modelTreeView, 2);
|
||||
this.modelTreeView.Size = new System.Drawing.Size(287, 440);
|
||||
this.modelTreeView.TabIndex = 0;
|
||||
this.modelTreeView.BeforeSelect += new System.Windows.Forms.TreeViewCancelEventHandler(this.modelTreeView_BeforeSelect);
|
||||
//
|
||||
// modelContextMenu
|
||||
//
|
||||
this.modelContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.exportToolStripMenuItem,
|
||||
this.editToolStripMenuItem,
|
||||
this.removeToolStripMenuItem});
|
||||
this.modelContextMenu.Name = "modelContextMenu";
|
||||
this.modelContextMenu.Size = new System.Drawing.Size(118, 70);
|
||||
//
|
||||
// exportToolStripMenuItem
|
||||
//
|
||||
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
|
||||
this.exportToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.exportToolStripMenuItem.Text = "Export";
|
||||
this.exportToolStripMenuItem.Click += new System.EventHandler(this.exportToolStripMenuItem_Click);
|
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||
this.editToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.editToolStripMenuItem.Text = "Edit";
|
||||
this.editToolStripMenuItem.Visible = false;
|
||||
//
|
||||
// removeToolStripMenuItem
|
||||
//
|
||||
this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
|
||||
this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22);
|
||||
this.removeToolStripMenuItem.Text = "Remove";
|
||||
this.removeToolStripMenuItem.Visible = false;
|
||||
this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
this.menuStrip1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem,
|
||||
this.viewToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(20, 60);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(660, 24);
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.BackColor = System.Drawing.Color.Transparent;
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.importToolStripMenuItem1,
|
||||
this.saveToolStripMenuItem});
|
||||
this.fileToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
|
||||
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
|
||||
this.fileToolStripMenuItem.Text = "File";
|
||||
//
|
||||
// importToolStripMenuItem1
|
||||
//
|
||||
this.importToolStripMenuItem1.Name = "importToolStripMenuItem1";
|
||||
this.importToolStripMenuItem1.Size = new System.Drawing.Size(110, 22);
|
||||
this.importToolStripMenuItem1.Text = "Import";
|
||||
this.importToolStripMenuItem1.Click += new System.EventHandler(this.importToolStripMenuItem1_Click);
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
this.saveToolStripMenuItem.Size = new System.Drawing.Size(110, 22);
|
||||
this.saveToolStripMenuItem.Text = "Save";
|
||||
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
|
||||
//
|
||||
// viewToolStripMenuItem
|
||||
//
|
||||
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.showModelBoundsToolStripMenuItem});
|
||||
this.viewToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.viewToolStripMenuItem.Text = "View";
|
||||
//
|
||||
// showModelBoundsToolStripMenuItem
|
||||
//
|
||||
this.showModelBoundsToolStripMenuItem.CheckOnClick = true;
|
||||
this.showModelBoundsToolStripMenuItem.Name = "showModelBoundsToolStripMenuItem";
|
||||
this.showModelBoundsToolStripMenuItem.Size = new System.Drawing.Size(183, 22);
|
||||
this.showModelBoundsToolStripMenuItem.Text = "Show Model Bounds";
|
||||
this.showModelBoundsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.showModelBoundsToolStripMenuItem_CheckedChanged);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.modelViewport, 1, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.namedTexturesTreeView, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.modelTreeView, 0, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(20, 84);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 2;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 60F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 40F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(660, 446);
|
||||
this.tableLayoutPanel1.TabIndex = 2;
|
||||
//
|
||||
// modelViewport
|
||||
//
|
||||
this.modelViewport.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(30)))), ((int)(((byte)(30)))));
|
||||
this.modelViewport.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.modelViewport.Location = new System.Drawing.Point(296, 3);
|
||||
this.modelViewport.MouseSensetivity = 0.01F;
|
||||
this.modelViewport.Name = "modelViewport";
|
||||
this.modelViewport.RefreshRate = 120;
|
||||
this.modelViewport.RenderModelBounds = false;
|
||||
this.modelViewport.Size = new System.Drawing.Size(361, 261);
|
||||
this.modelViewport.TabIndex = 1;
|
||||
this.modelViewport.VSync = true;
|
||||
//
|
||||
// namedTexturesTreeView
|
||||
//
|
||||
this.namedTexturesTreeView.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
this.namedTexturesTreeView.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.namedTexturesTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.namedTexturesTreeView.ForeColor = System.Drawing.SystemColors.Window;
|
||||
this.namedTexturesTreeView.FullRowSelect = true;
|
||||
this.namedTexturesTreeView.HideSelection = false;
|
||||
this.namedTexturesTreeView.ImageIndex = 0;
|
||||
this.namedTexturesTreeView.ImageList = this.textureImageList;
|
||||
this.namedTexturesTreeView.Location = new System.Drawing.Point(296, 270);
|
||||
this.namedTexturesTreeView.Name = "namedTexturesTreeView";
|
||||
this.namedTexturesTreeView.SelectedImageIndex = 0;
|
||||
this.namedTexturesTreeView.ShowLines = false;
|
||||
this.namedTexturesTreeView.ShowPlusMinus = false;
|
||||
this.namedTexturesTreeView.ShowRootLines = false;
|
||||
this.namedTexturesTreeView.Size = new System.Drawing.Size(361, 173);
|
||||
this.namedTexturesTreeView.TabIndex = 2;
|
||||
this.namedTexturesTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.namedTexturesTreeView_AfterSelect);
|
||||
//
|
||||
// textureImageList
|
||||
//
|
||||
this.textureImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
|
||||
this.textureImageList.ImageSize = new System.Drawing.Size(36, 36);
|
||||
this.textureImageList.TransparentColor = System.Drawing.Color.Transparent;
|
||||
//
|
||||
// ModelEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(700, 550);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(700, 550);
|
||||
this.Name = "ModelEditor";
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Text = "Model Editor";
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.modelContextMenu.ResumeLayout(false);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TreeView modelTreeView;
|
||||
private MetroFramework.Controls.MetroContextMenu modelContextMenu;
|
||||
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
private Rendering.ModelRenderer modelViewport;
|
||||
private System.Windows.Forms.TreeView namedTexturesTreeView;
|
||||
private System.Windows.Forms.ImageList textureImageList;
|
||||
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem showModelBoundsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
342
PCK-Studio/Forms/Editor/ModelEditor.cs
Normal file
342
PCK-Studio/Forms/Editor/ModelEditor.cs
Normal file
@@ -0,0 +1,342 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using OMI.Formats.Model;
|
||||
using MetroFramework.Forms;
|
||||
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Interfaces;
|
||||
using OMI.Formats.Material;
|
||||
using PckStudio.ModelSupport;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Core;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
public partial class ModelEditor : EditorForm<ModelContainer>
|
||||
{
|
||||
private readonly ITryGetSet<string, Image> _textures;
|
||||
private readonly ITryGet<string, MaterialContainer.Material> _tryGetEntityMaterial;
|
||||
|
||||
public ModelEditor(ModelContainer models, ISaveContext<ModelContainer> saveContext, ITryGetSet<string, Image> tryGetSetTextures, ITryGet<string, MaterialContainer.Material> tryGetEntityMaterial)
|
||||
: base(models, saveContext)
|
||||
{
|
||||
InitializeComponent();
|
||||
_textures = tryGetSetTextures;
|
||||
_tryGetEntityMaterial = tryGetEntityMaterial;
|
||||
modelTreeView.ImageList = new ImageList
|
||||
{
|
||||
ColorDepth = ColorDepth.Depth32Bit,
|
||||
ImageSize = new Size(32, 32)
|
||||
};
|
||||
modelTreeView.ImageList.Images.AddRange(ApplicationScope.EntityImages);
|
||||
}
|
||||
|
||||
private const int InvalidImageIndex = 127;
|
||||
// TODO: move to json file. -miku
|
||||
private static Dictionary<string, int> ModelImageIndex = new Dictionary<string, int>()
|
||||
{
|
||||
["bat"] = 3,
|
||||
["blaze"] = 4,
|
||||
["boat"] = 5,
|
||||
["cat"] = 6,
|
||||
["spider"] = 107,
|
||||
["chicken"] = 9,
|
||||
["cod"] = 10,
|
||||
["cow"] = 12,
|
||||
["creeper"] = 13,
|
||||
["creeper_head"] = 13,
|
||||
["dolphin"] = 14,
|
||||
["horse.v2"] = 110,
|
||||
["guardian"] = 109,
|
||||
["bed"] = 108,
|
||||
["dragon"] = 21,
|
||||
["dragon_head"] = 21,
|
||||
["enderman"] = 23,
|
||||
["ghast"] = 34,
|
||||
["irongolem"] = 40,
|
||||
["lavaslime"] = 46,
|
||||
["llama"] = 44,
|
||||
["llamaspit"] = 45,
|
||||
["minecart"] = 47,
|
||||
["ocelot"] = 50,
|
||||
["parrot"] = 53,
|
||||
["phantom"] = 54,
|
||||
["pig"] = 55,
|
||||
["pigzombie"] = 94,
|
||||
["polarbear"] = 57,
|
||||
["rabbit"] = 60,
|
||||
["sheep"] = 63,
|
||||
["sheep.sheared"] = 113,
|
||||
["shulker"] = 64,
|
||||
["silverfish"] = 66,
|
||||
["skeleton"] = 67,
|
||||
["skeleton_head"] = 67,
|
||||
["skeleton.stray"] = 77,
|
||||
["skeleton.wither"] = 89,
|
||||
["skeleton_wither_head"] = 89,
|
||||
["slime"] = 115,
|
||||
["slime.armor"] = 116,
|
||||
|
||||
["snowgolem"] = 71,
|
||||
["squid"] = 76,
|
||||
["trident"] = 80,
|
||||
["turtle"] = 82,
|
||||
["villager"] = 84,
|
||||
["villager.witch"] = 87,
|
||||
|
||||
["vex"] = 83,
|
||||
["evoker"] = 25,
|
||||
["vindicator"] = 25,
|
||||
["witherBoss"] = 88,
|
||||
["wolf"] = 91,
|
||||
["zombie"] = 92,
|
||||
["zombie_head"] = 92,
|
||||
["zombie.husk"] = 39,
|
||||
["zombie.villager"] = 95,
|
||||
["zombie.drowned"] = 17,
|
||||
["endermite"] = 24,
|
||||
["pufferfish.small"] = 111,
|
||||
["pufferfish.mid"] = 112,
|
||||
["pufferfish.large"] = 59,
|
||||
["salmon"] = 62,
|
||||
["stray.armor"] = 118,
|
||||
["stray_armor"] = 118,
|
||||
["tropicalfish_a"] = 81,
|
||||
["tropicalfish_b"] = 81,
|
||||
["mooshroom"] = 48,
|
||||
["witherBoss.armor"] = 90,
|
||||
|
||||
// 1.14 models
|
||||
["panda"] = 52,
|
||||
["ravager"] = 61,
|
||||
["pillager"] = 56,
|
||||
["villager_v2"] = 101,
|
||||
["zombie.villager_v2"] = 102,
|
||||
};
|
||||
|
||||
private static int GetModelImageIndex(string name) => ModelImageIndex.TryGetValue(name, out int index) ? index : InvalidImageIndex;
|
||||
|
||||
private class ModelNode : TreeNode
|
||||
{
|
||||
private Model _model;
|
||||
public Model Model => _model;
|
||||
|
||||
private ModelNode(Model model)
|
||||
: base(model.Name)
|
||||
{
|
||||
_model = model;
|
||||
ImageIndex = GetModelImageIndex(model.Name);
|
||||
SelectedImageIndex = GetModelImageIndex(model.Name);
|
||||
Nodes.AddRange(GetModelPartNodes(_model.GetParts()).ToArray());
|
||||
}
|
||||
private static IEnumerable<TreeNode> GetModelPartNodes(IEnumerable<ModelPart> parts) => parts.Select(ModelPartNode.Create);
|
||||
|
||||
internal static ModelNode Create(Model model) => new ModelNode(model);
|
||||
}
|
||||
|
||||
private class ModelPartNode : TreeNode
|
||||
{
|
||||
private ModelPart _part;
|
||||
|
||||
public ModelPart Part => _part;
|
||||
|
||||
private ModelPartNode(ModelPart part)
|
||||
: base($"{part.Name} Pivot:{part.Translation * -1} Rot:{part.Rotation + part.AdditionalRotation} ")
|
||||
{
|
||||
_part = part;
|
||||
ImageIndex = 126;
|
||||
SelectedImageIndex = 126;
|
||||
Nodes.AddRange(GetModelBoxNodes(part.GetBoxes()).ToArray());
|
||||
}
|
||||
private static IEnumerable<TreeNode> GetModelBoxNodes(IEnumerable<ModelBox> boxes) => boxes.Select(ModelBoxNode.Create);
|
||||
|
||||
internal static ModelPartNode Create(ModelPart part) => new ModelPartNode(part);
|
||||
}
|
||||
|
||||
private class ModelBoxNode : TreeNode
|
||||
{
|
||||
private ModelBox _modelBox;
|
||||
public ModelBox Box => _modelBox;
|
||||
private ModelBoxNode(ModelBox modelBox)
|
||||
: base($"Box: pos:{modelBox.Position} size:{modelBox.Size}")
|
||||
{
|
||||
ImageIndex = 126;
|
||||
SelectedImageIndex = 126;
|
||||
_modelBox = modelBox;
|
||||
}
|
||||
|
||||
internal static ModelBoxNode Create(ModelBox modelBox) => new ModelBoxNode(modelBox);
|
||||
}
|
||||
|
||||
private class NamedTextureTreeNode : TreeNode
|
||||
{
|
||||
private readonly NamedData<Image> _namedTexture;
|
||||
|
||||
public NamedTextureTreeNode(NamedData<Image> namedTexture)
|
||||
: base(namedTexture.Name)
|
||||
{
|
||||
Tag = namedTexture;
|
||||
_namedTexture = namedTexture;
|
||||
}
|
||||
|
||||
public Image GetTexture() => _namedTexture.Value;
|
||||
}
|
||||
|
||||
private void LoadModels()
|
||||
{
|
||||
modelTreeView.Nodes.Clear();
|
||||
modelTreeView.Nodes.AddRange(EditorValue.Select(ModelNode.Create).ToArray());
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
LoadModels();
|
||||
}
|
||||
|
||||
private void exportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (modelTreeView.SelectedNode is ModelNode modelNode)
|
||||
{
|
||||
Model model = modelNode.Model;
|
||||
Debug.Write(model.Name + "; ");
|
||||
Debug.WriteLine(model.TextureSize);
|
||||
|
||||
GameModelImporter.Default.ExportSettings.CreateModelOutline =
|
||||
MessageBox.Show(
|
||||
$"Do you wish to have all model parts contained in a group called '{model.Name}'?",
|
||||
"Group model parts", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
|
||||
|
||||
using SaveFileDialog openFileDialog = new SaveFileDialog();
|
||||
openFileDialog.FileName = model.Name;
|
||||
openFileDialog.Filter = GameModelImporter.Default.SupportedModelFileFormatsFilter;
|
||||
|
||||
if (openFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
IEnumerable<NamedData<Image>> textures = GetModelTextures(model.Name);
|
||||
var modelInfo = new GameModelInfo(model, textures);
|
||||
GameModelImporter.Default.Export(openFileDialog.FileName, modelInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void modelTreeView_BeforeSelect(object sender, TreeViewCancelEventArgs e)
|
||||
{
|
||||
exportToolStripMenuItem.Visible = e.Node is ModelNode;
|
||||
removeToolStripMenuItem.Visible = e.Node is ModelNode;
|
||||
editToolStripMenuItem.Visible = e.Node is ModelBoxNode;
|
||||
//removeToolStripMenuItem.Visible = e.Node is ModelPartNode || e.Node is ModelBoxNode;
|
||||
if (e.Node is ModelNode modelNode && modelNode.Model.Name != modelViewport.CurrentModelName)
|
||||
{
|
||||
NamedData<Image>[] textures = GetModelTextures(modelNode.Model.Name).ToArray();
|
||||
|
||||
textureImageList.Images.Clear();
|
||||
namedTexturesTreeView.Nodes.Clear();
|
||||
|
||||
foreach ((int i, NamedData<Image> item) in textures.enumerate())
|
||||
{
|
||||
textureImageList.Images.Add(item.Value);
|
||||
namedTexturesTreeView.Nodes.Add(new NamedTextureTreeNode(item) { ImageIndex = i, SelectedImageIndex = i });
|
||||
}
|
||||
if (textures.Length != 0)
|
||||
modelViewport.Texture = textures[0].Value;
|
||||
|
||||
modelViewport.LoadModel(modelNode.Model);
|
||||
if (GameModelImporter.ModelMetaData.TryGetValue(modelNode.Model.Name, out JsonModelMetaData modelMetaData) && !string.IsNullOrEmpty(modelMetaData.MaterialName) &&
|
||||
_tryGetEntityMaterial.TryGet(modelMetaData.MaterialName, out MaterialContainer.Material entityMaterial) ||
|
||||
_tryGetEntityMaterial.TryGet(modelNode.Model.Name, out entityMaterial))
|
||||
{
|
||||
modelViewport.SetModelMaterial(entityMaterial);
|
||||
}
|
||||
modelViewport.ResetCamera();
|
||||
}
|
||||
if (e.Node is ModelPartNode modelPartNode && modelPartNode.Parent is ModelNode parentNode && modelViewport.CurrentModelName == parentNode.Model.Name)
|
||||
{
|
||||
modelViewport.Highlight(modelPartNode.Part);
|
||||
}
|
||||
|
||||
if (e.Node is ModelBoxNode modelBoxNode && modelBoxNode.Parent is ModelPartNode parentPartNode && parentPartNode.Parent is ModelNode parentNode1 &&
|
||||
modelViewport.CurrentModelName == parentNode1.Model.Name)
|
||||
{
|
||||
modelViewport.Highlight(modelBoxNode.Box, parentPartNode.Part);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<NamedData<Image>> GetModelTextures(string modelName)
|
||||
{
|
||||
if (!GameModelImporter.ModelMetaData.ContainsKey(modelName) || GameModelImporter.ModelMetaData[modelName]?.TextureLocations?.Length <= 0)
|
||||
yield break;
|
||||
foreach (var textureLocation in GameModelImporter.ModelMetaData[modelName].TextureLocations)
|
||||
{
|
||||
if (_textures.TryGet(textureLocation, out Image img))
|
||||
yield return new NamedData<Image>(Path.GetFileName(textureLocation), img);
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
|
||||
private void importToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog fileDialog = new OpenFileDialog();
|
||||
fileDialog.Filter = GameModelImporter.Default.SupportedModelFileFormatsFilter;
|
||||
fileDialog.Title = "Select model";
|
||||
if (fileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
GameModelInfo modelInfo = GameModelImporter.Default.Import(fileDialog.FileName);
|
||||
if (modelInfo is null)
|
||||
{
|
||||
MessageBox.Show("Import failed.", ProductName);
|
||||
return;
|
||||
}
|
||||
|
||||
//if (models.Version < modelInfo.ModelVersion)
|
||||
//{
|
||||
// MessageBox.Show("Model container version does not match with the model version.", ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
// return;
|
||||
//}
|
||||
|
||||
EditorValue.SetModel(modelInfo.Model);
|
||||
|
||||
foreach (NamedData<Image> texture in modelInfo.Textures)
|
||||
{
|
||||
_textures.TrySet(texture.Name, texture.Value);
|
||||
}
|
||||
|
||||
LoadModels();
|
||||
}
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void namedTexturesTreeView_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
if (namedTexturesTreeView.SelectedNode is NamedTextureTreeNode namedTextureNode)
|
||||
modelViewport.Texture = namedTextureNode.GetTexture();
|
||||
}
|
||||
|
||||
private void showModelBoundsToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
modelViewport.RenderModelBounds = showModelBoundsToolStripMenuItem.Checked;
|
||||
}
|
||||
|
||||
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (modelTreeView?.SelectedNode is ModelNode modelNode && EditorValue.Remove(modelNode.Model))
|
||||
{
|
||||
modelNode.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
129
PCK-Studio/Forms/Editor/ModelEditor.resx
Normal file
129
PCK-Studio/Forms/Editor/ModelEditor.resx
Normal file
@@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="modelContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>178, 17</value>
|
||||
</metadata>
|
||||
<metadata name="textureImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>293, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -36,6 +36,7 @@
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.applyColorMaskToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.playAnimationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.allowGroupsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.originalPictureBox = new PckStudio.ToolboxItems.InterpolationPictureBox();
|
||||
this.selectTilePictureBox = new PckStudio.ToolboxItems.AnimationPictureBox();
|
||||
@@ -102,7 +103,8 @@
|
||||
//
|
||||
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.applyColorMaskToolStripMenuItem,
|
||||
this.playAnimationsToolStripMenuItem});
|
||||
this.playAnimationsToolStripMenuItem,
|
||||
this.allowGroupsToolStripMenuItem});
|
||||
this.viewToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
@@ -114,7 +116,7 @@
|
||||
this.applyColorMaskToolStripMenuItem.CheckOnClick = true;
|
||||
this.applyColorMaskToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.applyColorMaskToolStripMenuItem.Name = "applyColorMaskToolStripMenuItem";
|
||||
this.applyColorMaskToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
||||
this.applyColorMaskToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.applyColorMaskToolStripMenuItem.Text = "Apply Color Mask";
|
||||
this.applyColorMaskToolStripMenuItem.CheckedChanged += new System.EventHandler(this.applyColorMaskToolStripMenuItem_CheckedChanged);
|
||||
//
|
||||
@@ -124,10 +126,20 @@
|
||||
this.playAnimationsToolStripMenuItem.CheckOnClick = true;
|
||||
this.playAnimationsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.playAnimationsToolStripMenuItem.Name = "playAnimationsToolStripMenuItem";
|
||||
this.playAnimationsToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
||||
this.playAnimationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.playAnimationsToolStripMenuItem.Text = "Play Animations";
|
||||
this.playAnimationsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.playAnimationsToolStripMenuItem_CheckedChanged);
|
||||
//
|
||||
// allowGroupsToolStripMenuItem
|
||||
//
|
||||
this.allowGroupsToolStripMenuItem.Checked = true;
|
||||
this.allowGroupsToolStripMenuItem.CheckOnClick = true;
|
||||
this.allowGroupsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.allowGroupsToolStripMenuItem.Name = "allowGroupsToolStripMenuItem";
|
||||
this.allowGroupsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.allowGroupsToolStripMenuItem.Text = "Allow Groups";
|
||||
this.allowGroupsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.allowGroupsToolStripMenuItem_CheckedChanged);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
@@ -171,6 +183,7 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.originalPictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.originalPictureBox.BackgroundInterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.originalPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.originalPictureBox.Location = new System.Drawing.Point(217, 3);
|
||||
this.originalPictureBox.Name = "originalPictureBox";
|
||||
@@ -187,8 +200,9 @@
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectTilePictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.selectTilePictureBox.BackgroundInterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.selectTilePictureBox.BlendColor = System.Drawing.Color.White;
|
||||
this.selectTilePictureBox.BlendMode = PckStudio.Extensions.BlendMode.Multiply;
|
||||
this.selectTilePictureBox.BlendMode = PckStudio.Core.Extensions.BlendMode.Multiply;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.selectTilePictureBox, 2);
|
||||
this.selectTilePictureBox.Image = null;
|
||||
this.selectTilePictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
@@ -384,5 +398,6 @@
|
||||
private MetroFramework.Controls.MetroTrackBar colorSlider;
|
||||
private MetroFramework.Controls.MetroLabel colorSliderLabel;
|
||||
private MetroFramework.Controls.MetroButton extractButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem allowGroupsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2023-present miku-666, MattNL
|
||||
/* Copyright (c) 2023-present miku-666, MayNL
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
@@ -21,53 +21,61 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using MetroFramework.Forms;
|
||||
|
||||
using OMI.Formats.Color;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Color;
|
||||
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Controls;
|
||||
using PckStudio.Core;
|
||||
using PckStudio.Core.Extensions;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Interfaces;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Internal.Deserializer;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Internal.Serializer;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Forms.Editor
|
||||
{
|
||||
internal partial class TextureAtlasEditor : MetroForm
|
||||
internal partial class TextureAtlasEditor : EditorForm<Atlas>
|
||||
{
|
||||
private Image _atlasTexture;
|
||||
public Image FinalTexture => DialogResult == DialogResult.OK ? _atlasTexture : null;
|
||||
|
||||
private readonly PckFile _pckFile;
|
||||
private ColorContainer _colourTable;
|
||||
private readonly Size _tileAreaSize;
|
||||
private readonly int _rowCount;
|
||||
private readonly int _columnCount;
|
||||
private readonly ResourceLocation _resourceLocation;
|
||||
private readonly List<AtlasTile> _tiles;
|
||||
private readonly ITryGet<string, Animation> _tryGetAnimation;
|
||||
private readonly ITryGet<string, ISaveContext<Animation>> _tryGetAnimationSaveContext;
|
||||
private readonly ColorContainer _colourTable;
|
||||
private readonly ResourceCategory _resourceLocationCategory;
|
||||
private readonly Atlas _atlas;
|
||||
|
||||
private AtlasTile _selectedTile;
|
||||
// the "parent" tile for tiles that share name; i.e. parts of water_flow
|
||||
private AtlasTile dataTile;
|
||||
|
||||
private sealed class AtlasTile
|
||||
public TextureAtlasEditor(Atlas atlas, ISaveContext<Atlas> saveContext, ResourceLocation resourceLocation, ColorContainer colorContainer,
|
||||
ITryGet<string, Animation> tryGetAnimation, ITryGet<string, ISaveContext<Animation>> tryGetAnimationSaveContext)
|
||||
: base(atlas, saveContext)
|
||||
{
|
||||
internal readonly int Index;
|
||||
internal readonly Rectangle Area;
|
||||
internal readonly JsonTileInfo Tile;
|
||||
internal readonly Image Texture;
|
||||
InitializeComponent();
|
||||
|
||||
public AtlasTile(int index, Rectangle area, JsonTileInfo tile, Image texture)
|
||||
_ = atlas ?? throw new ArgumentNullException(nameof(atlas));
|
||||
_ = resourceLocation ?? throw new ArgumentNullException(nameof(resourceLocation));
|
||||
_atlas = atlas;
|
||||
Text = _atlas.Name;
|
||||
originalPictureBox.Image = atlas;
|
||||
|
||||
_colourTable = colorContainer ?? AppResourceManager.Default.GetData(Resources.tu69colours, new COLFileReader());
|
||||
_tryGetAnimation = tryGetAnimation;
|
||||
_tryGetAnimationSaveContext = tryGetAnimationSaveContext;
|
||||
_resourceLocationCategory = resourceLocation.Category;
|
||||
|
||||
SelectedIndex = 0;
|
||||
|
||||
animationButton.Enabled =
|
||||
_resourceLocationCategory == ResourceCategory.BlockAtlas ||
|
||||
_resourceLocationCategory == ResourceCategory.ItemAtlas;
|
||||
|
||||
// this is directly based on Java's source code for handling enchanted hits
|
||||
// the particle is assigned a random grayscale color between roughly 154 and 230
|
||||
// since critical hit is the only particle with this distinction, we just need to check the atlas type
|
||||
if (_resourceLocationCategory == ResourceCategory.ParticleAtlas)
|
||||
{
|
||||
Index = index;
|
||||
Area = area;
|
||||
Tile = tile;
|
||||
Texture = texture;
|
||||
colorSlider.Minimum = 154;
|
||||
colorSlider.Maximum = 230;
|
||||
colorSlider.Value = colorSlider.Maximum;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,11 +84,11 @@ namespace PckStudio.Forms.Editor
|
||||
set {
|
||||
if (value < 0)
|
||||
{
|
||||
value += _tiles.Count;
|
||||
value += _atlas.TileCount;
|
||||
}
|
||||
else if (value >= _tiles.Count)
|
||||
else if (value >= _atlas.TileCount)
|
||||
{
|
||||
value -= _tiles.Count;
|
||||
value -= _atlas.TileCount;
|
||||
}
|
||||
SetImageDisplayed(value);
|
||||
}
|
||||
@@ -94,104 +102,18 @@ namespace PckStudio.Forms.Editor
|
||||
PixelOffsetMode = PixelOffsetMode.HighQuality
|
||||
};
|
||||
|
||||
public TextureAtlasEditor(PckFile pckFile, ResourceLocation resourceLocation, Image atlas)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (!AcquireColorTable(pckFile))
|
||||
{
|
||||
MessageBox.Show("Failed to acquire color information", "Acquire failure", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
|
||||
return;
|
||||
}
|
||||
|
||||
_atlasTexture = atlas;
|
||||
_tileAreaSize = resourceLocation.GetTileArea(atlas.Size);
|
||||
_pckFile = pckFile;
|
||||
_rowCount = atlas.Width / _tileAreaSize.Width;
|
||||
_columnCount = atlas.Height / _tileAreaSize.Height;
|
||||
_resourceLocation = resourceLocation;
|
||||
List<JsonTileInfo> tileInfos = resourceLocation.Category switch
|
||||
{
|
||||
ResourceCategory.BlockAtlas => Tiles.BlockTileInfos,
|
||||
ResourceCategory.ItemAtlas => Tiles.ItemTileInfos,
|
||||
ResourceCategory.ParticleAtlas => Tiles.ParticleTileInfos,
|
||||
ResourceCategory.MapIconAtlas => Tiles.MapIconTileInfos,
|
||||
ResourceCategory.AdditionalMapIconsAtlas => Tiles.AdditionalMapIconTileInfos,
|
||||
ResourceCategory.MoonPhaseAtlas => Tiles.MoonPhaseTileInfos,
|
||||
ResourceCategory.ExperienceOrbAtlas => Tiles.ExperienceOrbTileInfos,
|
||||
ResourceCategory.ExplosionAtlas => Tiles.ExplosionTileInfos,
|
||||
ResourceCategory.PaintingAtlas => Tiles.PaintingTileInfos,
|
||||
ResourceCategory.BannerAtlas => Tiles.BannerTileInfos,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
originalPictureBox.Image = new Bitmap(atlas);
|
||||
|
||||
IEnumerable<Image> images = atlas.Split(_tileAreaSize, _imageLayout);
|
||||
|
||||
AtlasTile MakeTile((int index, Image value) p)
|
||||
{
|
||||
int i = p.index;
|
||||
JsonTileInfo tileInfo = tileInfos.IndexInRange(i) ? tileInfos[i] : null;
|
||||
|
||||
Rectangle atlasArea = GetAtlasArea(i, tileInfo?.TileWidth ?? 1, tileInfo?.TileHeight ?? 1, _rowCount, _columnCount, _tileAreaSize, _imageLayout);
|
||||
|
||||
// get texture for tiles that are not 1x1 tiles
|
||||
Point selectedPoint = GetSelectedPoint(i, _rowCount, _columnCount, _imageLayout);
|
||||
|
||||
var textureLocation = new Point(selectedPoint.X * _tileAreaSize.Width, selectedPoint.Y * _tileAreaSize.Height);
|
||||
var textureSize = new Size(tileInfos[i].TileWidth * _tileAreaSize.Width, tileInfos[i].TileHeight * _tileAreaSize.Height);
|
||||
var textureArea = new Rectangle(textureLocation, textureSize);
|
||||
|
||||
Image texture = tileInfos.IndexInRange(i) ? atlas.GetArea(textureArea) : p.value;
|
||||
return new AtlasTile(i, atlasArea, tileInfo, texture);
|
||||
}
|
||||
|
||||
_tiles = new List<AtlasTile>(images.enumerate().Select(MakeTile));
|
||||
|
||||
SelectedIndex = 0;
|
||||
|
||||
animationButton.Enabled =
|
||||
_resourceLocation.Category == ResourceCategory.BlockAtlas ||
|
||||
_resourceLocation.Category == ResourceCategory.ItemAtlas;
|
||||
|
||||
// this is directly based on Java's source code for handling enchanted hits
|
||||
// the particle is assigned a random grayscale color between roughly 154 and 230
|
||||
// since critical hit is the only particle with this distinction, we just need to check the atlas type
|
||||
if (_resourceLocation.Category == ResourceCategory.ParticleAtlas)
|
||||
{
|
||||
colorSlider.Minimum = 154;
|
||||
colorSlider.Maximum = 230;
|
||||
colorSlider.Value = colorSlider.Maximum;
|
||||
}
|
||||
}
|
||||
|
||||
private bool AcquireColorTable(PckFile pckFile)
|
||||
{
|
||||
if (pckFile.TryGetAsset("colours.col", PckAssetType.ColourTableFile, out PckAsset colAsset) &&
|
||||
colAsset.Size > 0)
|
||||
{
|
||||
using var ms = new MemoryStream(colAsset.Data);
|
||||
var reader = new COLFileReader();
|
||||
_colourTable = reader.FromStream(ms);
|
||||
return true;
|
||||
}
|
||||
_colourTable = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void UpdateAtlasDisplay()
|
||||
{
|
||||
using (var g = Graphics.FromImage(originalPictureBox.Image))
|
||||
{
|
||||
g.ApplyConfig(_graphicsConfig);
|
||||
g.Clear(Color.Transparent);
|
||||
g.DrawImage(_atlasTexture, 0, 0, _atlasTexture.Width, _atlasTexture.Height);
|
||||
Image image = EditorValue;
|
||||
g.DrawImage(image, 0, 0, image.Width, image.Height);
|
||||
|
||||
SolidBrush brush = new SolidBrush(Color.FromArgb(127, Color.White));
|
||||
g.FillRectangle(brush, _selectedTile.Area);
|
||||
g.FillRectangle(brush, allowGroupsToolStripMenuItem.Checked ? _atlas.GetTileArea(_selectedTile) : _selectedTile.GetArea(_atlas.TileSize));
|
||||
}
|
||||
|
||||
originalPictureBox.Invalidate();
|
||||
}
|
||||
|
||||
@@ -213,51 +135,42 @@ namespace PckStudio.Forms.Editor
|
||||
selectTilePictureBox.Stop();
|
||||
selectTilePictureBox.UseBlendColor = false;
|
||||
selectTilePictureBox.Image = null;
|
||||
_selectedTile = _atlas[index];
|
||||
|
||||
if (_tiles is null || !_tiles.IndexInRange(index) || (_selectedTile = _tiles[index]) is null)
|
||||
if (_selectedTile is null)
|
||||
return;
|
||||
|
||||
UpdateAtlasDisplay();
|
||||
|
||||
dataTile = _selectedTile;
|
||||
if (string.IsNullOrEmpty(dataTile.Tile.DisplayName) && !string.IsNullOrEmpty(dataTile.Tile.InternalName))
|
||||
{
|
||||
dataTile = _tiles.Find(t => t.Tile.InternalName == _selectedTile.Tile.InternalName);
|
||||
}
|
||||
|
||||
selectTilePictureBox.Image = dataTile.Texture;
|
||||
selectTilePictureBox.Image = _selectedTile.Texture;
|
||||
selectTilePictureBox.BlendColor = GetBlendColor();
|
||||
selectTilePictureBox.UseBlendColor = applyColorMaskToolStripMenuItem.Checked;
|
||||
|
||||
tileNameLabel.Text = $"{dataTile.Tile.DisplayName}";
|
||||
internalTileNameLabel.Text = $"{dataTile.Tile.InternalName}";
|
||||
JsonTileInfo tileInfo = _selectedTile.GetUserDataOfType<JsonTileInfo>();
|
||||
|
||||
if (animationButton.Enabled)
|
||||
tileNameLabel.Text = $"{tileInfo?.DisplayName}";
|
||||
internalTileNameLabel.Text = $"{tileInfo?.InternalName}";
|
||||
if (animationButton.Enabled && (_resourceLocationCategory == ResourceCategory.ItemAtlas || _resourceLocationCategory == ResourceCategory.BlockAtlas))
|
||||
{
|
||||
PckAsset animationAsset;
|
||||
ResourceCategory animationResourceCategory = _resourceLocation.Category == ResourceCategory.ItemAtlas ? ResourceCategory.ItemAnimation : ResourceCategory.BlockAnimation;
|
||||
ResourceCategory animationResourceCategory = _resourceLocationCategory == ResourceCategory.ItemAtlas ? ResourceCategory.ItemAnimation : ResourceCategory.BlockAnimation;
|
||||
|
||||
string animationAssetPath = $"{ResourceLocation.GetPathFromCategory(animationResourceCategory)}/{dataTile.Tile.InternalName}";
|
||||
bool hasAnimation =
|
||||
_pckFile.TryGetValue($"{animationAssetPath}.png", PckAssetType.TextureFile, out animationAsset) ||
|
||||
_pckFile.TryGetValue($"{animationAssetPath}.tga", PckAssetType.TextureFile, out animationAsset);
|
||||
string animationAssetPath = $"{ResourceLocation.GetPathFromCategory(animationResourceCategory)}/{tileInfo.InternalName}";
|
||||
bool hasAnimation = _tryGetAnimation.TryGet(animationAssetPath, out Animation animation);
|
||||
animationButton.Text = hasAnimation ? "Edit Animation" : "Create Animation";
|
||||
|
||||
// asset size check dont have to be done here the deserializer handles it. -Miku
|
||||
if (playAnimationsToolStripMenuItem.Checked && hasAnimation)
|
||||
{
|
||||
Animation animation = animationAsset.GetDeserializedData(AnimationDeserializer.DefaultDeserializer);
|
||||
selectTilePictureBox.Image = animation.CreateAnimationImage();
|
||||
selectTilePictureBox.Image = animation.CreateAnimationImage(selectTilePictureBox.BlendColor);
|
||||
selectTilePictureBox.Start();
|
||||
}
|
||||
}
|
||||
|
||||
setColorButton.Enabled = dataTile.Tile.AllowCustomColour;
|
||||
setColorButton.Enabled = tileInfo.HasColourEntry;
|
||||
|
||||
variantComboBox.Enabled = variantComboBox.Visible = dataTile.Tile.HasColourEntry && dataTile.Tile.ColourEntry?.Variants?.Length > 1;
|
||||
variantComboBox.Enabled = variantComboBox.Visible = tileInfo.HasColourEntry && tileInfo.ColourEntry?.Variants?.Length > 1;
|
||||
if (variantComboBox.Enabled)
|
||||
{
|
||||
if (dataTile.Tile.ColourEntry.IsWaterColour)
|
||||
if (tileInfo.ColourEntry.IsWaterColour)
|
||||
{
|
||||
foreach (ColorContainer.WaterColor col in _colourTable.WaterColors)
|
||||
{
|
||||
@@ -267,11 +180,34 @@ namespace PckStudio.Forms.Editor
|
||||
}
|
||||
|
||||
// TODO: only add variants that are available in the color table
|
||||
variantComboBox.Items.AddRange(dataTile.Tile.ColourEntry.Variants);
|
||||
variantComboBox.Items.AddRange(tileInfo.ColourEntry.Variants.Where(colorName => _colourTable.Colors.Any(c => c.Name == colorName) || _colourTable.WaterColors.Any(c => c.Name == colorName)).ToArray());
|
||||
|
||||
if (variantComboBox.Items.Count > 0)
|
||||
variantComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
if (_selectedTile.IsPartOfGroup && allowGroupsToolStripMenuItem.Checked)
|
||||
{
|
||||
AtlasGroup group = _selectedTile.GetGroup();
|
||||
tileNameLabel.Text = $"{group.Name}";
|
||||
internalTileNameLabel.Text = string.Empty;
|
||||
if (group.IsAnimation())
|
||||
{
|
||||
animationButton.Enabled = true;
|
||||
animationButton.Text = "Edit as Animation";
|
||||
if (playAnimationsToolStripMenuItem.Checked)
|
||||
{
|
||||
selectTilePictureBox.UseBlendColor = false;
|
||||
selectTilePictureBox.Image = _atlas.GetAnimationFromGroup(group).CreateAnimationImage(selectTilePictureBox.BlendColor);
|
||||
selectTilePictureBox.Start();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (group.IsLargeTile())
|
||||
{
|
||||
selectTilePictureBox.Image = _atlas.GetTileTexture(_selectedTile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int GetSelectedImageIndex(
|
||||
@@ -344,6 +280,7 @@ namespace PckStudio.Forms.Editor
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Debug.WriteLine(result);
|
||||
return GetSelectedIndex(result.X, result.Y, rowCount, columnCount, imageLayout);
|
||||
}
|
||||
|
||||
@@ -357,47 +294,31 @@ namespace PckStudio.Forms.Editor
|
||||
};
|
||||
}
|
||||
|
||||
private static Rectangle GetAtlasArea(int index, int tileWidth, int tileHeight, int rowCount, int columnCount, Size size, ImageLayoutDirection imageLayout)
|
||||
{
|
||||
Point p = GetSelectedPoint(index, rowCount, columnCount, imageLayout);
|
||||
var ap = new Point(p.X * size.Width, p.Y * size.Height);
|
||||
return new Rectangle(ap, new Size(size.Width * tileWidth, size.Height * tileHeight));
|
||||
}
|
||||
|
||||
private static Point GetSelectedPoint(int index, int rowCount, int columnCount, ImageLayoutDirection imageLayout)
|
||||
{
|
||||
int y = Math.DivRem(index, rowCount, out int x);
|
||||
if (imageLayout == ImageLayoutDirection.Vertical)
|
||||
x = Math.DivRem(index, columnCount, out y);
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
private void SetTile(Image texture)
|
||||
{
|
||||
if (texture.Size != _tileAreaSize)
|
||||
texture = texture.Resize(_tileAreaSize, _graphicsConfig);
|
||||
|
||||
using (var g = Graphics.FromImage(_atlasTexture))
|
||||
if (_selectedTile.IsPartOfGroup)
|
||||
{
|
||||
g.ApplyConfig(_graphicsConfig);
|
||||
g.Fill(dataTile.Area, Color.Transparent);
|
||||
g.DrawImage(texture, dataTile.Area);
|
||||
AtlasGroup group = _selectedTile.GetGroup();
|
||||
_atlas.SetGroup(group, texture);
|
||||
selectTilePictureBox.Image = _atlas.GetTileTexture(_selectedTile);
|
||||
UpdateAtlasDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
AtlasTile tile = _selectedTile != dataTile ? dataTile : _selectedTile;
|
||||
_tiles[tile.Index] = new AtlasTile(tile.Index, tile.Area, tile.Tile, texture);
|
||||
if (texture.Size != _atlas.TileSize)
|
||||
texture = texture.Resize(_atlas.TileSize, _graphicsConfig);
|
||||
|
||||
_selectedTile.Texture = texture;
|
||||
selectTilePictureBox.Image = texture;
|
||||
UpdateAtlasDisplay();
|
||||
}
|
||||
|
||||
private Color GetBlendColor()
|
||||
{
|
||||
if (dataTile.Tile.HasColourEntry && dataTile.Tile.ColourEntry is not null)
|
||||
if (_selectedTile.TryGetUserDataOfType(out JsonTileInfo tileInfo) && tileInfo.HasColourEntry)
|
||||
{
|
||||
Color col = FindBlendColorByKey(dataTile.Tile.ColourEntry.DefaultName);
|
||||
return col;
|
||||
return FindBlendColorByKey(tileInfo.ColourEntry.DefaultName);
|
||||
}
|
||||
|
||||
return Color.White;
|
||||
}
|
||||
|
||||
@@ -413,7 +334,7 @@ namespace PckStudio.Forms.Editor
|
||||
var final_color = Color.FromArgb(colorSlider.Value, colorSlider.Value, colorSlider.Value);
|
||||
|
||||
// Enchanted hits are modified critical hit particles
|
||||
if (dataTile.Tile.InternalName == "enchanted_hit")
|
||||
if (_selectedTile.TryGetUserDataOfType(out JsonTileInfo tileInfo) && tileInfo.InternalName == "enchanted_hit")
|
||||
{
|
||||
// This is directly based on Java's source code for handling enchanted hits
|
||||
// it just multiplies the red by 0.3 and green by .8 of the color assigned to the critical hit particle
|
||||
@@ -428,28 +349,36 @@ namespace PckStudio.Forms.Editor
|
||||
if (colorKey == "experience_orb" || colorKey == "critical_hit")
|
||||
return GetSpecificBlendColor(colorKey);
|
||||
|
||||
if (dataTile.Tile.HasColourEntry && dataTile.Tile.ColourEntry is not null)
|
||||
if (!_selectedTile.TryGetUserDataOfType(out JsonTileInfo tileInfo) || !tileInfo.HasColourEntry)
|
||||
{
|
||||
// basic way to check for classic water colors
|
||||
if(!dataTile.Tile.ColourEntry.IsWaterColour || colorKey.StartsWith("Water_"))
|
||||
Debug.WriteLine("Could not find: " + colorKey);
|
||||
return Color.White;
|
||||
}
|
||||
|
||||
// basic way to check for classic water colors
|
||||
if (!tileInfo.ColourEntry.IsWaterColour || colorKey.StartsWith("Water_"))
|
||||
{
|
||||
if (_colourTable.Colors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.Color color)
|
||||
{
|
||||
if (_colourTable.Colors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.Color color)
|
||||
{
|
||||
return color.ColorPallette;
|
||||
}
|
||||
}
|
||||
else if (_colourTable.WaterColors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.WaterColor waterColor)
|
||||
{
|
||||
return waterColor.SurfaceColor;
|
||||
return color.ColorPallette;
|
||||
}
|
||||
}
|
||||
else if (_colourTable.WaterColors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.WaterColor waterColor)
|
||||
{
|
||||
return waterColor.SurfaceColor;
|
||||
}
|
||||
|
||||
Debug.WriteLine("Could not find: " + colorKey);
|
||||
return Color.White;
|
||||
}
|
||||
|
||||
// TODO(null): check for large tile and get skip length
|
||||
protected override bool ProcessDialogKey(Keys keyData)
|
||||
{
|
||||
int up = -_atlas.Rows;
|
||||
int down = _atlas.Rows;
|
||||
int left = -1;
|
||||
int right = 1;
|
||||
switch (keyData)
|
||||
{
|
||||
case Keys.R:
|
||||
@@ -457,16 +386,16 @@ namespace PckStudio.Forms.Editor
|
||||
SelectedIndex = _selectedTile.Index;
|
||||
return true;
|
||||
case Keys.Left:
|
||||
SelectedIndex = _selectedTile.Index - 1;
|
||||
SelectedIndex = _selectedTile.Index + left;
|
||||
return true;
|
||||
case Keys.Right:
|
||||
SelectedIndex = _selectedTile.Index + 1;
|
||||
SelectedIndex = _selectedTile.Index + right;
|
||||
return true;
|
||||
case Keys.Up:
|
||||
SelectedIndex = _selectedTile.Index - _rowCount;
|
||||
SelectedIndex = _selectedTile.Index + up;
|
||||
return true;
|
||||
case Keys.Down:
|
||||
SelectedIndex = _selectedTile.Index + _rowCount;
|
||||
SelectedIndex = _selectedTile.Index + down;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -482,8 +411,8 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
int index = GetSelectedImageIndex(
|
||||
originalPictureBox.Size,
|
||||
_atlasTexture.Size,
|
||||
_tileAreaSize,
|
||||
((Image)_atlas).Size,
|
||||
_atlas.TileSize,
|
||||
e.Location,
|
||||
originalPictureBox.SizeMode,
|
||||
_imageLayout);
|
||||
@@ -504,28 +433,43 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
if (fileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
var img = Image.FromFile(fileDialog.FileName);
|
||||
Image img = Image.FromFile(fileDialog.FileName).ReleaseFromFile();
|
||||
SetTile(img);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Save();
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
||||
private void animationButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ResourceCategory animationResourceCategory = _resourceLocation.Category == ResourceCategory.ItemAtlas ? ResourceCategory.ItemAnimation : ResourceCategory.BlockAnimation;
|
||||
string animationAssetPath = $"{ResourceLocation.GetPathFromCategory(animationResourceCategory)}/{_selectedTile.Tile.InternalName}.png";
|
||||
PckAsset asset = _pckFile.GetOrCreate(animationAssetPath, PckAssetType.TextureFile);
|
||||
if (_selectedTile.IsPartOfGroup)
|
||||
{
|
||||
AtlasGroup group = _selectedTile.GetGroup();
|
||||
Animation anim = _atlas.GetAnimationFromGroup(group);
|
||||
ISaveContext<Animation> saveContext = new DelegatedSaveContext<Animation>(false, (animation) =>
|
||||
{
|
||||
//! TODO(null): Test for functionallity
|
||||
_atlas.SetGroupTilesFromAnimation(group, animation);
|
||||
});
|
||||
var aEditor = new AnimationEditor(anim, saveContext, group.Name, false);
|
||||
aEditor.ShowDialog(this);
|
||||
return;
|
||||
}
|
||||
JsonTileInfo tileInfo = _selectedTile.GetUserDataOfType<JsonTileInfo>();
|
||||
ResourceCategory animationResourceCategory = _resourceLocationCategory == ResourceCategory.ItemAtlas ? ResourceCategory.ItemAnimation : ResourceCategory.BlockAnimation;
|
||||
string animationAssetPath = $"{ResourceLocation.GetPathFromCategory(animationResourceCategory)}/{tileInfo.InternalName}";
|
||||
bool hasAnimation = _tryGetAnimation.TryGet(animationAssetPath, out Animation animation);
|
||||
bool isValidAnimationSaveContext = _tryGetAnimationSaveContext.TryGet(animationAssetPath, out ISaveContext<Animation> animationSaveContext);
|
||||
|
||||
Animation animation = asset.GetDeserializedData(AnimationDeserializer.DefaultDeserializer);
|
||||
Debug.Assert(isValidAnimationSaveContext, "Couldn't get valid animation save context.");
|
||||
|
||||
var animationEditor = new AnimationEditor(animation, _selectedTile.Tile.DisplayName);
|
||||
var animationEditor = new AnimationEditor(hasAnimation ? animation : Animation.CreateEmpty(), animationSaveContext, tileInfo.DisplayName);
|
||||
if (animationEditor.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
asset.SetSerializedData(animationEditor.Result, AnimationSerializer.DefaultSerializer);
|
||||
// so animations can automatically update upon saving
|
||||
SelectedIndex = _selectedTile.Index;
|
||||
}
|
||||
@@ -533,25 +477,44 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void extractTileToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
string filename = GetSanitizedFilename();
|
||||
SaveFileDialog saveFileDialog = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Tile Texture|*.png",
|
||||
FileName = _selectedTile.Tile.InternalName
|
||||
FileName = filename
|
||||
};
|
||||
if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
dataTile.Texture.Save(saveFileDialog.FileName, ImageFormat.Png);
|
||||
_atlas.GetTileTexture(_selectedTile).Save(saveFileDialog.FileName, ImageFormat.Png);
|
||||
//Process.Start("explorer.exe", $"{saveFileDialog.FileName}");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetSanitizedFilename()
|
||||
{
|
||||
if (_selectedTile.IsPartOfGroup)
|
||||
{
|
||||
AtlasGroup group = _selectedTile.GetGroup();
|
||||
return group.Name.Replace(' ', '_').Trim().ToLower();
|
||||
}
|
||||
if (_selectedTile.TryGetUserDataOfType(out JsonTileInfo tileInfo) && !string.IsNullOrWhiteSpace(tileInfo.InternalName))
|
||||
return tileInfo.InternalName;
|
||||
return "tile";
|
||||
}
|
||||
|
||||
private void variantComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (dataTile.Tile.ColourEntry is not null && variantComboBox.SelectedItem is not null)
|
||||
if (_selectedTile.TryGetUserDataOfType(out JsonTileInfo tileInfo) && variantComboBox.SelectedItem is not null)
|
||||
{
|
||||
string colorKey = variantComboBox.SelectedItem.ToString();
|
||||
|
||||
selectTilePictureBox.BlendColor = FindBlendColorByKey(colorKey);
|
||||
selectTilePictureBox.Image = dataTile.Texture;
|
||||
Color blendColor = FindBlendColorByKey(colorKey);
|
||||
if (_selectedTile.IsPartOfGroup && _selectedTile.GetGroup().IsAnimation())
|
||||
{
|
||||
selectTilePictureBox.Image = _atlas.GetAnimationFromGroup(_selectedTile.GetGroup()).CreateAnimationImage(blendColor);
|
||||
selectTilePictureBox.Start();
|
||||
return;
|
||||
}
|
||||
selectTilePictureBox.BlendColor = blendColor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,35 +536,18 @@ namespace PckStudio.Forms.Editor
|
||||
|
||||
private void setColorButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
ColorDialog colorPick = new ColorDialog();
|
||||
colorPick.AllowFullOpen = true;
|
||||
colorPick.AnyColor = true;
|
||||
colorPick.SolidColorOnly = true;
|
||||
ColorDialog colorPick = new ColorDialog
|
||||
{
|
||||
AllowFullOpen = true,
|
||||
AnyColor = true,
|
||||
SolidColorOnly = true,
|
||||
CustomColors = GameConstants.DyeColors.Select(ColorExtensions.ToBGR).ToArray()
|
||||
};
|
||||
|
||||
//Debug.Assert(Color.FromArgb(0xf9fffe).ToBGR() == 0xfefff9); // White
|
||||
//Debug.Assert(Color.FromArgb(0xf9801d).ToBGR() == 0x1d80f9); // Orange
|
||||
//Debug.Assert(Color.FromArgb(0xc74ebd).ToBGR() == 0xbd4ec7); // Magenta
|
||||
//Debug.Assert(Color.FromArgb(0x3ab3da).ToBGR() == 0xdab33a); // Light Blue
|
||||
//Debug.Assert(Color.FromArgb(0xfed83d).ToBGR() == 0x3dd8fe); // Yellow
|
||||
//Debug.Assert(Color.FromArgb(0x80c71f).ToBGR() == 0x1fc780); // Lime
|
||||
//Debug.Assert(Color.FromArgb(0xf38baa).ToBGR() == 0xaa8bf3); // Pink
|
||||
//Debug.Assert(Color.FromArgb(0x474f52).ToBGR() == 0x524f47); // Gray
|
||||
//Debug.Assert(Color.FromArgb(0x9d9d97).ToBGR() == 0x979d9d); // Light Gray
|
||||
//Debug.Assert(Color.FromArgb(0x169c9c).ToBGR() == 0x9c9c16); // Cyan
|
||||
//Debug.Assert(Color.FromArgb(0x8932b8).ToBGR() == 0xb83289); // Purple
|
||||
//Debug.Assert(Color.FromArgb(0x3c44aa).ToBGR() == 0xaa443c); // Blue
|
||||
//Debug.Assert(Color.FromArgb(0x835432).ToBGR() == 0x325483); // Brown
|
||||
//Debug.Assert(Color.FromArgb(0x5e7c16).ToBGR() == 0x167c5e); // Green
|
||||
//Debug.Assert(Color.FromArgb(0xb02e26).ToBGR() == 0x262eb0); // Red
|
||||
//Debug.Assert(Color.FromArgb(0x1d1d21).ToBGR() == 0x211d1d); // Black
|
||||
|
||||
colorPick.CustomColors = GameConstants.DyeColors.Select(c => c.ToBGR()).ToArray();
|
||||
|
||||
if (colorPick.ShowDialog(this) != DialogResult.OK)
|
||||
return;
|
||||
|
||||
selectTilePictureBox.BlendColor = colorPick.Color;
|
||||
selectTilePictureBox.Image = dataTile.Texture;
|
||||
variantComboBox.Enabled = false;
|
||||
clearColorButton.Enabled = true;
|
||||
}
|
||||
@@ -610,7 +556,7 @@ namespace PckStudio.Forms.Editor
|
||||
{
|
||||
variantComboBox.Enabled = true;
|
||||
|
||||
variantComboBox_SelectedIndexChanged(sender, e);
|
||||
selectTilePictureBox.BlendColor = Color.White;
|
||||
|
||||
clearColorButton.Enabled = false;
|
||||
}
|
||||
@@ -618,7 +564,11 @@ namespace PckStudio.Forms.Editor
|
||||
private void colorSlider_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
selectTilePictureBox.BlendColor = GetBlendColor();
|
||||
selectTilePictureBox.Image = dataTile.Texture;
|
||||
}
|
||||
|
||||
private void allowGroupsToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndex = _selectedTile.Index;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,14 @@
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Internal.Misc;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Core.Misc;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.Forms.Features
|
||||
{
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
using OMI;
|
||||
using OMI.Formats.Pck;
|
||||
using OMI.Workers.Pck;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
@@ -20,11 +18,11 @@ namespace PckStudio.Popups
|
||||
{
|
||||
set
|
||||
{
|
||||
_endianness = value ? Endianness.LittleEndian : Endianness.BigEndian;
|
||||
_endianness = value ? ByteOrder.LittleEndian : ByteOrder.BigEndian;
|
||||
}
|
||||
}
|
||||
private readonly PckFile _pckFile;
|
||||
private Endianness _endianness;
|
||||
private ByteOrder _endianness;
|
||||
|
||||
public AdvancedOptions(PckFile pckFile)
|
||||
{
|
||||
@@ -54,9 +52,7 @@ namespace PckStudio.Popups
|
||||
{
|
||||
try
|
||||
{
|
||||
var reader = new PckFileReader(_endianness);
|
||||
using var ms = new MemoryStream(asset.Data);
|
||||
PckFile subPCK = reader.FromStream(ms);
|
||||
PckFile subPCK = asset.GetData(new PckFileReader(_endianness));
|
||||
applyBulkProperties(subPCK.GetAssets(), index);
|
||||
asset.SetData(new PckFileWriter(subPCK, _endianness));
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
partial class SkinPreview
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SkinPreview));
|
||||
this.ModelView = new PckStudio.Models.MinecraftModelView(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// ModelView
|
||||
//
|
||||
this.ModelView.BackColor = System.Drawing.Color.DarkGray;
|
||||
this.ModelView.BackGradientColor1 = System.Drawing.SystemColors.ActiveCaptionText;
|
||||
this.ModelView.BackGradientColor2 = System.Drawing.SystemColors.ActiveCaptionText;
|
||||
this.ModelView.BackgroundType = PckStudio.Models.BackgroundTypes.Color;
|
||||
this.ModelView.DegreesX = 0;
|
||||
this.ModelView.DegreesY = 0;
|
||||
this.ModelView.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.ModelView.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.ModelView.ForeColor = System.Drawing.Color.Black;
|
||||
this.ModelView.FOV = 90;
|
||||
this.ModelView.Location = new System.Drawing.Point(0, 0);
|
||||
this.ModelView.Name = "ModelView";
|
||||
this.ModelView.Projection = PckStudio.Models.ProjectionTypes.Perspective;
|
||||
this.ModelView.Size = new System.Drawing.Size(418, 568);
|
||||
this.ModelView.TabIndex = 1;
|
||||
this.ModelView.Text = "PCK Model View";
|
||||
//
|
||||
// SkinPreview
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(418, 568);
|
||||
this.Controls.Add(this.ModelView);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "SkinPreview";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "SkinPreview";
|
||||
this.Load += new System.EventHandler(this.SkinPreview_Load);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private PckStudio.Models.MinecraftModelView ModelView;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Classes.Models.DefaultModels;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Models;
|
||||
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
public partial class SkinPreview : Form
|
||||
{
|
||||
Image _texture;
|
||||
ModelBase _model;
|
||||
|
||||
public SkinPreview(Image img, SkinANIM anim, ModelBase model = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
_texture = img;
|
||||
|
||||
_model = model ?? new Steve64x32Model(_texture);
|
||||
if (img.Width == 64 && img.Height == 64)
|
||||
{
|
||||
_model = model ?? new Steve64x64Model(_texture, anim);
|
||||
}
|
||||
}
|
||||
|
||||
private void SkinPreview_Load(object sender, EventArgs e) => RenderModel(_texture);
|
||||
|
||||
public void RenderModel(Image source)
|
||||
{
|
||||
_model.AddToModelView(ModelView);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,642 +0,0 @@
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
partial class generateModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.Label label6;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(generateModel));
|
||||
System.Windows.Forms.Label label5;
|
||||
System.Windows.Forms.Label label3;
|
||||
System.Windows.Forms.Label label7;
|
||||
System.Windows.Forms.Label labelTextureMappingPreview;
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.createToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.cloneToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.changeColorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buttonDone = new System.Windows.Forms.Button();
|
||||
this.labelView = new System.Windows.Forms.Label();
|
||||
this.rotateRightBtn = new System.Windows.Forms.Button();
|
||||
this.rotateLeftBtn = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.tabBody = new System.Windows.Forms.TabControl();
|
||||
this.tabArmor = new System.Windows.Forms.TabPage();
|
||||
this.tabPage1 = new System.Windows.Forms.TabPage();
|
||||
this.myTablePanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.offsetArms = new System.Windows.Forms.TextBox();
|
||||
this.label14 = new System.Windows.Forms.Label();
|
||||
this.offsetBody = new System.Windows.Forms.TextBox();
|
||||
this.offsetLegs = new System.Windows.Forms.TextBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.offsetHead = new System.Windows.Forms.TextBox();
|
||||
this.label12 = new System.Windows.Forms.Label();
|
||||
this.comboParent = new System.Windows.Forms.ComboBox();
|
||||
this.buttonEXPORT = new System.Windows.Forms.Button();
|
||||
this.buttonIMPORT = new System.Windows.Forms.Button();
|
||||
this.uvPictureBox = new PckStudio.ToolboxItems.InterpolationPictureBox();
|
||||
this.displayBox = new System.Windows.Forms.PictureBox();
|
||||
this.buttonTemplate = new MetroFramework.Controls.MetroButton();
|
||||
this.generateTextureCheckBox = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.checkGuide = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.checkBoxArmor = new MetroFramework.Controls.MetroCheckBox();
|
||||
this.SizeXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.SizeZUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.TextureXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.TextureYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.PosZUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.PosYUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.PosXUpDown = new System.Windows.Forms.NumericUpDown();
|
||||
this.Part = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.X = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.Y = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.Z = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this._Width = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this._Height = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.Length = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.U = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.V = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.listViewBoxes = new System.Windows.Forms.ListView();
|
||||
label6 = new System.Windows.Forms.Label();
|
||||
label5 = new System.Windows.Forms.Label();
|
||||
label3 = new System.Windows.Forms.Label();
|
||||
label7 = new System.Windows.Forms.Label();
|
||||
labelTextureMappingPreview = new System.Windows.Forms.Label();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.tabBody.SuspendLayout();
|
||||
this.tabPage1.SuspendLayout();
|
||||
this.myTablePanel2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.displayBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TextureXUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TextureYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// label6
|
||||
//
|
||||
resources.ApplyResources(label6, "label6");
|
||||
label6.ForeColor = System.Drawing.Color.White;
|
||||
label6.Name = "label6";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
resources.ApplyResources(label5, "label5");
|
||||
label5.ForeColor = System.Drawing.Color.White;
|
||||
label5.Name = "label5";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
resources.ApplyResources(label3, "label3");
|
||||
label3.ForeColor = System.Drawing.Color.White;
|
||||
label3.Name = "label3";
|
||||
//
|
||||
// label7
|
||||
//
|
||||
resources.ApplyResources(label7, "label7");
|
||||
label7.ForeColor = System.Drawing.Color.White;
|
||||
label7.Name = "label7";
|
||||
//
|
||||
// labelTextureMappingPreview
|
||||
//
|
||||
resources.ApplyResources(labelTextureMappingPreview, "labelTextureMappingPreview");
|
||||
labelTextureMappingPreview.ForeColor = System.Drawing.Color.White;
|
||||
labelTextureMappingPreview.Name = "labelTextureMappingPreview";
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.createToolStripMenuItem,
|
||||
this.cloneToolStripMenuItem,
|
||||
this.deleteToolStripMenuItem,
|
||||
this.changeColorToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
resources.ApplyResources(this.contextMenuStrip1, "contextMenuStrip1");
|
||||
//
|
||||
// createToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.createToolStripMenuItem, "createToolStripMenuItem");
|
||||
this.createToolStripMenuItem.Name = "createToolStripMenuItem";
|
||||
this.createToolStripMenuItem.Click += new System.EventHandler(this.createToolStripMenuItem_Click);
|
||||
//
|
||||
// cloneToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.cloneToolStripMenuItem, "cloneToolStripMenuItem");
|
||||
this.cloneToolStripMenuItem.Name = "cloneToolStripMenuItem";
|
||||
this.cloneToolStripMenuItem.Click += new System.EventHandler(this.cloneToolStripMenuItem_Click);
|
||||
//
|
||||
// deleteToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.deleteToolStripMenuItem, "deleteToolStripMenuItem");
|
||||
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
|
||||
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click);
|
||||
//
|
||||
// changeColorToolStripMenuItem
|
||||
//
|
||||
resources.ApplyResources(this.changeColorToolStripMenuItem, "changeColorToolStripMenuItem");
|
||||
this.changeColorToolStripMenuItem.Name = "changeColorToolStripMenuItem";
|
||||
this.changeColorToolStripMenuItem.Click += new System.EventHandler(this.changeColorToolStripMenuItem_Click);
|
||||
//
|
||||
// buttonDone
|
||||
//
|
||||
this.buttonDone.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
resources.ApplyResources(this.buttonDone, "buttonDone");
|
||||
this.buttonDone.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonDone.Name = "buttonDone";
|
||||
this.buttonDone.UseVisualStyleBackColor = true;
|
||||
this.buttonDone.Click += new System.EventHandler(this.buttonDone_Click);
|
||||
//
|
||||
// labelView
|
||||
//
|
||||
resources.ApplyResources(this.labelView, "labelView");
|
||||
this.labelView.ForeColor = System.Drawing.Color.White;
|
||||
this.labelView.Name = "labelView";
|
||||
//
|
||||
// rotateRightBtn
|
||||
//
|
||||
resources.ApplyResources(this.rotateRightBtn, "rotateRightBtn");
|
||||
this.rotateRightBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.rotateRightBtn.Name = "rotateRightBtn";
|
||||
this.rotateRightBtn.UseVisualStyleBackColor = true;
|
||||
this.rotateRightBtn.Click += new System.EventHandler(this.rotateRightBtn_Click);
|
||||
//
|
||||
// rotateLeftBtn
|
||||
//
|
||||
resources.ApplyResources(this.rotateLeftBtn, "rotateLeftBtn");
|
||||
this.rotateLeftBtn.ForeColor = System.Drawing.Color.White;
|
||||
this.rotateLeftBtn.Name = "rotateLeftBtn";
|
||||
this.rotateLeftBtn.UseVisualStyleBackColor = true;
|
||||
this.rotateLeftBtn.Click += new System.EventHandler(this.rotateLeftBtn_Click);
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.tabBody);
|
||||
this.groupBox1.ForeColor = System.Drawing.Color.White;
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
// tabBody
|
||||
//
|
||||
this.tabBody.Controls.Add(this.tabArmor);
|
||||
this.tabBody.Controls.Add(this.tabPage1);
|
||||
resources.ApplyResources(this.tabBody, "tabBody");
|
||||
this.tabBody.Name = "tabBody";
|
||||
this.tabBody.SelectedIndex = 0;
|
||||
//
|
||||
// tabArmor
|
||||
//
|
||||
this.tabArmor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
resources.ApplyResources(this.tabArmor, "tabArmor");
|
||||
this.tabArmor.Name = "tabArmor";
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
this.tabPage1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.tabPage1.Controls.Add(this.myTablePanel2);
|
||||
resources.ApplyResources(this.tabPage1, "tabPage1");
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
//
|
||||
// myTablePanel2
|
||||
//
|
||||
resources.ApplyResources(this.myTablePanel2, "myTablePanel2");
|
||||
this.myTablePanel2.Controls.Add(this.offsetArms, 1, 3);
|
||||
this.myTablePanel2.Controls.Add(this.label14, 0, 3);
|
||||
this.myTablePanel2.Controls.Add(this.offsetBody, 1, 1);
|
||||
this.myTablePanel2.Controls.Add(this.offsetLegs, 1, 2);
|
||||
this.myTablePanel2.Controls.Add(this.label10, 0, 0);
|
||||
this.myTablePanel2.Controls.Add(this.label13, 0, 2);
|
||||
this.myTablePanel2.Controls.Add(this.offsetHead, 1, 0);
|
||||
this.myTablePanel2.Controls.Add(this.label12, 0, 1);
|
||||
this.myTablePanel2.Name = "myTablePanel2";
|
||||
//
|
||||
// offsetArms
|
||||
//
|
||||
resources.ApplyResources(this.offsetArms, "offsetArms");
|
||||
this.offsetArms.Name = "offsetArms";
|
||||
this.offsetArms.TextChanged += new System.EventHandler(this.offsetHead_TextChanged);
|
||||
//
|
||||
// label14
|
||||
//
|
||||
resources.ApplyResources(this.label14, "label14");
|
||||
this.label14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(192)))));
|
||||
this.label14.Name = "label14";
|
||||
//
|
||||
// offsetBody
|
||||
//
|
||||
resources.ApplyResources(this.offsetBody, "offsetBody");
|
||||
this.offsetBody.Name = "offsetBody";
|
||||
this.offsetBody.TextChanged += new System.EventHandler(this.offsetHead_TextChanged);
|
||||
//
|
||||
// offsetLegs
|
||||
//
|
||||
resources.ApplyResources(this.offsetLegs, "offsetLegs");
|
||||
this.offsetLegs.Name = "offsetLegs";
|
||||
this.offsetLegs.TextChanged += new System.EventHandler(this.offsetHead_TextChanged);
|
||||
//
|
||||
// label10
|
||||
//
|
||||
resources.ApplyResources(this.label10, "label10");
|
||||
this.label10.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
|
||||
this.label10.Name = "label10";
|
||||
//
|
||||
// label13
|
||||
//
|
||||
resources.ApplyResources(this.label13, "label13");
|
||||
this.label13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(0)))), ((int)(((byte)(64)))));
|
||||
this.label13.Name = "label13";
|
||||
//
|
||||
// offsetHead
|
||||
//
|
||||
resources.ApplyResources(this.offsetHead, "offsetHead");
|
||||
this.offsetHead.Name = "offsetHead";
|
||||
this.offsetHead.TextChanged += new System.EventHandler(this.offsetHead_TextChanged);
|
||||
//
|
||||
// label12
|
||||
//
|
||||
resources.ApplyResources(this.label12, "label12");
|
||||
this.label12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(64)))), ((int)(((byte)(0)))));
|
||||
this.label12.Name = "label12";
|
||||
//
|
||||
// comboParent
|
||||
//
|
||||
this.comboParent.FormattingEnabled = true;
|
||||
this.comboParent.Items.AddRange(new object[] {
|
||||
resources.GetString("comboParent.Items"),
|
||||
resources.GetString("comboParent.Items1"),
|
||||
resources.GetString("comboParent.Items2"),
|
||||
resources.GetString("comboParent.Items3"),
|
||||
resources.GetString("comboParent.Items4"),
|
||||
resources.GetString("comboParent.Items5")});
|
||||
resources.ApplyResources(this.comboParent, "comboParent");
|
||||
this.comboParent.Name = "comboParent";
|
||||
this.comboParent.SelectedValueChanged += new System.EventHandler(this.comboParent_SelectedIndexChanged);
|
||||
//
|
||||
// buttonEXPORT
|
||||
//
|
||||
resources.ApplyResources(this.buttonEXPORT, "buttonEXPORT");
|
||||
this.buttonEXPORT.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonEXPORT.Name = "buttonEXPORT";
|
||||
this.buttonEXPORT.UseVisualStyleBackColor = true;
|
||||
this.buttonEXPORT.Click += new System.EventHandler(this.buttonEXPORT_Click);
|
||||
//
|
||||
// buttonIMPORT
|
||||
//
|
||||
resources.ApplyResources(this.buttonIMPORT, "buttonIMPORT");
|
||||
this.buttonIMPORT.ForeColor = System.Drawing.Color.White;
|
||||
this.buttonIMPORT.Name = "buttonIMPORT";
|
||||
this.buttonIMPORT.UseVisualStyleBackColor = true;
|
||||
this.buttonIMPORT.Click += new System.EventHandler(this.buttonIMPORT_Click);
|
||||
//
|
||||
// uvPictureBox
|
||||
//
|
||||
this.uvPictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
resources.ApplyResources(this.uvPictureBox, "uvPictureBox");
|
||||
this.uvPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.uvPictureBox.Name = "uvPictureBox";
|
||||
this.uvPictureBox.TabStop = false;
|
||||
//
|
||||
// displayBox
|
||||
//
|
||||
this.displayBox.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(50)))), ((int)(((byte)(50)))));
|
||||
this.displayBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
resources.ApplyResources(this.displayBox, "displayBox");
|
||||
this.displayBox.Name = "displayBox";
|
||||
this.displayBox.TabStop = false;
|
||||
//
|
||||
// buttonTemplate
|
||||
//
|
||||
resources.ApplyResources(this.buttonTemplate, "buttonTemplate");
|
||||
this.buttonTemplate.Name = "buttonTemplate";
|
||||
this.buttonTemplate.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.buttonTemplate.UseSelectable = true;
|
||||
this.buttonTemplate.Click += new System.EventHandler(this.buttonTemplate_Click);
|
||||
//
|
||||
// generateTextureCheckBox
|
||||
//
|
||||
resources.ApplyResources(this.generateTextureCheckBox, "generateTextureCheckBox");
|
||||
this.generateTextureCheckBox.Name = "generateTextureCheckBox";
|
||||
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.Render);
|
||||
//
|
||||
// checkBoxArmor
|
||||
//
|
||||
resources.ApplyResources(this.checkBoxArmor, "checkBoxArmor");
|
||||
this.checkBoxArmor.Name = "checkBoxArmor";
|
||||
this.checkBoxArmor.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.checkBoxArmor.UseSelectable = true;
|
||||
this.checkBoxArmor.CheckedChanged += new System.EventHandler(this.Render);
|
||||
//
|
||||
// SizeXUpDown
|
||||
//
|
||||
this.SizeXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeXUpDown.DecimalPlaces = 1;
|
||||
this.SizeXUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.SizeXUpDown, "SizeXUpDown");
|
||||
this.SizeXUpDown.Name = "SizeXUpDown";
|
||||
this.SizeXUpDown.ValueChanged += new System.EventHandler(this.SizeXUpDown_ValueChanged);
|
||||
//
|
||||
// SizeYUpDown
|
||||
//
|
||||
this.SizeYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeYUpDown.DecimalPlaces = 1;
|
||||
this.SizeYUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.SizeYUpDown, "SizeYUpDown");
|
||||
this.SizeYUpDown.Name = "SizeYUpDown";
|
||||
this.SizeYUpDown.ValueChanged += new System.EventHandler(this.SizeYUpDown_ValueChanged);
|
||||
//
|
||||
// SizeZUpDown
|
||||
//
|
||||
this.SizeZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.SizeZUpDown.DecimalPlaces = 1;
|
||||
this.SizeZUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.SizeZUpDown, "SizeZUpDown");
|
||||
this.SizeZUpDown.Name = "SizeZUpDown";
|
||||
this.SizeZUpDown.ValueChanged += new System.EventHandler(this.SizeZUpDown_ValueChanged);
|
||||
//
|
||||
// TextureXUpDown
|
||||
//
|
||||
this.TextureXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.TextureXUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.TextureXUpDown, "TextureXUpDown");
|
||||
this.TextureXUpDown.Maximum = new decimal(new int[] {
|
||||
64,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.TextureXUpDown.Name = "TextureXUpDown";
|
||||
this.TextureXUpDown.ValueChanged += new System.EventHandler(this.TextureXUpDown_ValueChanged);
|
||||
//
|
||||
// TextureYUpDown
|
||||
//
|
||||
this.TextureYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.TextureYUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.TextureYUpDown, "TextureYUpDown");
|
||||
this.TextureYUpDown.Maximum = new decimal(new int[] {
|
||||
64,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.TextureYUpDown.Name = "TextureYUpDown";
|
||||
this.TextureYUpDown.ValueChanged += new System.EventHandler(this.TextureYUpDown_ValueChanged);
|
||||
//
|
||||
// PosZUpDown
|
||||
//
|
||||
this.PosZUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosZUpDown.DecimalPlaces = 1;
|
||||
this.PosZUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.PosZUpDown, "PosZUpDown");
|
||||
this.PosZUpDown.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosZUpDown.Name = "PosZUpDown";
|
||||
this.PosZUpDown.ValueChanged += new System.EventHandler(this.PosZUpDown_ValueChanged);
|
||||
//
|
||||
// PosYUpDown
|
||||
//
|
||||
this.PosYUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosYUpDown.DecimalPlaces = 1;
|
||||
this.PosYUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.PosYUpDown, "PosYUpDown");
|
||||
this.PosYUpDown.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosYUpDown.Name = "PosYUpDown";
|
||||
this.PosYUpDown.ValueChanged += new System.EventHandler(this.PosYUpDown_ValueChanged);
|
||||
//
|
||||
// PosXUpDown
|
||||
//
|
||||
this.PosXUpDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(17)))), ((int)(((byte)(17)))), ((int)(((byte)(17)))));
|
||||
this.PosXUpDown.DecimalPlaces = 1;
|
||||
this.PosXUpDown.ForeColor = System.Drawing.SystemColors.Menu;
|
||||
resources.ApplyResources(this.PosXUpDown, "PosXUpDown");
|
||||
this.PosXUpDown.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.PosXUpDown.Name = "PosXUpDown";
|
||||
this.PosXUpDown.ValueChanged += new System.EventHandler(this.PosXUpDown_ValueChanged);
|
||||
//
|
||||
// Part
|
||||
//
|
||||
resources.ApplyResources(this.Part, "Part");
|
||||
//
|
||||
// X
|
||||
//
|
||||
resources.ApplyResources(this.X, "X");
|
||||
//
|
||||
// Y
|
||||
//
|
||||
resources.ApplyResources(this.Y, "Y");
|
||||
//
|
||||
// Z
|
||||
//
|
||||
resources.ApplyResources(this.Z, "Z");
|
||||
//
|
||||
// _Width
|
||||
//
|
||||
resources.ApplyResources(this._Width, "_Width");
|
||||
//
|
||||
// _Height
|
||||
//
|
||||
resources.ApplyResources(this._Height, "_Height");
|
||||
//
|
||||
// Length
|
||||
//
|
||||
resources.ApplyResources(this.Length, "Length");
|
||||
//
|
||||
// U
|
||||
//
|
||||
resources.ApplyResources(this.U, "U");
|
||||
//
|
||||
// V
|
||||
//
|
||||
resources.ApplyResources(this.V, "V");
|
||||
//
|
||||
// listViewBoxes
|
||||
//
|
||||
this.listViewBoxes.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.listViewBoxes.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.Part,
|
||||
this.X,
|
||||
this.Y,
|
||||
this.Z,
|
||||
this._Width,
|
||||
this._Height,
|
||||
this.Length,
|
||||
this.U,
|
||||
this.V});
|
||||
this.listViewBoxes.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.listViewBoxes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||
this.listViewBoxes.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
|
||||
this.listViewBoxes.HideSelection = false;
|
||||
this.listViewBoxes.LabelEdit = true;
|
||||
resources.ApplyResources(this.listViewBoxes, "listViewBoxes");
|
||||
this.listViewBoxes.MultiSelect = false;
|
||||
this.listViewBoxes.Name = "listViewBoxes";
|
||||
this.listViewBoxes.UseCompatibleStateImageBehavior = false;
|
||||
this.listViewBoxes.View = System.Windows.Forms.View.Details;
|
||||
this.listViewBoxes.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
|
||||
this.listViewBoxes.Click += new System.EventHandler(this.listView1_Click);
|
||||
this.listViewBoxes.DoubleClick += new System.EventHandler(this.listView1_DoubleClick);
|
||||
this.listViewBoxes.KeyDown += new System.Windows.Forms.KeyEventHandler(this.delStuffUsingDelKey);
|
||||
//
|
||||
// generateModel
|
||||
//
|
||||
resources.ApplyResources(this, "$this");
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.PosZUpDown);
|
||||
this.Controls.Add(this.PosYUpDown);
|
||||
this.Controls.Add(this.PosXUpDown);
|
||||
this.Controls.Add(this.TextureYUpDown);
|
||||
this.Controls.Add(this.TextureXUpDown);
|
||||
this.Controls.Add(this.SizeZUpDown);
|
||||
this.Controls.Add(this.SizeYUpDown);
|
||||
this.Controls.Add(this.SizeXUpDown);
|
||||
this.Controls.Add(this.checkBoxArmor);
|
||||
this.Controls.Add(this.checkGuide);
|
||||
this.Controls.Add(this.generateTextureCheckBox);
|
||||
this.Controls.Add(this.buttonTemplate);
|
||||
this.Controls.Add(this.displayBox);
|
||||
this.Controls.Add(this.listViewBoxes);
|
||||
this.Controls.Add(this.buttonEXPORT);
|
||||
this.Controls.Add(labelTextureMappingPreview);
|
||||
this.Controls.Add(this.uvPictureBox);
|
||||
this.Controls.Add(this.comboParent);
|
||||
this.Controls.Add(label6);
|
||||
this.Controls.Add(this.buttonIMPORT);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(label7);
|
||||
this.Controls.Add(this.rotateLeftBtn);
|
||||
this.Controls.Add(this.rotateRightBtn);
|
||||
this.Controls.Add(this.labelView);
|
||||
this.Controls.Add(this.buttonDone);
|
||||
this.Controls.Add(label3);
|
||||
this.Controls.Add(label5);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "generateModel";
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.generateModel_FormClosing);
|
||||
this.Load += new System.EventHandler(this.generateModel_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.generateModel_SizeChanged);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.tabBody.ResumeLayout(false);
|
||||
this.tabPage1.ResumeLayout(false);
|
||||
this.myTablePanel2.ResumeLayout(false);
|
||||
this.myTablePanel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.uvPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.displayBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.SizeZUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TextureXUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TextureYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosZUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosYUpDown)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PosXUpDown)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem createToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem cloneToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem changeColorToolStripMenuItem;
|
||||
private System.Windows.Forms.Button buttonDone;
|
||||
private System.Windows.Forms.PictureBox displayBox;
|
||||
private PckStudio.ToolboxItems.InterpolationPictureBox uvPictureBox;
|
||||
private System.Windows.Forms.Button buttonIMPORT;
|
||||
private System.Windows.Forms.Button buttonEXPORT;
|
||||
private System.Windows.Forms.ComboBox comboParent;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.TabControl tabBody;
|
||||
private System.Windows.Forms.TabPage tabPage1;
|
||||
private System.Windows.Forms.TableLayoutPanel myTablePanel2;
|
||||
private System.Windows.Forms.TextBox offsetArms;
|
||||
private System.Windows.Forms.Label label14;
|
||||
private System.Windows.Forms.TextBox offsetBody;
|
||||
private System.Windows.Forms.TextBox offsetLegs;
|
||||
private System.Windows.Forms.Label label10;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.TextBox offsetHead;
|
||||
private System.Windows.Forms.Label label12;
|
||||
private System.Windows.Forms.TabPage tabArmor;
|
||||
private System.Windows.Forms.Button rotateLeftBtn;
|
||||
private System.Windows.Forms.Button rotateRightBtn;
|
||||
private System.Windows.Forms.Label labelView;
|
||||
private MetroFramework.Controls.MetroButton buttonTemplate;
|
||||
private MetroFramework.Controls.MetroCheckBox generateTextureCheckBox;
|
||||
private MetroFramework.Controls.MetroCheckBox checkGuide;
|
||||
private MetroFramework.Controls.MetroCheckBox checkBoxArmor;
|
||||
private System.Windows.Forms.NumericUpDown SizeXUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown SizeZUpDown;
|
||||
private System.Windows.Forms.NumericUpDown TextureXUpDown;
|
||||
private System.Windows.Forms.NumericUpDown TextureYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown PosZUpDown;
|
||||
private System.Windows.Forms.NumericUpDown PosYUpDown;
|
||||
private System.Windows.Forms.NumericUpDown PosXUpDown;
|
||||
private System.Windows.Forms.ColumnHeader Part;
|
||||
private System.Windows.Forms.ColumnHeader X;
|
||||
private System.Windows.Forms.ColumnHeader Y;
|
||||
private System.Windows.Forms.ColumnHeader Z;
|
||||
private System.Windows.Forms.ColumnHeader _Width;
|
||||
private System.Windows.Forms.ColumnHeader _Height;
|
||||
private System.Windows.Forms.ColumnHeader Length;
|
||||
private System.Windows.Forms.ColumnHeader U;
|
||||
private System.Windows.Forms.ColumnHeader V;
|
||||
private System.Windows.Forms.ListView listViewBoxes;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2023-present miku-666, MattNL
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace PckStudio.Internal.App
|
||||
{
|
||||
static internal class ApplicationBuildInfo
|
||||
{
|
||||
// this is to specify which build release this is. This is manually updated for now
|
||||
// TODO: add different chars for different configurations
|
||||
private const string BuildType = "c";
|
||||
private static System.Globalization.Calendar _buildCalendar;
|
||||
private static DateTime date = new FileInfo(Assembly.GetExecutingAssembly().Location).LastWriteTime;
|
||||
private static string _betaBuildVersion;
|
||||
|
||||
public static string BetaBuildVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
// adopted Minecraft Java Edition Snapshot format (YYwWWn)
|
||||
// to keep track of work in progress features and builds
|
||||
_buildCalendar ??= new System.Globalization.CultureInfo("en-US").Calendar;
|
||||
return _betaBuildVersion ??= string.Format("#{0}w{1}{2}",
|
||||
date.ToString("yy"),
|
||||
_buildCalendar.GetWeekOfYear(date, System.Globalization.CalendarWeekRule.FirstDay, DayOfWeek.Monday),
|
||||
BuildType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/* Copyright (c) 2023-present miku-666
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1.The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace PckStudio.Internal.App
|
||||
{
|
||||
internal static class Profiler
|
||||
{
|
||||
private static Stopwatch _stopwatch = new Stopwatch();
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Start([CallerMemberName] string caller = default!, [CallerFilePath] string source = default!, [CallerLineNumber] int line = default!)
|
||||
{
|
||||
Debug.WriteLine($"Stopwatch starts", category: nameof(Profiler));
|
||||
Debug.WriteLine($"{source}@{caller}:{line}", category: nameof(Profiler));
|
||||
_stopwatch.Restart();
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
internal static void Stop([CallerMemberName] string caller = default!, [CallerFilePath] string source = default!, [CallerLineNumber] int line = default!)
|
||||
{
|
||||
_stopwatch.Stop();
|
||||
Debug.WriteLine($"{caller} took {_stopwatch.ElapsedMilliseconds}ms", category: nameof(Profiler));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
45
PCK-Studio/Internal/AppResourceManager.cs
Normal file
45
PCK-Studio/Internal/AppResourceManager.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Resources;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using OMI.Workers;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
internal sealed class AppResourceManager
|
||||
{
|
||||
public static readonly AppResourceManager Default = new AppResourceManager(Resources.ResourceManager, Resources.Culture);
|
||||
private ResourceManager _resourceManager;
|
||||
private readonly CultureInfo _culture;
|
||||
|
||||
public AppResourceManager(ResourceManager resourceManager, CultureInfo culture)
|
||||
{
|
||||
_resourceManager = resourceManager ?? throw new ArgumentNullException(nameof(resourceManager));
|
||||
_culture = culture;
|
||||
}
|
||||
|
||||
public T GetData<T>(byte[] rawData, IDataFormatReader<T> dataFormatReader) where T : class
|
||||
{
|
||||
_ = rawData ?? throw new ArgumentNullException(nameof(rawData));
|
||||
_ = dataFormatReader ?? throw new ArgumentNullException(nameof(dataFormatReader));
|
||||
|
||||
T result = default;
|
||||
using (Stream resourceStream = new MemoryStream(rawData))
|
||||
{
|
||||
result = dataFormatReader.FromStream(resourceStream);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public T GetDataFromResource<T>(string name, IDataFormatReader<T> dataFormatReader) where T : class
|
||||
{
|
||||
return GetData((byte[])_resourceManager.GetObject(name, _culture), dataFormatReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,13 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
using System.Globalization;
|
||||
using PckStudio.Internal.Json;
|
||||
using PckStudio.Internal.Misc;
|
||||
using PckStudio.Core.Json;
|
||||
using PckStudio.Core.Misc;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using PckStudio.Json;
|
||||
|
||||
namespace PckStudio.Internal.App
|
||||
{
|
||||
@@ -25,30 +26,26 @@ namespace PckStudio.Internal.App
|
||||
|
||||
internal static void Initialize()
|
||||
{
|
||||
Profiler.Start();
|
||||
{
|
||||
_entityImages ??= Resources.entities_atlas.SplitHorizontal(32).ToArray();
|
||||
DataCacher ??= new FileCacher(Program.AppDataCache);
|
||||
_ = Tiles.JsonBlockData;
|
||||
_ = Tiles.JsonItemData;
|
||||
_ = Tiles.JsonParticleData;
|
||||
_ = Tiles.JsonMoonPhaseData;
|
||||
_ = Tiles.JsonExplosionData;
|
||||
_ = Tiles.JsonMapIconData;
|
||||
_ = Tiles.JsonExperienceOrbData;
|
||||
_ = Tiles.JsonPaintingData;
|
||||
_ = Tiles.BlockImageList;
|
||||
_ = Tiles.ItemImageList;
|
||||
_ = Tiles.ParticleImageList;
|
||||
_ = Tiles.ExplosionImageList;
|
||||
_ = Tiles.MapIconImageList;
|
||||
_ = Tiles.ExperienceOrbImageList;
|
||||
_ = Tiles.MoonPhaseImageList;
|
||||
_ = Tiles.PaintingImageList;
|
||||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
Task.Run(GetContributors);
|
||||
}
|
||||
Profiler.Stop();
|
||||
_entityImages ??= Resources.entities_atlas.SplitHorizontal(32).ToArray();
|
||||
DataCacher ??= new FileCacher(Program.AppDataCache);
|
||||
_ = Tiles.JsonBlockData;
|
||||
_ = Tiles.JsonItemData;
|
||||
_ = Tiles.JsonParticleData;
|
||||
_ = Tiles.JsonMoonPhaseData;
|
||||
_ = Tiles.JsonExplosionData;
|
||||
_ = Tiles.JsonMapIconData;
|
||||
_ = Tiles.JsonExperienceOrbData;
|
||||
_ = Tiles.JsonPaintingData;
|
||||
_ = Tiles.BlockImageList;
|
||||
_ = Tiles.ItemImageList;
|
||||
_ = Tiles.ParticleImageList;
|
||||
_ = Tiles.ExplosionImageList;
|
||||
_ = Tiles.MapIconImageList;
|
||||
_ = Tiles.ExperienceOrbImageList;
|
||||
_ = Tiles.MoonPhaseImageList;
|
||||
_ = Tiles.PaintingImageList;
|
||||
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
|
||||
Task.Run(GetContributors);
|
||||
}
|
||||
|
||||
internal static void GetContributors()
|
||||
@@ -4,12 +4,11 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Newtonsoft.Json;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Properties;
|
||||
using PckStudio.Core.Json;
|
||||
|
||||
namespace PckStudio.Internal.Json
|
||||
namespace PckStudio.Json
|
||||
{
|
||||
internal class JsonEntities
|
||||
{
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
internal static class GameConstants
|
||||
{
|
||||
|
||||
public const int GameTickInMilliseconds = 50;
|
||||
|
||||
// See: https://minecraft.fandom.com/wiki/Dye#Color_values for more information.
|
||||
public static readonly Color[] DyeColors = [
|
||||
Color.FromArgb(0xf9fffe), // White
|
||||
Color.FromArgb(0xf9801d), // Orange
|
||||
Color.FromArgb(0xc74ebd), // Magenta
|
||||
Color.FromArgb(0x3ab3da), // Light Blue
|
||||
Color.FromArgb(0xfed83d), // Yellow
|
||||
Color.FromArgb(0x80c71f), // Lime
|
||||
Color.FromArgb(0xf38baa), // Pink
|
||||
Color.FromArgb(0x474f52), // Gray
|
||||
Color.FromArgb(0x9d9d97), // Light Gray
|
||||
Color.FromArgb(0x169c9c), // Cyan
|
||||
Color.FromArgb(0x8932b8), // Purple
|
||||
Color.FromArgb(0x3c44aa), // Blue
|
||||
Color.FromArgb(0x835432), // Brown
|
||||
Color.FromArgb(0x5e7c16), // Green
|
||||
Color.FromArgb(0xb02e26), // Red
|
||||
Color.FromArgb(0x1d1d21), // Black
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using OMI;
|
||||
using OMI.Workers;
|
||||
using PckStudio.FileFormats;
|
||||
|
||||
namespace PckStudio.Internal.IO.CSMB
|
||||
{
|
||||
internal class CSMBFileReader : IDataFormatReader<CSMBFile>, IDataFormatReader
|
||||
{
|
||||
private CSMBFileReader()
|
||||
{ }
|
||||
|
||||
public CSMBFile FromFile(string filename)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public CSMBFile FromStream(Stream stream)
|
||||
{
|
||||
CSMBFile csmbFile = new CSMBFile();
|
||||
using (var reader = new EndiannessAwareBinaryReader(stream, Encoding.ASCII, leaveOpen: true, Endianness.LittleEndian))
|
||||
{
|
||||
reader.ReadInt32();
|
||||
int numOfParts = reader.ReadInt32();
|
||||
for (int i = 0; i < numOfParts; i++)
|
||||
{
|
||||
CSMBPart part = new CSMBPart();
|
||||
part.Name = ReadString(reader);
|
||||
part.Parent = (CSMBParentPart)reader.ReadInt32();
|
||||
part.posX = reader.ReadSingle();
|
||||
part.posY = reader.ReadSingle();
|
||||
part.posZ = reader.ReadSingle();
|
||||
part.sizeX = reader.ReadSingle();
|
||||
part.sizeY = reader.ReadSingle();
|
||||
part.sizeZ = reader.ReadSingle();
|
||||
part.uvX = reader.ReadInt32();
|
||||
part.uvY = reader.ReadInt32();
|
||||
part.MirrorTexture = reader.ReadBoolean();
|
||||
part.HideWArmour = reader.ReadBoolean();
|
||||
part.Inflation = reader.ReadSingle();
|
||||
csmbFile.Parts.Add(part);
|
||||
}
|
||||
int numOfOffsets = reader.ReadInt32();
|
||||
for (int i = 0; i < numOfOffsets; i++)
|
||||
{
|
||||
CSMBOffset offset = new CSMBOffset();
|
||||
offset.offsetPart = (CSMBOffsetPart)reader.ReadInt32();
|
||||
offset.VerticalOffset = reader.ReadSingle();
|
||||
csmbFile.Offsets.Add(offset);
|
||||
}
|
||||
}
|
||||
return csmbFile;
|
||||
}
|
||||
|
||||
private string ReadString(EndiannessAwareBinaryReader reader)
|
||||
{
|
||||
ushort strlen = reader.ReadUInt16();
|
||||
return reader.ReadString(strlen);
|
||||
}
|
||||
|
||||
object IDataFormatReader.FromStream(Stream stream) => FromStream(stream);
|
||||
|
||||
object IDataFormatReader.FromFile(string filename) => FromFile(filename);
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using PckStudio.FileFormats;
|
||||
using OMI.Workers;
|
||||
using OMI;
|
||||
|
||||
namespace PckStudio.Internal.IO.CSMB
|
||||
{
|
||||
internal class CSMBFileWriter : IDataFormatWriter
|
||||
{
|
||||
CSMBFile _CSMB;
|
||||
|
||||
public CSMBFileWriter(CSMBFile csmb)
|
||||
{
|
||||
_CSMB = csmb;
|
||||
}
|
||||
|
||||
public void WriteToFile(string filename)
|
||||
{
|
||||
using (FileStream fs = File.OpenWrite(filename))
|
||||
{
|
||||
WriteToStream(fs);
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteToStream(Stream stream)
|
||||
{
|
||||
using (var writer = new EndiannessAwareBinaryWriter(stream, Encoding.ASCII, leaveOpen: true, Endianness.LittleEndian))
|
||||
{
|
||||
writer.Write(0);
|
||||
writer.Write(_CSMB.Parts.Count);
|
||||
foreach (CSMBPart part in _CSMB.Parts)
|
||||
{
|
||||
writer.Write((short)part.Name.Length);
|
||||
writer.WriteString(part.Name);
|
||||
writer.Write((int)part.Parent);
|
||||
writer.Write(part.posX);
|
||||
writer.Write(part.posY);
|
||||
writer.Write(part.posZ);
|
||||
writer.Write(part.sizeX);
|
||||
writer.Write(part.sizeY);
|
||||
writer.Write(part.sizeZ);
|
||||
writer.Write(part.uvX);
|
||||
writer.Write(part.uvY);
|
||||
writer.Write(part.MirrorTexture);
|
||||
writer.Write(part.HideWArmour);
|
||||
writer.Write(part.Inflation);
|
||||
}
|
||||
writer.Write(_CSMB.Offsets.Count);
|
||||
foreach (CSMBOffset offset in _CSMB.Offsets)
|
||||
{
|
||||
writer.Write((int)offset.offsetPart);
|
||||
writer.Write(offset.VerticalOffset);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using OMI.Formats.Pck;
|
||||
using PckStudio.Extensions;
|
||||
using PckStudio.Core.Extensions;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/* Copyright (c) 2024-present miku-666
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1.The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
internal sealed class ResourceLocation
|
||||
{
|
||||
private static List<ResourceLocation> ResourceGroups = new List<ResourceLocation>();
|
||||
private static readonly ResourceLocation Unknown = new ResourceLocation(string.Empty, ResourceCategory.Unknown, 1);
|
||||
|
||||
private static readonly Dictionary<string, ResourceLocation> _categoryLookUp = new Dictionary<string, ResourceLocation>()
|
||||
{
|
||||
["textures/items"] = new ResourceLocation("textures/items", ResourceCategory.ItemAnimation, 16, isGroup: true),
|
||||
["textures/blocks"] = new ResourceLocation("textures/blocks", ResourceCategory.BlockAnimation, 16, isGroup: true),
|
||||
["terrain.png"] = new ResourceLocation("terrain.png", ResourceCategory.BlockAtlas, 16),
|
||||
["items.png"] = new ResourceLocation("items.png", ResourceCategory.ItemAtlas, 16),
|
||||
["particles.png"] = new ResourceLocation("particles.png", ResourceCategory.ParticleAtlas, 16),
|
||||
["item/banner/Banner_Atlas.png"] = new ResourceLocation("item/banner/Banner_Atlas.png", ResourceCategory.BannerAtlas, new Size(6, 7), TillingMode.WidthAndHeight),
|
||||
["art/kz.png"] = new ResourceLocation("art/kz.png", ResourceCategory.PaintingAtlas, 16),
|
||||
["misc/explosion.png"] = new ResourceLocation("misc/explosion.png", ResourceCategory.ExplosionAtlas, 4),
|
||||
["item/xporb.png"] = new ResourceLocation("item/xporb.png", ResourceCategory.ExperienceOrbAtlas, 4),
|
||||
["terrain/moon_phases.png"] = new ResourceLocation("terrain/moon_phases.png", ResourceCategory.MoonPhaseAtlas, 4),
|
||||
["misc/mapicons.png"] = new ResourceLocation("misc/mapicons.png", ResourceCategory.MapIconAtlas, 4),
|
||||
["misc/additionalmapicons.png"] = new ResourceLocation("misc/additionalmapicons.png", ResourceCategory.AdditionalMapIconsAtlas, 4),
|
||||
};
|
||||
|
||||
public static string GetPathFromCategory(ResourceCategory category)
|
||||
{
|
||||
return category switch
|
||||
{
|
||||
ResourceCategory.ItemAnimation => _categoryLookUp["textures/items"].ToString(),
|
||||
ResourceCategory.BlockAnimation => _categoryLookUp["textures/blocks"].ToString(),
|
||||
ResourceCategory.BlockAtlas => _categoryLookUp["terrain.png"].ToString(),
|
||||
ResourceCategory.ItemAtlas => _categoryLookUp["items.png"].ToString(),
|
||||
ResourceCategory.ParticleAtlas => _categoryLookUp["particles.png"].ToString(),
|
||||
ResourceCategory.BannerAtlas => _categoryLookUp["item/banner/Banner_Atlas.png"].ToString(),
|
||||
ResourceCategory.PaintingAtlas => _categoryLookUp["art/kz.png"].ToString(),
|
||||
ResourceCategory.ExplosionAtlas => _categoryLookUp["misc/explosion.png"].ToString(),
|
||||
ResourceCategory.ExperienceOrbAtlas => _categoryLookUp["item/xporb.png"].ToString(),
|
||||
ResourceCategory.MoonPhaseAtlas => _categoryLookUp["terrain/moon_phases.png"].ToString(),
|
||||
ResourceCategory.MapIconAtlas => _categoryLookUp["misc/mapicons.png"].ToString(),
|
||||
ResourceCategory.AdditionalMapIconsAtlas => _categoryLookUp["misc/additionalmapicons.png"].ToString(),
|
||||
_ => string.Empty
|
||||
};
|
||||
}
|
||||
|
||||
public static ResourceCategory GetCategoryFromPath(string path) => GetFromPath(path).Category;
|
||||
|
||||
public static ResourceLocation GetFromPath(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path) || !path.StartsWith("res/"))
|
||||
return Unknown;
|
||||
string categoryPath = path.Substring("res/".Length);
|
||||
if (_categoryLookUp.ContainsKey(categoryPath))
|
||||
return _categoryLookUp[categoryPath];
|
||||
return ResourceGroups.Where(group => categoryPath.StartsWith(group.Path)).FirstOrDefault() ?? Unknown;
|
||||
}
|
||||
|
||||
public enum TillingMode
|
||||
{
|
||||
Width,
|
||||
Height,
|
||||
WidthAndHeight
|
||||
}
|
||||
|
||||
public readonly string Path;
|
||||
public readonly ResourceCategory Category;
|
||||
public readonly Size TillingFactor;
|
||||
public readonly TillingMode Tilling;
|
||||
public readonly bool IsGroup;
|
||||
|
||||
public Size GetTileArea(Size imgSize)
|
||||
{
|
||||
int tileFactorWidth = Math.Max(1, TillingFactor.Width);
|
||||
int tileFactorHeight = Math.Max(1, TillingFactor.Height);
|
||||
return Tilling switch
|
||||
{
|
||||
TillingMode.Width => new Size(imgSize.Width / tileFactorWidth, imgSize.Width / tileFactorHeight),
|
||||
TillingMode.Height => new Size(imgSize.Height / tileFactorWidth, imgSize.Height / tileFactorHeight),
|
||||
TillingMode.WidthAndHeight => new Size(imgSize.Width / tileFactorWidth, imgSize.Height / tileFactorHeight),
|
||||
_ => Size.Empty,
|
||||
};
|
||||
}
|
||||
|
||||
private ResourceLocation(string path, ResourceCategory category, int tillingFactor, TillingMode tilling = TillingMode.Width, bool isGroup = false)
|
||||
: this(path, category, new Size(tillingFactor, tillingFactor), tilling, isGroup)
|
||||
{
|
||||
}
|
||||
|
||||
private ResourceLocation(string path, ResourceCategory category, Size tillingFactor, TillingMode tilling = TillingMode.Width, bool isGroup = false)
|
||||
{
|
||||
Path = path;
|
||||
Category = category;
|
||||
TillingFactor = tillingFactor;
|
||||
Tilling = tilling;
|
||||
IsGroup = isGroup;
|
||||
if (isGroup)
|
||||
ResourceGroups.Add(this);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return "res/" + Path;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,10 @@
|
||||
using System.Diagnostics;
|
||||
using DiscordRPC;
|
||||
using PckStudio.Internal;
|
||||
using PckStudio.Properties;
|
||||
using DiscordRPC.Logging;
|
||||
using PckStudio.Internal.App;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal.Misc
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
// https://github.com/BullyWiiPlaza/Minecraft-Wii-U-Mod-Injector/blob/main/Minecraft%20Wii%20U%20Mod%20Injector/Helpers/DiscordRpc.cs
|
||||
static class RPC
|
||||
14
PCK-Studio/Internal/SettingsManager.cs
Normal file
14
PCK-Studio/Internal/SettingsManager.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PckStudio.Properties;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
internal static class SettingsManager
|
||||
{
|
||||
internal static Core.App.SettingsManager Default { get; } = new Core.App.SettingsManager(Settings.Default, isReadOnly: true);
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Copyright (c) 2022-present miku-666, MattNL
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
/// <summary>
|
||||
/// For usage see <see cref="SkinANIM"/>
|
||||
/// </summary>
|
||||
public enum SkinAnimFlag : int
|
||||
{
|
||||
STATIC_ARMS = 0, // 0x01
|
||||
ZOMBIE_ARMS = 1, // 0x02
|
||||
STATIC_LEGS = 2, // 0x04
|
||||
BAD_SANTA = 3, // 0x08
|
||||
//
|
||||
__BIT_4 = 4, // 0x10 - Unused??
|
||||
SYNCED_LEGS = 5, // 0x20
|
||||
SYNCED_ARMS = 6, // 0x40
|
||||
STATUE_OF_LIBERTY = 7, // 0x80
|
||||
|
||||
ALL_ARMOR_DISABLED = 8, // 0x100
|
||||
HEAD_BOBBING_DISABLED = 9, // 0x200
|
||||
HEAD_DISABLED = 10, // 0x400
|
||||
RIGHT_ARM_DISABLED = 11, // 0x800
|
||||
|
||||
LEFT_ARM_DISABLED = 12, // 0x1000
|
||||
BODY_DISABLED = 13, // 0x2000
|
||||
RIGHT_LEG_DISABLED = 14, // 0x4000
|
||||
LEFT_LEG_DISABLED = 15, // 0x8000
|
||||
|
||||
HEAD_OVERLAY_DISABLED = 16, // 0x10000
|
||||
DO_BACKWARDS_CROUCH = 17, // 0x20000
|
||||
RESOLUTION_64x64 = 18, // 0x40000
|
||||
SLIM_MODEL = 19, // 0x80000
|
||||
|
||||
LEFT_ARM_OVERLAY_DISABLED = 20, // 0x100000
|
||||
RIGHT_ARM_OVERLAY_DISABLED = 21, // 0x200000
|
||||
LEFT_LEG_OVERLAY_DISABLED = 22, // 0x400000
|
||||
RIGHT_LEG_OVERLAY_DISABLED = 23, // 0x800000
|
||||
|
||||
BODY_OVERLAY_DISABLED = 24, // 0x1000000
|
||||
FORCE_HEAD_ARMOR = 25, // 0x2000000
|
||||
FORCE_RIGHT_ARM_ARMOR = 26, // 0x4000000
|
||||
FORCE_LEFT_ARM_ARMOR = 27, // 0x8000000
|
||||
|
||||
FORCE_BODY_ARMOR = 28, // 0x10000000
|
||||
FORCE_RIGHT_LEG_ARMOR = 29, // 0x20000000
|
||||
FORCE_LEFT_LEG_ARMOR = 30, // 0x40000000
|
||||
DINNERBONE = 31, // 0x80000000
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
/* Copyright (c) 2023-present miku-666, MattNL
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1.The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace PckStudio.Internal
|
||||
{
|
||||
public class SkinBOX : ICloneable, IEquatable<SkinBOX>
|
||||
{
|
||||
public static readonly SkinBOX Empty = new SkinBOX("HEAD", new Vector3(-4, -8, -4), new Vector3(8), Vector2.Zero);
|
||||
|
||||
public string Type;
|
||||
public Vector3 Pos;
|
||||
public Vector3 Size;
|
||||
public Vector2 UV;
|
||||
public bool HideWithArmor;
|
||||
public bool Mirror;
|
||||
public float Scale;
|
||||
|
||||
public SkinBOX(string type, Vector3 pos, Vector3 size, Vector2 uv,
|
||||
bool hideWithArmor = false, bool mirror = false, float scale = 0.0f)
|
||||
{
|
||||
Type = type;
|
||||
Pos = pos;
|
||||
Size = size;
|
||||
UV = uv;
|
||||
HideWithArmor = hideWithArmor;
|
||||
Mirror = mirror;
|
||||
Scale = scale;
|
||||
}
|
||||
|
||||
public static SkinBOX FromString(string value)
|
||||
{
|
||||
var arguments = value.Split(' ');
|
||||
if (arguments.Length < 9)
|
||||
{
|
||||
throw new ArgumentException("Arguments must have at least a length of 9");
|
||||
}
|
||||
string type = arguments[0];
|
||||
Vector3 pos = TryGetVector3(arguments, 1);
|
||||
Vector3 size = TryGetVector3(arguments, 4);
|
||||
Vector2 uv = TryGetVector2(arguments, 7);
|
||||
var skinBox = new SkinBOX(type, pos, size, uv);
|
||||
if (arguments.Length >= 10)
|
||||
skinBox.HideWithArmor = arguments[9] == "1";
|
||||
if (arguments.Length >= 11)
|
||||
skinBox.Mirror = arguments[10] == "1";
|
||||
if (arguments.Length >= 12)
|
||||
float.TryParse(arguments[11], out skinBox.Scale);
|
||||
return skinBox;
|
||||
}
|
||||
|
||||
public ValueTuple<string, string> ToProperty()
|
||||
{
|
||||
return new ValueTuple<string, string>("BOX", ToString());
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return
|
||||
$"{Type} {Pos.X} {Pos.Y} {Pos.Z} {Size.X} {Size.Y} {Size.Z} {UV.X} {UV.Y} {Convert.ToInt32(HideWithArmor)} {Convert.ToInt32(Mirror)} {Scale}"
|
||||
.Replace(',', '.');
|
||||
}
|
||||
|
||||
private static Vector2 TryGetVector2(string[] arguments, int startIndex)
|
||||
{
|
||||
float.TryParse(arguments[startIndex], out float x);
|
||||
float.TryParse(arguments[startIndex + 1], out float y);
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
|
||||
private static Vector3 TryGetVector3(string[] arguments, int startIndex)
|
||||
{
|
||||
Vector2 xy = TryGetVector2(arguments, startIndex);
|
||||
float.TryParse(arguments[startIndex + 2], out float z);
|
||||
return new Vector3(xy, z);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Type.GetHashCode() % Pos.GetHashCode() * UV.GetHashCode() % Size.GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is SkinBOX box && Equals(box);
|
||||
}
|
||||
|
||||
public bool Equals(SkinBOX other)
|
||||
{
|
||||
return Type.Equals(other.Type) &&
|
||||
Pos.Equals(other.Pos) &&
|
||||
Size.Equals(other.Size) &&
|
||||
UV.Equals(other.UV);
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return new SkinBOX((string)Type.Clone(), Pos, Size, UV, HideWithArmor, Mirror, Scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
1023
PCK-Studio/MainForm.Designer.cs
generated
1023
PCK-Studio/MainForm.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user