mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-08-02 14:41:23 +00:00
TextureAtlasEditor - Added settings for disabling playing animations or applying color masks
This commit is contained in:
137
PCK-Studio/Forms/Editor/TextureAtlasEditor.Designer.cs
generated
137
PCK-Studio/Forms/Editor/TextureAtlasEditor.Designer.cs
generated
@@ -28,61 +28,52 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
MetroFramework.Controls.MetroLabel metroLabel1;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TextureAtlasEditor));
|
||||
this.prevButton = new MetroFramework.Controls.MetroButton();
|
||||
this.nextButton = new MetroFramework.Controls.MetroButton();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.extractTileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.applyColorMaskToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.playAnimationsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.originalPictureBox = new PckStudio.PictureBoxWithInterpolationMode();
|
||||
this.selectTilePictureBox = new PckStudio.Forms.Editor.AnimationPictureBox();
|
||||
this.infoTextBox = new System.Windows.Forms.RichTextBox();
|
||||
this.replaceButton = new MetroFramework.Controls.MetroButton();
|
||||
this.animationButton = new MetroFramework.Controls.MetroButton();
|
||||
this.variantComboBox = new MetroFramework.Controls.MetroComboBox();
|
||||
metroLabel1 = new MetroFramework.Controls.MetroLabel();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.tableLayoutPanel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.originalPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.selectTilePictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// prevButton
|
||||
// metroLabel1
|
||||
//
|
||||
this.prevButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
metroLabel1.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.prevButton.Enabled = false;
|
||||
this.prevButton.Location = new System.Drawing.Point(3, 210);
|
||||
this.prevButton.Name = "prevButton";
|
||||
this.prevButton.Size = new System.Drawing.Size(145, 19);
|
||||
this.prevButton.TabIndex = 1;
|
||||
this.prevButton.Text = "Prev.";
|
||||
this.prevButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.prevButton.UseSelectable = true;
|
||||
this.prevButton.Click += new System.EventHandler(this.prevButton_Click);
|
||||
//
|
||||
// nextButton
|
||||
//
|
||||
this.nextButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nextButton.Enabled = false;
|
||||
this.nextButton.Location = new System.Drawing.Point(154, 210);
|
||||
this.nextButton.Name = "nextButton";
|
||||
this.nextButton.Size = new System.Drawing.Size(145, 19);
|
||||
this.nextButton.TabIndex = 2;
|
||||
this.nextButton.Text = "Next";
|
||||
this.nextButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.nextButton.UseSelectable = true;
|
||||
this.nextButton.Click += new System.EventHandler(this.nextButton_Click);
|
||||
metroLabel1.AutoSize = true;
|
||||
metroLabel1.Location = new System.Drawing.Point(3, 218);
|
||||
metroLabel1.Name = "metroLabel1";
|
||||
metroLabel1.Size = new System.Drawing.Size(112, 33);
|
||||
metroLabel1.TabIndex = 18;
|
||||
metroLabel1.Text = "Variant:";
|
||||
metroLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
metroLabel1.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.fileToolStripMenuItem});
|
||||
this.fileToolStripMenuItem,
|
||||
this.viewToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(20, 60);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(759, 24);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(590, 24);
|
||||
this.menuStrip1.TabIndex = 16;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
@@ -111,6 +102,36 @@
|
||||
this.extractTileToolStripMenuItem.Text = "Extract Tile";
|
||||
this.extractTileToolStripMenuItem.Click += new System.EventHandler(this.extractTileToolStripMenuItem_Click);
|
||||
//
|
||||
// viewToolStripMenuItem
|
||||
//
|
||||
this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.applyColorMaskToolStripMenuItem,
|
||||
this.playAnimationsToolStripMenuItem});
|
||||
this.viewToolStripMenuItem.ForeColor = System.Drawing.SystemColors.Control;
|
||||
this.viewToolStripMenuItem.Name = "viewToolStripMenuItem";
|
||||
this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
|
||||
this.viewToolStripMenuItem.Text = "View";
|
||||
//
|
||||
// applyColorMaskToolStripMenuItem
|
||||
//
|
||||
this.applyColorMaskToolStripMenuItem.Checked = true;
|
||||
this.applyColorMaskToolStripMenuItem.CheckOnClick = true;
|
||||
this.applyColorMaskToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.applyColorMaskToolStripMenuItem.Name = "applyColorMaskToolStripMenuItem";
|
||||
this.applyColorMaskToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.applyColorMaskToolStripMenuItem.Text = "Apply Color Mask";
|
||||
this.applyColorMaskToolStripMenuItem.CheckedChanged += new System.EventHandler(this.applyColorMaskToolStripMenuItem_CheckedChanged);
|
||||
//
|
||||
// playAnimationsToolStripMenuItem
|
||||
//
|
||||
this.playAnimationsToolStripMenuItem.Checked = true;
|
||||
this.playAnimationsToolStripMenuItem.CheckOnClick = true;
|
||||
this.playAnimationsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.playAnimationsToolStripMenuItem.Name = "playAnimationsToolStripMenuItem";
|
||||
this.playAnimationsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.playAnimationsToolStripMenuItem.Text = "Play Animations";
|
||||
this.playAnimationsToolStripMenuItem.CheckedChanged += new System.EventHandler(this.playAnimationsToolStripMenuItem_CheckedChanged);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.AutoSize = true;
|
||||
@@ -119,24 +140,23 @@
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 60F));
|
||||
this.tableLayoutPanel1.Controls.Add(this.prevButton, 0, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.nextButton, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(this.originalPictureBox, 2, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.selectTilePictureBox, 0, 0);
|
||||
this.tableLayoutPanel1.Controls.Add(this.infoTextBox, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.replaceButton, 0, 4);
|
||||
this.tableLayoutPanel1.Controls.Add(this.animationButton, 0, 3);
|
||||
this.tableLayoutPanel1.Controls.Add(this.variantComboBox, 1, 1);
|
||||
this.tableLayoutPanel1.Controls.Add(metroLabel1, 0, 1);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(20, 84);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 5;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 38.09524F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.761905F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 47.61905F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.761905F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.761905F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(759, 545);
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 38.73288F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 5.934431F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 46.11058F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.611058F));
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 4.611058F));
|
||||
this.tableLayoutPanel1.Size = new System.Drawing.Size(590, 565);
|
||||
this.tableLayoutPanel1.TabIndex = 17;
|
||||
//
|
||||
// originalPictureBox
|
||||
@@ -144,10 +164,10 @@
|
||||
this.originalPictureBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.originalPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.originalPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.originalPictureBox.Location = new System.Drawing.Point(305, 3);
|
||||
this.originalPictureBox.Location = new System.Drawing.Point(239, 3);
|
||||
this.originalPictureBox.Name = "originalPictureBox";
|
||||
this.tableLayoutPanel1.SetRowSpan(this.originalPictureBox, 5);
|
||||
this.originalPictureBox.Size = new System.Drawing.Size(451, 539);
|
||||
this.originalPictureBox.Size = new System.Drawing.Size(348, 559);
|
||||
this.originalPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.originalPictureBox.TabIndex = 4;
|
||||
this.originalPictureBox.TabStop = false;
|
||||
@@ -163,7 +183,7 @@
|
||||
this.selectTilePictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
|
||||
this.selectTilePictureBox.Location = new System.Drawing.Point(3, 3);
|
||||
this.selectTilePictureBox.Name = "selectTilePictureBox";
|
||||
this.selectTilePictureBox.Size = new System.Drawing.Size(296, 201);
|
||||
this.selectTilePictureBox.Size = new System.Drawing.Size(230, 212);
|
||||
this.selectTilePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.selectTilePictureBox.TabIndex = 0;
|
||||
this.selectTilePictureBox.TabStop = false;
|
||||
@@ -178,10 +198,10 @@
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.infoTextBox, 2);
|
||||
this.infoTextBox.Cursor = System.Windows.Forms.Cursors.Arrow;
|
||||
this.infoTextBox.ForeColor = System.Drawing.SystemColors.Window;
|
||||
this.infoTextBox.Location = new System.Drawing.Point(3, 235);
|
||||
this.infoTextBox.Location = new System.Drawing.Point(3, 254);
|
||||
this.infoTextBox.Name = "infoTextBox";
|
||||
this.infoTextBox.ReadOnly = true;
|
||||
this.infoTextBox.Size = new System.Drawing.Size(296, 253);
|
||||
this.infoTextBox.Size = new System.Drawing.Size(230, 254);
|
||||
this.infoTextBox.TabIndex = 15;
|
||||
this.infoTextBox.TabStop = false;
|
||||
this.infoTextBox.Text = "";
|
||||
@@ -192,9 +212,9 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.replaceButton.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.replaceButton, 2);
|
||||
this.replaceButton.Location = new System.Drawing.Point(3, 519);
|
||||
this.replaceButton.Location = new System.Drawing.Point(3, 540);
|
||||
this.replaceButton.Name = "replaceButton";
|
||||
this.replaceButton.Size = new System.Drawing.Size(296, 23);
|
||||
this.replaceButton.Size = new System.Drawing.Size(230, 22);
|
||||
this.replaceButton.TabIndex = 14;
|
||||
this.replaceButton.Text = "Replace";
|
||||
this.replaceButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
@@ -207,24 +227,39 @@
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.animationButton.AutoSize = true;
|
||||
this.tableLayoutPanel1.SetColumnSpan(this.animationButton, 2);
|
||||
this.animationButton.Location = new System.Drawing.Point(3, 494);
|
||||
this.animationButton.Location = new System.Drawing.Point(3, 514);
|
||||
this.animationButton.Name = "animationButton";
|
||||
this.animationButton.Size = new System.Drawing.Size(296, 19);
|
||||
this.animationButton.Size = new System.Drawing.Size(230, 20);
|
||||
this.animationButton.TabIndex = 16;
|
||||
this.animationButton.Text = "Animation";
|
||||
this.animationButton.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.animationButton.UseSelectable = true;
|
||||
this.animationButton.Click += new System.EventHandler(this.animationButton_Click);
|
||||
//
|
||||
// variantComboBox
|
||||
//
|
||||
this.variantComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.variantComboBox.Enabled = false;
|
||||
this.variantComboBox.FormattingEnabled = true;
|
||||
this.variantComboBox.ItemHeight = 23;
|
||||
this.variantComboBox.Location = new System.Drawing.Point(121, 221);
|
||||
this.variantComboBox.Name = "variantComboBox";
|
||||
this.variantComboBox.Size = new System.Drawing.Size(112, 29);
|
||||
this.variantComboBox.TabIndex = 17;
|
||||
this.variantComboBox.Theme = MetroFramework.MetroThemeStyle.Dark;
|
||||
this.variantComboBox.UseSelectable = true;
|
||||
this.variantComboBox.SelectedIndexChanged += new System.EventHandler(this.variantComboBox_SelectedIndexChanged);
|
||||
//
|
||||
// TextureAtlasEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(799, 649);
|
||||
this.ClientSize = new System.Drawing.Size(630, 669);
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.MinimumSize = new System.Drawing.Size(630, 669);
|
||||
this.Name = "TextureAtlasEditor";
|
||||
this.ShadowType = MetroFramework.Forms.MetroFormShadowType.None;
|
||||
this.Style = MetroFramework.MetroColorStyle.Silver;
|
||||
@@ -244,8 +279,6 @@
|
||||
#endregion
|
||||
|
||||
private PckStudio.Forms.Editor.AnimationPictureBox selectTilePictureBox;
|
||||
private MetroFramework.Controls.MetroButton prevButton;
|
||||
private MetroFramework.Controls.MetroButton nextButton;
|
||||
private System.Windows.Forms.MenuStrip menuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
|
||||
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
|
||||
@@ -255,5 +288,9 @@
|
||||
private System.Windows.Forms.RichTextBox infoTextBox;
|
||||
private MetroFramework.Controls.MetroButton animationButton;
|
||||
private System.Windows.Forms.ToolStripMenuItem extractTileToolStripMenuItem;
|
||||
private MetroFramework.Controls.MetroComboBox variantComboBox;
|
||||
private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem applyColorMaskToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem playAnimationsToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
@@ -121,9 +121,11 @@ namespace PckStudio
|
||||
{
|
||||
if (selectTilePictureBox.IsPlaying)
|
||||
selectTilePictureBox.Stop();
|
||||
prevButton.Enabled = index > 0;
|
||||
nextButton.Enabled = index < _textures.Count - 1;
|
||||
selectTilePictureBox.Image = null;
|
||||
infoTextBox.Text = string.Empty;
|
||||
variantComboBox.Items.Clear();
|
||||
variantComboBox.SelectedItem = null;
|
||||
variantComboBox.Enabled = false;
|
||||
|
||||
if (_textureInfos is not null && _textureInfos.IndexInRange(index))
|
||||
{
|
||||
@@ -133,49 +135,52 @@ namespace PckStudio
|
||||
_selectedItem = new SelectedTile(index, info.DisplayName, info.InternalName, selectedArea, info);
|
||||
|
||||
infoTextBox.Text = $"{_selectedItem.Name}\n{_selectedItem.TextureName}";
|
||||
bool hasAnimation = _pckFile.Files.TryGetValue($"res/textures/{_atlasType}/{_selectedItem.TextureName}.png", PckFile.FileData.FileType.TextureFile, out var animationFile);
|
||||
animationButton.Text = hasAnimation ? "Edit Animation" : "Create Animation";
|
||||
if (hasAnimation && animationFile.Size > 0)
|
||||
{
|
||||
using var ms = new MemoryStream(animationFile.Data);
|
||||
var img = Image.FromStream(ms);
|
||||
var textures = img.CreateImageList(ImageLayoutDirection.Vertical);
|
||||
selectTilePictureBox.Start(new Internal.Animation(textures, animationFile.Properties.GetPropertyValue("ANIM")));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasAnimation =
|
||||
_pckFile.Files.TryGetValue($"res/textures/{_atlasType}/{_selectedItem.TextureName}.png", PckFile.FileData.FileType.TextureFile, out var animationFile);
|
||||
animationButton.Text = hasAnimation ? "Edit Animation" : "Create Animation";
|
||||
replaceButton.Enabled = !hasAnimation;
|
||||
|
||||
if (playAnimationsToolStripMenuItem.Checked &&
|
||||
hasAnimation &&
|
||||
animationFile.Size > 0)
|
||||
{
|
||||
using var ms = new MemoryStream(animationFile.Data);
|
||||
var img = Image.FromStream(ms);
|
||||
var textures = img.CreateImageList(ImageLayoutDirection.Vertical);
|
||||
var animation = new Internal.Animation(textures, animationFile.Properties.GetPropertyValue("ANIM"));
|
||||
selectTilePictureBox.Start(animation);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_textures.IndexInRange(index))
|
||||
{
|
||||
var img = _textures[index];
|
||||
if (_selectedItem.Tile.HasColourEntry &&
|
||||
if (applyColorMaskToolStripMenuItem.Checked &&
|
||||
_selectedItem.Tile.HasColourEntry &&
|
||||
!string.IsNullOrWhiteSpace(_selectedItem.Tile.ColourEntry.DefaultName) &&
|
||||
_colourTable is not null &&
|
||||
_colourTable.Colors.FirstOrDefault(entry => entry.Name == _selectedItem.Tile.ColourEntry.DefaultName) is ColorContainer.Color color)
|
||||
{
|
||||
img = img.Blend(color.ColorPallette, BlendMode.Multiply);
|
||||
if (variantComboBox.Enabled = _selectedItem.Tile.ColourEntry.Variants.Length > 1)
|
||||
{
|
||||
variantComboBox.Items.Clear();
|
||||
variantComboBox.Items.AddRange(_selectedItem.Tile.ColourEntry.Variants);
|
||||
variantComboBox.SelectedItem = _selectedItem.Tile.ColourEntry.DefaultName;
|
||||
}
|
||||
}
|
||||
selectTilePictureBox.Image = img;
|
||||
}
|
||||
}
|
||||
|
||||
private void prevButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndex = _selectedItem.Index - 1;
|
||||
}
|
||||
|
||||
private void nextButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndex = _selectedItem.Index + 1;
|
||||
}
|
||||
|
||||
private void originalPictureBox_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button != MouseButtons.Left)
|
||||
return;
|
||||
|
||||
var index = GetSelectedImageIndex(
|
||||
int index = GetSelectedImageIndex(
|
||||
originalPictureBox.Size,
|
||||
originalPictureBox.Image.Size,
|
||||
_areaSize,
|
||||
@@ -183,7 +188,6 @@ namespace PckStudio
|
||||
originalPictureBox.SizeMode,
|
||||
_imageLayout);
|
||||
|
||||
Debug.WriteLine(index);
|
||||
if (index != -1)
|
||||
{
|
||||
SelectedIndex = index;
|
||||
@@ -378,16 +382,16 @@ namespace PckStudio
|
||||
switch (keyData)
|
||||
{
|
||||
case Keys.Left:
|
||||
if (prevButton.Enabled)
|
||||
if (_textures.IndexInRange(_selectedItem.Index - 1))
|
||||
{
|
||||
prevButton_Click(this, EventArgs.Empty);
|
||||
SelectedIndex = _selectedItem.Index - 1;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Keys.Right:
|
||||
if (nextButton.Enabled)
|
||||
if (_textures.IndexInRange(_selectedItem.Index + 1))
|
||||
{
|
||||
nextButton_Click(this, EventArgs.Empty);
|
||||
SelectedIndex = _selectedItem.Index + 1;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
@@ -410,5 +414,44 @@ namespace PckStudio
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ApplyBlend(string colorKey, Image image)
|
||||
{
|
||||
Color blendColor = Color.White;
|
||||
if (_selectedItem.Tile.HasColourEntry &&
|
||||
_colourTable is not null)
|
||||
{
|
||||
if (_selectedItem.Tile.ColourEntry.IsWaterColour &&
|
||||
_colourTable.WaterColors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.WaterColor waterColor)
|
||||
{
|
||||
blendColor = waterColor.SurfaceColor;
|
||||
}
|
||||
else if (_colourTable.Colors.FirstOrDefault(entry => entry.Name == colorKey) is ColorContainer.Color color)
|
||||
{
|
||||
blendColor = color.ColorPallette;
|
||||
}
|
||||
|
||||
if (variantComboBox.Enabled = _selectedItem.Tile.ColourEntry.Variants.Length > 1)
|
||||
{
|
||||
selectTilePictureBox.Image = image.Blend(blendColor, BlendMode.Multiply);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void variantComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_selectedItem.Tile.ColourEntry.Variants.IndexInRange(variantComboBox.SelectedIndex))
|
||||
ApplyBlend(_selectedItem.Tile.ColourEntry.Variants[variantComboBox.SelectedIndex], _textures[_selectedItem.Index]);
|
||||
}
|
||||
|
||||
private void applyColorMaskToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndex = _selectedItem.Index;
|
||||
}
|
||||
|
||||
private void playAnimationsToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
SelectedIndex = _selectedItem.Index;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,6 +117,9 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="metroLabel1.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
|
||||
Reference in New Issue
Block a user