mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fix exporting not including the last frame of a tag and "Selected layers" not including the non-selected frames
This commit is contained in:
parent
36d4b0fa18
commit
55df23e400
|
@ -22,7 +22,8 @@ func blend_layers(
|
||||||
frame: Frame,
|
frame: Frame,
|
||||||
origin := Vector2i.ZERO,
|
origin := Vector2i.ZERO,
|
||||||
project := Global.current_project,
|
project := Global.current_project,
|
||||||
only_selected := false
|
only_selected_cels := false,
|
||||||
|
only_selected_layers := false,
|
||||||
) -> void:
|
) -> void:
|
||||||
var textures: Array[Image] = []
|
var textures: Array[Image] = []
|
||||||
# Nx3 texture, where N is the number of layers and the first row are the blend modes,
|
# Nx3 texture, where N is the number of layers and the first row are the blend modes,
|
||||||
|
@ -35,10 +36,18 @@ func blend_layers(
|
||||||
var ordered_index := project.ordered_layers[i]
|
var ordered_index := project.ordered_layers[i]
|
||||||
var layer := project.layers[ordered_index]
|
var layer := project.layers[ordered_index]
|
||||||
var include := true if layer.is_visible_in_hierarchy() else false
|
var include := true if layer.is_visible_in_hierarchy() else false
|
||||||
if only_selected and include:
|
if only_selected_cels and include:
|
||||||
var test_array := [frame_index, i]
|
var test_array := [frame_index, i]
|
||||||
if not test_array in project.selected_cels:
|
if not test_array in project.selected_cels:
|
||||||
include = false
|
include = false
|
||||||
|
if only_selected_layers and include:
|
||||||
|
var layer_is_selected := false
|
||||||
|
for selected_cel in project.selected_cels:
|
||||||
|
if i == selected_cel[1]:
|
||||||
|
layer_is_selected = true
|
||||||
|
break
|
||||||
|
if not layer_is_selected:
|
||||||
|
include = false
|
||||||
var cel := frame.cels[ordered_index]
|
var cel := frame.cels[ordered_index]
|
||||||
var cel_image := layer.display_effects(cel)
|
var cel_image := layer.display_effects(cel)
|
||||||
textures.append(cel_image)
|
textures.append(cel_image)
|
||||||
|
|
|
@ -182,7 +182,7 @@ func _calculate_frames(project := Global.current_project) -> Array[Frame]:
|
||||||
if frame_current_tag > 1: # Specific tag
|
if frame_current_tag > 1: # Specific tag
|
||||||
var frame_start: int = project.animation_tags[frame_current_tag - 2].from
|
var frame_start: int = project.animation_tags[frame_current_tag - 2].from
|
||||||
var frame_end: int = project.animation_tags[frame_current_tag - 2].to
|
var frame_end: int = project.animation_tags[frame_current_tag - 2].to
|
||||||
frames = project.frames.slice(frame_start - 1, frame_end - 1, 1, true)
|
frames = project.frames.slice(frame_start - 1, frame_end, 1, true)
|
||||||
elif frame_current_tag == 1: # Selected frames
|
elif frame_current_tag == 1: # Selected frames
|
||||||
for cel in project.selected_cels:
|
for cel in project.selected_cels:
|
||||||
frames.append(project.frames[cel[0]])
|
frames.append(project.frames[cel[0]])
|
||||||
|
@ -570,7 +570,7 @@ func _blend_layers(
|
||||||
if export_layers == 0:
|
if export_layers == 0:
|
||||||
DrawingAlgos.blend_layers(image, frame, origin, project)
|
DrawingAlgos.blend_layers(image, frame, origin, project)
|
||||||
elif export_layers == 1:
|
elif export_layers == 1:
|
||||||
DrawingAlgos.blend_layers(image, frame, origin, project, true)
|
DrawingAlgos.blend_layers(image, frame, origin, project, false, true)
|
||||||
else:
|
else:
|
||||||
var layer := project.layers[export_layers - 2]
|
var layer := project.layers[export_layers - 2]
|
||||||
var layer_image := Image.new()
|
var layer_image := Image.new()
|
||||||
|
|
|
@ -298,7 +298,7 @@ func open_v0_pxo_file(path: String, empty_project: bool) -> Project:
|
||||||
var test_json_conv := JSON.new()
|
var test_json_conv := JSON.new()
|
||||||
var error := test_json_conv.parse(first_line)
|
var error := test_json_conv.parse(first_line)
|
||||||
if error != OK:
|
if error != OK:
|
||||||
print("Error, corrupt pxo file. Error code %s (%s)" % [error, error_string(error)])
|
print("Error, corrupt legacy pxo file. Error code %s (%s)" % [error, error_string(error)])
|
||||||
file.close()
|
file.close()
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue