mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Fix crash when deleting a frame or layer and there is a transformation occurring
This commit is contained in:
parent
24da4bd703
commit
c859834f7c
|
@ -220,13 +220,15 @@ func handle_redo(_action : String, project : Project = Global.current_project, l
|
|||
func update_texture(layer_index : int, frame_index := -1, project : Project = Global.current_project) -> void:
|
||||
if frame_index == -1:
|
||||
frame_index = project.current_frame
|
||||
var current_cel : Cel = project.frames[frame_index].cels[layer_index]
|
||||
current_cel.image_texture.create_from_image(current_cel.image, 0)
|
||||
|
||||
if project == Global.current_project:
|
||||
var frame_texture_rect : TextureRect
|
||||
frame_texture_rect = Global.find_node_by_name(project.layers[layer_index].frame_container.get_child(frame_index), "CelTexture")
|
||||
frame_texture_rect.texture = current_cel.image_texture
|
||||
if frame_index < project.frames.size() and layer_index < project.layers.size():
|
||||
var current_cel : Cel = project.frames[frame_index].cels[layer_index]
|
||||
current_cel.image_texture.create_from_image(current_cel.image, 0)
|
||||
|
||||
if project == Global.current_project:
|
||||
var frame_texture_rect : TextureRect
|
||||
frame_texture_rect = Global.find_node_by_name(project.layers[layer_index].frame_container.get_child(frame_index), "CelTexture")
|
||||
frame_texture_rect.texture = current_cel.image_texture
|
||||
|
||||
|
||||
func onion_skinning() -> void:
|
||||
|
|
|
@ -442,18 +442,19 @@ func transform_content_confirm() -> void:
|
|||
if !is_moving_content:
|
||||
return
|
||||
var project : Project = Global.current_project
|
||||
var cel_image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
||||
cel_image.blit_rect_mask(preview_image, preview_image, Rect2(Vector2.ZERO, project.selection_bitmap.get_size()), big_bounding_rectangle.position)
|
||||
var selected_bitmap_copy = project.selection_bitmap.duplicate()
|
||||
project.move_bitmap_values(selected_bitmap_copy)
|
||||
project.selection_bitmap = selected_bitmap_copy
|
||||
if project.current_frame < project.frames.size() and project.current_layer < project.layers.size():
|
||||
var cel_image : Image = project.frames[project.current_frame].cels[project.current_layer].image
|
||||
cel_image.blit_rect_mask(preview_image, preview_image, Rect2(Vector2.ZERO, project.selection_bitmap.get_size()), big_bounding_rectangle.position)
|
||||
var selected_bitmap_copy = project.selection_bitmap.duplicate()
|
||||
project.move_bitmap_values(selected_bitmap_copy)
|
||||
project.selection_bitmap = selected_bitmap_copy
|
||||
commit_undo("Move Selection", undo_data)
|
||||
|
||||
original_preview_image = Image.new()
|
||||
preview_image = Image.new()
|
||||
original_bitmap = BitMap.new()
|
||||
is_moving_content = false
|
||||
is_pasting = false
|
||||
commit_undo("Move Selection", undo_data)
|
||||
update()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue