Upgrade for the add_search node operator. This now uses the same basic system as the regular add_node operator, with enum items generated from the common node categories system (nodeitems_utils module). This means that any node listed in the regular node Add menu can now also be added via searching, including node groups and the like. The search operator also uses the subsequent transform to make insertion a bit more streamlined.

This commit is contained in:
Lukas Toenne
2013-05-09 11:43:48 +00:00
parent 2e0f741d01
commit 56485b6562
3 changed files with 55 additions and 66 deletions

View File

@@ -114,6 +114,19 @@ def register_node_categories(identifier, cat_list):
_node_categories[identifier] = (cat_list, draw_add_menu, menu_types, panel_types)
def node_categories_iter(context):
for cat_type in _node_categories.values():
for cat in cat_type[0]:
if cat.poll and cat.poll(context):
yield cat
def node_items_iter(context):
for cat in node_categories_iter(context):
for item in cat.items(context):
yield item
def unregister_node_cat_types(cats):
bpy.types.NODE_MT_add.remove(cats[1])
for mt in cats[2]: