Skip to content

Commit

Permalink
Fix exporting selected layers not including the non-selected frames
Browse files Browse the repository at this point in the history
Backport from 55df23e.
  • Loading branch information
OverloadedOrama committed Mar 7, 2024
1 parent 1caa2c6 commit 324e217
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Built using Godot 3.5.2
- Optimize canvas drawing by only updating it when the image(s) have changed. [ac6a4db43d9296ebc03e639d8199dd3878a25d86](https://github.com/Orama-Interactive/Pixelorama/commit/ac6a4db43d9296ebc03e639d8199dd3878a25d86)
- Fix bug where using shortcuts to switch between frames also moved the selection, causing deletions.
- Pxo files can now be loaded from the Open menu option in the Web version. [3dcc51705a999145e53a8e6d4de217dc03b0f147](https://github.com/Orama-Interactive/Pixelorama/commit/3dcc51705a999145e53a8e6d4de217dc03b0f147)
- Fixed exporting selected layers not including the non-selected frames.
- The ellipse tool no longer produces gaps with large sizes. [4f3a7a305a264e0d2fe86c201af76eca4b2fea0a](https://github.com/Orama-Interactive/Pixelorama/commit/4f3a7a305a264e0d2fe86c201af76eca4b2fea0a)
- Fix "visible layers" option on the export dialog producing wrong results. [346d1f071a8c6b1defb1072d39aea9c642f1ef59](https://github.com/Orama-Interactive/Pixelorama/commit/346d1f071a8c6b1defb1072d39aea9c642f1ef59)
- Random brushes now work again. [1317e40ffa5e9f01a9d214221bb5133db20a1de9](https://github.com/Orama-Interactive/Pixelorama/commit/1317e40ffa5e9f01a9d214221bb5133db20a1de9)
Expand Down
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ config/icon="res://assets/graphics/icons/icon.png"
config/macos_native_icon="res://assets/graphics/icons/icon.icns"
config/windows_native_icon="res://assets/graphics/icons/icon.ico"
config/custom_user_dir_name.X11="pixelorama"
config/Version="v0.11.4-rc2"
config/Version="v0.11.4-rc3"
config/ExtensionsAPI_Version=3
config/Pxo_Version=2

Expand Down
23 changes: 18 additions & 5 deletions src/Autoload/Export.gd
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func blend_layers(
if export_layers == 0:
blend_all_layers(image, frame, origin, project)
elif export_layers == 1:
blend_selected_cels(image, frame, origin, project)
blend_selected_cels(image, frame, origin, project, true)
else:
var layer: BaseLayer = project.layers[export_layers - 2]
var layer_image := Image.new()
Expand Down Expand Up @@ -482,12 +482,25 @@ func blend_all_layers(

# Blends selected cels of the given frame into passed image starting from the origin position
func blend_selected_cels(
image: Image, frame: Frame, origin := Vector2(0, 0), project := Global.current_project
image: Image,
frame: Frame,
origin := Vector2.ZERO,
project := Global.current_project,
include_layers := false
) -> void:
for cel_ind in frame.cels.size():
var test_array := [project.frames.find(frame), cel_ind]
if not test_array in project.selected_cels:
continue
if include_layers:
var layer_is_selected := false
for selected_cel in project.selected_cels:
if cel_ind == selected_cel[1]:
layer_is_selected = true
break
if not layer_is_selected:
continue
else:
var test_array := [project.frames.find(frame), cel_ind]
if not test_array in project.selected_cels:
continue
if frame.cels[cel_ind] is GroupCel:
continue
if not project.layers[cel_ind].is_visible_in_hierarchy():
Expand Down

0 comments on commit 324e217

Please sign in to comment.