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

Add an icon in the layer buttons for layers that contain effects

This commit is contained in:
Emmanouil Papadeas 2025-01-23 00:04:17 +02:00
parent 44fd75fcb9
commit 71200309f2
6 changed files with 58 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dv5y24sb8lxg2"
path="res://.godot/imported/layer_active_effect.png-ad3844f290bf1cd6605ac13bbf59d4b3.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/graphics/layers/layer_active_effect.png"
dest_files=["res://.godot/imported/layer_active_effect.png-ad3844f290bf1cd6605ac13bbf59d4b3.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -5,6 +5,7 @@ extends RefCounted
signal name_changed ## Emits when [member name] is changed.
signal visibility_changed ## Emits when [member visible] is changed.
signal effects_added_removed ## Emits when an effect is added or removed to/from [member effects].
## All currently supported layer blend modes between two layers. The upper layer
## is the blend layer, and the bottom layer is the base layer.
@ -254,6 +255,10 @@ func display_effects(cel: BaseCel, image_override: Image = null) -> Image:
return image
func emit_effects_added_removed() -> void:
effects_added_removed.emit()
# Methods to Override:

View file

@ -33,6 +33,7 @@ var audio_player: AudioStreamPlayer
@onready var label := %LayerNameLabel as Label
@onready var line_edit := %LayerNameLineEdit as LineEdit
@onready var hierarchy_spacer := %HierarchySpacer as Control
@onready var layer_fx_texture_rect := %LayerFXTextureRect as TextureRect
@onready var layer_type_texture_rect := %LayerTypeTextureRect as TextureRect
@onready var linked_button := %LinkButton as BaseButton
@onready var clipping_mask_icon := %ClippingMask as TextureRect
@ -61,7 +62,11 @@ func _ready() -> void:
custom_minimum_size.y = Global.animation_timeline.cel_size
label.text = layer.name
line_edit.text = layer.name
layer_fx_texture_rect.visible = layer.effects.size() > 0
layer_type_texture_rect.texture = ARRAY_TEXTURE_TYPES[layer.get_layer_type()]
layer.effects_added_removed.connect(
func(): layer_fx_texture_rect.visible = layer.effects.size() > 0
)
for child in $HBoxContainer.get_children():
if not child is Button:
continue

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=3 uid="uid://bai814sqvk68f"]
[gd_scene load_steps=10 format=3 uid="uid://bai814sqvk68f"]
[ext_resource type="Script" path="res://src/UI/Timeline/LayerButton.gd" id="1_6hlpe"]
[ext_resource type="Texture2D" uid="uid://c2b3htff5yox8" path="res://assets/graphics/layers/layer_visible.png" id="2_ef6fb"]
@ -7,6 +7,7 @@
[ext_resource type="Texture2D" uid="uid://cofw1x6chh4i" path="res://assets/graphics/layers/unlinked_layer.png" id="4_058qm"]
[ext_resource type="Texture2D" uid="uid://ieo8fsapcgsy" path="res://assets/graphics/layers/clipping_mask.png" id="6_73j5q"]
[ext_resource type="Script" path="res://src/UI/Timeline/LayerMainButton.gd" id="6_n8q6b"]
[ext_resource type="Texture2D" uid="uid://dv5y24sb8lxg2" path="res://assets/graphics/layers/layer_active_effect.png" id="8_7wf6f"]
[ext_resource type="Texture2D" uid="uid://cjvk47bd56156" path="res://assets/graphics/layers/type_icons/layer_pixel.png" id="8_ce16y"]
[node name="LayerButton" type="HBoxContainer"]
@ -166,6 +167,14 @@ editable = false
caret_blink = true
caret_blink_interval = 0.5
[node name="LayerFXTextureRect" type="TextureRect" parent="LayerMainButton/LayerName" groups=["UIButtons"]]
unique_name_in_owner = true
visible = false
layout_mode = 2
texture = ExtResource("8_7wf6f")
stretch_mode = 3
flip_v = true
[node name="LayerTypeTextureRect" type="TextureRect" parent="LayerMainButton/LayerName" groups=["UIButtons"]]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.498039)

View file

@ -79,9 +79,11 @@ func _on_effect_list_id_pressed(index: int) -> void:
Global.current_project.undos += 1
Global.current_project.undo_redo.create_action("Add layer effect")
Global.current_project.undo_redo.add_do_method(func(): layer.effects.append(effect))
Global.current_project.undo_redo.add_do_method(layer.emit_effects_added_removed)
Global.current_project.undo_redo.add_do_method(Global.canvas.queue_redraw)
Global.current_project.undo_redo.add_do_method(Global.undo_or_redo.bind(false))
Global.current_project.undo_redo.add_undo_method(func(): layer.effects.erase(effect))
Global.current_project.undo_redo.add_undo_method(layer.emit_effects_added_removed)
Global.current_project.undo_redo.add_undo_method(Global.canvas.queue_redraw)
Global.current_project.undo_redo.add_undo_method(Global.undo_or_redo.bind(true))
Global.current_project.undo_redo.commit_action()
@ -154,9 +156,11 @@ func _delete_effect(effect: LayerEffect) -> void:
Global.current_project.undos += 1
Global.current_project.undo_redo.create_action("Delete layer effect")
Global.current_project.undo_redo.add_do_method(func(): layer.effects.erase(effect))
Global.current_project.undo_redo.add_do_method(layer.emit_effects_added_removed)
Global.current_project.undo_redo.add_do_method(Global.canvas.queue_redraw)
Global.current_project.undo_redo.add_do_method(Global.undo_or_redo.bind(false))
Global.current_project.undo_redo.add_undo_method(func(): layer.effects.insert(index, effect))
Global.current_project.undo_redo.add_undo_method(layer.emit_effects_added_removed)
Global.current_project.undo_redo.add_undo_method(Global.canvas.queue_redraw)
Global.current_project.undo_redo.add_undo_method(Global.undo_or_redo.bind(true))
Global.current_project.undo_redo.commit_action()