Tilemap layer selecting tiles is to difficult

hello,
when i make a tileSet layer is there a way to select the tiles on the sheet ?
instead of that tiny box on the left below the color pallete

if i hold CRTL i can see all the tiles nums but there is no way to select them ?

1 Like

I agree that selecting tiles on the canvas is too difficult.

I’d expect that, when TilemapMode.TILES is active, the magic wand tool would have different behaviors and context bar options. I’d want the wand to create a tile-sized selection on the canvas under the cursor on click.

A workaround is to turn on the grid under View > Show > Grid, choose the magic wand tool, then go to the context bar and enable Stop at Grid in the options menu. (Unlike regular layers, when a tile map layer is active, the grid aligns with the tile map’s top left corner, and moves when the cel is moved.)

However, it’s easy to forget this setting is enabled and it’s not one that I want enabled in other contexts.

[Edit: Another workaround would be to go to Edit > Preferences, click on Selection in the lefthand column, then enable Select a grid tile with double-click. Then use the marquee tool instead of the magic wand. Again, not a feature I want enabled in other contexts.]

Another workaround is to use a Lua script. imo, this is only effective in a workflow where one hand is on the mouse and another is on the keyboard (to press a shortcut assigned to the script).

Click on the arrow to the left to see script
local activeSprite = app.sprite
if not activeSprite then return end

local activeFrame = app.frame
if not activeFrame then return end

local activeLayer = app.layer
if not activeLayer then return end
if not activeLayer.isTilemap then return end

local tileSet = activeLayer.tileset
if not tileSet then return end

local activeCel = activeLayer:cel(activeFrame)
if not activeCel then return end

local mouse = app.editor.spritePos
local xMouse = mouse.x
local yMouse = mouse.y

-- If you want to worry about tiled view mode:
xMouse = xMouse % activeSprite.width
yMouse = yMouse % activeSprite.height

local celPos = activeCel.position
local xtlCel = celPos.x
local ytlCel = celPos.y

if xMouse < xtlCel or yMouse < ytlCel then return end

local tileMap = activeCel.image
local wSrcMap = tileMap.width
local hSrcMap = tileMap.height

local tileSize = tileSet.grid.tileSize
local wTile = math.max(1, math.abs(tileSize.width))
local hTile = math.max(1, math.abs(tileSize.height))
local xbrCel = xtlCel + wSrcMap * wTile - 1
local ybrCel = ytlCel + hSrcMap * hTile - 1

if xMouse > xbrCel or yMouse > ybrCel then return end

local xGrid = (xMouse - xtlCel) // wTile
local yGrid = (yMouse - ytlCel) // hTile
local xTile = xtlCel + xGrid * wTile
local yTile = ytlCel + yGrid * hTile
local mapEntry = tileMap:getPixel(xGrid, yGrid)

local mapIndex = app.pixelColor.tileI(mapEntry)
local lenTileSet = #tileSet
if mapIndex >= 0 and mapIndex < lenTileSet then
    app.fgTile = mapEntry
end

local _ = app.tool

-- To replace active selection:
-- activeSprite.selection = Selection(
--     Rectangle(xTile, yTile, wTile, hTile))

-- To add to current selection:
activeSprite.selection:add(
    Rectangle(xTile, yTile, wTile, hTile))

app.refresh()

Above is a simplification. More code would be required to, for example, cover all selection modes, contiguous vs. discontiguous selection, or sync the color bar range with the canvas selection.

1 Like

Just in case I’m sharing an extension which is a command to select all tiles placed on the tile map layer equal to the foreground color (primary tile).
SelectTiles.aseprite-extension

Once the extension is installed, go to:
Select > Fg Tiles on Tilemap