mapeditor / mapeditor/tiled

Scripting: TileLayerEdit.setTile() is affected by current selection

Open
#3,482 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

If the current map has any tiles selected, `TileLayerEdit.setTile()` will only work within the selection, and will not change any tiles outside the selection. This means that it is necessary to clear the user's selection when it isn't relevant to the script's action. Scripts should not have to do that.

I expect `setTile()` to set the tile, nothing more, nothing less. Its documentation does not state anything else. It also ignores layer lock status, as it should! It should be up to scripts to respect restrictions like locks and selections.

That said, a version of `setTile()` that *does* automatically respect selections (and layer locks!) could be convenient too, as a separate function that returns `true` when it set the tile and `false` when it did not.

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 locating the TileLayerEdit.setTile() implementation and its documentation, then inspect any nearby scripting tests for how selection state is applied. Done means setTile() changes the requested tile regardless of the current selection, while preserving the documented behavior and adding coverage for selected and unselected tiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.