mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
save meta in a more godot-friendly format
This commit is contained in:
parent
48bf02d22a
commit
04b20946ad
2 changed files with 4 additions and 4 deletions
|
@ -105,7 +105,7 @@ func to_json(with_meta: bool = true) -> String:
|
||||||
if with_meta:
|
if with_meta:
|
||||||
d["meta"] = {}
|
d["meta"] = {}
|
||||||
for meta in get_meta_list():
|
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)
|
return JSON.stringify(d, "\t", false)
|
||||||
|
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ static func from_json(json: String) -> Deck:
|
||||||
deck.variable_stack = data.deck.variable_stack
|
deck.variable_stack = data.deck.variable_stack
|
||||||
|
|
||||||
for key in data.meta:
|
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
|
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
|
node.ports[i].value = port_value
|
||||||
|
|
||||||
for key in nodes_data[node_id].meta:
|
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:
|
for prop in nodes_data[node_id].props:
|
||||||
node.set(prop, nodes_data[node_id].props[prop])
|
node.set(prop, nodes_data[node_id].props[prop])
|
||||||
|
|
|
@ -198,5 +198,5 @@ func to_dict(with_meta: bool = true) -> Dictionary:
|
||||||
if with_meta:
|
if with_meta:
|
||||||
d["meta"] = {}
|
d["meta"] = {}
|
||||||
for meta in get_meta_list():
|
for meta in get_meta_list():
|
||||||
d["meta"][meta] = get_meta(meta)
|
d["meta"][meta] = var_to_str(get_meta(meta))
|
||||||
return d
|
return d
|
||||||
|
|
Loading…
Reference in a new issue