-
Notifications
You must be signed in to change notification settings - Fork 11
/
__init__.py
125 lines (105 loc) · 3.2 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# import bpy
# import time
# import os
from nodeitems_utils import (
NodeItem,
NodeCategory,
register_node_categories,
unregister_node_categories
)
from . Preferences import MindMapperPreferences
from . MindmapNodeBase import (
MindmapTree,
MindmapNodeSocket,
preview_collections
)
from . MindmapNode import MindmapNode
from . NoteNode import NoteNode
from . ChecklistNode import ChecklistNode
from . NumberlistNode import NumberlistNode
from . SoundNode import SoundNode
from . BigTextNode import BigTextNode
from . BigTextNode import DrawBigTextOperator
from . BigPicNode import BigPicNode
from . BigPicNode import DrawBigPicOperator
bl_info = {
"name": "MindMapper",
"author": "Spectral Vectors, tin2tin, Bazza, cannibalox",
"version": (1, 7, 0),
"blender": (2, 90, 0),
"location": "Custom Node Editor, and Shader, Geometry, Compositor Nodes",
"description": "A multi-line text and image flow chart node",
"warning": "",
"doc_url": "",
"category": "Node",
}
# our own base class with an appropriate poll function,
# so the categories only show up in our own tree type
class MyNodeCategory(NodeCategory):
@classmethod
def poll(cls, context):
ntrees = [
'MindmapNodeTree',
'ShaderNodeTree',
'GeometryNodeTree'
]
return [context.space_data.tree_type for ntree in ntrees]
class LayoutCategory(NodeCategory):
@classmethod
def poll(cls, context):
return context.space_data.tree_type == 'MindmapNodeTree'
# all categories in a list
node_categories = [
# identifier, label, items list
# This list will show up in all Node Editors
MyNodeCategory('EXTRA', "Extra", items=[
# our basic node
NodeItem("MindmapNodeType"),
NodeItem("NoteNodeType"),
NodeItem("ChecklistNodeType"),
NodeItem("NumberlistNodeType"),
NodeItem("SoundNodeType"),
NodeItem("BigTextNodeType"),
NodeItem("BigPicNodeType")
]),
# This is to add the Layout nodes to the Mindmapper Node Editor
LayoutCategory('LAYOUT', "Layout", items=[
NodeItem("NodeReroute"),
NodeItem("NodeFrame"),
]),
]
classes = (
MindmapTree,
MindmapNode,
MindMapperPreferences,
MindmapNodeSocket,
NoteNode,
ChecklistNode,
NumberlistNode,
SoundNode,
BigTextNode,
DrawBigTextOperator,
BigPicNode,
DrawBigPicOperator
)
def register():
from bpy.utils import previews
pcoll = previews.new()
pcoll.node_images_dir = ""
pcoll.node_images = ()
preview_collections["mindmap"] = pcoll
from bpy.utils import register_class
for cls in classes:
register_class(cls)
register_node_categories('Mindmap', node_categories)
def unregister():
from bpy.utils import previews
for pcoll in preview_collections.values():
previews.remove(pcoll)
preview_collections.clear()
unregister_node_categories('Mindmap')
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
if __name__ == "__main__":
register()