Skip to content

App.transaction ignores Layer.isVisible #112

@annabunches

Description

@annabunches

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions