Moved the layer/animation panel to the right bar.

This commit is contained in:
Relintai 2020-11-29 23:05:18 +01:00
parent 245beafcb5
commit d25cae12ba
5 changed files with 36 additions and 136 deletions

View File

@ -16,7 +16,7 @@ var frames := [] setget frames_changed # Array of Frames (that contain Cels)
var layers := [] setget layers_changed # Array of Layers
var current_frame := 0 setget frame_changed
var current_layer := 0 setget layer_changed
var animation_tags := [] setget animation_tags_changed # Array of AnimationTags
var animation_tags := []
var guides := [] # Array of Guides
var brushes := [] # Array of Images
@ -374,8 +374,6 @@ func frames_changed(value : Array) -> void:
layers[i].frame_container.add_child(cel_button)
set_timeline_first_and_last_frames()
func layers_changed(value : Array) -> void:
layers = value
@ -498,44 +496,6 @@ func toggle_layer_buttons_current_layer() -> void:
if layers.size() > 1:
DrawGD.disable_button(DrawGD.remove_layer_button, false)
func animation_tags_changed(value : Array) -> void:
animation_tags = value
for child in DrawGD.tag_container.get_children():
child.queue_free()
for tag in animation_tags:
var tag_c : Container = load("res://addons/draw_gd/src/UI/Timeline/AnimationTag.tscn").instance()
DrawGD.tag_container.add_child(tag_c)
var tag_position : int = DrawGD.tag_container.get_child_count() - 1
DrawGD.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.rect_position.x = (tag.from - 1) * 39 + tag.from
var tag_size : int = tag.to - tag.from
tag_c.rect_min_size.x = (tag_size + 1) * 39
tag_c.get_node("Line2D").points[2] = Vector2(tag_c.rect_min_size.x, 0)
tag_c.get_node("Line2D").points[3] = Vector2(tag_c.rect_min_size.x, 32)
set_timeline_first_and_last_frames()
func set_timeline_first_and_last_frames() -> void:
# This is useful in case tags get modified DURING the animation is playing
# otherwise, this code is useless in this context, since these values are being set
# when the play buttons get pressed anyway
DrawGD.animation_timeline.first_frame = 0
DrawGD.animation_timeline.last_frame = frames.size() - 1
if DrawGD.play_only_tags:
for tag in animation_tags:
if current_frame + 1 >= tag.from && current_frame + 1 <= tag.to:
DrawGD.animation_timeline.first_frame = tag.from - 1
DrawGD.animation_timeline.last_frame = min(frames.size() - 1, tag.to - 1)
func has_changed_changed(value : bool) -> void:
has_changed = value
if value:

View File

@ -2,7 +2,7 @@ tool
extends AcceptDialog
var ExportScript = preload("res://addons/draw_gd/src/Autoload/Export.gd")
var Export = ExportScript.new()
var Export = null
# called when user resumes export after filename collision
signal resume_export_function()
@ -37,6 +37,9 @@ func _enter_tree() -> void:
break
n = n.get_parent()
Export = ExportScript.new()
Export.DrawGD = DrawGD
export_progress_popup = get_node("Popups/ExportProgressBar")
file_exists_alert_popup = get_node("Popups/FileExistsAlert")

View File

@ -4,7 +4,6 @@
[ext_resource path="res://addons/draw_gd/src/UI/TransparentChecker.tscn" type="PackedScene" id=2]
[node name="ExportDialog" type="AcceptDialog"]
visible = true
margin_right = 532.0
margin_bottom = 530.0
rect_min_size = Vector2( 456, 530 )

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=12 format=2]
[ext_resource path="res://addons/draw_gd/src/UI/Timeline/AnimationTimeline.gd" type="Script" id=1]
[ext_resource path="res://addons/draw_gd/assets/graphics/dark_themes/layers/new_layer.png" type="Texture" id=2]
@ -26,27 +26,6 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
expand_margin_bottom = 32.0
[sub_resource type="StyleBoxEmpty" id=3]
[sub_resource type="StyleBoxEmpty" id=4]
[sub_resource type="StyleBoxEmpty" id=5]
[sub_resource type="StyleBoxEmpty" id=6]
[sub_resource type="StyleBoxEmpty" id=7]
[sub_resource type="Theme" id=8]
HScrollBar/icons/decrement = null
HScrollBar/icons/decrement_highlight = null
HScrollBar/icons/increment = null
HScrollBar/icons/increment_highlight = null
HScrollBar/styles/grabber = SubResource( 3 )
HScrollBar/styles/grabber_highlight = SubResource( 4 )
HScrollBar/styles/grabber_pressed = SubResource( 5 )
HScrollBar/styles/scroll = SubResource( 6 )
HScrollBar/styles/scroll_focus = SubResource( 7 )
[node name="AnimationTimeline" type="Panel"]
margin_top = 438.0
margin_right = 902.0
@ -71,15 +50,9 @@ margin_right = 902.0
margin_bottom = 200.0
size_flags_horizontal = 3
[node name="SpacerControl" type="Control" parent="AnimationContainer/TimelineContainer"]
margin_right = 902.0
margin_bottom = 4.0
rect_min_size = Vector2( 0, 4 )
[node name="TimelineButtons" type="HBoxContainer" parent="AnimationContainer/TimelineContainer"]
margin_top = 8.0
margin_right = 902.0
margin_bottom = 46.0
margin_bottom = 38.0
size_flags_horizontal = 3
[node name="LayerButtonPanelContainer" type="PanelContainer" parent="AnimationContainer/TimelineContainer/TimelineButtons"]
@ -260,27 +233,21 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Control" type="Control" parent="AnimationContainer/TimelineContainer/TimelineButtons"]
margin_left = 225.0
margin_right = 902.0
margin_bottom = 38.0
size_flags_horizontal = 3
[node name="OpacityAndTagContainer" type="HBoxContainer" parent="AnimationContainer/TimelineContainer"]
margin_top = 50.0
margin_top = 42.0
margin_right = 902.0
margin_bottom = 82.0
margin_bottom = 66.0
custom_constants/separation = 2
[node name="SpacerControl" type="Control" parent="AnimationContainer/TimelineContainer/OpacityAndTagContainer"]
margin_right = 4.0
margin_bottom = 32.0
margin_bottom = 24.0
rect_min_size = Vector2( 4, 0 )
[node name="OpacityContainer" type="HBoxContainer" parent="AnimationContainer/TimelineContainer/OpacityAndTagContainer"]
margin_left = 6.0
margin_right = 220.0
margin_bottom = 32.0
margin_bottom = 24.0
rect_min_size = Vector2( 214, 0 )
[node name="OpacityLabel" type="Label" parent="AnimationContainer/TimelineContainer/OpacityAndTagContainer/OpacityContainer"]
@ -294,7 +261,7 @@ valign = 1
[node name="OpacitySlider" type="HSlider" parent="AnimationContainer/TimelineContainer/OpacityAndTagContainer/OpacityContainer"]
margin_left = 57.0
margin_right = 136.0
margin_bottom = 32.0
margin_bottom = 24.0
focus_mode = 0
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
@ -304,33 +271,15 @@ ticks_on_borders = true
[node name="OpacitySpinBox" type="SpinBox" parent="AnimationContainer/TimelineContainer/OpacityAndTagContainer/OpacityContainer"]
margin_left = 140.0
margin_top = 4.0
margin_right = 214.0
margin_bottom = 28.0
margin_bottom = 24.0
mouse_default_cursor_shape = 2
size_flags_vertical = 4
value = 100.0
align = 1
[node name="TagScroll" type="ScrollContainer" parent="AnimationContainer/TimelineContainer/OpacityAndTagContainer"]
margin_left = 222.0
margin_right = 902.0
margin_bottom = 32.0
rect_min_size = Vector2( 0, 32 )
size_flags_horizontal = 3
theme = SubResource( 8 )
scroll_vertical_enabled = false
[node name="TagContainer" type="Control" parent="AnimationContainer/TimelineContainer/OpacityAndTagContainer/TagScroll"]
[node name="SpacerControl2" type="Control" parent="AnimationContainer/TimelineContainer"]
margin_top = 86.0
margin_right = 902.0
margin_bottom = 94.0
rect_min_size = Vector2( 0, 8 )
[node name="PanelContainer" type="PanelContainer" parent="AnimationContainer/TimelineContainer"]
margin_top = 98.0
margin_top = 70.0
margin_right = 902.0
margin_bottom = 200.0
size_flags_vertical = 3
@ -339,17 +288,17 @@ size_flags_vertical = 3
margin_left = 7.0
margin_top = 7.0
margin_right = 895.0
margin_bottom = 95.0
margin_bottom = 123.0
size_flags_vertical = 3
[node name="LayersAndFrames" type="HBoxContainer" parent="AnimationContainer/TimelineContainer/PanelContainer/TimelineScroll"]
margin_right = 252.0
margin_bottom = 88.0
margin_bottom = 116.0
size_flags_vertical = 3
[node name="LayerVBoxCont" type="VBoxContainer" parent="AnimationContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames"]
margin_right = 212.0
margin_bottom = 88.0
margin_bottom = 116.0
[node name="LayerLabel" type="Label" parent="AnimationContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/LayerVBoxCont"]
margin_right = 212.0
@ -370,7 +319,7 @@ margin_right = 212.0
[node name="FrameButtonsAndIds" type="VBoxContainer" parent="AnimationContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames"]
margin_left = 216.0
margin_right = 252.0
margin_bottom = 88.0
margin_bottom = 116.0
[node name="FrameIDs" type="HBoxContainer" parent="AnimationContainer/TimelineContainer/PanelContainer/TimelineScroll/LayersAndFrames/FrameButtonsAndIds"]
margin_right = 36.0
@ -394,18 +343,6 @@ margin_bottom = 20.0
[node name="FrameTagDialog" parent="." instance=ExtResource( 42 )]
[node name="FakeVSplitContainerGrabber" type="TextureRect" parent="."]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -24.0
margin_top = -6.0
margin_right = 24.0
margin_bottom = -4.76837e-07
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 ]]

View File

@ -202,7 +202,7 @@ custom_constants/autohide = 0
[node name="ViewportAndRulers" type="VBoxContainer" parent="CanvasAndTimeline"]
margin_right = 902.0
margin_bottom = 480.0
margin_bottom = 692.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 0
@ -235,20 +235,20 @@ script = ExtResource( 14 )
[node name="HSplitContainer" type="HSplitContainer" parent="CanvasAndTimeline/ViewportAndRulers"]
margin_top = 58.0
margin_right = 902.0
margin_bottom = 480.0
margin_bottom = 692.0
size_flags_vertical = 3
custom_constants/autohide = 0
[node name="ViewportandVerticalRuler" type="HBoxContainer" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer"]
margin_right = 890.0
margin_bottom = 422.0
margin_bottom = 634.0
size_flags_horizontal = 3
size_flags_vertical = 3
custom_constants/separation = 0
[node name="VerticalRuler" type="Button" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler"]
margin_right = 16.0
margin_bottom = 422.0
margin_bottom = 634.0
rect_min_size = Vector2( 16, 0 )
focus_mode = 0
mouse_default_cursor_shape = 15
@ -261,7 +261,7 @@ script = ExtResource( 3 )
[node name="ViewportContainer" type="ViewportContainer" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler"]
margin_left = 16.0
margin_right = 890.0
margin_bottom = 422.0
margin_bottom = 634.0
focus_mode = 2
mouse_default_cursor_shape = 3
size_flags_horizontal = 3
@ -270,7 +270,7 @@ stretch = true
script = ExtResource( 21 )
[node name="Viewport" type="Viewport" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportandVerticalRuler/ViewportContainer"]
size = Vector2( 874, 422 )
size = Vector2( 874, 634 )
handle_input_locally = false
usage = 0
render_target_update_mode = 3
@ -296,13 +296,13 @@ script = ExtResource( 11 )
[node name="ViewportContainer2" type="ViewportContainer" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer"]
margin_left = 902.0
margin_right = 902.0
margin_bottom = 422.0
margin_bottom = 634.0
size_flags_vertical = 3
stretch = true
script = ExtResource( 21 )
[node name="Viewport" type="Viewport" parent="CanvasAndTimeline/ViewportAndRulers/HSplitContainer/ViewportContainer2"]
size = Vector2( 0, 422 )
size = Vector2( 0, 634 )
handle_input_locally = false
render_target_update_mode = 3
@ -315,11 +315,6 @@ current = true
zoom = Vector2( 0.15, 0.15 )
script = ExtResource( 9 )
[node name="AnimationTimeline" parent="CanvasAndTimeline" instance=ExtResource( 18 )]
margin_top = 492.0
margin_bottom = 692.0
custom_styles/panel = SubResource( 1 )
[node name="RightPanel" type="Panel" parent="."]
margin_left = 950.0
margin_right = 1280.0
@ -343,16 +338,22 @@ margin_right = 315.0
[node name="ToolAndPaletteVSplit" type="VSplitContainer" parent="RightPanel/PreviewAndPalettes"]
margin_top = 168.0
margin_right = 330.0
margin_bottom = 676.0
margin_bottom = 472.0
size_flags_vertical = 3
custom_constants/autohide = 0
[node name="ColorAndToolOptions" parent="RightPanel/PreviewAndPalettes/ToolAndPaletteVSplit" instance=ExtResource( 2 )]
margin_bottom = 248.0
margin_bottom = 124.0
[node name="PalettePanelContainer" parent="RightPanel/PreviewAndPalettes/ToolAndPaletteVSplit" instance=ExtResource( 17 )]
margin_top = 260.0
margin_bottom = 508.0
margin_top = 136.0
margin_bottom = 304.0
[node name="AnimationTimeline" parent="RightPanel/PreviewAndPalettes" instance=ExtResource( 18 )]
margin_top = 476.0
margin_right = 330.0
margin_bottom = 676.0
custom_styles/panel = SubResource( 1 )
[connection signal="reposition_active_tab_request" from="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" to="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" method="_on_Tabs_reposition_active_tab_request"]
[connection signal="tab_changed" from="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" to="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" method="_on_Tabs_tab_changed"]