diff --git a/Scripts/AnimationTimeline.gd b/Scripts/AnimationTimeline.gd index 94d0c18ee..d6dd40425 100644 --- a/Scripts/AnimationTimeline.gd +++ b/Scripts/AnimationTimeline.gd @@ -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) diff --git a/Scripts/Dialogs/FrameTagDialog.gd b/Scripts/Dialogs/FrameTagDialog.gd index 73735fac5..4b280bfbe 100644 --- a/Scripts/Dialogs/FrameTagDialog.gd +++ b/Scripts/Dialogs/FrameTagDialog.gd @@ -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()