mapeditor / mapeditor/tiled

Use source image size on unscaled objects after exchanging the source image.

Open
#2,985 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
12.9k
Forks
2k
Avg merge
4h 27m
Merged PRs (30d)
8

Description

(Thats an issue we already discussed in Discord a few weeks or months ago, but I forgot to open an issue as suggested. So I catch up on it now.)

Right now, if you place (image-) objects on a map the absolute size of the objects gets stored for each individual instance of the object. If you exchange the source image with a new one. All the placed objects will keep their old absolute size. So if the new image source is wider or higher all the objects will appear stretched or compressed.

Example: I have a map with a lot of decorative flowers and some bigger trees (alignment bottom-center). After I replaced the source images of the flowers and trees with new more beautiful ones that have a slightly different image size all the flowers and trees will appear stretched or compressed on the existing maps.

My suggestion for a (long-term solution) was to use scale variables instead of absolutes sizes, so a scale of 1 keeps always the original image size and a scale of 2 will always double it (keeping the integer scaling for pixel art games) even after changing the source image or its canvas sizes. But I understand that it might be a too fundamental change to the object properties.

**The solution @bjorn suggested instead was to not store the width and height values if the object has not been resized which would solve the problem for unscaled objects at least.**

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how image-object width and height are stored and how objects respond when their source image is exchanged. Check the existing object-property and image-source handling before changing behavior. Done means unscaled objects use the replacement image's source size, while explicitly resized objects retain their dimensions; the issue mentions no files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.