Skip to content

Commit

Permalink
Add buttons for moving the current frame left or right (#344)
Browse files Browse the repository at this point in the history
Add dark theme sprite

Add light theme sprite

Co-authored-by: Laurenz Reinthaler <reinthalerlaurenz@gmail.com>
  • Loading branch information
Schweini07 and Laurenz Reinthaler authored Oct 3, 2020
1 parent 1ca4b6a commit 0f8a041
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Translations/Translations.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1407,3 +1407,9 @@ msgstr ""

msgid "and"
msgstr ""

msgid "Move the selected frame to the left."
msgstr ""

msgid "Move the selected frame to the right."
msgstr ""
Binary file added assets/graphics/dark_themes/timeline/move_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/graphics/dark_themes/timeline/move_arrow.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/move_arrow.png-a7e1075bf6415244d8e7290d244180b2.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/dark_themes/timeline/move_arrow.png"
dest_files=[ "res://.import/move_arrow.png-a7e1075bf6415244d8e7290d244180b2.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added assets/graphics/light_themes/timeline/move_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/graphics/light_themes/timeline/move_arrow.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/move_arrow.png-5ac1f48e226beb6e78d77de0e04d0b5e.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/light_themes/timeline/move_arrow.png"
dest_files=[ "res://.import/move_arrow.png-5ac1f48e226beb6e78d77de0e04d0b5e.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
13 changes: 12 additions & 1 deletion src/UI/Timeline/AnimationTimeline.gd
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ func _on_CopyFrame_pressed(frame := -1) -> void:
func _on_FrameTagButton_pressed() -> void:
Global.tag_dialog.popup_centered()

func _on_MoveLeft_pressed() -> void:
var frame : int = Global.current_project.current_frame
if frame == 0:
return
Global.current_project.layers[Global.current_project.current_layer].frame_container.get_child(frame).change_frame_order(-1)

func _on_MoveRight_pressed() -> void:
var frame : int = Global.current_project.current_frame
if frame == last_frame:
return
Global.current_project.layers[Global.current_project.current_layer].frame_container.get_child(frame).change_frame_order(1)

func _on_OnionSkinning_pressed() -> void:
Global.onion_skinning = !Global.onion_skinning
Expand All @@ -176,7 +187,6 @@ func _on_OnionSkinning_pressed() -> void:
else:
Global.change_button_texturerect(texture_button, "onion_skinning_off.png")


func _on_OnionSkinningSettings_pressed() -> void:
$OnionSkinningSettings.popup(Rect2(Global.onion_skinning_button.rect_global_position.x - $OnionSkinningSettings.rect_size.x - 16, Global.onion_skinning_button.rect_global_position.y - 106, 136, 126))

Expand Down Expand Up @@ -474,3 +484,4 @@ func _on_OpacitySlider_value_changed(value) -> void:

func _on_OnionSkinningSettings_popup_hide() -> void:
Global.can_draw = true

76 changes: 67 additions & 9 deletions src/UI/Timeline/AnimationTimeline.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=43 format=2]
[gd_scene load_steps=44 format=2]

[ext_resource path="res://src/UI/Timeline/AnimationTimeline.gd" type="Script" id=1]
[ext_resource path="res://assets/graphics/dark_themes/layers/new_layer.png" type="Texture" id=2]
Expand All @@ -7,6 +7,7 @@
[ext_resource path="res://assets/graphics/dark_themes/layers/move_down_disabled.png" type="Texture" id=5]
[ext_resource path="res://assets/graphics/dark_themes/layers/merge_down_disabled.png" type="Texture" id=6]
[ext_resource path="res://assets/graphics/dark_themes/layers/clone_layer.png" type="Texture" id=7]
[ext_resource path="res://assets/graphics/dark_themes/timeline/move_arrow.png" type="Texture" id=8]
[ext_resource path="res://src/UI/Timeline/LayerButton.tscn" type="PackedScene" id=18]
[ext_resource path="res://assets/graphics/dark_themes/timeline/new_frame.png" type="Texture" id=19]
[ext_resource path="res://assets/graphics/dark_themes/timeline/remove_frame.png" type="Texture" id=20]
Expand Down Expand Up @@ -319,27 +320,27 @@ __meta__ = {

[node name="Control" type="Control" parent="AnimationContainer/TimelineContainer/TimelineButtons"]
margin_left = 225.0
margin_right = 434.0
margin_right = 386.0
margin_bottom = 38.0
size_flags_horizontal = 3

[node name="PanelContainer" type="PanelContainer" parent="AnimationContainer/TimelineContainer/TimelineButtons"]
margin_left = 438.0
margin_left = 390.0
margin_right = 902.0
margin_bottom = 38.0

[node name="AnimationButtons" type="HBoxContainer" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer"]
margin_left = 7.0
margin_top = 7.0
margin_right = 457.0
margin_right = 505.0
margin_bottom = 31.0
rect_min_size = Vector2( 0, 24 )
size_flags_horizontal = 3
custom_constants/separation = 40
alignment = 2

[node name="FrameButtons" type="HBoxContainer" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons"]
margin_right = 92.0
margin_right = 140.0
margin_bottom = 24.0

[node name="AddFrame" type="Button" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons" groups=[
Expand Down Expand Up @@ -455,9 +456,64 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="MoveLeft" type="Button" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons" groups=[
"UIButtons",
]]
margin_left = 96.0
margin_top = 2.0
margin_right = 116.0
margin_bottom = 22.0
rect_min_size = Vector2( 20, 0 )
hint_tooltip = "Move the selected frame to the left."
mouse_default_cursor_shape = 2
size_flags_horizontal = 0
size_flags_vertical = 4

[node name="TextureRect" type="TextureRect" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons/MoveLeft"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -7.0
margin_top = -7.0
margin_right = 8.0
margin_bottom = 8.0
texture = ExtResource( 8 )
flip_h = true
__meta__ = {
"_edit_use_anchors_": false
}

[node name="MoveRight" type="Button" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons" groups=[
"UIButtons",
]]
margin_left = 120.0
margin_top = 2.0
margin_right = 140.0
margin_bottom = 22.0
rect_min_size = Vector2( 20, 0 )
hint_tooltip = "Move the selected frame to the right."
mouse_default_cursor_shape = 2
size_flags_horizontal = 0
size_flags_vertical = 4

[node name="TextureRect" type="TextureRect" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons/MoveRight"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -7.0
margin_top = -7.0
margin_right = 7.0
margin_bottom = 7.0
texture = ExtResource( 8 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="PlaybackButtons" type="HBoxContainer" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons"]
margin_left = 132.0
margin_right = 272.0
margin_left = 180.0
margin_right = 320.0
margin_bottom = 24.0

[node name="FirstFrame" type="Button" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/PlaybackButtons" groups=[
Expand Down Expand Up @@ -637,8 +693,8 @@ __meta__ = {
}

[node name="LoopButtons" type="HBoxContainer" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons"]
margin_left = 312.0
margin_right = 450.0
margin_left = 360.0
margin_right = 498.0
margin_bottom = 24.0

[node name="OnionSkinningSettings" type="Button" parent="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/LoopButtons" groups=[
Expand Down Expand Up @@ -942,6 +998,8 @@ __meta__ = {
[connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons/DeleteFrame" to="." method="_on_DeleteFrame_pressed"]
[connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons/CopyFrame" to="." method="_on_CopyFrame_pressed"]
[connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons/FrameTagButton" to="." method="_on_FrameTagButton_pressed"]
[connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons/MoveLeft" to="." method="_on_MoveLeft_pressed"]
[connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/FrameButtons/MoveRight" to="." method="_on_MoveRight_pressed"]
[connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/PlaybackButtons/FirstFrame" to="." method="_on_FirstFrame_pressed"]
[connection signal="pressed" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/PlaybackButtons/PreviousFrame" to="." method="_on_PreviousFrame_pressed"]
[connection signal="toggled" from="AnimationContainer/TimelineContainer/TimelineButtons/PanelContainer/AnimationButtons/PlaybackButtons/PlayBackwards" to="." method="_on_PlayBackwards_toggled"]
Expand Down

0 comments on commit 0f8a041

Please sign in to comment.