armortools icon indicating copy to clipboard operation
armortools copied to clipboard

Undo-Redo-Mechanism issues

Open MathemanFlo opened this issue 4 years ago • 3 comments

ArmorPaint version: ArmorPaint.org - v0.8 (2021-01-30) - 77d0ef2

OS/device including version: Win64

Issue description: The undo-redo mechanism does not work with layer groups as expected

Steps to reproduce: First problem:

  1. Create several layers
  2. Changing their order and redoing it works perfectly fine
  3. Now create a group, for xample ap1
  4. Redo it immediately and ArmorPaint switches into a unusable state ap2

Second, related problem:

  1. Reopen ArmorPaint
  2. Create several Layers and groups
  3. Assign Layers to groups
  4. Redo some steps
  5. The behavior is incorrect. Layers are shifted to wrong positions

MathemanFlo avatar Jan 30 '21 13:01 MathemanFlo

Thank you for tidying up @luboslenco

MathemanFlo avatar Jun 13 '21 05:06 MathemanFlo

In 4ef088065dc8926e739cd455789cd28f03d17c5b deleting a layer with mask was fixed. Now one can see that undo does not work well for this operation. Steps to reproduce

  1. Create a second paint layer and add a mask
  2. Delete the newly created layer. Now the mask is deleted as well (as expected)
  3. Undo does not work correctly because only the layer is restored and not the mask itself.
  4. Redoing after the undo freezes ArmorPaint

MathemanFlo avatar Jun 14 '21 14:06 MathemanFlo

@luboslenco I started sorting out the issues connected with rearranging layers, masks and groups. I'm already halfway through fixing them. It is possible to undo rearrangements by using LayerSlot.move. Sorting out merge down operations and all these other operations that modify multiple layers is probably a bit harder and requires a refactoring of Layers.hx, LayerSlot.hx, TabLayers.hx and History.hx. Especially the logical boundary between Layers and LayerSlot does not seem to be well defined, some LayerSlot methods only work if it is placed on the layer stack but not in the undo layer queue and the History.

MathemanFlo avatar Feb 28 '22 21:02 MathemanFlo