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

Don't let tag_to be larger than Global.canvases.size(), and smaller than tag_from

Also, when adding an new tag, the starting and ending frame values become the current frame.
This commit is contained in:
OverloadedOrama 2020-04-16 03:00:40 +03:00
parent bd49ec5f0c
commit 40e7a0aed9
2 changed files with 12 additions and 3 deletions

View file

@ -59,6 +59,8 @@ func _on_FrameTagDialog_popup_hide() -> void:
func _on_AddTag_pressed() -> void:
options_dialog.popup_centered()
current_tag_id = Global.animation_tags.size()
options_dialog.get_node("GridContainer/FromSpinBox").value = Global.current_frame + 1
options_dialog.get_node("GridContainer/ToSpinBox").value = Global.current_frame + 1
func _on_EditButton_pressed(_tag_id : int) -> void:
@ -79,6 +81,13 @@ func _on_TagOptions_confirmed() -> void:
var tag_color : Color = options_dialog.get_node("GridContainer/ColorPickerButton").color
var tag_from : int = options_dialog.get_node("GridContainer/FromSpinBox").value
var tag_to : int = options_dialog.get_node("GridContainer/ToSpinBox").value
if tag_to > Global.canvases.size():
tag_to = Global.canvases.size()
if tag_from > tag_to:
tag_from = tag_to
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()