Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Name Remains after Deleting Pattern from Slot #48

Open
JeffreyBytes opened this issue Aug 23, 2023 · 2 comments
Open

[Bug] Name Remains after Deleting Pattern from Slot #48

JeffreyBytes opened this issue Aug 23, 2023 · 2 comments

Comments

@JeffreyBytes
Copy link

JeffreyBytes commented Aug 23, 2023

Description:

When deleting a pattern from grid, the name of the last pattern stays in that slot.

Environment:

OS: Windows
Version: 0.9.5p16 (latest)

Steps to Reproduce:

  1. Import a pattern into a slot
  2. Delete pattern from slot

Expected Behavior:

Name is set to "Empty" or "Design Pattern"

Actual Behavior:

Last pattern name remains

Screenshot:

image

Reproducibility:

Issue occurs consistently.

Related Issue:

Might be related to #41

Note:

When importing a pattern, the name is filled in successfully. This is only an issue when deleting patterns.
This isn't an application-breaking bug, but more of a QoL thing.

@JeffreyBytes
Copy link
Author

The issue can be resolved by editing the following method:

public static void Empty(this DesignPattern pattern)
{
for (var i = 0; i < pattern.Palette.Length; i++)
{
pattern.Palette[i].R = EmptyPalette[i].Item1;
pattern.Palette[i].G = EmptyPalette[i].Item2;
pattern.Palette[i].B = EmptyPalette[i].Item3;
}
pattern.Image = new byte[(pattern.Width / 2) * pattern.Height];
if (pattern is ProDesignPattern)
{
pattern.Type = DesignPattern.TypeEnum.EmptyProPattern;
Array.Copy(EmptyProPixels, 0, pattern.Image, 0, EmptyProPixels.Length);
}
else
{
Array.Copy(EmptyPixels, 0, pattern.Image, 0, pattern.Image.Length);
}
}

I've confirmed this to work, but I'm not a Unity developer and don't think I have my development environment set up correctly. I'm getting weird behavior even before making edits.

I've pushed the changes to my fork: JeffreyBytes@f887f32

Here's a code comparison between the old and new code:

 public static void Empty(this DesignPattern pattern)
 {
     for (var i = 0; i < pattern.Palette.Length; i++)
     {
        pattern.Palette[i].R = EmptyPalette[i].Item1;
        pattern.Palette[i].G = EmptyPalette[i].Item2;
        pattern.Palette[i].B = EmptyPalette[i].Item3;
     }
     pattern.Image = new byte[(pattern.Width / 2) * pattern.Height];
     if (pattern is ProDesignPattern)
     {
         pattern.Type = DesignPattern.TypeEnum.EmptyProPattern;
+        pattern.Name = "PRO Pattern";
         Array.Copy(EmptyProPixels, 0, pattern.Image, 0, EmptyProPixels.Length);
     }
     else
     {
+        pattern.Name = "Design Pattern";
         Array.Copy(EmptyPixels, 0, pattern.Image, 0, pattern.Image.Length);
     }
 }

@lottehime
Copy link

Not related to #41 , but a sister issue with it and #27 as well as #30 in regards to some pattern logic issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants