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:
parent
8414f3deaf
commit
d8704fdf5d
|
@ -488,17 +488,10 @@ func _animation_tags_changed(value: Array[AnimationTag]) -> void:
|
||||||
|
|
||||||
for tag in animation_tags:
|
for tag in animation_tags:
|
||||||
var tag_c: Container = animation_tag_node.instantiate()
|
var tag_c: Container = animation_tag_node.instantiate()
|
||||||
Global.tag_container.add_child(tag_c)
|
|
||||||
tag_c.tag = tag
|
tag_c.tag = tag
|
||||||
|
Global.tag_container.add_child(tag_c)
|
||||||
var tag_position := Global.tag_container.get_child_count() - 1
|
var tag_position := Global.tag_container.get_child_count() - 1
|
||||||
Global.tag_container.move_child(tag_c, tag_position)
|
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()
|
_set_timeline_first_and_last_frames()
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
extends VBoxContainer
|
extends VBoxContainer
|
||||||
|
|
||||||
var tag: AnimationTag
|
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)
|
||||||
|
|
|
@ -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"]
|
[node name="AnimationTagUI" type="VBoxContainer"]
|
||||||
|
custom_minimum_size = Vector2(39, 32)
|
||||||
offset_right = 39.0
|
offset_right = 39.0
|
||||||
offset_bottom = 32.0
|
offset_bottom = 32.0
|
||||||
custom_minimum_size = Vector2( 39, 32 )
|
script = ExtResource("1")
|
||||||
script = ExtResource( 1 )
|
|
||||||
__meta__ = {
|
|
||||||
"_edit_use_anchors_": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Line2D" type="Line2D" parent="."]
|
[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
|
width = 1.0
|
||||||
|
joint_mode = 2
|
||||||
|
begin_cap_mode = 2
|
||||||
|
end_cap_mode = 2
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="."]
|
[node name="Label" type="Label" parent="."]
|
||||||
offset_left = 7.0
|
layout_mode = 2
|
||||||
offset_right = 32.0
|
|
||||||
offset_bottom = 32.0
|
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
text = "Idle"
|
text = "Idle"
|
||||||
align = 1
|
|
||||||
valign = 1
|
|
||||||
|
|
|
@ -218,12 +218,7 @@ func _cel_size_changed(value: int) -> void:
|
||||||
frame_id.size.x = cel_size
|
frame_id.size.x = cel_size
|
||||||
|
|
||||||
for tag_c: Control in Global.tag_container.get_children():
|
for tag_c: Control in Global.tag_container.get_children():
|
||||||
var tag: AnimationTag = tag_c.tag
|
tag_c.update_position_and_size()
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_blend_modes_item_selected(index: int) -> void:
|
func _on_blend_modes_item_selected(index: int) -> void:
|
||||||
|
|
Loading…
Reference in a new issue