mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.17k stars 1.76k forks source link

Switching tilesets overwrites current brush #3654

Open eishiya opened 1 year ago

eishiya commented 1 year ago

When switching tilesets in the Tilesets panel, the brush is set to the currently selected tiles in that tileset. This overwrites any currently set brush, and if the tileset previously had multiple tiles selected, as happens when painting with a larger brush, it's overwritten by the arrangement of those tiles in the tileset, which is rarely useful.

brushoverwrite

To Reproduce This requires that at least two tilesets are available in the Tilesets panel.

  1. Sample some tiles from a map into a brush, or choose a saved stamp. For the clearest results, this brush should consist of tiles that aren't all together in the tileset.
  2. Go to another tileset tab.
  3. Observe that the brush you just spent time making has been overwritten by whatever tiles were selected in that tileset.
  4. Switch back to the previous tileset.
  5. Observe that your brush is again changed, this time to the relevant tiles from your sampled brush, but as they occur in the tileset rather than your original brush.

Expected behaviour Switching to a different tileset should not modify the brush if doing so would be destructive or would be likely to produce a garbage brush. I can think of two concrete ways to make this decision:

The above GIF is from Tiled 1.10.1 64-bit on Windows 10, but I'm pretty sure this has been happening since 1.8 and quite likely much earlier.

This is a usability problem rather than a bug, but it sure feels like a bug when your brush gets mangled by switching tilesets xP

bjorn commented 8 months ago

Hmm, I was thinking about how to implement the various suggestions here. It gets a little complicated. In the end, it seemed to me that we should store the stamp with the tileset, based upon which the tiles were selected, so that when you switch back to that tileset, it can just pick up that same stamp again.

However, a much easier solution would be, if switching tilesets would not touch the current brush at all. Maybe that is rather unexpected in the first place?

To make this more clear, we could, if you select some tiles from some tileset, automatically deselect any tiles selected in other tilesets. Though, this might make #3768 possibly a bit annoying, since the deselection would then also happen in the associated tileset editors. Maybe we can just keep the selected tiles, but just not change the tile stamp when switching tilesets.

eishiya commented 8 months ago

Storing stamps with the Tileset sounds weird to me, since a stamp can consist of tiles from several tilesets.

Maybe that is rather unexpected in the first place?

I think updating the brush can be convenient when all your brushes correspond to simple regions from the tileset and you use many tilesets, just not in more complex scenarios.

Perhaps there could be an option in the tilesets panel for this, e.g. "Automatically set brush to selected tiles"? It could affect the tile selection changing both due to the tileset being changed in the Tilesets view, and due to tiles being selected in a Tileset document due to sync (and it may need a tooltip to explain this). With that setting being off, my complaints about #3768 would be irrelevant, and the sync feature might not even need to be optional.

bjorn commented 8 months ago

Storing stamps with the Tileset sounds weird to me, since a stamp can consist of tiles from several tilesets.

Yeah, in this case we could store the same stamp on each of the tilesets though. But I'm not sure this approach is a good idea, anyway.

I'm not convinced that the convenience of switching brushes when switching tilesets is worth an option. I think it's rather rare people would be relying on that, and that it should be no problem to click in the tileset view again.

What I do worry about a bit is either:

However, maybe the latter is not a big problem, given that the "current tile" should stay, so stuff like collision editor, properties view and such will not switch to another tile at least. Well, unless multiple tiles were selected, which does affect the properties view.

eishiya commented 8 months ago

I'm not convinced that the convenience of switching brushes when switching tilesets is worth an option. I think it's rather rare people would be relying on that, and that it should be no problem to click in the tileset view again.

For a multi-tile brush (which is where this behaviour would be most useful), one would have to ctrl+click twice on a tile to update the brush, which isn't necessarily intuitive. I think some users, not knowing about ctrl+click, would complain about "having to" reselect their entire brush. This would be alleviated if these selection modifiers were documented within Tiled itself, or if the Tilesets view had selection options similar to the toolbar actions for the selection tools.

I agree that seeing different tiles selected versus what's in the brush is a weird, but I don't think the selection should be "cleared", I think it's better for the selection and brush to disagree when the syncing is added/enabled. The properties view doesn't allow you to edit tiles while in the Map Editor (which I think is a good thing since it enforces a conceptual separation between Map and Tileset, even if wasn't not a fully intentional decision) and the brush isn't visible in the Tileset Editor, so I think this disagreement isn't likely to cause any damage.

Somewhat related: Tiled has the Ctrl+[1-9] feature to save Tile Stamps, but this feature is hard to discover and requires foresight to use. Perhaps there could be some sort of automatic version of this that saves the last few used stamps that users could cycle through, perhaps via some modifier(s) + scrollwheel (I think shift+wheel might be free?)? This way, in the scenario where someone was actually relying on their brush being set to the selected tiles in a Tileset they switched to, they could instead scroll through their recent stamp history instead of changing tilesets. This would still be hard to discover, but at least it wouldn't require foresight. Edit: And/or maybe there could be a "recent stamps" panel, which would be easier to discover, to allow quickly selecting recently used stamps in a visual manner similar to the Tile Stamps panel.