mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Add a "New Tag" option in the frame menu to easily create new tags
This commit is contained in:
parent
c6e9b1621d
commit
002d5cae86
|
@ -1898,6 +1898,13 @@ msgstr ""
|
|||
msgid "Cel properties"
|
||||
msgstr ""
|
||||
|
||||
msgid "Tag properties"
|
||||
msgstr ""
|
||||
|
||||
#. Found on the popup menu that appears when a user right-clicks on a frame button. When clicked, a new frame tag is added.
|
||||
msgid "New Tag"
|
||||
msgstr ""
|
||||
|
||||
#. Found on the popup menu that appears when a user right-clicks on a frame button. When clicked, the order of the selected frames is being reversed.
|
||||
msgid "Reverse Frames"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
extends VBoxContainer
|
||||
|
||||
var tag: AnimationTag
|
||||
@onready var options_dialog := Global.control.find_child("TagProperties") as ConfirmationDialog
|
||||
@onready var tag_properties := Global.control.find_child("TagProperties") as ConfirmationDialog
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -23,4 +23,4 @@ func update_position_and_size() -> void:
|
|||
|
||||
func _on_button_pressed() -> void:
|
||||
var tag_id = Global.current_project.animation_tags.find(tag)
|
||||
options_dialog.show_dialog(Rect2i(), tag_id, true)
|
||||
tag_properties.show_dialog(Rect2i(), tag_id, true)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
extends Button
|
||||
|
||||
enum { PROPERTIES, REMOVE, CLONE, MOVE_LEFT, MOVE_RIGHT, REVERSE, CENTER }
|
||||
enum { PROPERTIES, REMOVE, CLONE, MOVE_LEFT, MOVE_RIGHT, NEW_TAG, REVERSE, CENTER }
|
||||
|
||||
var frame := 0
|
||||
|
||||
@onready var popup_menu: PopupMenu = $PopupMenu
|
||||
@onready var frame_properties: ConfirmationDialog = Global.control.find_child("FrameProperties")
|
||||
@onready var frame_properties := Global.control.find_child("FrameProperties") as ConfirmationDialog
|
||||
@onready var tag_properties := Global.control.find_child("TagProperties") as ConfirmationDialog
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -79,6 +80,10 @@ func _button_pressed() -> void:
|
|||
func _on_PopupMenu_id_pressed(id: int) -> void:
|
||||
var indices := _get_frame_indices()
|
||||
match id:
|
||||
PROPERTIES:
|
||||
frame_properties.frame_indices = indices
|
||||
frame_properties.popup_centered()
|
||||
Global.dialog_open(true)
|
||||
REMOVE:
|
||||
Global.animation_timeline.delete_frames(indices)
|
||||
CLONE:
|
||||
|
@ -87,10 +92,9 @@ func _on_PopupMenu_id_pressed(id: int) -> void:
|
|||
Global.animation_timeline.move_frames(frame, -1)
|
||||
MOVE_RIGHT:
|
||||
Global.animation_timeline.move_frames(frame, 1)
|
||||
PROPERTIES:
|
||||
frame_properties.frame_indices = indices
|
||||
frame_properties.popup_centered()
|
||||
Global.dialog_open(true)
|
||||
NEW_TAG:
|
||||
var current_tag_id := Global.current_project.animation_tags.size()
|
||||
tag_properties.show_dialog(Rect2i(), current_tag_id, false, indices)
|
||||
REVERSE:
|
||||
Global.animation_timeline.reverse_frames(indices)
|
||||
CENTER:
|
||||
|
|
|
@ -14,7 +14,7 @@ text = "1"
|
|||
script = ExtResource("1")
|
||||
|
||||
[node name="PopupMenu" type="PopupMenu" parent="."]
|
||||
item_count = 7
|
||||
item_count = 8
|
||||
item_0/text = "Properties"
|
||||
item_0/id = -1
|
||||
item_1/text = "Remove Frame"
|
||||
|
@ -28,10 +28,12 @@ item_3/disabled = true
|
|||
item_4/text = "Move Right"
|
||||
item_4/id = -1
|
||||
item_4/disabled = true
|
||||
item_5/text = "Reverse Frames"
|
||||
item_5/text = "New Tag"
|
||||
item_5/id = 5
|
||||
item_5/disabled = true
|
||||
item_6/text = "Center Frames"
|
||||
item_6/text = "Reverse Frames"
|
||||
item_6/id = 6
|
||||
item_6/disabled = true
|
||||
item_7/text = "Center Frames"
|
||||
item_7/id = 7
|
||||
|
||||
[connection signal="id_pressed" from="PopupMenu" to="." method="_on_PopupMenu_id_pressed"]
|
||||
|
|
|
@ -5,11 +5,11 @@ var called_tag_properties := false ## True when tag properties has been shown b
|
|||
|
||||
@onready var main_vbox_cont: VBoxContainer = $VBoxContainer/ScrollContainer/VBoxTagContainer
|
||||
@onready var add_tag_button: Button = $VBoxContainer/ScrollContainer/VBoxTagContainer/AddTag
|
||||
@onready var options_dialog := Global.control.find_child("TagProperties") as ConfirmationDialog
|
||||
@onready var tag_properties := Global.control.find_child("TagProperties") as ConfirmationDialog
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
options_dialog.visibility_changed.connect(_on_tag_options_visibility_changed)
|
||||
tag_properties.visibility_changed.connect(_on_tag_options_visibility_changed)
|
||||
|
||||
|
||||
func _on_tag_options_visibility_changed() -> void:
|
||||
|
@ -68,22 +68,22 @@ func _on_FrameTagDialog_visibility_changed() -> void:
|
|||
func _on_AddTag_pressed() -> void:
|
||||
var x_pos := add_tag_button.global_position.x
|
||||
var y_pos := add_tag_button.global_position.y + 2 * add_tag_button.size.y
|
||||
var dialog_position := Rect2i(position + Vector2i(x_pos, y_pos), options_dialog.size)
|
||||
var dialog_position := Rect2i(position + Vector2i(x_pos, y_pos), tag_properties.size)
|
||||
var current_tag_id := Global.current_project.animation_tags.size()
|
||||
# Determine tag values (array sort method)
|
||||
var frames := PackedInt32Array([])
|
||||
for cel in Global.current_project.selected_cels:
|
||||
frames.append(cel[0])
|
||||
frames.sort()
|
||||
options_dialog.show_dialog(dialog_position, current_tag_id, false, frames)
|
||||
tag_properties.show_dialog(dialog_position, current_tag_id, false, frames)
|
||||
called_tag_properties = true
|
||||
|
||||
|
||||
func _on_EditButton_pressed(_tag_id: int, edit_button: Button) -> void:
|
||||
var x_pos := edit_button.global_position.x
|
||||
var y_pos := edit_button.global_position.y + 2 * edit_button.size.y
|
||||
var dialog_position := Rect2i(position + Vector2i(x_pos, y_pos), options_dialog.size)
|
||||
options_dialog.show_dialog(dialog_position, _tag_id, true)
|
||||
var dialog_position := Rect2i(position + Vector2i(x_pos, y_pos), tag_properties.size)
|
||||
tag_properties.show_dialog(dialog_position, _tag_id, true)
|
||||
called_tag_properties = true
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue