ldtk icon indicating copy to clipboard operation
ldtk copied to clipboard

Tileset enum overlay

Open keithclark opened this issue 3 years ago • 4 comments

This change adds an overlay to tileset layers to show which tiles have which enum values assigned to them. It's triggered by clicking a new "Tile enums" option in the tool palette. Tiles with an enum value are outlined in the relevant colour, as defined in the tileset editor. Tiles with multiple enum values are indicated by nested outlines.

I made this change because I was finding it difficult to determine if tiles had enum set correctly. See #698. Also, this is my first encounter with a Haxe project so I could have taken the wrong approach with this, and there could be unforeseen issues that I've not though of.

Summary of changes:

  • Adds a new "Tile enums" item to the editing options
  • Adds a new tileEnumOverlays boolean setting
  • Adds TilesetEnumChanged event, triggered when an enum value is assigned, changed or removed from a tile.
  • Adds a h2d.Graphics instance to the LayerRenderer, which is used to draw the overlay rectangles
Screenshot 2022-06-18 at 13 37 10

keithclark avatar Jun 18 '22 15:06 keithclark

Amazing stuff! Does it fair well with enums that have images assigned to them from a tileset, or does it just use the enum colors? Also I would maybe group the button with the grid toggle and the eye icon instead of putting on the bottom, but that's just a minor change.

FaultyFunctions avatar Jun 21 '22 08:06 FaultyFunctions

Amazing stuff! Does it fair well with enums that have images assigned to them from a tileset, or does it just use the enum colors?

At the moment it just uses the assigned enum colours. I thought the layers may become cluttered and hard to scan if tiles and enum images were mixed together, but it's something I could look at.

Also I would maybe group the button with the grid toggle and the eye icon instead of putting on the bottom, but that's just a minor change.

I've already done that locally. It made more sense up with the other two options :) I can commit / push the change if you're planning to build the project yourself?

I'm not going to spend much more time on this until the feature has been properly evaluated and I know I'm on the right track.

keithclark avatar Jun 21 '22 16:06 keithclark

@deepnight Is this something that has potential?

keithclark avatar Jun 30 '22 16:06 keithclark

Yes :)

deepnight avatar Jun 30 '22 19:06 deepnight

This was merged in 1.1.4 branch, which should be released in the next few weeks.

  • I fixed a visual bug with X-flipped tiles (overlay was off to the right)
  • I added support for enum overlays to Auto-Layers as well, as the tiles they generate might also be tagged.

deepnight avatar Dec 13 '22 09:12 deepnight

Thanks a lot for this very cool PR :)

deepnight avatar Dec 13 '22 09:12 deepnight