aseprite / aseprite/api

App.transaction ignores Layer.isVisible

Open
#112 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
307
Forks
68
PR merge metrics
No merged PRs in 30d

Description

If you set the `isVisible` property on a Layer inside a transaction, and then call `app.undo()`, the visibility change is not reverted.

Example code:

```
local function revealLayers(layers)
for i, layer in ipairs(layers) do
layer.isVisible = true
if layer.isGroup then
revealLayers(layer.layers)
end
end
end

app.transaction(function()
revealLayers(app.activeSprite.layers)
end)
app.undo() -- This has no effect.
```

Other actions that act directly on properties *are* reverted (I tested setting `Layer.color` instead of `Layer.isVisible`, for instance).

I suspect this is intentional in that it is consistent with the UI behavior; changing a layer's visibility doesn't seem to be revertable via Edit -> Undo. However, in a scripting context it would be useful to have a revertable visibility change. So if the behavior is intentional, this could be considered a feature request for something like `Sprite:setVisibility(visibility, revertable=false)`, where setting the second parameter to `true` adds the visibility change to the edit history.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.