mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Fix group layers blending twice in Canvas.update_texture() when their blend mode is set to passthrough
This solves a part of #1166
This commit is contained in:
parent
9b1b0df123
commit
87b9df8049
|
@ -56,7 +56,7 @@ func blend_layers(
|
|||
if DisplayServer.get_name() == "headless":
|
||||
blend_layers_headless(image, project, layer, cel, origin)
|
||||
else:
|
||||
if layer is GroupLayer and layer.blend_mode != BaseLayer.BlendModes.PASS_THROUGH:
|
||||
if layer.is_blender():
|
||||
var cel_image := (layer as GroupLayer).blend_children(frame)
|
||||
textures.append(cel_image)
|
||||
else:
|
||||
|
|
|
@ -355,3 +355,10 @@ func accepts_child(_layer: BaseLayer) -> bool:
|
|||
## Returns an instance of the layer button that will be added to the timeline.
|
||||
func instantiate_layer_button() -> Node:
|
||||
return Global.layer_button_node.instantiate()
|
||||
|
||||
|
||||
## Returns [code]true[/code] if the layer is responsible for blending other layers.
|
||||
## Currently only returns [code]true[/code] with [GroupLayer]s, when their
|
||||
## blend mode is set to something else rather than [enum BlendModes.PASS_THROUGH].
|
||||
func is_blender() -> bool:
|
||||
return false
|
||||
|
|
|
@ -167,3 +167,7 @@ func set_name_to_default(number: int) -> void:
|
|||
|
||||
func accepts_child(_layer: BaseLayer) -> bool:
|
||||
return true
|
||||
|
||||
|
||||
func is_blender() -> bool:
|
||||
return blend_mode != BlendModes.PASS_THROUGH
|
||||
|
|
|
@ -126,7 +126,7 @@ func update_texture(
|
|||
return
|
||||
var layer := project.layers[layer_i].get_blender_ancestor()
|
||||
var cel_image: Image
|
||||
if layer is GroupLayer:
|
||||
if layer.is_blender():
|
||||
cel_image = layer.blend_children(
|
||||
project.frames[project.current_frame], Vector2i.ZERO, Global.display_layer_effects
|
||||
)
|
||||
|
@ -217,7 +217,7 @@ func _update_texture_array_layer(
|
|||
var ordered_index := project.ordered_layers[layer.index]
|
||||
var cel := project.frames[project.current_frame].cels[layer.index]
|
||||
var include := true
|
||||
if layer is GroupLayer and layer.blend_mode != BaseLayer.BlendModes.PASS_THROUGH:
|
||||
if layer.is_blender():
|
||||
cel_image.copy_from(
|
||||
layer.blend_children(
|
||||
project.frames[project.current_frame],
|
||||
|
|
|
@ -85,7 +85,7 @@ func _draw_layers() -> void:
|
|||
var cel := current_cels[i]
|
||||
var layer := project.layers[i]
|
||||
var cel_image: Image
|
||||
if layer is GroupLayer and layer.blend_mode != BaseLayer.BlendModes.PASS_THROUGH:
|
||||
if layer.is_blender():
|
||||
cel_image = layer.blend_children(
|
||||
current_frame, Vector2i.ZERO, Global.display_layer_effects
|
||||
)
|
||||
|
|
|
@ -102,7 +102,7 @@ func blend_layers(
|
|||
include = false
|
||||
var cel := frame.cels[ordered_index]
|
||||
var cel_image: Image
|
||||
if layer is GroupLayer and layer.blend_mode != BaseLayer.BlendModes.PASS_THROUGH:
|
||||
if layer.is_blender():
|
||||
cel_image = (layer as GroupLayer).blend_children(frame)
|
||||
else:
|
||||
cel_image = layer.display_effects(cel)
|
||||
|
|
Loading…
Reference in a new issue