diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-07-17 12:45:02 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-07-17 12:59:24 +0300 |
commit | 9bcf1bb266e09f92a50033d1c9c4c42bd69290e3 (patch) | |
tree | 0cf38af380c6f59c34d44848f1ae4c2d2f787b34 /release/scripts/modules/nodeitems_utils.py | |
parent | 4052384be30444aa732532ebe698218d876b6723 (diff) |
Fix for nodeitems module using the NODE_MT_add menu types from bl_ui.
This is basically a bad-level call: ui scripts are registered *after*
the modules. It only works for addons because those are loaded even
later.
Now the nodeitems_utils module just defines a function which is then
called by the UI script, rather than the other way around.
Diffstat (limited to 'release/scripts/modules/nodeitems_utils.py')
-rw-r--r-- | release/scripts/modules/nodeitems_utils.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py index 2f69ea84386..1cc9afc78cc 100644 --- a/release/scripts/modules/nodeitems_utils.py +++ b/release/scripts/modules/nodeitems_utils.py @@ -85,7 +85,6 @@ class NodeItemCustom: _node_categories = {} - def register_node_categories(identifier, cat_list): if identifier in _node_categories: raise KeyError("Node categories list '%s' already registered" % identifier) @@ -131,8 +130,6 @@ def register_node_categories(identifier, cat_list): if cat.poll(context): layout.menu("NODE_MT_category_%s" % cat.identifier) - bpy.types.NODE_MT_add.append(draw_add_menu) - # stores: (categories list, menu draw function, submenu types, panel types) _node_categories[identifier] = (cat_list, draw_add_menu, menu_types, panel_types) @@ -151,7 +148,6 @@ def node_items_iter(context): def unregister_node_cat_types(cats): - bpy.types.NODE_MT_add.remove(cats[1]) for mt in cats[2]: bpy.utils.unregister_class(mt) for pt in cats[3]: @@ -170,3 +166,7 @@ def unregister_node_categories(identifier=None): for cat_types in _node_categories.values(): unregister_node_cat_types(cat_types) _node_categories.clear() + +def draw_node_categories_menu(self, context): + for cats in _node_categories.values(): + cats[1](self, context) |