1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

You can now delete tags

This commit is contained in:
OverloadedOrama 2020-04-06 01:07:28 +03:00
parent cf55c9167f
commit 1e9d44fffc
3 changed files with 26 additions and 9 deletions

View file

@ -4,16 +4,13 @@
[ext_resource path="res://Assets/Graphics/Dark Themes/Timeline/New_Frame_Hover.png" type="Texture" id=2]
[ext_resource path="res://Assets/Graphics/Dark Themes/Timeline/New_Frame.png" type="Texture" id=3]
[node name="FrameTagDialog" type="ConfirmationDialog"]
[node name="FrameTagDialog" type="AcceptDialog"]
margin_right = 83.0
margin_bottom = 58.0
rect_min_size = Vector2( 400, 200 )
window_title = "Frame Tag Properties"
resizable = true
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="ScrollContainer" type="ScrollContainer" parent="."]
anchor_right = 1.0
@ -79,6 +76,8 @@ text = "Name:"
margin_left = 50.0
margin_right = 124.0
margin_bottom = 24.0
caret_blink = true
caret_blink_speed = 0.5
[node name="ColorLabel" type="Label" parent="TagOptions/GridContainer"]
margin_left = 132.0
@ -125,3 +124,5 @@ value = 1.0
[connection signal="popup_hide" from="." to="." method="_on_FrameTagDialog_popup_hide"]
[connection signal="pressed" from="ScrollContainer/VBoxContainer/AddTag" to="." method="_on_AddTag_pressed"]
[connection signal="confirmed" from="TagOptions" to="." method="_on_TagOptions_confirmed"]
[connection signal="custom_action" from="TagOptions" to="." method="_on_TagOptions_custom_action"]
[connection signal="popup_hide" from="TagOptions" to="." method="_on_TagOptions_popup_hide"]

View file

@ -1,8 +1,9 @@
extends ConfirmationDialog
extends AcceptDialog
var current_tag_id := 0
var tag_vboxes := []
var delete_tag_button : Button
onready var main_vbox_cont : VBoxContainer = $ScrollContainer/VBoxContainer
onready var add_tag_button : TextureButton = $ScrollContainer/VBoxContainer/AddTag
@ -18,7 +19,6 @@ func _on_FrameTagDialog_about_to_show() -> void:
var i := 0
for tag in Global.animation_tags:
var vbox_cont := VBoxContainer.new()
var hbox_cont := HBoxContainer.new()
var tag_label := Label.new()
if tag[2] == tag[3]:
@ -67,6 +67,10 @@ func _on_EditButton_pressed(_tag_id : int) -> void:
options_dialog.get_node("GridContainer/ColorPickerButton").color = Global.animation_tags[_tag_id][1]
options_dialog.get_node("GridContainer/FromSpinBox").value = Global.animation_tags[_tag_id][2]
options_dialog.get_node("GridContainer/ToSpinBox").value = Global.animation_tags[_tag_id][3]
if !delete_tag_button:
delete_tag_button = options_dialog.add_button("Delete Tag", true, "delete_tag")
else:
delete_tag_button.visible = true
func _on_TagOptions_confirmed() -> void:
@ -76,11 +80,23 @@ func _on_TagOptions_confirmed() -> void:
var tag_to : int = options_dialog.get_node("GridContainer/ToSpinBox").value
if current_tag_id == Global.animation_tags.size():
Global.animation_tags.append([tag_name, tag_color, tag_from, tag_to])
Global.animation_tags = Global.animation_tags # To execute animation_tags_changed()
else:
Global.animation_tags[current_tag_id][0] = tag_name
Global.animation_tags[current_tag_id][1] = tag_color
Global.animation_tags[current_tag_id][2] = tag_from
Global.animation_tags[current_tag_id][3] = tag_to
Global.animation_tags = Global.animation_tags # To execute animation_tags_changed()
_on_FrameTagDialog_about_to_show()
func _on_TagOptions_custom_action(action : String) -> void:
if action == "delete_tag":
Global.animation_tags.remove(current_tag_id)
Global.animation_tags = Global.animation_tags # To execute animation_tags_changed()
options_dialog.hide()
_on_FrameTagDialog_about_to_show()
func _on_TagOptions_popup_hide() -> void:
if delete_tag_button:
delete_tag_button.visible = false

View file

@ -235,7 +235,7 @@ var timeline_seconds : Control
var layers_container : VBoxContainer
var frames_container : VBoxContainer
var tag_container : Control
var tag_dialog : ConfirmationDialog
var tag_dialog : AcceptDialog
var remove_layer_button : BaseButton
var move_up_layer_button : BaseButton