UI: remove node tree panels
This duplicates items in the add menu and uses a lot of vertical space. This should be used for tools or disabled.
This commit is contained in:
parent
b8d21f9b9b
commit
48c137ad5d
|
@ -105,7 +105,7 @@ def register_node_categories(identifier, cat_list):
|
|||
raise KeyError("Node categories list '%s' already registered" % identifier)
|
||||
return
|
||||
|
||||
# works as draw function for both menus and panels
|
||||
# works as draw function for menus
|
||||
def draw_node_item(self, context):
|
||||
layout = self.layout
|
||||
col = layout.column()
|
||||
|
@ -113,7 +113,6 @@ def register_node_categories(identifier, cat_list):
|
|||
item.draw(item, col, context)
|
||||
|
||||
menu_types = []
|
||||
panel_types = []
|
||||
for cat in cat_list:
|
||||
menu_type = type("NODE_MT_category_" + cat.identifier, (bpy.types.Menu,), {
|
||||
"bl_space_type": 'NODE_EDITOR',
|
||||
|
@ -122,21 +121,10 @@ def register_node_categories(identifier, cat_list):
|
|||
"poll": cat.poll,
|
||||
"draw": draw_node_item,
|
||||
})
|
||||
panel_type = type("NODE_PT_category_" + cat.identifier, (bpy.types.Panel,), {
|
||||
"bl_space_type": 'NODE_EDITOR',
|
||||
"bl_region_type": 'TOOLS',
|
||||
"bl_label": cat.name,
|
||||
"bl_category": cat.name,
|
||||
"category": cat,
|
||||
"poll": cat.poll,
|
||||
"draw": draw_node_item,
|
||||
})
|
||||
|
||||
menu_types.append(menu_type)
|
||||
panel_types.append(panel_type)
|
||||
|
||||
bpy.utils.register_class(menu_type)
|
||||
bpy.utils.register_class(panel_type)
|
||||
|
||||
def draw_add_menu(self, context):
|
||||
layout = self.layout
|
||||
|
@ -145,8 +133,8 @@ def register_node_categories(identifier, cat_list):
|
|||
if cat.poll(context):
|
||||
layout.menu("NODE_MT_category_%s" % cat.identifier)
|
||||
|
||||
# stores: (categories list, menu draw function, submenu types, panel types)
|
||||
_node_categories[identifier] = (cat_list, draw_add_menu, menu_types, panel_types)
|
||||
# stores: (categories list, menu draw function, submenu types)
|
||||
_node_categories[identifier] = (cat_list, draw_add_menu, menu_types)
|
||||
|
||||
|
||||
def node_categories_iter(context):
|
||||
|
@ -165,8 +153,6 @@ def node_items_iter(context):
|
|||
def unregister_node_cat_types(cats):
|
||||
for mt in cats[2]:
|
||||
bpy.utils.unregister_class(mt)
|
||||
for pt in cats[3]:
|
||||
bpy.utils.unregister_class(pt)
|
||||
|
||||
|
||||
def unregister_node_categories(identifier=None):
|
||||
|
|
Loading…
Reference in New Issue