diff --git a/assets/graphics/layers/layer_active_effect.png b/assets/graphics/layers/layer_active_effect.png new file mode 100644 index 000000000..666fef3c7 Binary files /dev/null and b/assets/graphics/layers/layer_active_effect.png differ diff --git a/assets/graphics/layers/layer_active_effect.png.import b/assets/graphics/layers/layer_active_effect.png.import new file mode 100644 index 000000000..468cb93c7 --- /dev/null +++ b/assets/graphics/layers/layer_active_effect.png.import @@ -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 diff --git a/src/Classes/Layers/BaseLayer.gd b/src/Classes/Layers/BaseLayer.gd index 18f2d68b2..0bed8b3ab 100644 --- a/src/Classes/Layers/BaseLayer.gd +++ b/src/Classes/Layers/BaseLayer.gd @@ -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: diff --git a/src/UI/Timeline/LayerButton.gd b/src/UI/Timeline/LayerButton.gd index b76699efa..7afdf65ad 100644 --- a/src/UI/Timeline/LayerButton.gd +++ b/src/UI/Timeline/LayerButton.gd @@ -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 diff --git a/src/UI/Timeline/LayerButton.tscn b/src/UI/Timeline/LayerButton.tscn index edefd1a3d..bac0ea281 100644 --- a/src/UI/Timeline/LayerButton.tscn +++ b/src/UI/Timeline/LayerButton.tscn @@ -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) diff --git a/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd b/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd index ce1b96bdc..c6fd70555 100644 --- a/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd +++ b/src/UI/Timeline/LayerEffects/LayerEffectsSettings.gd @@ -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()