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

App.transaction ignores Layer.isVisible #112

Open
annabunches opened this issue Jul 19, 2024 · 0 comments
Open

App.transaction ignores Layer.isVisible #112

annabunches opened this issue Jul 19, 2024 · 0 comments

Comments

@annabunches
Copy link

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.

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

No branches or pull requests

1 participant