Made the frame move buttons get disabled when you can't move frames

This commit is contained in:
OverloadedOrama 2020-10-05 02:37:55 +03:00
parent a5da9aaeb9
commit fbbdcdaa57
9 changed files with 86 additions and 8 deletions

View file

@ -139,6 +139,8 @@ var tag_container : Control
var tag_dialog : AcceptDialog
var remove_frame_button : BaseButton
var move_left_frame_button : BaseButton
var move_right_frame_button : BaseButton
var remove_layer_button : BaseButton
var move_up_layer_button : BaseButton
@ -233,6 +235,8 @@ func _ready() -> 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")

View file

@ -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

View file

@ -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