Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Toenne <lukas.toenne@googlemail.com>2013-05-09 15:43:48 +0400
committerLukas Toenne <lukas.toenne@googlemail.com>2013-05-09 15:43:48 +0400
commit56485b6562ee349513e5de4ac450150f569a230d (patch)
tree61e8a666fda5c5e13ce301b731d3687d062ec87c /release/scripts/modules/nodeitems_utils.py
parent2e0f741d0190d60243d8ace131ffcd7f3b620f63 (diff)
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.
Diffstat (limited to 'release/scripts/modules/nodeitems_utils.py')
-rw-r--r--release/scripts/modules/nodeitems_utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py
index 3fbafc3ae9b..b58207d7c65 100644
--- a/release/scripts/modules/nodeitems_utils.py
+++ b/release/scripts/modules/nodeitems_utils.py
@@ -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]: