-
Notifications
You must be signed in to change notification settings - Fork 5
/
__init__.py
56 lines (42 loc) · 1.44 KB
/
__init__.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
47
48
49
50
51
52
53
54
55
56
from .osl_py_addin import ShaderNodeOSLPY
import bpy
import nodeitems_utils
from nodeitems_utils import NodeCategory, NodeItem
import sys
import importlib
bl_info = {
"name": "OSLPY",
"author": (
"LazyDodo, "
),
"version": (0, 0, 2, 0),
"blender": (2, 80, 0),
"location": "Nodes > Add nodes",
"description": "OSL PY",
"warning": "",
"wiki_url": "",
"category": "Node"}
modulesNames = ['NodeGroupBuilder', 'Nodes','OpcodeBaseTypes','Opcodes','osl_py_addin','OSOInstruction','OSOReader','OSOVariable','StringBuilder']
modulesFullNames = {}
for currentModuleName in modulesNames:
modulesFullNames[currentModuleName] = ('{}'.format(currentModuleName))
for currentModuleFullName in modulesFullNames.values():
if currentModuleFullName in sys.modules:
importlib.reload(sys.modules[currentModuleFullName])
class ExtraNodesCategory(NodeCategory):
@classmethod
def poll(cls, context):
return (context.space_data.tree_type == 'ShaderNodeTree')
node_categories = [
ExtraNodesCategory("SH_OSL_PY", "OslPY", items=[
NodeItem("ShaderNodeOSLPY"),
]),
]
def register():
bpy.utils.register_class(ShaderNodeOSLPY)
nodeitems_utils.register_node_categories("SH_OSL_PY", node_categories)
def unregister():
nodeitems_utils.unregister_node_categories("SH_OSL_PY")
bpy.utils.unregister_class(ShaderNodeOSLPY)
if __name__ == "__main__":
register()