From 04b20946ad9acb83c4cf23c716c798b59aa7dfb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Tue, 8 Aug 2023 09:54:17 +0300 Subject: [PATCH] save meta in a more godot-friendly format --- classes/deck/deck.gd | 6 +++--- classes/deck/deck_node.gd | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/deck/deck.gd b/classes/deck/deck.gd index 0da3237..7748d5e 100644 --- a/classes/deck/deck.gd +++ b/classes/deck/deck.gd @@ -105,7 +105,7 @@ func to_json(with_meta: bool = true) -> String: if with_meta: d["meta"] = {} for meta in get_meta_list(): - d["meta"][meta] = get_meta(meta) + d["meta"][meta] = var_to_str(get_meta(meta)) return JSON.stringify(d, "\t", false) @@ -116,7 +116,7 @@ static func from_json(json: String) -> Deck: deck.variable_stack = data.deck.variable_stack for key in data.meta: - deck.set_meta(key, data.meta[key]) + deck.set_meta(key, str_to_var(data.meta[key])) var nodes_data: Dictionary = data.deck.nodes as Dictionary @@ -144,7 +144,7 @@ static func from_json(json: String) -> Deck: node.ports[i].value = port_value for key in nodes_data[node_id].meta: - node.set_meta(key, nodes_data[node_id].meta[key]) + node.set_meta(key, str_to_var(nodes_data[node_id].meta[key])) for prop in nodes_data[node_id].props: node.set(prop, nodes_data[node_id].props[prop]) diff --git a/classes/deck/deck_node.gd b/classes/deck/deck_node.gd index d63ef30..2cd748e 100644 --- a/classes/deck/deck_node.gd +++ b/classes/deck/deck_node.gd @@ -198,5 +198,5 @@ func to_dict(with_meta: bool = true) -> Dictionary: if with_meta: d["meta"] = {} for meta in get_meta_list(): - d["meta"][meta] = get_meta(meta) + d["meta"][meta] = var_to_str(get_meta(meta)) return d