Expand click/drag to sprite boundary
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12.9k
- Forks
- 2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 8
Description
It seems like the two current options for handling tilesheets in Tiled are:
- Make or find a perfect tilesheet, with every single item perfectly aligned to a grid, and use "Based on Tileset Image"
- Split any sub-optimal tilesheets up into a single image for each tile, and use "Collection of Images"
I'd like to propose a third option, which is to allow users to select an object/tile/item based on the whitespace around it. I feel that with these three options, every imaginable majority case is covered.
A perfect example of what I mean is used by spritecow. After loading a tilesheet, experiment with clicking items in it. It calculates the dimensions by finding the smallest rectangle around a click such that every pixel on the edge is transparent (or the color denoted as transparent). You can also drag your mouse, and it does the same algorithm starting from the drawn boundaries, which makes it easy to handle what would otherwise be edge cases to the above.
Spritecow is on github, and the relevant algorithm appears to be here.
This feature would make Tiled much more powerful, as well as make it more approachable for one of it's biggest demographics: developers that want to get up and running with tilesheets they find on the web.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Tiled's tilesheet and tileset-selection workflow, then compare the proposed behavior with the referenced SpriteCanvas.js algorithm in sprite-cow. Done means users can click or drag on a tilesheet to select an item by its non-transparent sprite boundary, including the described edge cases.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100