This patch adds support for:
- Per space-type tools (3D view and edit).
- Per mode tools (object, edit, weight-paint .. etc).
- Multiple active combinations of space-type & mode at once.
What Works
- Toolbar in image and 3d view.
- Switching modes changes tools.
- Topbar only shows last activated tool (this is a design issue, since topbar is global and tools are per space).
Not Yet Working
- Multiple windows multiple, different tools with manipulators *(currently unlinking manipulators isn't aware of other workspaces windows)*.
Plans
- Remove WM_OT_tool_set, using an operator here causes quite a few jumps between C and Python in the callstack. Some of this logic can be kept in Python's WM_OT_tool_set_by_name.
- Improve the image toolbar (currently it's a proof of concept to show whats possible).
- Refactor toolbar definitions, one file per space-type, share code in common location.
Notes
- Having per-space-type API calls: workspace.tools.from_space_view3d_mode / from_space_image_mode isn't nice. It's needed because the values of the mode argument depend on space_type.
- WM_toolsystem_update_from_context_view3d from mode switching operators are needed because we cant use message bus subscribers to run operators or set RNA values (needed for switching tools).