diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-08 20:44:16 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2012-08-08 20:44:16 +0400 |
commit | bd3ec606517f0ca02d503a1856963b0a2ddc32e1 (patch) | |
tree | 4251dbafb08ca1c88dd1cd5613fa2f623d251dc3 /source/blender/editors/space_node/node_header.c | |
parent | a1693168f24c818e3902bd95352aa0c5fb3b7d1c (diff) |
Search option for adding nodes.
The 'Add' menu in the node editor now has an option 'Search' at the top, which opens a separate popup for searching node types by name.
The operator for this is implemented completely in Python (this could also be done for the regular menu-based Add options in the future). There are a few necessary extensions to the RNA as well:
* The View2D struct in regions is now exposed. Currently only contains converter functions for coordinates from the region to the view (i.e. scrolled and zoomed view space). Used for converting mouse location to node space.
* The SpaceNode exposes the existing 'cursor_location' for operators to store mouse position beyond invoke calls. Not used for anything else (transforms) so far.
* The edit_tree in SpaceNode is also exposed, this is needed for operators to work correctly inside node groups.
Diffstat (limited to 'source/blender/editors/space_node/node_header.c')
-rw-r--r-- | source/blender/editors/space_node/node_header.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 27ee6006327..b6bf8d77732 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -235,6 +235,9 @@ static void node_menu_add(const bContext *C, Menu *menu) if (!snode->nodetree) uiLayoutSetActive(layout, FALSE); + uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); + uiItemO(layout, "Search ...", 0, "NODE_OT_add_search"); + if (ntreetype && ntreetype->foreach_nodeclass) ntreetype->foreach_nodeclass(scene, layout, node_menu_add_foreach_cb); } |