mapeditor / mapeditor/tiled

Signal: assetAboutToBeExported

Open
#3,984 1 comment 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

**Is your feature request related to a problem? Please describe.**
I've got an extension that listens to assetAboutToBeSaved to do last-minute corrections. Examples:
- ensuring that polygon vertices are in counter-clockwise winding order
- ensuring that vertices are snapped to the nearest pixel coordinate
- apply rotation and offset

This works well, but the signal is not triggered when exporting. Thus, when changes are made since the last save and a user then hits export, an invalid file can be generated

**Describe the solution you'd like**
A new signal `assetAboutToBeExported` that works the same way as `assetAboutToBeSaved`. For consistency perhaps `assetExported` as well

**Describe alternatives you've considered**
- An `objectEdited` signal emitted whenever anything about an object changes. But there are usecases for layers, tilesets etc. too.
- Doing the corrections to the map in the `write` function of a map format. Not allowed; the map is read-only.
- Completely parsing the map and writing it to a custom format, doing checks and fixes along the way. Lots of work, plus the result is not visible to the user since it is only applied to the exported file; not the map
- Doing the checks in the `write` function of a map format and returning an error message "please save before exporting" when issues are found. That seems a bit annoying when the issues could be fixed automatically.

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 existing assetAboutToBeSaved signal and tracing the export path, including where map-format write functions are called. Compare the available signal timing with the requested assetAboutToBeExported and optional assetExported behavior; done means extensions can apply last-minute corrections before export without modifying the read-only map.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Feature
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.