From fbbdcdaa578a79cb4a8ac605c09ee5f3cddec490 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Mon, 5 Oct 2020 02:37:55 +0300 Subject: [PATCH] Made the frame move buttons get disabled when you can't move frames --- .../dark_themes/timeline/move_arrow.png | Bin 144 -> 143 bytes .../timeline/move_arrow_disabled.png | Bin 0 -> 142 bytes .../timeline/move_arrow_disabled.png.import | 34 ++++++++++++++++++ .../light_themes/timeline/move_arrow.png | Bin 145 -> 144 bytes .../timeline/move_arrow_disabled.png | Bin 0 -> 144 bytes .../timeline/move_arrow_disabled.png.import | 34 ++++++++++++++++++ src/Autoload/Global.gd | 4 +++ src/Classes/Project.gd | 4 +++ src/UI/Timeline/AnimationTimeline.tscn | 18 +++++----- 9 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 assets/graphics/dark_themes/timeline/move_arrow_disabled.png create mode 100644 assets/graphics/dark_themes/timeline/move_arrow_disabled.png.import create mode 100644 assets/graphics/light_themes/timeline/move_arrow_disabled.png create mode 100644 assets/graphics/light_themes/timeline/move_arrow_disabled.png.import diff --git a/assets/graphics/dark_themes/timeline/move_arrow.png b/assets/graphics/dark_themes/timeline/move_arrow.png index fc8ed305f08a0f8fd682db3b2dacf25cc238d290..f5591029babb28835e3ef61a654f16f4a215eebf 100644 GIT binary patch delta 127 zcmbQh*v~jYyn>s9je&t-f&29sAjMc5tg(_`(4bI0|7MLwL8`*xnFqyXc-QQDt~%*jTcg`s?a0WUw;oa2mCg4* eaGqKkCCn0qKidU3cz9A&qK%oECC|BSoGH=zVjVX~2 dLMyf~GDJnont0pY>IRz1;OXk;vd$@?2>^ojDl-58 diff --git a/assets/graphics/dark_themes/timeline/move_arrow_disabled.png b/assets/graphics/dark_themes/timeline/move_arrow_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..3f9482a29870bbc1123f3347809afeb3f6390da1 GIT binary patch literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^{6Ngj!3HE3xL=O}QjEnx?oJHr&dIz4ay&d;978lF z&Yf_Ok3oUMY2*86FY2$aTsuc^(&EpITpUH;XP#|m3THE#BUy9s;(=AwaY~uF5*b(a rO`3Z2M&FXHlgxkc&R?+R)kbP0l+XkK+H*4N literal 0 HcmV?d00001 diff --git a/assets/graphics/dark_themes/timeline/move_arrow_disabled.png.import b/assets/graphics/dark_themes/timeline/move_arrow_disabled.png.import new file mode 100644 index 000000000..4684f51c5 --- /dev/null +++ b/assets/graphics/dark_themes/timeline/move_arrow_disabled.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/move_arrow_disabled.png-52a5629e1ae2c34034b70ce489237c77.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/dark_themes/timeline/move_arrow_disabled.png" +dest_files=[ "res://.import/move_arrow_disabled.png-52a5629e1ae2c34034b70ce489237c77.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 diff --git a/assets/graphics/light_themes/timeline/move_arrow.png b/assets/graphics/light_themes/timeline/move_arrow.png index 5050ce3f76b7428c51521160d3a6fced8f83824c..c167c1d62d426d676b8e7b5c3a32000d71f08e27 100644 GIT binary patch delta 128 zcmbQpIDv73cqKOn8v_Hw0{81NK#H+A$lZxy-8q?;K#rHEi(`n!#N-48CJ70NKgZS1 zx%8yPunDY{oXx0`>1N&_IK7^uky~8PVA9%|jg36%i*NY!IF($F-BHjuQD=6dl;^dc fH4`%$v;!Ews!Qx`C~TbtG?l^A)z4*}Q$iB}_P8rq delta 129 zcmbQhIFWIJcojbf8v_G_^|h&9K#H+A$lZxy-8q?;K#sSki(`n!#N-5tD+dl7cwlc< zsOH6^5M^w}>~X0lk3m`QzW|fCUQB{Yv@tWY_h&{PIbS3j3^P6 void: tag_dialog = find_node_by_name(animation_timeline, "FrameTagDialog") remove_frame_button = find_node_by_name(animation_timeline, "DeleteFrame") + move_left_frame_button = find_node_by_name(animation_timeline, "MoveLeft") + move_right_frame_button = find_node_by_name(animation_timeline, "MoveRight") remove_layer_button = find_node_by_name(animation_timeline, "RemoveLayer") move_up_layer_button = find_node_by_name(animation_timeline, "MoveUpLayer") diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 3582f4674..dff832cad 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -136,6 +136,8 @@ func change_project() -> void: Global.current_frame_mark_label.text = "%s/%s" % [str(current_frame + 1), frames.size()] Global.disable_button(Global.remove_frame_button, frames.size() == 1) + Global.disable_button(Global.move_left_frame_button, frames.size() == 1 or current_frame == 0) + Global.disable_button(Global.move_right_frame_button, frames.size() == 1 or current_frame == frames.size() - 1) toggle_layer_buttons_layers() toggle_layer_buttons_current_layer() @@ -436,6 +438,8 @@ func frame_changed(value : int) -> void: layers[current_layer].frame_container.get_child(current_frame).pressed = true Global.disable_button(Global.remove_frame_button, frames.size() == 1) + Global.disable_button(Global.move_left_frame_button, frames.size() == 1 or current_frame == 0) + Global.disable_button(Global.move_right_frame_button, frames.size() == 1 or current_frame == frames.size() - 1) Global.canvas.update() Global.transparent_checker._ready() # To update the rect size diff --git a/src/UI/Timeline/AnimationTimeline.tscn b/src/UI/Timeline/AnimationTimeline.tscn index d05cf4225..e9cb45812 100644 --- a/src/UI/Timeline/AnimationTimeline.tscn +++ b/src/UI/Timeline/AnimationTimeline.tscn @@ -465,6 +465,7 @@ margin_right = 116.0 margin_bottom = 22.0 rect_min_size = Vector2( 20, 0 ) hint_tooltip = "Move the selected frame to the left." +focus_mode = 0 mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 4 @@ -474,10 +475,10 @@ 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 +margin_left = -7.5 +margin_top = -5.5 +margin_right = 7.5 +margin_bottom = 5.5 texture = ExtResource( 8 ) flip_h = true __meta__ = { @@ -493,6 +494,7 @@ margin_right = 140.0 margin_bottom = 22.0 rect_min_size = Vector2( 20, 0 ) hint_tooltip = "Move the selected frame to the right." +focus_mode = 0 mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 4 @@ -502,10 +504,10 @@ 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 +margin_left = -7.5 +margin_top = -5.5 +margin_right = 7.5 +margin_bottom = 5.5 texture = ExtResource( 8 ) __meta__ = { "_edit_use_anchors_": false