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

Added TileLayerWangEdit.generate #3770

Merged
merged 2 commits into from
Jun 30, 2023
Merged

Conversation

bjorn
Copy link
Member

@bjorn bjorn commented Jun 29, 2023

Returns a bare tile layer for now. Example use in a custom tool:

    mouseMoved: function(x, y, modifiers) {
        let ws = tiled.mapEditor.currentWangSet
        let editor = tiled.activeAsset.currentLayer.wangEdit(ws)
        editor.correctionsEnabled = true
        editor.setCorner(this.tilePosition, tiled.mapEditor.currentWangColorIndex)
        let map = new TileMap()
        map.addLayer(editor.generate())
        this.preview = map
    },

Returns a bare tile layer. Example use in a custom tool:

    mouseMoved: function(x, y, modifiers) {
        let ws = tiled.mapEditor.currentWangSet
        let editor = tiled.activeAsset.currentLayer.wangEdit(ws)
        editor.correctionsEnabled = true
        editor.setCorner(this.tilePosition, tiled.mapEditor.currentWangColorIndex)
        let map = new TileMap()
        map.addLayer(editor.generate())
        this.preview = map
    },

One problem is that currently the "checked" state is not used later on,
for example when rendering the preview or when calling
EditableMap::merge. This makes it impossible to erase tiles through
TileLayerWangEdit.generate().
* The Tool.preview now includes empty-but-modified tiles in the
  highlighted area.

* The TileMap.merge function now also copies empty-but-modified tiles
  from the map getting merged.
@bjorn bjorn merged commit d660572 into mapeditor:master Jun 30, 2023
12 checks passed
@bjorn bjorn deleted the wangedit-generate branch June 30, 2023 16:00
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