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

Change tag color, text and size in AnimationTagUI.gd

This commit is contained in:
Emmanouil Papadeas 2024-05-06 16:30:10 +03:00
parent 8414f3deaf
commit d8704fdf5d
4 changed files with 28 additions and 27 deletions

View file

@ -488,17 +488,10 @@ func _animation_tags_changed(value: Array[AnimationTag]) -> void:
for tag in animation_tags:
var tag_c: Container = animation_tag_node.instantiate()
Global.tag_container.add_child(tag_c)
tag_c.tag = tag
Global.tag_container.add_child(tag_c)
var tag_position := Global.tag_container.get_child_count() - 1
Global.tag_container.move_child(tag_c, tag_position)
tag_c.get_node("Label").text = tag.name
tag_c.get_node("Label").modulate = tag.color
tag_c.get_node("Line2D").default_color = tag.color
tag_c.position = tag.get_position()
tag_c.custom_minimum_size.x = tag.get_minimum_size()
tag_c.get_node("Line2D").points[2] = Vector2(tag_c.custom_minimum_size.x, 0)
tag_c.get_node("Line2D").points[3] = Vector2(tag_c.custom_minimum_size.x, 32)
_set_timeline_first_and_last_frames()

View file

@ -1,3 +1,20 @@
extends VBoxContainer
var tag: AnimationTag
func _ready() -> void:
if not is_instance_valid(tag):
return
$Label.text = tag.name
$Line2D.default_color = tag.color
$Label.modulate = tag.color
update_position_and_size()
func update_position_and_size() -> void:
position = tag.get_position()
custom_minimum_size.x = tag.get_minimum_size()
size.x = custom_minimum_size.x
$Line2D.points[2] = Vector2(custom_minimum_size.x, 0)
$Line2D.points[3] = Vector2(custom_minimum_size.x, 32)

View file

@ -1,26 +1,22 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=2 format=3 uid="uid://dxjxve3gmc8h4"]
[ext_resource path="res://src/UI/Timeline/AnimationTagUI.gd" type="Script" id=1]
[ext_resource type="Script" path="res://src/UI/Timeline/AnimationTagUI.gd" id="1"]
[node name="AnimationTagUI" type="VBoxContainer"]
custom_minimum_size = Vector2(39, 32)
offset_right = 39.0
offset_bottom = 32.0
custom_minimum_size = Vector2( 39, 32 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
script = ExtResource("1")
[node name="Line2D" type="Line2D" parent="."]
points = PackedVector2Array( 0, 32, 0, 0, 39, 0, 39, 32 )
points = PackedVector2Array(0, 32, 0, 0, 39, 0, 39, 32)
width = 1.0
joint_mode = 2
begin_cap_mode = 2
end_cap_mode = 2
[node name="Label" type="Label" parent="."]
offset_left = 7.0
offset_right = 32.0
offset_bottom = 32.0
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 3
text = "Idle"
align = 1
valign = 1

View file

@ -218,12 +218,7 @@ func _cel_size_changed(value: int) -> void:
frame_id.size.x = cel_size
for tag_c: Control in Global.tag_container.get_children():
var tag: AnimationTag = tag_c.tag
tag_c.position = tag.get_position()
tag_c.custom_minimum_size.x = tag.get_minimum_size()
tag_c.size.x = tag_c.custom_minimum_size.x
tag_c.get_node("Line2D").points[2] = Vector2(tag_c.custom_minimum_size.x, 0)
tag_c.get_node("Line2D").points[3] = Vector2(tag_c.custom_minimum_size.x, 32)
tag_c.update_position_and_size()
func _on_blend_modes_item_selected(index: int) -> void: