I found conversions other users have performed, and diffed the two versions to check the changes they made. They only seem to change the syntax of the input/output in such a way that sv_main is no longer used:
- every item in the lists
in_sockets and out_sockets is now defined at the start inside bracketed (""") comments with the commands in and out
- after the
in / out command the variable name is given, followed by the variable type
- the
in variables also get a d default value, which was in sv_main before, and an n value of 1 or 2
- if the default value is
[] then n=1 otherwise n=2 (I dont know the meaning of this)
- all code in
sv_main is just executed at the end of the script and the def and return lines are just deleted
For instance
in_sockets = [
['s', 'maximum branches', npoints],
['s', 'branch length', dist],
['s', 'minimum distance', min_dist],
['s', 'maximum distance', max_dist],
['s', 'tip radius', tip_radius],
['v', 'tropism', trop],
['v', 'End Vertices', verts_in],
['v', 'Start Vertices', verts_start]
]
def sv_main(npoints=100 , dist=0.05, min_dist=0.05, max_dist=2.0, tip_radius=0.01, trop=[], verts_in=[], verts_start=[]):
out_sockets = [
['v', 'Vertices', [verts_out]],
['s', 'Edges', [edges_out]],
['s', 'Branch radii', [rad_out]],
['s', 'Ends mask', [ends_out]],
['m', 'Leaf matrices', mats_out],
]
#some code
return in_sockets, out_sockets
Is converted to
"""
in npoints s d=100 n=2
in dist s d=0.05 n=2
in min_dist s d=0.05 n=2
in max_dist s d=2.0 n=2
in tip_radius s d=0.01 n=2
in tropism v d=[] n=1
in verts_in v d=[] n=1
in verts_start v d=[] n=1
out verts_out v
out edges_out s
out rad_out s
out ends_out s
out leaf_mats m
"""
#some code
I took these code snippets from a sverchok script by elfnor, so thanks to her for the example!