Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/json_reader.py
Created February 21, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/32709688240c8107d75e to your computer and use it in GitHub Desktop.
Save zeffii/32709688240c8107d75e to your computer and use it in GitHub Desktop.
import bpy
import json
def sv_main(scale=0.3):
verts_out = []
edges_out = []
in_sockets = [
['s', 'scale', scale]
]
out_sockets = [
['v', 'verts', verts_out],
['s', 'edges', edges_out]
]
text_obj = bpy.data.texts['multifile.json']
text_str = text_obj.as_string()
print(text_str)
nodes_json = json.loads(text_str)
print(nodes_json['graphs'])
return in_sockets, out_sockets
{
"graphs": {
"0": {
"items": {
"0": {
"bl_idname": "SvGenFloatRange",
"duration": 0.00010203810819531256,
"name": "Float Series",
"start": 2.624644403129448
},
"1": {
"bl_idname": "ScalarMathNode",
"duration": 0.00022125717095322628,
"name": "function",
"start": 2.6247534253655145
},
"2": {
"bl_idname": "ScalarMathNode",
"duration": 0.00018102859441659902,
"name": "function.001",
"start": 2.624980758727715
},
"3": {
"bl_idname": "GenVectorsNode",
"duration": 0.00013528255686123813,
"name": "Vectors in",
"start": 2.625167514306986
},
"4": {
"bl_idname": "ViewerNode2",
"duration": 0.00014540954227415526,
"name": "Viewer Draw2",
"start": 2.625308942896374
}
},
"name": "NodeTree"
},
"1": {
"items": {
"0": {
"bl_idname": "SvGenFloatRange",
"duration": 6.53714368725744e-05,
"name": "Float Series",
"start": 2.6261603779251272
},
"1": {
"bl_idname": "GenVectorsNode",
"duration": 8.5695248977391e-05,
"name": "Vectors in",
"start": 2.6262328033311495
},
"2": {
"bl_idname": "MatrixGenNode",
"duration": 0.00015867938522928782,
"name": "Matrix in",
"start": 2.6263248541364894
},
"3": {
"bl_idname": "GenListRangeIntNode",
"duration": 5.838730900142863e-05,
"name": "List Range Int",
"start": 2.626488981141458
},
"4": {
"bl_idname": "SvCircleNode",
"duration": 0.00030716194376667616,
"name": "Circle",
"start": 2.6265529557527563
},
"5": {
"bl_idname": "ViewerNode2",
"duration": 0.00025282542893023674,
"name": "Viewer Draw2",
"start": 2.626866543094164
}
},
"name": "NodeTree.001"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment