From 9a37eac6ecd22d5fb73d0816961d0b076adb0240 Mon Sep 17 00:00:00 2001 From: miku-666 <74728189+NessieHax@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:51:35 +0200 Subject: [PATCH] TextureAtlasEditor - Fix argument null exception when populating variant combo box --- PCK-Studio/Forms/Editor/TextureAtlasEditor.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs index 6bfec1b8..5ffd1b2f 100644 --- a/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs +++ b/PCK-Studio/Forms/Editor/TextureAtlasEditor.cs @@ -17,6 +17,7 @@ **/ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; @@ -228,8 +229,6 @@ private void SetImageDisplayed(int index) selectTilePictureBox.BlendColor = GetBlendColor(); selectTilePictureBox.UseBlendColor = applyColorMaskToolStripMenuItem.Checked; - - tileNameLabel.Text = $"{dataTile.Tile.DisplayName}"; internalTileNameLabel.Text = $"{dataTile.Tile.InternalName}"; @@ -255,10 +254,9 @@ private void SetImageDisplayed(int index) setColorButton.Enabled = dataTile.Tile.AllowCustomColour; - if (setColorButton.Enabled) + variantComboBox.Enabled = variantComboBox.Visible = dataTile.Tile.HasColourEntry && dataTile.Tile.ColourEntry?.Variants?.Length > 1; + if (variantComboBox.Enabled) { - variantComboBox.Enabled = variantComboBox.Visible = dataTile.Tile.ColourEntry.Variants.Length > 1; - if (dataTile.Tile.ColourEntry.IsWaterColour) { foreach (ColorContainer.WaterColor col in _colourTable.WaterColors) @@ -268,6 +266,7 @@ private void SetImageDisplayed(int index) } } + // TODO: only add variants that are available in the color table variantComboBox.Items.AddRange(dataTile.Tile.ColourEntry.Variants); if (variantComboBox.Items.Count > 0) @@ -445,6 +444,7 @@ private Color FindBlendColorByKey(string colorKey) } } + Debug.WriteLine("Could not find: " + colorKey); return Color.White; }