From 2b5f6b47ee2c333b22863c5613a699d353ff3d29 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Sun, 3 May 2020 18:17:12 +0300 Subject: [PATCH] Made the remove frame button get disabled when there's only one frame --- .../timeline/remove_frame_disabled.png | Bin 0 -> 93 bytes .../timeline/remove_frame_disabled.png.import | 34 ++++++++++++++++++ .../timeline/remove_frame_disabled.png | Bin 0 -> 93 bytes .../timeline/remove_frame_disabled.png.import | 34 ++++++++++++++++++ src/Autoload/Global.gd | 9 +++++ 5 files changed, 77 insertions(+) create mode 100644 Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png create mode 100644 Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png.import create mode 100644 Assets/Graphics/light_themes/timeline/remove_frame_disabled.png create mode 100644 Assets/Graphics/light_themes/timeline/remove_frame_disabled.png.import diff --git a/Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png b/Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..5ddbafe682e305cc3b6456473090f0f587bbdecf GIT binary patch literal 93 zcmeAS@N?(olHy`uVBq!ia0vp^JV4CE!3HFA>TRb3DaPU;cPEB*=VV?2IpUr!jv*W~ olXEgNf1Y<>N>Fk&WCj9;&mK(uN57=Z2P$FkboFyt=akR{0BE-si~s-t literal 0 HcmV?d00001 diff --git a/Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png.import b/Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png.import new file mode 100644 index 000000000..fd21c386a --- /dev/null +++ b/Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/remove_frame_disabled.png-0b0bf95063e120cabfe225b5e96232e6.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Graphics/dark_themes/timeline/remove_frame_disabled.png" +dest_files=[ "res://.import/remove_frame_disabled.png-0b0bf95063e120cabfe225b5e96232e6.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/remove_frame_disabled.png b/Assets/Graphics/light_themes/timeline/remove_frame_disabled.png new file mode 100644 index 0000000000000000000000000000000000000000..2c618f5f9573ed1053ff74aeb1fcf110e5fd8c49 GIT binary patch literal 93 zcmeAS@N?(olHy`uVBq!ia0vp^JV4CE!3HFA>TRb3DaPU;cPEB*=VV?2IpUr!jv*W~ oldoL8`uDs8Q-YGKAu|v#Ow3^HI<|n%52%E})78&qol`;+0D+qpjsO4v literal 0 HcmV?d00001 diff --git a/Assets/Graphics/light_themes/timeline/remove_frame_disabled.png.import b/Assets/Graphics/light_themes/timeline/remove_frame_disabled.png.import new file mode 100644 index 000000000..a556954dc --- /dev/null +++ b/Assets/Graphics/light_themes/timeline/remove_frame_disabled.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/remove_frame_disabled.png-788471f1b29606174c549e45209f03ca.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Assets/Graphics/light_themes/timeline/remove_frame_disabled.png" +dest_files=[ "res://.import/remove_frame_disabled.png-788471f1b29606174c549e45209f03ca.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/src/Autoload/Global.gd b/src/Autoload/Global.gd index f5eda421b..d570b92ab 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -243,6 +243,8 @@ var frames_container : VBoxContainer var tag_container : Control var tag_dialog : AcceptDialog +var remove_frame_button : BaseButton + var remove_layer_button : BaseButton var move_up_layer_button : BaseButton var move_down_layer_button : BaseButton @@ -374,6 +376,8 @@ func _ready() -> void: tag_container = find_node_by_name(animation_timeline, "TagContainer") tag_dialog = find_node_by_name(animation_timeline, "FrameTagDialog") + remove_frame_button = find_node_by_name(animation_timeline, "DeleteFrame") + remove_layer_button = find_node_by_name(animation_timeline, "RemoveLayer") move_up_layer_button = find_node_by_name(animation_timeline, "MoveUpLayer") move_down_layer_button = find_node_by_name(animation_timeline, "MoveDownLayer") @@ -640,6 +644,11 @@ func frame_changed(value : int) -> void: if current_frame < layers[current_layer][3].get_child_count(): layers[current_layer][3].get_child(current_frame).pressed = true + if canvases.size() == 1: + disable_button(remove_frame_button, true) + elif !layers[current_layer][2]: + disable_button(remove_frame_button, false) + Global.transparent_checker._ready() # To update the rect size