diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index a2b558c8f..0c2d518b2 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -206,7 +206,6 @@ onready var play_backwards: BaseButton = animation_timeline.find_node("PlayBackw onready var remove_frame_button: BaseButton = animation_timeline.find_node("DeleteFrame") onready var move_left_frame_button: BaseButton = animation_timeline.find_node("MoveLeft") onready var move_right_frame_button: BaseButton = animation_timeline.find_node("MoveRight") -onready var copy_tag_button: BaseButton = animation_timeline.find_node("CopyTag") onready var remove_layer_button: BaseButton = animation_timeline.find_node("RemoveLayer") onready var move_up_layer_button: BaseButton = animation_timeline.find_node("MoveUpLayer") onready var move_down_layer_button: BaseButton = animation_timeline.find_node("MoveDownLayer") diff --git a/src/Classes/Project.gd b/src/Classes/Project.gd index 539c79e26..11f232598 100644 --- a/src/Classes/Project.gd +++ b/src/Classes/Project.gd @@ -161,7 +161,7 @@ func change_project() -> void: Global.animation_timeline.project_changed() Global.current_frame_mark_label.text = "%s/%s" % [str(current_frame + 1), frames.size()] - Global.disable_button(Global.copy_tag_button, animation_tags.size() == 0) + 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( @@ -540,7 +540,6 @@ func change_cel(new_frame: int, new_layer := -1) -> void: func toggle_frame_buttons() -> void: 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.copy_tag_button, animation_tags.size() == 0) Global.disable_button( Global.move_right_frame_button, frames.size() == 1 or current_frame == frames.size() - 1 ) diff --git a/src/UI/Timeline/AnimationTimeline.gd b/src/UI/Timeline/AnimationTimeline.gd index c1c8efb9f..4780e10b8 100644 --- a/src/UI/Timeline/AnimationTimeline.gd +++ b/src/UI/Timeline/AnimationTimeline.gd @@ -379,38 +379,38 @@ func copy_frames(indices := [], destination := -1) -> void: adjust_scroll_container() -func _on_CopyTag_pressed() -> void: - $"%TagList".clear() - if Global.current_project.animation_tags.empty(): - return - for tag in Global.current_project.animation_tags: - var img = Image.new() - img.create(5, 5, true, Image.FORMAT_RGBA8) - img.fill(tag.color) - var tex = ImageTexture.new() - tex.create_from_image(img) - var title = tag.name - if title == "": - title = "(Untitled)" - $"%TagList".add_icon_item(tex, title) +func _on_FrameTagButton_pressed() -> void: + if Input.is_action_just_released("right_mouse"): + $"%TagList".clear() + if Global.current_project.animation_tags.empty(): + return + $"%TagList".add_separator("Copy Tag to Current Frame") + for tag in Global.current_project.animation_tags: + var img = Image.new() + img.create(5, 5, true, Image.FORMAT_RGBA8) + img.fill(tag.color) + var tex = ImageTexture.new() + tex.create_from_image(img) + var title = tag.name + if title == "": + title = "(Untitled)" + $"%TagList".add_icon_item(tex, title) - if not $"%TagList".is_connected("id_pressed", self, "_on_TagList_id_pressed"): - $"%TagList".connect("id_pressed", self, "_on_TagList_id_pressed") - $"%TagList".popup(Rect2(get_global_mouse_position(), Vector2.ONE)) + if not $"%TagList".is_connected("id_pressed", self, "_on_TagList_id_pressed"): + $"%TagList".connect("id_pressed", self, "_on_TagList_id_pressed") + $"%TagList".popup(Rect2(get_global_mouse_position(), Vector2.ONE)) + else: + find_node("FrameTagDialog").popup_centered() func _on_TagList_id_pressed(id: int) -> void: - var tag: AnimationTag = Global.current_project.animation_tags[id] + var tag: AnimationTag = Global.current_project.animation_tags[id - 1] var frames = [] for i in range(tag.from - 1, tag.to): frames.append(i) copy_frames(frames, Global.current_project.current_frame) -func _on_FrameTagButton_pressed() -> void: - find_node("FrameTagDialog").popup_centered() - - func _on_MoveLeft_pressed() -> void: var frame: int = Global.current_project.current_frame if frame == 0: diff --git a/src/UI/Timeline/AnimationTimeline.tscn b/src/UI/Timeline/AnimationTimeline.tscn index 1b7f2b419..b19685cd8 100644 --- a/src/UI/Timeline/AnimationTimeline.tscn +++ b/src/UI/Timeline/AnimationTimeline.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=45 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/layers/new.png" type="Texture" id=2] @@ -11,7 +11,6 @@ [ext_resource path="res://src/UI/Nodes/ValueSlider.tscn" type="PackedScene" id=9] [ext_resource path="res://assets/graphics/misc/value_arrow.svg" type="Texture" id=10] [ext_resource path="res://src/UI/Timeline/FrameScrollContainer.gd" type="Script" id=11] -[ext_resource path="res://assets/graphics/timeline/copy_tag.png" type="Texture" id=12] [ext_resource path="res://assets/graphics/timeline/new_frame.png" type="Texture" id=19] [ext_resource path="res://assets/graphics/timeline/remove_frame.png" type="Texture" id=20] [ext_resource path="res://assets/graphics/timeline/go_to_first_frame.png" type="Texture" id=21] @@ -314,7 +313,7 @@ theme = SubResource( 20 ) scroll_vertical_enabled = false [node name="AnimationTools" type="PanelContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer"] -margin_left = 135.0 +margin_left = 159.0 margin_right = 677.0 margin_bottom = 38.0 size_flags_horizontal = 10 @@ -322,7 +321,7 @@ size_flags_horizontal = 10 [node name="AnimationButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools"] margin_left = 7.0 margin_top = 7.0 -margin_right = 535.0 +margin_right = 511.0 margin_bottom = 31.0 rect_min_size = Vector2( 0, 24 ) size_flags_horizontal = 3 @@ -333,7 +332,7 @@ __meta__ = { } [node name="FrameButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons"] -margin_right = 164.0 +margin_right = 140.0 margin_bottom = 24.0 [node name="AddFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]] @@ -412,46 +411,19 @@ margin_right = 5.0 margin_bottom = 7.0 texture = ExtResource( 27 ) -[node name="CopyTag" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]] +[node name="FrameTagButton" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]] margin_left = 72.0 margin_top = 2.0 margin_right = 92.0 margin_bottom = 22.0 rect_min_size = Vector2( 20, 0 ) -hint_tooltip = "Clone an Existing Tag" -mouse_default_cursor_shape = 2 -size_flags_horizontal = 0 -size_flags_vertical = 4 - -[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/CopyTag"] -anchor_left = 0.5 -anchor_top = 0.5 -anchor_right = 0.5 -anchor_bottom = 0.5 -margin_left = -10.0 -margin_top = -7.0 -margin_right = 10.0 -margin_bottom = 7.0 -texture = ExtResource( 12 ) -expand = true -stretch_mode = 6 - -[node name="TagList" type="PopupMenu" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/CopyTag"] -unique_name_in_owner = true -margin_right = 20.0 -margin_bottom = 20.0 - -[node name="FrameTagButton" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/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 = "Manage frame tags" +hint_tooltip = "Left click: Manage frame tags +Right click: Copy an existing tag to current frame" focus_mode = 0 mouse_default_cursor_shape = 2 size_flags_horizontal = 0 size_flags_vertical = 4 +button_mask = 3 [node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/FrameTagButton"] anchor_left = 0.5 @@ -463,14 +435,17 @@ margin_top = -7.0 margin_right = 7.0 margin_bottom = 7.0 texture = ExtResource( 28 ) -__meta__ = { -"_edit_use_anchors_": false -} + +[node name="TagList" type="PopupMenu" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/FrameTagButton"] +unique_name_in_owner = true +margin_left = -24.0 +margin_right = -4.0 +margin_bottom = 20.0 [node name="MoveLeft" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]] -margin_left = 120.0 +margin_left = 96.0 margin_top = 2.0 -margin_right = 140.0 +margin_right = 116.0 margin_bottom = 22.0 rect_min_size = Vector2( 20, 0 ) hint_tooltip = "Move the selected frame to the left." @@ -495,9 +470,9 @@ __meta__ = { } [node name="MoveRight" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]] -margin_left = 144.0 +margin_left = 120.0 margin_top = 2.0 -margin_right = 164.0 +margin_right = 140.0 margin_bottom = 22.0 rect_min_size = Vector2( 20, 0 ) hint_tooltip = "Move the selected frame to the right." @@ -518,8 +493,8 @@ margin_bottom = 5.5 texture = ExtResource( 8 ) [node name="PlaybackButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons"] -margin_left = 204.0 -margin_right = 344.0 +margin_left = 180.0 +margin_right = 320.0 margin_bottom = 24.0 [node name="FirstFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons" groups=["UIButtons"]] @@ -693,8 +668,8 @@ __meta__ = { } [node name="LoopButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons"] -margin_left = 384.0 -margin_right = 528.0 +margin_left = 360.0 +margin_right = 504.0 margin_bottom = 24.0 [node name="OnionSkinningSettings" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons" groups=["UIButtons"]] @@ -1017,7 +992,6 @@ color = Color( 0, 0.741176, 1, 0.501961 ) [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/AddFrame" to="." method="add_frame"] [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/DeleteFrame" to="." method="_on_DeleteFrame_pressed"] [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/CopyFrame" to="." method="_on_CopyFrame_pressed"] -[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/CopyTag" to="." method="_on_CopyTag_pressed"] [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/FrameTagButton" to="." method="_on_FrameTagButton_pressed"] [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/MoveLeft" to="." method="_on_MoveLeft_pressed"] [connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/MoveRight" to="." method="_on_MoveRight_pressed"] diff --git a/src/UI/Timeline/FrameTagDialog.gd b/src/UI/Timeline/FrameTagDialog.gd index 72e18648a..b4bfc24b2 100644 --- a/src/UI/Timeline/FrameTagDialog.gd +++ b/src/UI/Timeline/FrameTagDialog.gd @@ -135,8 +135,6 @@ func _on_TagOptions_confirmed() -> void: Global.current_project.undo_redo.add_undo_property( Global.current_project, "animation_tags", Global.current_project.animation_tags ) - Global.current_project.undo_redo.add_do_method(Global.current_project, "toggle_frame_buttons") - Global.current_project.undo_redo.add_undo_method(Global.current_project, "toggle_frame_buttons") Global.current_project.undo_redo.commit_action() _on_FrameTagDialog_about_to_show() @@ -156,12 +154,6 @@ func _on_TagOptions_custom_action(action: String) -> void: Global.current_project.undo_redo.add_undo_property( Global.current_project, "animation_tags", Global.current_project.animation_tags ) - Global.current_project.undo_redo.add_do_method( - Global.current_project, "toggle_frame_buttons" - ) - Global.current_project.undo_redo.add_undo_method( - Global.current_project, "toggle_frame_buttons" - ) Global.current_project.undo_redo.commit_action() options_dialog.hide()