Nodes: Use plain menus for geometry nodes add menu
At the cost of slightly more boilerplate code, we can avoid the `NodeItem`
and `NodeCategory` abstractions used to build the node add menu.
This makes the menus more flexible and more obvious, which will
make them easier to extend with assets.
The identifiers for the new menu types are inconsistent with regular
class naming for backwards compatibility with the old "category"
menu naming.
Also adds an item for the "Self Object" node missed in dd5131bd70.
Differential Revision: https://developer.blender.org/D15973
This commit is contained in:
@@ -219,10 +219,14 @@ class NODE_MT_add(bpy.types.Menu):
|
||||
import nodeitems_utils
|
||||
|
||||
layout = self.layout
|
||||
|
||||
layout.operator_context = 'INVOKE_DEFAULT'
|
||||
|
||||
if nodeitems_utils.has_node_categories(context):
|
||||
snode = context.space_data
|
||||
if snode.tree_type == 'GeometryNodeTree':
|
||||
props = layout.operator("node.add_search", text="Search...", icon='VIEWZOOM')
|
||||
layout.separator()
|
||||
layout.menu_contents("NODE_MT_geometry_node_add_all")
|
||||
elif nodeitems_utils.has_node_categories(context):
|
||||
props = layout.operator("node.add_search", text="Search...", icon='VIEWZOOM')
|
||||
props.use_transform = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user