better-terrain icon indicating copy to clipboard operation
better-terrain copied to clipboard

Highlight selected layer

Open torcado194 opened this issue 1 year ago • 14 comments

Adds a toggle button to the right of the layer list which will highlight the current layer in the tilemap. This mirrors the behavior of the built-in tilemap system.

sx-916

This is not a perfect solution. Internally in Godot, there's a nice TileMap::set_selected_layer() function which the built-in system uses. Unfortunately, this function isn't exposed to the user. Instead, this PR modifies the layer modulate properties directly. It properly resets the modulates when disabled or when navigating away from the TileMap, but it may have other unintended behavior (for instance, testing the project while the toggle is enabled will cause layers to be darkened/faded in-game, closing the project will keep the modified modulates, manual layer modulate changes won't be kept unless untoggled first, etc.).

So I'm not sure that this PR should be merged in its current state. I find it useful for my own sake, but I also know to make sure to disable the toggle when appropriate. I'm not sure how to better implement this without that internal function exposed (maybe there's a way to call it that I don't know about). But I'm submitting this in case you or anyone else has any input.

torcado194 avatar Jul 08 '23 22:07 torcado194