forked from nortikin/sverchok
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnode_Vector_out.py
46 lines (37 loc) · 1.39 KB
/
node_Vector_out.py
1
2
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import bpy
from node_s import *
from util import *
class VectorsOutNode(Node, SverchCustomTreeNode):
''' Vectors out '''
bl_idname = 'VectorsOutNode'
bl_label = 'Vectors out'
bl_icon = 'OUTLINER_OB_EMPTY'
def init(self, context):
self.inputs.new('VerticesSocket', "Vectors", "Vectors")
self.outputs.new('StringsSocket', "X", "X")
self.outputs.new('StringsSocket', "Y", "Y")
self.outputs.new('StringsSocket', "Z", "Z")
def update(self):
# inputs
X, Y, Z = [], [], []
if 'Vectors' in self.inputs and self.inputs['Vectors'].links:
xyz = SvGetSocketAnyType(self,self.inputs['Vectors'])
data = dataCorrect(xyz) #
#print (data)
X,Y,Z = [],[],[]
for obj in data:
for item in obj:
X.append(item[0])
Y.append(item[1])
Z.append(item[2])
for i,name in enumerate(['X','Y','Z']):
if self.outputs[name].links:
SvSetSocketAnyType(self,name,[[X,Y,Z][i]])
def update_socket(self, context):
self.update()
def register():
bpy.utils.register_class(VectorsOutNode)
def unregister():
bpy.utils.unregister_class(VectorsOutNode)
if __name__ == "__main__":
register()