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 Tönne <lukas.toenne@gmail.com>2015-07-17 12:45:02 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-07-17 12:59:24 +0300
commit9bcf1bb266e09f92a50033d1c9c4c42bd69290e3 (patch)
tree0cf38af380c6f59c34d44848f1ae4c2d2f787b34 /release
parent4052384be30444aa732532ebe698218d876b6723 (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')
-rw-r--r--release/scripts/modules/nodeitems_utils.py8
-rw-r--r--release/scripts/startup/bl_ui/space_node.py4
2 files changed, 7 insertions, 5 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)
diff --git a/release/scripts/startup/bl_ui/space_node.py b/release/scripts/startup/bl_ui/space_node.py
index d0d1376fe05..4fc93fafc4d 100644
--- a/release/scripts/startup/bl_ui/space_node.py
+++ b/release/scripts/startup/bl_ui/space_node.py
@@ -18,6 +18,7 @@
# <pep8 compliant>
import bpy
+import nodeitems_utils
from bpy.types import Header, Menu, Panel
from bpy.app.translations import pgettext_iface as iface_
from bl_ui.properties_grease_pencil_common import (
@@ -154,7 +155,8 @@ class NODE_MT_add(bpy.types.Menu):
props = layout.operator("node.add_search", text="Search ...")
props.use_transform = True
- # actual node submenus are added by draw functions from node categories
+ # actual node submenus are defined by draw functions from node categories
+ nodeitems_utils.draw_node_categories_menu(self, context)
class NODE_MT_view(Menu):