Skip to content

Instantly share code, notes, and snippets.

@nortikin
Last active September 30, 2016 14:34
Show Gist options
  • Save nortikin/4acb2bf6d7606bbeb261 to your computer and use it in GitHub Desktop.
Save nortikin/4acb2bf6d7606bbeb261 to your computer and use it in GitHub Desktop.
particles sverchok json
{
"export_version": "0.055",
"framed_nodes": {},
"groups": {},
"nodes": {
"Script Generator": {
"bl_idname": "SvScriptNode",
"color": [
0.0,
0.800000011920929,
0.949999988079071
],
"height": 100.0,
"hide": false,
"label": "Text",
"location": [
-284.89324951171875,
88.16504669189453
],
"params": {
"button_names": "",
"has_buttons": 0,
"int_list": [
0,
1,
0,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31
],
"script_name": "Text",
"script_str": "def sv_main(obj_id=[], particle_sys=0):\n\n in_sockets = [\n ['s', 'obj_id', obj_id],\n ['s', 'particle_sys', particle_sys]]\n\n out_sockets = [\n ['v', 'locations', []]\n ]\n\n objects = bpy.data.objects\n if not obj_id:\n return in_sockets, out_sockets \n obj = obj_id[1][0]\n print(obj)\n if not particle_sys < len(obj.particle_systems):\n out_sockets[0][2] = []\n return in_sockets, out_sockets\n\n ps = obj.particle_systems[particle_sys]\n particles = ps.particles\n\n # on large objects list comprehension seems to be slower than index\n # and . dotted access is also a slowing factor\n locs = []\n add_loc = locs.append\n\n for i in range(len(particles)):\n # alive_state\n # angular_velocity\n # birth_time\n # die_time\n # hair_keys\n # is_exist\n # is_visible\n # lifetime\n pt = particles[i]\n if pt.is_exist and pt.alive_state == 'ALIVE':\n add_loc(pt.location[:])\n # prev_angular_velocity\n # prev_location\n # prev_rotation\n # prev_velocity\n # rotation\n # size\n # velocity\n #\n\n out_sockets[0][2] = [locs]\n\n return in_sockets, out_sockets"
},
"width": 140.0
},
"Viewer Draw2": {
"bl_idname": "ViewerNode2",
"color": [
0.6284880042076111,
0.931007981300354,
1.0
],
"height": 100.0,
"hide": false,
"label": "",
"location": [
-63.037017822265625,
157.48562622070312
],
"params": {},
"width": 140.0
},
"get_dataobject": {
"bl_idname": "SvGetDataObjectNode",
"color": [
0.6079999804496765,
0.6079999804496765,
0.6079999804496765
],
"height": 100.0,
"hide": false,
"label": "",
"location": [
-545.5576171875,
89.25444793701172
],
"params": {
"Types": "MESH"
},
"width": 140.0
}
},
"update_lists": [
[
"get_dataobject",
"Objects",
"Script Generator",
"obj_id"
],
[
"Script Generator",
"locations",
"Viewer Draw2",
"vertices"
]
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment