1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Fix crashes when attempting to export specific layers or tags that have been deleted

This commit is contained in:
Emmanouil Papadeas 2024-08-11 01:00:10 +03:00
parent 363c764fc1
commit f3ee00a944

View file

@ -275,10 +275,13 @@ func process_animation(project := Global.current_project) -> void:
func _calculate_frames(project := Global.current_project) -> Array[Frame]: func _calculate_frames(project := Global.current_project) -> Array[Frame]:
var tag_index := frame_current_tag - ExportFrames.size()
if tag_index >= project.animation_tags.size():
frame_current_tag = ExportFrames.ALL_FRAMES
var frames: Array[Frame] = [] var frames: Array[Frame] = []
if frame_current_tag >= ExportFrames.size(): # Export a specific tag if frame_current_tag >= ExportFrames.size(): # Export a specific tag
var frame_start: int = project.animation_tags[frame_current_tag - ExportFrames.size()].from var frame_start: int = project.animation_tags[tag_index].from
var frame_end: int = project.animation_tags[frame_current_tag - ExportFrames.size()].to var frame_end: int = project.animation_tags[tag_index].to
frames = project.frames.slice(frame_start - 1, frame_end, 1, true) frames = project.frames.slice(frame_start - 1, frame_end, 1, true)
elif frame_current_tag == ExportFrames.SELECTED_FRAMES: elif frame_current_tag == ExportFrames.SELECTED_FRAMES:
for cel in project.selected_cels: for cel in project.selected_cels:
@ -656,6 +659,8 @@ func _get_processed_image_tag_name_and_start_id(project: Project, processed_imag
func _blend_layers( func _blend_layers(
image: Image, frame: Frame, origin := Vector2i.ZERO, project := Global.current_project image: Image, frame: Frame, origin := Vector2i.ZERO, project := Global.current_project
) -> void: ) -> void:
if export_layers - 2 >= project.layers.size():
export_layers = VISIBLE_LAYERS
if export_layers == VISIBLE_LAYERS: if export_layers == VISIBLE_LAYERS:
var load_result_from_pxo := not project.save_path.is_empty() and not project.has_changed var load_result_from_pxo := not project.save_path.is_empty() and not project.has_changed
if load_result_from_pxo: if load_result_from_pxo: