From 68f877879f46f8af682481502a4573ec3e9c0f42 Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 29 Nov 2020 18:24:24 +0100 Subject: [PATCH] Fix layer bar icon positioning. --- .../src/UI/Timeline/AnimationTimeline.tscn | 3 +- addons/draw_gd/src/UI/Timeline/LayerButton.gd | 16 ++--- .../draw_gd/src/UI/Timeline/LayerButton.tscn | 67 +++++++++++-------- 3 files changed, 46 insertions(+), 40 deletions(-) diff --git a/addons/draw_gd/src/UI/Timeline/AnimationTimeline.tscn b/addons/draw_gd/src/UI/Timeline/AnimationTimeline.tscn index ffab6bd..56096d3 100644 --- a/addons/draw_gd/src/UI/Timeline/AnimationTimeline.tscn +++ b/addons/draw_gd/src/UI/Timeline/AnimationTimeline.tscn @@ -24,8 +24,6 @@ [ext_resource path="res://addons/draw_gd/assets/graphics/dark_themes/timeline/loop.png" type="Texture" id=31] [ext_resource path="res://addons/draw_gd/src/UI/Timeline/FrameTagDialog.tscn" type="PackedScene" id=42] - - [sub_resource type="StyleBoxFlat" id=1] bg_color = Color( 0.0627451, 0.0627451, 0.0627451, 1 ) expand_margin_top = 6.0 @@ -992,6 +990,7 @@ mouse_filter = 2 __meta__ = { "_edit_use_anchors_": false } + [connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/LayerButtonPanelContainer/LayerButtons/AddLayer" to="." method="add_layer" binds= [ true ]] [connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/LayerButtonPanelContainer/LayerButtons/RemoveLayer" to="." method="_on_RemoveLayer_pressed"] [connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/LayerButtonPanelContainer/LayerButtons/MoveUpLayer" to="." method="change_layer_order" binds= [ 1 ]] diff --git a/addons/draw_gd/src/UI/Timeline/LayerButton.gd b/addons/draw_gd/src/UI/Timeline/LayerButton.gd index 3678e7b..1156e6a 100644 --- a/addons/draw_gd/src/UI/Timeline/LayerButton.gd +++ b/addons/draw_gd/src/UI/Timeline/LayerButton.gd @@ -32,23 +32,19 @@ func init(): line_edit = DrawGD.find_node_by_name(self, "LineEdit") if DrawGD.current_project.layers[i].visible: - DrawGD.change_button_texturerect(visibility_button.get_child(0), "layer_visible.png") - visibility_button.get_child(0).rect_size = Vector2(24, 14) - visibility_button.get_child(0).rect_position = Vector2(4, 9) + DrawGD.change_button_texturerect(visibility_button.get_child(0).get_child(0), "layer_visible.png") else: - DrawGD.change_button_texturerect(visibility_button.get_child(0), "layer_invisible.png") - visibility_button.get_child(0).rect_size = Vector2(24, 8) - visibility_button.get_child(0).rect_position = Vector2(4, 12) + DrawGD.change_button_texturerect(visibility_button.get_child(0).get_child(0), "layer_invisible.png") if DrawGD.current_project.layers[i].locked: - DrawGD.change_button_texturerect(lock_button.get_child(0), "lock.png") + DrawGD.change_button_texturerect(lock_button.get_child(0).get_child(0), "lock.png") else: - DrawGD.change_button_texturerect(lock_button.get_child(0), "unlock.png") + DrawGD.change_button_texturerect(lock_button.get_child(0).get_child(0), "unlock.png") if DrawGD.current_project.layers[i].new_cels_linked: # If new layers will be linked - DrawGD.change_button_texturerect(linked_button.get_child(0), "linked_layer.png") + DrawGD.change_button_texturerect(linked_button.get_child(0).get_child(0), "linked_layer.png") else: - DrawGD.change_button_texturerect(linked_button.get_child(0), "unlinked_layer.png") + DrawGD.change_button_texturerect(linked_button.get_child(0).get_child(0), "unlinked_layer.png") func _input(event : InputEvent) -> void: diff --git a/addons/draw_gd/src/UI/Timeline/LayerButton.tscn b/addons/draw_gd/src/UI/Timeline/LayerButton.tscn index eaefdb6..f3118b2 100644 --- a/addons/draw_gd/src/UI/Timeline/LayerButton.tscn +++ b/addons/draw_gd/src/UI/Timeline/LayerButton.tscn @@ -5,7 +5,6 @@ [ext_resource path="res://addons/draw_gd/assets/graphics/dark_themes/layers/unlock.png" type="Texture" id=3] [ext_resource path="res://addons/draw_gd/assets/graphics/dark_themes/layers/unlinked_layer.png" type="Texture" id=4] - [node name="LayerContainer" type="Button"] margin_right = 210.0 margin_bottom = 36.0 @@ -48,15 +47,19 @@ mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 4 -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/LayerButtons/VisibilityButton"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -12.0 -margin_top = -7.0 -margin_right = 12.0 -margin_bottom = 7.0 +[node name="CenterContainer" type="CenterContainer" parent="HBoxContainer/LayerButtons/VisibilityButton"] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/LayerButtons/VisibilityButton/CenterContainer"] +margin_left = 4.0 +margin_top = 9.0 +margin_right = 28.0 +margin_bottom = 23.0 size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource( 2 ) @@ -78,15 +81,19 @@ mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 4 -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/LayerButtons/LockButton"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -10.0 -margin_top = -12.0 -margin_right = 10.0 -margin_bottom = 12.0 +[node name="CenterContainer" type="CenterContainer" parent="HBoxContainer/LayerButtons/LockButton"] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/LayerButtons/LockButton/CenterContainer"] +margin_left = 6.0 +margin_top = 4.0 +margin_right = 26.0 +margin_bottom = 28.0 size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource( 3 ) @@ -110,15 +117,19 @@ mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 4 -[node name="TextureRect" type="TextureRect" parent="HBoxContainer/LayerButtons/LinkButton"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -12.0 -margin_top = -4.0 -margin_right = 12.0 -margin_bottom = 4.0 +[node name="CenterContainer" type="CenterContainer" parent="HBoxContainer/LayerButtons/LinkButton"] +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/LayerButtons/LinkButton/CenterContainer"] +margin_left = 4.0 +margin_top = 12.0 +margin_right = 28.0 +margin_bottom = 20.0 size_flags_horizontal = 0 size_flags_vertical = 0 texture = ExtResource( 4 )