diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-06-05 13:21:17 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-06-05 13:21:17 +0400 |
commit | 32f35056af6909610c563dcca8f9b11b55acbe40 (patch) | |
tree | 056cc4fd4b4a37a007ddd9390dab38585a360419 /release/scripts/modules/nodeitems_utils.py | |
parent | aa96f0290a882b78289f2b8d2e2750d3f73675c0 (diff) |
Fix #35633, Cannot Add Group Node In Blender 2.67a. The menu entry for the "make group" operator was missing in the new categories system. Added an alternative NodeItemCustom to the standard NodeItem to
allow custom draw functions such as this operator. Used in the group items callback to generate the basic group_make operator call.
Diffstat (limited to 'release/scripts/modules/nodeitems_utils.py')
-rw-r--r-- | release/scripts/modules/nodeitems_utils.py | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/release/scripts/modules/nodeitems_utils.py b/release/scripts/modules/nodeitems_utils.py index cb574b72853..2114a64e416 100644 --- a/release/scripts/modules/nodeitems_utils.py +++ b/release/scripts/modules/nodeitems_utils.py @@ -57,6 +57,27 @@ class NodeItem(): # if no custom label is defined, fall back to the node type UI name return getattr(bpy.types, self.nodetype).bl_rna.name + # NB: is a staticmethod because called with an explicit self argument + # NodeItemCustom sets this as a variable attribute in __init__ + @staticmethod + def draw(self, layout, context): + default_context = bpy.app.translations.contexts.default + + props = layout.operator("node.add_node", text=self.label, text_ctxt=default_context) + props.type = self.nodetype + props.use_transform = True + + for setting in self.settings.items(): + ops = props.settings.add() + ops.name = setting[0] + ops.value = setting[1] + + +class NodeItemCustom(): + def __init__(self, poll=None, draw=None): + self.poll = poll + self.draw = draw + _node_categories = {} @@ -71,14 +92,7 @@ def register_node_categories(identifier, cat_list): col = layout.column() default_context = bpy.app.translations.contexts.default for item in self.category.items(context): - props = col.operator("node.add_node", text=item.label, text_ctxt=default_context) - props.type = item.nodetype - props.use_transform = True - - for setting in item.settings.items(): - ops = props.settings.add() - ops.name = setting[0] - ops.value = setting[1] + item.draw(item, col, context) menu_types = [] panel_types = [] |