Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect repainting when using scripted Tools #3268

Closed
eishiya opened this issue Feb 9, 2022 · 2 comments
Closed

Incorrect repainting when using scripted Tools #3268

eishiya opened this issue Feb 9, 2022 · 2 comments
Assignees
Labels
bug Broken behavior.

Comments

@eishiya
Copy link
Contributor

eishiya commented Feb 9, 2022

When using a scripted tool that displays a tile preview, when the preview changes, only the area occupied by the map cells is redrawn, any bits of tiles that stuck out of this area are not redrawn:
toolpreviews2
(Here, 48x48 tiles are being used on a 32x32 grid, so there are 16px of tile that stick out at the top and right.)


This next one may or may not be a related issue, but I'm including it here because it may be related and its triggers are so unusual that I worry I'll forget about it.
When Undoing the action of a custom Tool, sometimes a smaller area than the cell/tile is repainted. In this gif, there are two separate Undos, notice how each one only repaints the lower 24x24 of the modified cell:
toolpreviews4
The area repainted seems to be affected by the size of the tile last drawn to the map, I've been able to get 16x16, 24x24, and the full 48x48 repainted by placing tiles of those sizes prior to performing this test. However, it's not entirely consistent and sometimes the issue just seems to get resolved after painting some tiles, and I haven't tracked down a reliable way to reproduce it. On Discord, Bjorn suggested it may be a caching issue.


The scripted tool I used in these gifs is available here if you want to test with it, but any scripted tool that previews tiles seems to be affected by at least the first issue.

@bjorn bjorn self-assigned this Feb 10, 2022
@bjorn bjorn added the bug Broken behavior. label Feb 10, 2022
@bjorn
Copy link
Member

bjorn commented Feb 10, 2022

This is due to the tilesets missing from the preview map, since they do currently not get added automatically. I'll make it so that they are.

@bjorn bjorn closed this as completed in e09d8a4 Feb 11, 2022
@eishiya
Copy link
Contributor Author

eishiya commented Feb 18, 2022

It seems the fix is not quite 100%.

Wrote a script today that copies tiles from a source map open in the editor to a map created in the script, and from there to a destination map in the editor (to allow copying entire layers across maps). The tilesets are not added to the destination map.

The layer's tiles are added prior to the layer being added to the map, I recall you mentioned that potentially being a problem. However, the structure of the code is such that it would be messy to change the order. I think addLayer() should add any new tilesets to the map, if it doesn't already.

@bjorn bjorn reopened this Feb 18, 2022
@bjorn bjorn closed this as completed in 9fa93e5 Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior.
Projects
None yet
Development

No branches or pull requests

2 participants