mapeditor / mapeditor/tiled

Scripting: FilePicker for multiple files

Open
#3,558 3 comments 1 reaction 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

The [FileEdit](https://www.mapeditor.org/docs/scripting/classes/FileEdit.html) returned by `Dialog.addFilePicker()` only allows selecting one file at a time. This means that if I want to prompt users for any number of files, I have to either let them add files one after the other using one filepicker, or give them a button to add as many FilePickers as they want, neither of these is convenient for the user.

It would be much more convenient for the user if I could give them a file dialog that lets them select multiple files. It would simplify the script, as well.

Example scriptable use cases that require an unknown number of files to be selected:
- Generate tilesets with the same settings from any number of tilesheet images (this was requested on Discord)
- Add multiple Image Layers quickly
- Merge multiple map files into one map (or into a World with custom auto-placement, if/when Worlds become exposed to scripting)

Tangential request: being able to select directories, not just files. This would be more convenient than selecting all the files in a directory, and combined with multi-file select, this would allow selecting all the files in several directories. It would also be more intuitive for scripts that want an output directory than the current approach of picking some file in that directory.

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 implementation behind Dialog.addFilePicker() and the FileEdit scripting class referenced in the issue. Determine how the file dialog currently returns one file, then define and verify support for selecting multiple files; directory selection is listed as a separate, tangential request.

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
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.