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:
parent
bd49ec5f0c
commit
40e7a0aed9
|
@ -92,12 +92,12 @@ func _on_CopyFrame_pressed():
|
|||
var new_canvas : Canvas = load("res://Prefabs/Canvas.tscn").instance()
|
||||
new_canvas.size = Global.canvas.size
|
||||
new_canvas.frame = Global.canvases.size()
|
||||
|
||||
|
||||
var new_canvases := Global.canvases.duplicate()
|
||||
new_canvases.append(new_canvas)
|
||||
var new_hidden_canvases := Global.hidden_canvases.duplicate()
|
||||
new_hidden_canvases.append(new_canvas)
|
||||
|
||||
|
||||
for layer in canvas.layers: # Copy every layer
|
||||
var sprite := Image.new()
|
||||
sprite.copy_from(layer[0])
|
||||
|
@ -122,7 +122,7 @@ func _on_CopyFrame_pressed():
|
|||
for c in Global.canvases:
|
||||
Global.undo_redo.add_do_property(c, "visible", false)
|
||||
Global.undo_redo.add_undo_property(c, "visible", c.visible)
|
||||
|
||||
|
||||
Global.undo_redo.add_undo_property(Global, "canvases", Global.canvases)
|
||||
Global.undo_redo.add_undo_property(Global, "hidden_canvases", new_hidden_canvases)
|
||||
Global.undo_redo.add_undo_property(Global, "canvas", Global.canvas)
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue