1
1
import bpy
2
- import bl_ui
3
2
import itertools
4
3
import enum
5
4
import re
5
+ import os
6
6
from .state import State
7
7
from .types import *
8
8
from .static .input_group import InputGroup
@@ -105,35 +105,13 @@ class NodeNamespace: pass
105
105
enum_type = enum .Enum (enum_type_name , { map_case_name (i ): i .identifier for i in prop .enum_items })
106
106
setattr (globals ()[node_namespace_name ], enum_type_name , enum_type )
107
107
registered_nodes .add (node_type )
108
- for category_name in list (filter (lambda x : x .startswith ('NODE_MT_category_GEO_' ), dir (bpy .types ))):
109
- category = getattr (bpy .types , category_name )
110
- if not hasattr (category , 'category' ):
111
- category_path = category .bl_label .lower ().replace (' ' , '_' )
112
- add_node_type = bl_ui .node_add_menu .add_node_type
113
- draw_node_group_add_menu = bl_ui .node_add_menu .draw_node_group_add_menu
114
- draw_assets_for_catalog = bl_ui .node_add_menu .draw_assets_for_catalog
115
- bl_ui .node_add_menu .add_node_type = lambda _layout , node_type_name : register_node (getattr (bpy .types , node_type_name ), category_path )
116
- bl_ui .node_add_menu .draw_node_group_add_menu = lambda _context , _layout : None
117
- bl_ui .node_add_menu .draw_assets_for_catalog = lambda _context , _layout : None
118
- class CategoryStub :
119
- bl_label = ""
120
- def __init__ (self ):
121
- self .layout = Layout ()
122
- class Layout :
123
- def separator (self ): pass
124
- category .draw (CategoryStub (), None )
125
- bl_ui .node_add_menu .add_node_type = add_node_type
126
- bl_ui .node_add_menu .draw_node_group_add_menu = draw_node_group_add_menu
127
- bl_ui .node_add_menu .draw_assets_for_catalog = draw_assets_for_catalog
128
- else :
129
- category_path = category .category .name .lower ().replace (' ' , '_' )
130
- for node in category .category .items (None ):
131
- node_type = getattr (bpy .types , node .nodetype )
132
- register_node (node_type , category_path )
133
- for node_type_name in list (filter (lambda x : 'GeometryNode' in x , dir (bpy .types ))):
108
+
109
+ denylist = {'filter' } # some nodes should be excluded.
110
+ for node_type_name in dir (bpy .types ):
134
111
node_type = getattr (bpy .types , node_type_name )
135
- if issubclass (node_type , bpy .types .GeometryNode ):
136
- register_node (node_type )
112
+ if isinstance (node_type , type ) and issubclass (node_type , bpy .types .Node ):
113
+ if node_type .is_registered_node_type () and node_type .bl_rna .name .lower () not in denylist :
114
+ register_node (node_type )
137
115
138
116
def create_documentation ():
139
117
temp_node_group = bpy .data .node_groups .new ('temp_node_group' , 'GeometryNodeTree' )
@@ -155,6 +133,7 @@ def create_documentation():
155
133
docstrings = []
156
134
symbols = []
157
135
enums = {}
136
+ skipped_nodes = []
158
137
for func in sorted (documentation .keys ()):
159
138
try :
160
139
method = documentation [func ]
@@ -261,12 +240,8 @@ def primary_arg_docs():
261
240
{ output_symbol_separator .join (output_symbols )} """ )
262
241
return_type_hint = list (symbol_outputs .values ())[0 ] if len (output_symbols ) == 1 else f"{ node_namespace_name } .Result"
263
242
symbols .append (f"""def { func } ({ ', ' .join (symbol_args )} ) -> { return_type_hint } : \" \" \" \" \" \" """ )
264
- except Exception as e :
265
- import os , sys
266
- print (e )
267
- exc_type , exc_obj , exc_tb = sys .exc_info ()
268
- fname = os .path .split (exc_tb .tb_frame .f_code .co_filename )[1 ]
269
- print (exc_type , fname , exc_tb .tb_lineno )
243
+ except :
244
+ skipped_nodes .append (documentation [func ].bl_node_type .__name__ )
270
245
continue
271
246
bpy .data .node_groups .remove (temp_node_group )
272
247
html = f"""
@@ -362,6 +337,9 @@ def transfer(self, attribute: Type, **kwargs) -> Type: return Type()
362
337
fpyi .write (contents )
363
338
fpy .write (contents )
364
339
340
+ if len (skipped_nodes ) > 0 :
341
+ pass # This could be reported later.
342
+
365
343
def create_docs ():
366
344
create_documentation ()
367
345
bpy .app .timers .register (create_docs )
0 commit comments