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

feat: remove image rect restrictions in tilesets #4166

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

deathbeam
Copy link

@deathbeam deathbeam commented Feb 3, 2025

Previously, image rect could only be set on collection tileset tiles. This change allows setting image rect on any tile type.

This allows making "multi tile" tiles without changing any of the existing data layout or needing to painfully create new collections.

Godot 4 has similar feature in merging tiles (even though more advanced and works differently)

This is mostly useful for y sorting and multi tile properties.

Still unfinished, just PRing the first draft for opinions

The baseline currently works (tested with json saving/loading so far), just need to sort out some rendering quirks and make sure I did not broke anything. And maybe improve the usage by a bit.

@eishiya
Copy link
Contributor

eishiya commented Feb 3, 2025

This sounds like a partial implementation of the Tile Atlas concept discussed in #2863? Image rects were added as a first step towards this. You may want to see the discussion there about why this should probably be a separate tileset type rather than just extending image rects to "Based on Tileset Image" tilesets.

@deathbeam
Copy link
Author

Looking through it, yea. Even though I think you are overcomplicating it a bit there with the off-grid tiles like the 16x19 example there as that one also fits in 16x32 so the grid display can always just remain in the regular baseline grid set on the tileset, so dont think new view is even needed.

New tileset type, I guess the benefit would be to just inherently save all the image recs instead of saving just the custom ones? which means image recs would be able to also get removed (which would be ideal for merging tiles, which is the feature im trying to replicate here from godot and I think godot mostly works like that anyway, and I think you are also talking about ending on something like that eventually).

@deathbeam
Copy link
Author

Ok got some progress done, I for now added boolean "atlas" on the tileset and adjusted how everything is rendered when set to atlas (grid is no longer used at all and every image rect is drawn directly, and indexAt also uses image rects for resolving tiles they are clicking on). Also added ability to delete tiles, add and merge is something I want to look at next after resolving some rendering quirks this still has

image

@deathbeam deathbeam force-pushed the image-rect-tile branch 2 times, most recently from ba09831 to 694cbe9 Compare February 3, 2025 17:13
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.

2 participants