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

Fixed overwriting of sprites with duplicate coords #2

Merged
merged 2 commits into from
Aug 29, 2024

Conversation

LinfanS
Copy link
Contributor

@LinfanS LinfanS commented Aug 28, 2024

Summary

This pull request addresses the issue described in #1 where icons in the spritesheet that are used for multiple entries would not update correctly when a single icon is updated, leading to it being overwritten with the old image.

Related Issues

Fixes #1 (but without generating a new Atlas file).

Details

  • Ensures that if a user replaces a sprite that is a duplicate, it will be placed on the spritesheet last to prevent overwriting the image.
  • Adds functionality to track the names of sprites that use images referred to by multiple sprites.
  • Adds functionality to track which sprites have been updated by the user through image hashing including non-dupes.

Edge Cases

  • If an icon used under multiple sprite names is changed twice in different places, the one changed last (in the order listed in the UI) will take precedence. This means the later image overwrites the first one, which is noticeable if using images of different sizes.
  • Further improvements may require generating a new Atlas file and spritesheet that separates icons with duplicate sprite names into individual icons.

Demo

With the implemented changes, if a sprite such as monster_type_0_en.png is replaced with a substitute, the spritesheet should be updated as shown below (top left).
main

Copy link
Owner

@Seth-Revz Seth-Revz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting some small changes. The rest is great 👍

pokatlas.py Outdated Show resolved Hide resolved
pokatlas.py Show resolved Hide resolved
Copy link
Owner

@Seth-Revz Seth-Revz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@Seth-Revz Seth-Revz merged commit 1ab1e17 into Seth-Revz:main Aug 29, 2024
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

Successfully merging this pull request may close these issues.

Add option to create a new main.atlas file and new main.png sprite layout when saving.
2 participants