Skip to content

Instantly share code, notes, and snippets.

@zeffii
Forked from anonymous/plastica.py
Created June 11, 2014 09:41
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/1049d2d8fd713eb581da to your computer and use it in GitHub Desktop.
Save zeffii/1049d2d8fd713eb581da to your computer and use it in GitHub Desktop.
from mathutils import Vector, Euler
def sv_main(verts=[], indices=[], translate=[]):
in_sockets = [
['v', 'verts', verts],
['s', 'indices', indices],
['v', 'translate', translate]]
out_sockets = [
['v', 'Verts', [verts]]
]
if not verts:
return in_sockets, out_sockets
# yes, ugly..
if indices and translate:
if indices[0] and len(indices[0][0]) > 0:
if translate[0] and len(translate[0][0]) > 0:
indices = indices[0][0]
translate = translate[0][0]
else:
return in_sockets, out_sockets
# reaches here only if conditions are met.
v_out = []
for idx, v in enumerate(verts[0]):
print(idx)
if idx in indices:
print('in indices')
v = Vector(v) + Vector(translate)
v = v[:]
v_out.append(v)
out_sockets[0][2] = [v_out]
return in_sockets, out_sockets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment