From 1460ba2e8928e8fb547b54fed4450119a935b25d Mon Sep 17 00:00:00 2001 From: alikin12 <12932510+alikin12@users.noreply.github.com> Date: Sun, 1 Sep 2024 01:30:36 +0200 Subject: [PATCH] Set timeline layer and frame header to be fixed on top (#1095) --- src/UI/Timeline/AnimationTimeline.gd | 12 +++ src/UI/Timeline/AnimationTimeline.tscn | 125 ++++++++++++++++--------- 2 files changed, 92 insertions(+), 45 deletions(-) diff --git a/src/UI/Timeline/AnimationTimeline.gd b/src/UI/Timeline/AnimationTimeline.gd index 19580d054..c885cb4f7 100644 --- a/src/UI/Timeline/AnimationTimeline.gd +++ b/src/UI/Timeline/AnimationTimeline.gd @@ -32,6 +32,7 @@ var global_layer_expand := true @onready var tag_spacer := %TagSpacer as Control @onready var layer_settings_container := %LayerSettingsContainer as VBoxContainer @onready var layer_container := %LayerContainer as VBoxContainer +@onready var layer_header_container := %LayerHeaderContainer as HBoxContainer @onready var add_layer_list := %AddLayerList as MenuButton @onready var remove_layer := %RemoveLayer as Button @onready var move_up_layer := %MoveUpLayer as Button @@ -43,6 +44,7 @@ var global_layer_expand := true @onready var frame_scroll_bar := %FrameScrollBar as HScrollBar @onready var tag_scroll_container := %TagScroll as ScrollContainer @onready var layer_frame_h_split := %LayerFrameHSplit as HSplitContainer +@onready var layer_frame_header_h_split := %LayerFrameHeaderHSplit as HSplitContainer @onready var delete_frame := %DeleteFrame as Button @onready var move_frame_left := %MoveFrameLeft as Button @onready var move_frame_right := %MoveFrameRight as Button @@ -60,6 +62,7 @@ func _ready() -> void: Global.control.find_child("LayerProperties").layer_property_changed.connect(_update_layer_ui) min_cel_size = get_tree().current_scene.theme.default_font_size + 24 layer_container.custom_minimum_size.x = layer_settings_container.size.x + 12 + layer_header_container.custom_minimum_size.x = layer_container.custom_minimum_size.x cel_size = min_cel_size cel_size_slider.min_value = min_cel_size cel_size_slider.max_value = max_cel_size @@ -71,6 +74,7 @@ func _ready() -> void: _fill_blend_modes_option_button() # Config loading layer_frame_h_split.split_offset = Global.config_cache.get_value("timeline", "layer_size", 0) + layer_frame_header_h_split.split_offset = layer_frame_h_split.split_offset cel_size = Global.config_cache.get_value("timeline", "cel_size", cel_size) # Call setter var past_rate = Global.config_cache.get_value( "timeline", "past_rate", Global.onion_skinning_past_rate @@ -109,6 +113,7 @@ func _notification(what: int) -> void: await get_tree().process_frame if is_instance_valid(layer_settings_container): layer_container.custom_minimum_size.x = layer_settings_container.size.x + 12 + layer_header_container.custom_minimum_size.x = layer_container.custom_minimum_size.x func _input(event: InputEvent) -> void: @@ -1326,3 +1331,10 @@ func update_global_layer_buttons() -> void: Global.change_button_texturerect(%GlobalExpandButton.get_child(0), "group_expanded.png") else: Global.change_button_texturerect(%GlobalExpandButton.get_child(0), "group_collapsed.png") + + +func _on_layer_frame_h_split_dragged(offset: int) -> void: + if layer_frame_header_h_split.split_offset != offset: + layer_frame_header_h_split.split_offset = offset + if layer_frame_h_split.split_offset != offset: + layer_frame_h_split.split_offset = offset diff --git a/src/UI/Timeline/AnimationTimeline.tscn b/src/UI/Timeline/AnimationTimeline.tscn index d07d380e2..ba10b0341 100644 --- a/src/UI/Timeline/AnimationTimeline.tscn +++ b/src/UI/Timeline/AnimationTimeline.tscn @@ -786,36 +786,32 @@ mouse_filter = 1 [node name="MainBodyVBoxContainer" type="VBoxContainer" parent="TimelineContainer/MainBodyPanel"] layout_mode = 2 size_flags_horizontal = 3 +theme_override_constants/separation = 0 -[node name="TimelineScroll" type="ScrollContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer"] -layout_mode = 2 -size_flags_vertical = 3 - -[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll"] +[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer"] +clip_contents = true +custom_minimum_size = Vector2(0, 38) layout_mode = 2 size_flags_horizontal = 3 -size_flags_vertical = 3 +theme_override_constants/margin_bottom = 0 -[node name="LayerFrameHSplit" type="HSplitContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer"] +[node name="LayerFrameHeaderHSplit" type="HSplitContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer"] unique_name_in_owner = true layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 -theme_override_constants/separation = 0 +theme_override_constants/separation = 6 theme_override_constants/minimum_grab_thickness = 12 theme_override_icons/grabber = SubResource("ImageTexture_ku1qg") -[node name="LayerContainer" type="VBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit"] +[node name="LayerHeaderContainer" type="HBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit"] unique_name_in_owner = true -layout_mode = 2 -theme_override_constants/separation = 1 - -[node name="HBoxContainer" type="HBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer"] custom_minimum_size = Vector2(84, 0) layout_mode = 2 +size_flags_vertical = 0 theme_override_constants/separation = 0 -[node name="GlobalVisibilityButton" type="Button" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer" groups=["UIButtons"]] +[node name="GlobalVisibilityButton" type="Button" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer" groups=["UIButtons"]] unique_name_in_owner = true custom_minimum_size = Vector2(28, 22) layout_mode = 2 @@ -823,7 +819,7 @@ tooltip_text = "Toggle layer's visibility" focus_mode = 0 mouse_default_cursor_shape = 2 -[node name="TextureRect" type="TextureRect" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/GlobalVisibilityButton"] +[node name="TextureRect" type="TextureRect" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/GlobalVisibilityButton"] layout_mode = 0 anchor_left = 0.5 anchor_top = 0.5 @@ -837,7 +833,7 @@ size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource("24_6ikqj") -[node name="GlobalLockButton" type="Button" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer" groups=["UIButtons"]] +[node name="GlobalLockButton" type="Button" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer" groups=["UIButtons"]] unique_name_in_owner = true custom_minimum_size = Vector2(28, 22) layout_mode = 2 @@ -845,7 +841,7 @@ tooltip_text = "Lock/unlock layer" focus_mode = 0 mouse_default_cursor_shape = 2 -[node name="TextureRect" type="TextureRect" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/GlobalLockButton"] +[node name="TextureRect" type="TextureRect" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/GlobalLockButton"] layout_mode = 0 anchor_left = 0.5 anchor_top = 0.5 @@ -859,7 +855,7 @@ size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource("25_7x5su") -[node name="GlobalExpandButton" type="Button" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer" groups=["UIButtons"]] +[node name="GlobalExpandButton" type="Button" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer" groups=["UIButtons"]] unique_name_in_owner = true custom_minimum_size = Vector2(28, 22) layout_mode = 2 @@ -867,7 +863,7 @@ tooltip_text = "Expand/collapse group" focus_mode = 0 mouse_default_cursor_shape = 2 -[node name="TextureRect" type="TextureRect" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/GlobalExpandButton"] +[node name="TextureRect" type="TextureRect" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/GlobalExpandButton"] layout_mode = 0 anchor_left = 0.5 anchor_top = 0.5 @@ -881,7 +877,7 @@ size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource("27_lrc8y") -[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer"] +[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer"] layout_mode = 2 size_flags_horizontal = 3 theme_override_constants/margin_left = 0 @@ -889,7 +885,7 @@ theme_override_constants/margin_top = 2 theme_override_constants/margin_right = 1 theme_override_constants/margin_bottom = 0 -[node name="OpacitySlider" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/MarginContainer" instance=ExtResource("9")] +[node name="OpacitySlider" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/MarginContainer" instance=ExtResource("9")] unique_name_in_owner = true custom_minimum_size = Vector2(0, 29) layout_mode = 2 @@ -897,6 +893,56 @@ size_flags_vertical = 0 value = 100.0 prefix = "Opacity:" +[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit"] +layout_mode = 2 +theme_override_constants/margin_left = -2 +theme_override_constants/margin_top = 0 +theme_override_constants/margin_right = 0 +theme_override_constants/margin_bottom = 0 + +[node name="FrameScrollHeaderContainer" type="Container" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/MarginContainer" node_paths=PackedStringArray("h_scroll_bar")] +clip_contents = true +layout_mode = 2 +script = ExtResource("11") +h_scroll_bar = NodePath("../../../../FrameScrollBar") + +[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/MarginContainer/FrameScrollHeaderContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 1 +theme_override_constants/margin_top = 2 +theme_override_constants/margin_right = 0 +theme_override_constants/margin_bottom = 0 + +[node name="FrameHBox" type="HBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/MarginContainer/FrameScrollHeaderContainer/MarginContainer"] +custom_minimum_size = Vector2(0, 30) +layout_mode = 2 +theme_override_constants/separation = 0 + +[node name="TimelineScroll" type="ScrollContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +vertical_scroll_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_constants/margin_right = 0 + +[node name="LayerFrameHSplit" type="HSplitContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +theme_override_constants/separation = 6 +theme_override_constants/minimum_grab_thickness = 12 +theme_override_icons/grabber = SubResource("ImageTexture_ku1qg") + +[node name="LayerContainer" type="VBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit"] +unique_name_in_owner = true +layout_mode = 2 +theme_override_constants/separation = 1 + [node name="LayerVBox" type="VBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer"] layout_mode = 2 size_flags_horizontal = 3 @@ -905,7 +951,7 @@ theme_override_constants/separation = 0 [node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit"] layout_mode = 2 theme_override_constants/margin_left = -2 -theme_override_constants/margin_top = 0 +theme_override_constants/margin_top = -2 theme_override_constants/margin_right = 0 theme_override_constants/margin_bottom = 0 @@ -914,7 +960,7 @@ unique_name_in_owner = true clip_contents = true layout_mode = 2 script = ExtResource("11") -h_scroll_bar = NodePath("../../../../../BreakFreeFromContainer/FrameScrollBar") +h_scroll_bar = NodePath("../../../../../FrameScrollBar") [node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/MarginContainer/FrameScrollContainer"] layout_mode = 2 @@ -923,28 +969,14 @@ theme_override_constants/margin_top = 2 theme_override_constants/margin_right = 0 theme_override_constants/margin_bottom = 0 -[node name="FrameAndCelBox" type="VBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/MarginContainer/FrameScrollContainer/MarginContainer"] +[node name="CelVBox" type="VBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/MarginContainer/FrameScrollContainer/MarginContainer"] layout_mode = 2 theme_override_constants/separation = 0 -[node name="FrameHBox" type="HBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/MarginContainer/FrameScrollContainer/MarginContainer/FrameAndCelBox"] -custom_minimum_size = Vector2(0, 30) -layout_mode = 2 -theme_override_constants/separation = 0 - -[node name="CelVBox" type="VBoxContainer" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/MarginContainer/FrameScrollContainer/MarginContainer/FrameAndCelBox"] -layout_mode = 2 -theme_override_constants/separation = 0 - -[node name="BreakFreeFromContainer" type="Control" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer"] -layout_mode = 2 - -[node name="FrameScrollBar" type="HScrollBar" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/BreakFreeFromContainer"] +[node name="FrameScrollBar" type="HScrollBar" parent="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer"] unique_name_in_owner = true -layout_mode = 0 -anchor_right = 1.0 -offset_left = 41.0 -offset_top = -12.0 +z_index = 2 +layout_mode = 2 size_flags_horizontal = 3 [node name="AnimationTimer" type="Timer" parent="."] @@ -1114,11 +1146,14 @@ color = Color(0, 0.741176, 1, 0.501961) [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/OnionSkinning" to="." method="_on_OnionSkinning_pressed"] [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/LoopAnim" to="." method="_on_LoopAnim_pressed"] [connection signal="value_changed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/FPSValue" to="." method="_on_FPSValue_value_changed"] +[connection signal="dragged" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit" to="." method="_on_layer_frame_h_split_dragged"] +[connection signal="gui_input" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit" to="." method="_on_LayerFrameSplitContainer_gui_input"] +[connection signal="pressed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/GlobalVisibilityButton" to="." method="_on_global_visibility_button_pressed"] +[connection signal="pressed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/GlobalLockButton" to="." method="_on_global_lock_button_pressed"] +[connection signal="pressed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/GlobalExpandButton" to="." method="_on_global_expand_button_pressed"] +[connection signal="value_changed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/MarginContainer/OpacitySlider" to="." method="_on_opacity_slider_value_changed"] +[connection signal="dragged" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit" to="." method="_on_layer_frame_h_split_dragged"] [connection signal="gui_input" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit" to="." method="_on_LayerFrameSplitContainer_gui_input"] -[connection signal="pressed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/GlobalVisibilityButton" to="." method="_on_global_visibility_button_pressed"] -[connection signal="pressed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/GlobalLockButton" to="." method="_on_global_lock_button_pressed"] -[connection signal="pressed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/GlobalExpandButton" to="." method="_on_global_expand_button_pressed"] -[connection signal="value_changed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/HBoxContainer/MarginContainer/OpacitySlider" to="." method="_on_opacity_slider_value_changed"] [connection signal="resized" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/TimelineScroll/MarginContainer/LayerFrameHSplit/LayerContainer/LayerVBox" to="." method="_on_LayerVBox_resized"] [connection signal="timeout" from="AnimationTimer" to="." method="_on_AnimationTimer_timeout"] [connection signal="close_requested" from="TimelineSettings" to="." method="_on_timeline_settings_close_requested"]