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

Fix bug where, if the bottom-most layer is invisible, selection can't transform content on other layers

This commit is contained in:
Emmanouil Papadeas 2023-03-27 03:42:16 +03:00
parent 6b587688f1
commit 5c9f0d8c18

View file

@ -417,31 +417,28 @@ func blend_all_layers(
func blend_selected_cels( func blend_selected_cels(
image: Image, frame: Frame, origin := Vector2(0, 0), project := Global.current_project image: Image, frame: Frame, origin := Vector2(0, 0), project := Global.current_project
) -> void: ) -> void:
var layer_i := 0
for cel_ind in frame.cels.size(): for cel_ind in frame.cels.size():
var test_array := [project.current_frame, cel_ind] var test_array := [project.current_frame, cel_ind]
if not test_array in project.selected_cels: if not test_array in project.selected_cels:
continue continue
if not frame.cels[cel_ind] is PixelCel: if not frame.cels[cel_ind] is PixelCel:
continue continue
if not project.layers[cel_ind].is_visible_in_hierarchy():
continue
var cel: PixelCel = frame.cels[cel_ind] var cel: PixelCel = frame.cels[cel_ind]
var cel_image := Image.new()
if project.layers[layer_i].is_visible_in_hierarchy(): cel_image.copy_from(cel.image)
var cel_image := Image.new() if cel.opacity < 1: # If we have cel transparency
cel_image.copy_from(cel.image) cel_image.lock()
if cel.opacity < 1: # If we have cel transparency for xx in cel_image.get_size().x:
cel_image.lock() for yy in cel_image.get_size().y:
for xx in cel_image.get_size().x: var pixel_color := cel_image.get_pixel(xx, yy)
for yy in cel_image.get_size().y: var alpha: float = pixel_color.a * cel.opacity
var pixel_color := cel_image.get_pixel(xx, yy) cel_image.set_pixel(
var alpha: float = pixel_color.a * cel.opacity xx, yy, Color(pixel_color.r, pixel_color.g, pixel_color.b, alpha)
cel_image.set_pixel( )
xx, yy, Color(pixel_color.r, pixel_color.g, pixel_color.b, alpha) cel_image.unlock()
) image.blend_rect(cel_image, Rect2(Vector2.ZERO, project.size), origin)
cel_image.unlock()
image.blend_rect(cel_image, Rect2(Vector2.ZERO, project.size), origin)
layer_i += 1
func frames_divided_by_spritesheet_lines() -> int: func frames_divided_by_spritesheet_lines() -> int: