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

More z-index layer ordering fixes

This commit is contained in:
Emmanouil Papadeas 2023-12-06 15:11:04 +02:00
parent b40fef2c97
commit aacd41f2e5
2 changed files with 7 additions and 2 deletions

View file

@ -20,12 +20,15 @@ func blend_layers(
# Nx3 texture, where N is the number of layers and the first row are the blend modes,
# the second are the opacities and the third are the origins
var metadata_image := Image.create(project.layers.size(), 3, false, Image.FORMAT_R8)
var frame_index := project.frames.find(frame)
var previous_ordered_layers: Array[int] = Array(project.ordered_layers)
project.order_layers(frame_index)
for i in project.layers.size():
var ordered_index := project.ordered_layers[i]
var layer := project.layers[ordered_index]
var include := true if layer.is_visible_in_hierarchy() else false
if only_selected and include:
var test_array := [project.frames.find(frame), i]
var test_array := [frame_index, i]
if not test_array in project.selected_cels:
include = false
var cel := frame.cels[ordered_index]
@ -49,6 +52,8 @@ func blend_layers(
var gen := ShaderImageEffect.new()
gen.generate_image(blended, blend_layers_shader, params, project.size)
image.blend_rect(blended, Rect2i(Vector2i.ZERO, project.size), origin)
# Re-order the layers again to ensure correct canvas drawing
project.ordered_layers = Array(previous_ordered_layers)
## Algorithm based on http://members.chello.at/easyfilter/bresenham.html

View file

@ -522,6 +522,7 @@ func change_cel(new_frame: int, new_layer := -1) -> void:
if new_layer != current_layer: # If the layer has changed
current_layer = new_layer
order_layers()
Global.transparent_checker.update_rect()
Global.cel_changed.emit()
if get_current_cel() is Cel3D:
@ -868,4 +869,3 @@ func _update_layer_ui() -> void:
for f in frames.size():
cel_hbox.get_child(f).layer = l
cel_hbox.get_child(f).button_setup()
order_layers()