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

Improve WangBrush and TileLayerWangEdit behavior with empty color #3774

Merged
merged 8 commits into from
Jul 6, 2023

Conversation

bjorn
Copy link
Member

@bjorn bjorn commented Jul 4, 2023

Mostly removing the special handling for erasing and changing the way filling is implemented. Should also improve the new TileLayerWangEdit behavior when erasing.

bjorn added 8 commits July 6, 2023 17:14
Mostly removing the special handling for erasing and changing the way
filling is implemented.
* Slightly simplified updateAdjacent (one less call to "oppositeIndex").

* In wangIdFromSurrounding, prefer colors over "no color".

* In WangFiller::wangIdFromSurroundings, don't let tiles outside of a
  fixed map contribute to the WangId.

* Don't require tiles on the border of the region to match their
  surroundings, but only prefer them to.
Also slightly optimized it based on WangId::mergeWith.
Also exposed the new TileLayerWangEdit.erasingEnabled property in the
scripting API.

Another change is that empty tiles no longer contribute to the desired
WangId for the Terrain Fill mode (when corrections are disabled).
Previously, only tiles outside of the map would not contribute to the
desired WangId. This change yields nicer behavior when using the Wang
Fill mode with the Stamp Brush, but it may need to be reconsidered for
the Shape Fill tool or a later Terrain Fill tool.
This avoids the problem, that tiles set outside of the map by the
algorithm will affect the tiles inside the map, which is not desirable.

Also, explicitly set tiles that are outside of the map to empty.  This
seems like a good idea, since it means the preview will still highlight
those areas, but it will not affect the map once applied.
…bled

Don't let unset indices from the WangId based on surroundings override
colors from currently present tiles.
@bjorn bjorn merged commit 781c74d into mapeditor:master Jul 6, 2023
12 checks passed
bjorn added a commit that referenced this pull request Jul 6, 2023
Mostly removing the special handling for erasing and changing the way filling
is implemented. This does mean that terrain sets now support only 254
colors (down from 255).

* Slightly simplified updateAdjacent (one less call to "oppositeIndex").

* In wangIdFromSurrounding, prefer colors over "no color".

* In WangFiller::wangIdFromSurroundings, don't let empty tiles contribute to
  the WangId.

* Don't require tiles on the border of the region to match their surroundings,
  but only prefer them to.

* Slightly optimized WangBrush rotational symmetry mode.

* Disabled placement of empty tiles by Stamp Brush in Terrain Fill mode.

* Added TileLayerWangEdit.erasingEnabled property in the scripting API.

* WangFiller: Don't try to make changes outside of a fixed map.

This avoids the problem, that tiles set outside of the map by the algorithm
will affect the tiles inside the map, which is not desirable.

Also, explicitly set tiles that are outside of the map to empty. This seems
like a good idea, since it means the preview will still highlight those areas,
but it will not affect the map once applied.
@bjorn bjorn deleted the wangedit-improvements branch July 6, 2023 15:23
@bjorn
Copy link
Member Author

bjorn commented Jul 6, 2023

Not sure what went wrong here, but GitHub provided me only with a rebase button that executed directly, even though I wanted to squash the commits. I've force-pushed the squashed version now (336569e).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant