Skip to content

Commit fc06d30

Browse files
committed
Sverchok inputs/outputs.
1 parent db1b7b6 commit fc06d30

9 files changed

Lines changed: 221 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""
2+
out bool_out s
3+
"""
4+
5+
# Initialization
6+
if 'BEInputName' not in self.keys():
7+
self['BEInputName'] = 'Boolean'
8+
if 'BEBoolean' not in self.keys():
9+
self['BEBoolean'] = 0
10+
bool_prop = self.id_properties_ui("BEBoolean")
11+
bool_prop.update(min=0, max=1)
12+
if 'BEBooleanDefault' not in self.keys():
13+
self['BEBooleanDefault'] = 0
14+
bool_prop = self.id_properties_ui("BEBooleanDefault")
15+
bool_prop.update(min=0, max=1)
16+
17+
# Outputs
18+
bool_out = [[self['BEBoolean']]]
19+
20+
# UI
21+
def ui(self, context, layout):
22+
layout.prop(self, '["BEInputName"]', text="Name")
23+
layout.separator()
24+
layout.prop(self, '["BEBoolean"]', text="Boolean")
25+
layout.separator()
26+
layout.prop(self, '["BEBooleanDefault"]', text="Default")
27+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
out coll_out o
3+
"""
4+
5+
# Initialization
6+
if 'BEInputName' not in self.keys():
7+
self['BEInputName'] = 'Collection'
8+
if 'BECollection' not in self.keys():
9+
self['BECollection'] = ''
10+
11+
# Outputs
12+
if self['BECollection'] in bpy.data.collections.keys():
13+
coll_objs = [obj for obj in bpy.data.collections[self['BECollection']].objects.values()]
14+
coll_out = coll_objs
15+
else:
16+
coll_out = []
17+
18+
# UI
19+
def ui(self, context, layout):
20+
layout.prop(self, '["BEInputName"]', text="Name")
21+
layout.separator()
22+
layout.prop_search(self, '["BECollection"]', bpy.data, "collections", text="Collection")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
out color_out c
3+
"""
4+
5+
# Initialization
6+
if 'BEInputName' not in self.keys():
7+
self['BEInputName'] = 'Color'
8+
if 'BEColor' not in self.keys():
9+
self['BEColor'] = (0.0, 0.0, 0.0, 1.0)
10+
col_prop = self.id_properties_ui("BEColor")
11+
# Also it could be subtype="COLOR"
12+
col_prop.update(soft_min=0.0, soft_max=1.0, default=(0, 0, 0, 1.0), subtype="COLOR") # Maybe COLOR_GAMMA
13+
if 'BEColorDefault' not in self.keys():
14+
self['BEColorDefault'] = (0.0, 0.0, 0.0, 1.0)
15+
col_prop = self.id_properties_ui("BEColorDefault")
16+
# Also it could be subtype="COLOR"
17+
col_prop.update(soft_min=0.0, soft_max=1.0, default=(0, 0, 0, 1.0), subtype="COLOR") # Maybe COLOR_GAMMA
18+
19+
# Outputs
20+
color_out = [[tuple(self['BEColor'])]]
21+
22+
# UI
23+
def ui(self, context, layout):
24+
layout.prop(self, '["BEInputName"]', text="Name")
25+
layout.separator()
26+
layout.prop(self, '["BEColor"]', text="Color")
27+
layout.separator()
28+
layout.prop(self, '["BEColorDefault"]', text="Default")
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""
2+
out float_out s
3+
"""
4+
5+
import sys
6+
7+
8+
# Initialization
9+
if 'BEInputName' not in self.keys():
10+
self['BEInputName'] = 'Float'
11+
if 'BEFloat' not in self.keys():
12+
self['BEFloat'] = 0.0
13+
if 'BEFloatDefault' not in self.keys():
14+
self['BEFloatDefault'] = 0.0
15+
if 'BEFloatMin' not in self.keys():
16+
self['BEFloatMin'] = -sys.float_info.max
17+
if 'BEFloatMax' not in self.keys():
18+
self['BEFloatMax'] = sys.float_info.max
19+
20+
# Outputs
21+
float_out = [[self['BEFloat']]]
22+
23+
# UI
24+
def ui(self, context, layout):
25+
layout.prop(self, '["BEInputName"]', text="Name")
26+
layout.separator()
27+
layout.prop(self, '["BEFloat"]', text="Float")
28+
layout.separator()
29+
layout.prop(self, '["BEFloatDefault"]', text="Default")
30+
layout.prop(self, '["BEFloatMin"]', text="Min")
31+
layout.prop(self, '["BEFloatMax"]', text="Max")
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
"""
2+
out int_out s
3+
"""
4+
5+
import sys
6+
7+
8+
# Initialization
9+
if 'BEInputName' not in self.keys():
10+
self['BEInputName'] = 'Integer'
11+
if 'BEInteger' not in self.keys():
12+
self['BEInteger'] = 0
13+
if 'BEIntegerDefault' not in self.keys():
14+
self['BEIntegerDefault'] = 0
15+
if 'BEIntegerMin' not in self.keys():
16+
self['BEIntegerMin'] = -2147483647
17+
if 'BEIntegerMax' not in self.keys():
18+
self['BEIntegerMax'] = 2147483647
19+
20+
# Outputs
21+
int_out = [[self['BEInteger']]]
22+
23+
# UI
24+
def ui(self, context, layout):
25+
layout.prop(self, '["BEInputName"]', text="Name")
26+
layout.separator()
27+
layout.prop(self, '["BEInteger"]', text="Integer")
28+
layout.separator()
29+
layout.prop(self, '["BEIntegerDefault"]', text="Default")
30+
layout.prop(self, '["BEIntegerMin"]', text="Min")
31+
layout.prop(self, '["BEIntegerMax"]', text="Max")
32+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
out obj_out o
3+
"""
4+
5+
# Initialization
6+
if 'BEInputName' not in self.keys():
7+
self['BEInputName'] = 'Object'
8+
if 'BEObject' not in self.keys():
9+
self['BEObject'] = ''
10+
11+
# Outputs
12+
13+
if self['BEObject'] in bpy.data.objects.keys():
14+
obj_out = [bpy.data.objects[self['BEObject']]]
15+
else:
16+
obj_out = []
17+
18+
# UI
19+
def ui(self, context, layout):
20+
layout.prop(self, '["BEInputName"]', text="Name")
21+
layout.separator()
22+
layout.prop_search(self, '["BEObject"]', bpy.data, "objects", text="Object")
23+
# layout.prop(self, '["BEObject"]', text="Object")
24+
25+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
in Objects o
3+
"""
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""
2+
out str_out T
3+
"""
4+
5+
# Initialization
6+
if 'BEInputName' not in self.keys():
7+
self['BEInputName'] = 'String'
8+
if 'BEString' not in self.keys():
9+
self['BEString'] = ''
10+
if 'BEStringDefault' not in self.keys():
11+
self['BEStringDefault'] = ''
12+
13+
# Outputs
14+
str_out = [[self['BEString']]]
15+
16+
# UI
17+
def ui(self, context, layout):
18+
layout.prop(self, '["BEInputName"]', text="Name")
19+
layout.separator()
20+
layout.prop(self, '["BEString"]', text="String")
21+
layout.separator()
22+
layout.prop(self, '["BEStringDefault"]', text="Default")
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"""
2+
out vec_out v
3+
"""
4+
5+
import sys
6+
7+
8+
# Initialization
9+
if 'BEInputName' not in self.keys():
10+
self['BEInputName'] = 'Vector'
11+
if 'BEVector' not in self.keys():
12+
self['BEVector'] = (0.0, 0.0, 0.0)
13+
if 'BEVectorDefault' not in self.keys():
14+
self['BEVectorDefault'] = (0.0, 0.0, 0.0)
15+
if 'BEVectorMin' not in self.keys():
16+
self['BEVectorMin'] = -sys.float_info.max
17+
if 'BEVectorMax' not in self.keys():
18+
self['BEVectorMax'] = sys.float_info.max
19+
20+
# Outputs
21+
vec_out = [[tuple(self['BEVector'])]]
22+
23+
# UI
24+
def ui(self, context, layout):
25+
layout.prop(self, '["BEInputName"]', text="Name")
26+
layout.separator()
27+
layout.prop(self, '["BEVector"]', text="Vector")
28+
layout.separator()
29+
layout.prop(self, '["BEVectorDefault"]', text="Default")
30+
layout.prop(self, '["BEVectorMin"]', text="Min")
31+
layout.prop(self, '["BEVectorMax"]', text="Max")

0 commit comments

Comments
 (0)