diff options
author | Julian Eisel <julian@blender.org> | 2020-12-11 23:54:10 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-12 01:08:29 +0300 |
commit | af008f553293d91ef624ab4950e6d5dcc91650fe (patch) | |
tree | 75bb105b579be7a6e9286972a337e87a7afb8724 /source/blender/editors/interface/interface_context_menu.c | |
parent | ba83ad226d8c3b3d1a87ebbb13aacf5cfc27edfc (diff) |
UI: Allow Outliners to pass selected data-blocks to operators via context
The way the Outliner integrates operations on selected tree elements is known
to be quite problematic amongst developers. The context menu is generated in an
unusual way and doesn't use the normal operator system. Instead, changes are
applied via a recursive callback system. Things are quite ad-hoc, and the
callbacks often implement logic that should not be in the Outliner, but in
entirely different modules. Often these modules already contain the logic, but
as proper operators.
This commit is a step into a hopefully better direction that should allow us to
put actual operators into Outliner context menus. It starts solving the problem
of: How can the Outliner pass selected data to operators. It implements it for
data-blocks only, but other data could do it in the same way.
Idea is to keep doing what operators were initially designed to do: Operate on
context.
Operators can now query a "selected_ids" context member
(`CTX_data_selected_ids()` in C, `bpy.context.selected_ids` in .py). If an
Outliner is active, it will generate a list of selected data-blocks as a
response, via its `SpaceType.context` callback.
Any other editor could do the same.
No user visible changes. This new design isn't actually used yet. It will be
soon for asset operators.
Reviewed as part of https://developer.blender.org/D9717.
Reviewed by: Brecht Van Lommel
Diffstat (limited to 'source/blender/editors/interface/interface_context_menu.c')
0 files changed, 0 insertions, 0 deletions