add export functionality

This commit is contained in:
nek0 2022-12-10 11:55:52 +01:00
parent 48ba04b7e6
commit 6f63176b91
5 changed files with 64 additions and 6 deletions

View file

@ -16,6 +16,14 @@ func _on_card_paster_pressed():
var tmp = get_tree().root.get_child(0).paste()
if tmp != null:
select(tmp)
func save():
return {
id = self.get_instance_id(),
weight1 = $first_weight.value,
weight2 = $second_weight.value,
postit = post_it.get_instance_id()
}
"
[node name="Ingest Connection" type="VBoxContainer"]
@ -25,7 +33,7 @@ margin_top = 1.0
margin_right = -1838.0
script = SubResource( 1 )
[node name="first_weoght" type="HSlider" parent="."]
[node name="first_weight" type="HSlider" parent="."]
margin_right = 120.0
margin_bottom = 16.0
rect_min_size = Vector2( 120, 0 )

View file

@ -8,6 +8,13 @@ func _on_audio_button_up():
func _on_copy_pressed():
get_tree().root.get_child(0).copy(self)
func save():
return {
id = self.get_instance_id(),
text = $LineEdit.text
# TODO: Save audio
}
"
[node name="Ingest Post-It" type="VBoxContainer"]

View file

@ -44,7 +44,24 @@ func paste():
func _on_save_pressed():
var save_story = File.new()
save_story.open("res://dev-util/export.save", File.WRITE)
var save_nodes = $board
save_story.store_line(to_json(save_nodes))
var save_stories = File.new()
save_stories.open("res://dev-util/export.save", File.WRITE)
var stories = []
for story in story_list.get_children():
stories.append(story.save())
var cards = []
for card in all_cards:
cards.append(card.save())
var postits = []
for postit in all_post_its:
postits.append(postit.save())
var connections = []
for connection in connections_list.get_children():
connections.append(connection.save())
var save_dict = {
stories = stories,
cards = cards,
postits = postits,
connections = connections
}
save_stories.store_line(to_json(save_dict))

View file

@ -35,6 +35,21 @@ func push_children():
func _on_choose_Audio_button_down():
$FileDialog.show()
$FileDialog.rect_size = Vector2(250,250)
func save():
var postits_export = []
for postit in post_its:
postits_export.append(postit.get_instance_id())
var connections_export = []
for conn in connections:
connections_export.append(conn.get_instance_id())
return {
id = self.get_instance_id(),
text = $LineEdit.text,
postits = postits_export,
connections = connections_export
# TODO: save audio
}
"
[node name="Ingest Card" type="VBoxContainer"]
@ -76,7 +91,6 @@ margin_bottom = 20.0
text = "choose Audio"
[node name="FileDialog" type="FileDialog" parent="."]
visible = true
margin_top = 70.0
margin_right = 304.0
margin_bottom = 320.0

View file

@ -23,6 +23,18 @@ func _on_audio_select_pressed():
$FileDialog.show()
$FileDialog.size.x = 250
$FileDialog.size.y = 250
func save():
var cards_export = []
for card in cards:
cards_export.append(card.get_instance_id())
return {
id = self.get_instance_id(),
name = $LineEdit.text,
story = $TextEdit.text,
cards = cards_export
# TODO: save audio
}
"
[node name="Ingest Story" type="VBoxContainer"]