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

Frame tags are saved in .pxos

And are also cleared on clear_canvases()
This commit is contained in:
OverloadedOrama 2020-04-07 00:23:30 +03:00
parent 943e20a0de
commit f5ab5c3987

View file

@ -514,6 +514,17 @@ func _on_OpenSprite_file_selected(path : String) -> void:
Global.create_brush_button(image) Global.create_brush_button(image)
brush_line = file.get_line() brush_line = file.get_line()
if (version_number - 0.01) > 0.6:
var tag_line := file.get_line()
while tag_line == ".T/":
var tag_name := file.get_line()
var tag_color : Color = file.get_var()
var tag_from := file.get_8()
var tag_to := file.get_8()
Global.animation_tags.append([tag_name, tag_color, tag_from, tag_to])
Global.animation_tags = Global.animation_tags # To execute animation_tags_changed()
tag_line = file.get_line()
file.close() file.close()
current_save_path = path current_save_path = path
@ -587,7 +598,18 @@ func _on_SaveSprite_file_selected(path : String) -> void:
file.store_16(brush.get_size().y) file.store_16(brush.get_size().y)
file.store_buffer(brush.get_data()) file.store_buffer(brush.get_data())
file.store_line("END_BRUSHES") file.store_line("END_BRUSHES")
for tag in Global.animation_tags: # Store Global layers
file.store_line(".T/")
file.store_line(tag[0]) # Tag name
file.store_var(tag[1]) # Tag color
file.store_8(tag[2]) # Tag "from", the first frame
file.store_8(tag[3]) # Tag "to", the last frame
file.store_line("END_FRAME_TAGS")
file.close() file.close()
if !Global.saved: if !Global.saved:
Global.saved = true Global.saved = true
Global.window_title = Global.window_title.rstrip("(*)") Global.window_title = Global.window_title.rstrip("(*)")
@ -601,6 +623,9 @@ func clear_canvases() -> void:
if child is Canvas: if child is Canvas:
child.queue_free() child.queue_free()
Global.canvases.clear() Global.canvases.clear()
Global.animation_tags.clear()
Global.animation_tags = Global.animation_tags # To execute animation_tags_changed()
current_save_path = "" current_save_path = ""
file_menu.set_item_text(2, "Save") file_menu.set_item_text(2, "Save")
file_menu.set_item_text(5, "Export...") file_menu.set_item_text(5, "Export...")