mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-20 12:33:14 +00:00
[Undo/Redo] Compress images when replacing cels and merging layers
This commit is contained in:
parent
9279a8e0ab
commit
2c5ece53dd
2 changed files with 8 additions and 8 deletions
|
@ -546,8 +546,9 @@ func open_image_at_cel(image: Image, layer_index := 0, frame_index := 0) -> void
|
|||
continue
|
||||
var cel_image := Image.create(project_width, project_height, false, Image.FORMAT_RGBA8)
|
||||
cel_image.blit_rect(image, Rect2i(Vector2i.ZERO, image.get_size()), Vector2i.ZERO)
|
||||
project.undo_redo.add_do_property(cel, "image", cel_image)
|
||||
project.undo_redo.add_undo_property(cel, "image", cel.get_image())
|
||||
Global.undo_redo_compress_images(
|
||||
{cel.image: cel_image.data}, {cel.image: cel.image.data}, project
|
||||
)
|
||||
|
||||
project.undo_redo.add_do_property(project, "selected_cels", [])
|
||||
project.undo_redo.add_do_method(project.change_cel.bind(frame_index, layer_index))
|
||||
|
|
|
@ -923,15 +923,14 @@ func _on_MergeDownLayer_pressed() -> void:
|
|||
project.undo_redo.add_undo_method(
|
||||
bottom_layer.link_cel.bind(bottom_cel, bottom_cel.link_set)
|
||||
)
|
||||
project.undo_redo.add_do_property(bottom_cel, "image_texture", ImageTexture.new())
|
||||
project.undo_redo.add_undo_property(
|
||||
bottom_cel, "image_texture", bottom_cel.image_texture
|
||||
)
|
||||
project.undo_redo.add_do_property(bottom_cel, "image", bottom_image)
|
||||
project.undo_redo.add_undo_property(bottom_cel, "image", bottom_cel.image)
|
||||
else:
|
||||
project.undo_redo.add_do_property(bottom_cel.image, "data", bottom_image.data)
|
||||
project.undo_redo.add_undo_property(bottom_cel.image, "data", bottom_cel.image.data)
|
||||
Global.undo_redo_compress_images(
|
||||
{bottom_cel.image: bottom_image.data},
|
||||
{bottom_cel.image: bottom_cel.image.data},
|
||||
project
|
||||
)
|
||||
|
||||
project.undo_redo.add_do_method(project.remove_layers.bind([top_layer.index]))
|
||||
project.undo_redo.add_undo_method(
|
||||
|
|
Loading…
Add table
Reference in a new issue