mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-24 20:44:33 +00:00
CustomSkinEditor - Fixed Box Uv highlighting
This commit is contained in:
@@ -280,7 +280,7 @@ namespace PckStudio.Popups
|
||||
|
||||
skin.SetData(Resources.classic_template, ImageFormat.Png);
|
||||
|
||||
using CustomModelEditor generate = new CustomModelEditor(skin);
|
||||
using CustomSkinEditor generate = new CustomSkinEditor(skin);
|
||||
|
||||
if (generate.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
partial class CustomModelEditor
|
||||
partial class CustomSkinEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
@@ -30,7 +30,7 @@
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.Label label5;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomModelEditor));
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CustomSkinEditor));
|
||||
System.Windows.Forms.Label label3;
|
||||
System.Windows.Forms.Label label7;
|
||||
System.Windows.Forms.Label labelTextureMappingPreview;
|
||||
@@ -384,7 +384,6 @@
|
||||
this.Controls.Add(label3);
|
||||
this.Controls.Add(label5);
|
||||
this.Controls.Add(this.uvPictureBox);
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "CustomModelEditor";
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
this.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
@@ -1,14 +1,11 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using MetroFramework.Forms;
|
||||
@@ -21,7 +18,7 @@ using PckStudio.Forms.Editor;
|
||||
|
||||
namespace PckStudio.Forms
|
||||
{
|
||||
public partial class CustomModelEditor : MetroForm
|
||||
public partial class CustomSkinEditor : MetroForm
|
||||
{
|
||||
private Image _previewImage;
|
||||
public Image PreviewImage => _previewImage;
|
||||
@@ -36,7 +33,7 @@ namespace PckStudio.Forms
|
||||
|
||||
List<ModelOffset> modelOffsets = new List<ModelOffset>();
|
||||
|
||||
public CustomModelEditor(PckFileData file)
|
||||
public CustomSkinEditor(PckFileData file)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@@ -55,6 +52,7 @@ namespace PckStudio.Forms
|
||||
var boxProperties = properties.GetProperties("BOX");
|
||||
|
||||
Array.ForEach(boxProperties, kv => renderer3D1.ModelData.Add(SkinBOX.FromString(kv.Value)));
|
||||
|
||||
modelPartListBox.DataSource = renderer3D1.ModelData;
|
||||
modelPartListBox.DisplayMember = "Type";
|
||||
|
||||
@@ -118,15 +116,10 @@ namespace PckStudio.Forms
|
||||
{
|
||||
using (var img = Image.FromFile(openFileDialog.FileName))
|
||||
{
|
||||
if ((img.Width == img.Height || img.Height == img.Width / 2))
|
||||
if (img.Width == img.Height || img.Height == img.Width / 2)
|
||||
{
|
||||
generateTextureCheckBox.Checked = false;
|
||||
using (Graphics graphics = Graphics.FromImage(uvPictureBox.BackgroundImage))
|
||||
{
|
||||
graphics.ApplyConfig(_graphicsConfig);
|
||||
graphics.DrawImage(img, 0, 0, img.Width, img.Height);
|
||||
}
|
||||
uvPictureBox.Invalidate();
|
||||
renderer3D1.Texture = img;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -320,8 +313,14 @@ namespace PckStudio.Forms
|
||||
|
||||
private void renderer3D1_TextureChanging(object sender, Rendering.TextureChangingEventArgs e)
|
||||
{
|
||||
// TODO: add validation for 64x64 and 64x32
|
||||
uvPictureBox.BackgroundImage = e.NewTexture;
|
||||
var img = e.NewTexture;
|
||||
if (img.Width != img.Height && img.Height != img.Width / 2)
|
||||
{
|
||||
e.Cancel = true;
|
||||
MessageBox.Show("Invalid image dimensions.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
uvPictureBox.BackgroundImage = img;
|
||||
}
|
||||
|
||||
private void listBox1_DoubleClick(object sender, EventArgs e)
|
||||
@@ -345,7 +344,14 @@ namespace PckStudio.Forms
|
||||
uvPictureBox.Image = new Bitmap(uvPictureBox.BackgroundImage.Width * scale, uvPictureBox.BackgroundImage.Height * scale);
|
||||
using (Graphics g = Graphics.FromImage(uvPictureBox.Image))
|
||||
{
|
||||
g.DrawPath(new Pen(Color.HotPink, 1f), box.GetUVGraphicsPath(new System.Numerics.Vector2(uvPictureBox.Image.Width / uvPictureBox.BackgroundImage.Width, uvPictureBox.Image.Height / uvPictureBox.BackgroundImage.Height)));
|
||||
float penWidth = renderer3D1.UvTranslation.X * uvPictureBox.BackgroundImage.Width + renderer3D1.UvTranslation.Y * uvPictureBox.BackgroundImage.Height / 2f;
|
||||
GraphicsPath graphicsPath = box.GetUVGraphicsPath(
|
||||
new System.Numerics.Vector2(
|
||||
scale * renderer3D1.UvTranslation.X * uvPictureBox.BackgroundImage.Width,
|
||||
scale * renderer3D1.UvTranslation.Y * uvPictureBox.BackgroundImage.Height
|
||||
)
|
||||
);
|
||||
g.DrawPath(new Pen(Color.HotPink, penWidth), graphicsPath);
|
||||
}
|
||||
uvPictureBox.Invalidate();
|
||||
}
|
||||
@@ -434,7 +434,7 @@ namespace PckStudio
|
||||
{
|
||||
if (file.Properties.HasProperty("BOX"))
|
||||
{
|
||||
using CustomModelEditor generate = new CustomModelEditor(file);
|
||||
using CustomSkinEditor generate = new CustomSkinEditor(file);
|
||||
if (generate.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
entryDataTextBox.Text = entryTypeTextBox.Text = string.Empty;
|
||||
|
||||
@@ -400,11 +400,11 @@
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Skins-And-Textures\CustomModelEditor.cs">
|
||||
<Compile Include="Forms\Skins-And-Textures\CustomSkinEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Skins-And-Textures\CustomModelEditor.Designer.cs">
|
||||
<DependentUpon>CustomModelEditor.cs</DependentUpon>
|
||||
<Compile Include="Forms\Skins-And-Textures\CustomSkinEditor.Designer.cs">
|
||||
<DependentUpon>CustomSkinEditor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\Skins-And-Textures\SkinPreview.cs">
|
||||
<SubType>Form</SubType>
|
||||
@@ -575,11 +575,11 @@
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Skins-And-Textures\CustomModelEditor.ja.resx">
|
||||
<DependentUpon>CustomModelEditor.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Forms\Skins-And-Textures\CustomSkinEditor.ja.resx">
|
||||
<DependentUpon>CustomSkinEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Skins-And-Textures\CustomModelEditor.resx">
|
||||
<DependentUpon>CustomModelEditor.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Forms\Skins-And-Textures\CustomSkinEditor.resx">
|
||||
<DependentUpon>CustomSkinEditor.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\Skins-And-Textures\SkinPreview.resx">
|
||||
|
||||
2
Vendor/OMI-Lib
vendored
2
Vendor/OMI-Lib
vendored
Submodule Vendor/OMI-Lib updated: 3209ecca85...c33a6adafe
Reference in New Issue
Block a user