AdamsLair / duality

a 2D Game Development Framework
https://adamslair.github.io/duality
MIT License
1.41k stars 288 forks source link

#526 Fix for Tileset Editor drawing when out of focus #701

Closed megabytefisher closed 5 years ago

megabytefisher commented 5 years ago

This PR is a fix for issue #526. This issue is caused when the TilesetAutoTileInput instance is no longer in the editor object selection.

When a user uses auto-tile mode, the current layer's TilesetAutoTileInput instance is added to the global object selection. However, if a user then selects something else (such as a tilemap drawing tool), it can no longer retrieve the instance. This means that subsequent UI painting will draw the tile but not apply any darkening/highlighting because TilesetView_PaintTiles first checks if that instance is null.

This commit modifies the auto-tile mode so that it stores a local instance of the input object. It will still add it to the global selection when the layer is selected, but it no longer relies on value itself.

Please let me know if there are any issues with these changes.

megabytefisher commented 5 years ago

Hi, I've made an additional commit to clear the current auto-tile input object when the user deselects the current tileset or tileset layer. I have tested all the cases you provided, and this commit fixes all issues I encountered.

Please let me know if there are any other issues.

ilexp commented 5 years ago

Approved and merged. Thanks! 🙂