tiled icon indicating copy to clipboard operation
tiled copied to clipboard

Drag & dropping images into Tiled should give option to create Tilesets with them

Open eishiya opened this issue 2 years ago • 0 comments

So far, at least three times on the Tiled Discord people have reported expecting that dragging images into Tiled should prompt them to create a tileset using that image. Currently, dragging images onto Tiled causes Tiled to show an error message saying the file format is unrecognized, presumably because Tiled expects a tileset or a tilemap. Since Tiled is a program that uses many images, I think this is a sensible expectation.

I think Tiled should at least show the New Tileset dialog when a user drops an image file on it, defaulting to "Based on Image" and with the path of the file prefilled. ~~If the user drops image data instead of a file instead (e.g. if they drag an image from a browser), then Tiled should show an error telling the user that only files from their drive may be used in Tiled.~~ I think it might be possible to embed image data in tilesets, in which case Tiled should let us do that, but it should perhaps warn the user that they're embedding the image.

For even better quality of life, it would be handy if this dropping could be context-sensitive. The above would be the default behaviour, but in specific other scenarios, other behaviour could be desirable:

  • As current, dropping an image into a Collection of Images tileset in the Tileset Editor should add the image as a tile.
  • Dragging an image into a Collection of Images tileset in the tilesets panel should prompt the user whether they want to add that image to the tileset, or make a new tileset.
  • Dragging an image into the Layers panel should prompt the user whether they want to make an Image Layer using that image, or make a new tileset.
  • Dragging an image (or any file, really...) onto a Property of type File should give the option set that property's value to the path of the file.

Perhaps all this prompting is unnecessary and when possible, the context-appropriate action should always be taken instead, with all other drops counting as "try to make a tileset out of this". The reason I suggested prompting is to avoid scenarios where a user wants one thing but drops the image somewhere else by accident, which might be common since many programs are not that context-sensitive and have the same behaviour regardless of where you drop the image.

eishiya avatar Jul 18 '21 21:07 eishiya