Repository navigation
Expand file tree
/
Copy pathBEGNInputs.py
More file actions
69 lines (53 loc) · 1.81 KB
/
Copy pathBEGNInputs.py
File metadata and controls
69 lines (53 loc) · 1.81 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import bpy
def GetNodeTreeInputs(node_tree):
# Blen 3
if bpy.app.version[0] == 3:
return node_tree.inputs.items()
# Blen 4
else:
inputs = []
for item in node_tree.interface.items_tree:
if item.item_type == 'SOCKET':
if item.in_out == 'INPUT':
inputs.append(item)
return inputs
def GetInputIdentifier(input):
# Blen 3
if bpy.app.version[0] == 3:
return input[1].identifier
# Blen 4
return input.identifier
def GetInputType(input):
# Blen 3
if bpy.app.version[0] == 3:
return input[1].type
# Blen 4
else:
input_class = str(type(input))
if "NodeTreeInterfaceSocketFloat" in str(type(input)):
return "VALUE"
elif isinstance(input, bpy.types.NodeTreeInterfaceSocketBool):
return "BOOLEAN"
elif isinstance(input, bpy.types.NodeTreeInterfaceSocketObject):
return "OBJECT"
elif isinstance(input, bpy.types.NodeTreeInterfaceSocketCollection):
return "COLLECTION"
elif isinstance(input, bpy.types.NodeTreeInterfaceSocketColor):
return "RGBA"
elif isinstance(input, bpy.types.NodeTreeInterfaceSocketImage):
return "IMAGE"
elif "NodeTreeInterfaceSocketInt" in str(type(input)):
return "INT"
elif isinstance(input, bpy.types.NodeTreeInterfaceSocketMaterial):
return "MATERIAL"
elif isinstance(input, bpy.types.NodeTreeInterfaceSocketString):
return "STRING"
elif "NodeTreeInterfaceSocketVector" in str(type(input)):
return "VECTOR"
return "UNSUPPORTED_TYPE"
def GetInputName(input):
# Blen 3
if bpy.app.version[0] == 3:
return input[1].name
# Blen 4
return input.name