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

When merging layers, automatically make the bottom layer visible

If the bottom layer is invisible, it becomes visible now. Consistent with behavior seen in Krita and Photopea.
This commit is contained in:
Emmanouil Papadeas 2024-04-09 02:30:50 +03:00
parent 23a480fe7d
commit dbfd4d8412
3 changed files with 7 additions and 2 deletions

View file

@ -3,6 +3,7 @@ extends RefCounted
## Base class for layer properties. Different layer types extend from this class. ## Base class for layer properties. Different layer types extend from this class.
signal name_changed ## Emits when [member name] is changed. signal name_changed ## Emits when [member name] is changed.
signal visibility_changed ## Emits when [member visible] is changed.
## All currently supported layer blend modes between two layers. The upper layer ## All currently supported layer blend modes between two layers. The upper layer
## is the blend layer, and the bottom layer is the base layer. ## is the blend layer, and the bottom layer is the base layer.
@ -37,7 +38,10 @@ var name := "": ## Name of the layer.
var project: Project ## The project the layer belongs to. var project: Project ## The project the layer belongs to.
var index: int ## Index of layer in the timeline. var index: int ## Index of layer in the timeline.
var parent: BaseLayer ## Parent of the layer. var parent: BaseLayer ## Parent of the layer.
var visible := true ## Sets visibility of the layer. var visible := true: ## Sets visibility of the layer.
set(value):
visible = value
visibility_changed.emit()
var locked := false ## Images of a locked layer won't be overritten. var locked := false ## Images of a locked layer won't be overritten.
var new_cels_linked := false ## Determines if new cel of the layer should be linked or not. var new_cels_linked := false ## Determines if new cel of the layer should be linked or not.
var blend_mode := BlendModes.NORMAL ## Blend mode of the current layer. var blend_mode := BlendModes.NORMAL ## Blend mode of the current layer.

View file

@ -948,7 +948,6 @@ func _on_MergeDownLayer_pressed() -> void:
project.undos += 1 project.undos += 1
project.undo_redo.create_action("Merge Layer") project.undo_redo.create_action("Merge Layer")
for frame in project.frames: for frame in project.frames:
var top_cel := frame.cels[top_layer.index] var top_cel := frame.cels[top_layer.index]
top_cels.append(top_cel) # Store for undo purposes top_cels.append(top_cel) # Store for undo purposes
@ -1000,6 +999,7 @@ func _on_MergeDownLayer_pressed() -> void:
project.undo_redo.add_undo_method(Global.undo_or_redo.bind(true)) project.undo_redo.add_undo_method(Global.undo_or_redo.bind(true))
project.undo_redo.add_do_method(Global.undo_or_redo.bind(false)) project.undo_redo.add_do_method(Global.undo_or_redo.bind(false))
project.undo_redo.commit_action() project.undo_redo.commit_action()
bottom_layer.visible = true
func _on_OpacitySlider_value_changed(value: float) -> void: func _on_OpacitySlider_value_changed(value: float) -> void:

View file

@ -34,6 +34,7 @@ func _ready() -> void:
Global.cel_switched.connect(func(): z_index = 1 if button_pressed else 0) Global.cel_switched.connect(func(): z_index = 1 if button_pressed else 0)
var layer := Global.current_project.layers[layer_index] var layer := Global.current_project.layers[layer_index]
layer.name_changed.connect(func(): label.text = layer.name) layer.name_changed.connect(func(): label.text = layer.name)
layer.visibility_changed.connect(update_buttons)
if layer is PixelLayer: if layer is PixelLayer:
linked_button.visible = true linked_button.visible = true
elif layer is GroupLayer: elif layer is GroupLayer: