Commit Graph

141 Commits

Author SHA1 Message Date
Campbell Barton
28fca2c588 Docs: update the tool key-map docs, reference them from the toolbar 2020-02-28 09:18:07 +11:00
Philipp Oeser
d95e9c7cf8 Fix T63892: Tools cannot be registered into some contexts (e.g.
PAINT_TEXTURE)

This fails because some tool contexts define their tools with functions
[see the following list for context that fail]:

- PARTICLE (_defs_particle.generate_from_brushes)
- SCULPT (_defs_sculpt.generate_from_brushes)
- PAINT_TEXTURE (_defs_texture_paint.generate_from_brushes)
- PAINT_VERTEX (_defs_vertex_paint.generate_from_brushes)
- PAINT_WEIGHT (_defs_weight_paint.generate_from_brushes)
- PAINT_GPENCIL (_defs_gpencil_paint.generate_from_brushes)
- SCULPT_GPENCIL (_defs_gpencil_sculpt.generate_from_brushes)
- WEIGHT_GPENCIL (_defs_gpencil_weight.generate_from_brushes)

ToolSelectPanelHelper._tools_flatten() is usually called with
cls.tools_from_context(context) [that already yields from the function].
But when registering a tool, _tools_flatten() will still give back this
function, not a ToolDef - and we cannot get a bl_idname from that.
Now check for this and yield None in that case.

Also share logic across all tool_flatten functions:
- _tools_flatten
- _tools_flatten_with_tool_index
- _tools_flatten_with_keymap

Maniphest Tasks: T63892

Differential Revision: https://developer.blender.org/D6763
2020-02-20 13:28:53 +01:00
Richard Antalik
6a49161c8c VSE: Tool system integration
Add toolbar to sequencer regions.

A bit of refactoring has to be done in RNA space.
Currently there is only cut tool implemented to serve as template for
anybody who would like to add more.
2020-01-22 15:06:18 +01:00
Campbell Barton
b423b89127 Tool System: enable fallback tool by default
This defaults to selection when not using a gizmo.
The previous behavior to drag anywhere can be set in the tool settings
or by selecting the fallback tool (Alt-W).

See: T66304
2020-01-03 14:04:11 +11:00
Campbell Barton
a8ce9a143a Tool System: store the fallback tool for re-use
The fallback tool was run-time only data,
now it's stored in the blend file.
2020-01-03 12:34:55 +11:00
Campbell Barton
85f8690555 Cleanup: remove redundant dynamic tool expansion
The tools passed to _tools_flatten, _tools_flatten_with_tool_index
already have dynamic tool items expanded, so there is no need to check
for callable tool items.
2019-12-16 15:40:20 +11:00
Campbell Barton
165afb3ad0 Cleanup: pep8, unused vars, line length 2019-12-16 14:54:32 +11:00
Campbell Barton
80062e6305 Cleanup: use static sets 2019-12-16 13:43:45 +11:00
William Reynish
fb74dcc5d6 UI: Brush Settings overhaul
This makes a number of changes to the tool settings brush UI:

  - All brush-related controls are now grouped together, so you can see which items are brush settings are which are not. Previously it was all jumbled together.
  - The brush picker is in a separate panel, so that you can switch brushes without worrying about the settings, or vice versa.
  - Custom Icon settings moved from the Display settings(now known as Cursor) to the Brushes panel.
  - UnifiedPaintSettings panels are removed and the contained options are now next to their relevant setting with a globe icon toggle. This is not displayed in the header.
  - 2D Falloff and Absolute Jitter toggles were changed into enums, to make it clearer what happens when they are on or off.
  - Adjust Strength for Spacing option was in the Options panel in some modes, but in the Stroke panel in others. It is now always under Stroke.
  - Display (now Cursor) panel was reorganized, settings renamed.
  - 2-option enums are annoying as a drop-down menu, so they are now drawn with expand=True.
  - Smooth Stroke and Stabilizer options in grease pencil and other paint modes are now both called "Stabilize Stroke", for consistency and clarity.
  - De-duplicated some drawing code between various painting modes' brush options. I tried to keep de-duplication reasonable and easy to follow.
  - A few more tweaks - see D5928 for the extensive list.

Most of the patch is written by Demeter Dzadik, with some additions by myself

Differential Revision: https://developer.blender.org/D5928
Reviewers: Pablo Dobarro, Bastien Montagne, Matias Mendiola
2019-12-14 18:48:18 +01:00
Campbell Barton
059f7413c4 Cleanup: redundant NULL checks, simplify tool fallback arg checks 2019-12-12 21:09:22 +11:00
Campbell Barton
8aadba6ef0 UI: increase size of fallback tool popover 2019-12-12 13:32:15 +11:00
Campbell Barton
7f36db35ce UI: show tool cycling shortcuts in the toolbar 2019-12-11 18:09:39 +11:00
Campbell Barton
1a8642937d Fix T72272: Error setting tool in weight paint mode
Error from recent fallback tool support.
2019-12-10 08:15:43 +11:00
Campbell Barton
6a78ace569 Cleanup: remove unused arguments 2019-12-07 16:37:02 +11:00
Campbell Barton
6ffcddc10a Tool System: experimental fallback tool support
Implement T66304 as an experimental option,
available under the preferences "Experimental" section.

- When enabled most tools in the 3D view have a gizmo.
- Dragging outside the gizmo uses the 'fallback' tool.
- The fallback tool can be changed or disabled in the tool options
  or from a pie menu (Alt-W).
2019-12-07 06:03:00 +11:00
Campbell Barton
cff00f6b04 Cleanup: pep8, remove redundant parenthesis 2019-10-30 05:50:17 +11:00
Bastien Montagne
630747ca66 Fix T66731: Translated texts remain original english (Tools' tips part).
This should fix all remaining issues reported in T66731 I think.
2019-08-02 16:20:06 +02:00
Brecht Van Lommel
604fdb6e85 Spelling fixes in comments and descriptions, patch by luzpaz
Differential Revision: https://developer.blender.org/D3744
2019-07-31 14:27:35 +02:00
Campbell Barton
07f3ad06fc Fix T63775: Toolbar icons ignore BLENDER_SYSTEM_DATAFILES
The environment variable to locate system data-files was
ignored by toolbar icons.

Add bpy.utils.system_resource
to match Blender's internal data-file access.
2019-07-23 16:30:26 +10:00
Campbell Barton
4fcc3b8ba2 WM: add operator to set the tool by it's index
Needed for 2.7x brush switching keys.
2019-06-25 01:08:13 +10:00
Campbell Barton
3325b19ee7 Fix T64788: Double keymap entry in preferences
A display issue for tools which share keymaps.
2019-06-06 19:06:18 +10:00
Campbell Barton
d58631afc8 Fix error showing active tool side-bar in the image editor 2019-05-20 10:50:54 +10:00
Campbell Barton
d09289ff7a Cleanup: de-duplicate active tool panel 2019-05-15 12:20:13 +10:00
Campbell Barton
17a4decfea UI: top-bar reorganization
This hides the top-bar by default for everything
besides paint/sculpt workspaces.

- Use the top-bar mainly for active tool settings &
  popovers panel options.
  (transform / snap settings are an exception for this convention).
- Only show the top-bar (by default)
  in paint work-spaces (sculpt / texture-paint / grease-pencil).
- Add an active-tool panel to the sidebar.
- Split 3D view tabs into (Item / Tool / View).

D4721 with minor changes.

Further work is needed for the top-bar and image-editor.
2019-04-29 23:35:13 +10:00
Campbell Barton
d7672ad0f7 Fix tool settings showing in the top-bar
Each spaces top-bar wasn't showing it's own active tool,
Remove RNA access to the workspaces tool since using it is error prone.
Eventually this should be completely removed.
2019-04-24 16:11:16 +10:00
Brecht Van Lommel
21f35661c1 Fix cramped display of tool setting enums in workspace tab. 2019-03-29 17:56:42 +01:00
Brecht Van Lommel
fb4bb61155 Fix T62608: many tools in the toolbar not working.
The keymap names still use the label, so use that again for looking up the
keymap so things work again after recent changes.
2019-03-15 19:31:43 +01:00
Campbell Barton
3400fe3ece Tool System: split UI label from tool identifiers
Prepare for exposing tool registration to the Python API.

- Generated tools can use their own prefix so naming collisions
  won't happen between hard coded & generated tools.
- Add-on authors can use the add-on name as a prefix.

Currently the names match, renaming will happen next.
2019-03-15 14:53:08 +11:00
Campbell Barton
05fbb0d50e Fix separators use within tool groups 2019-03-14 17:27:55 +11:00
Campbell Barton
0bd45a2d51 Cleanup: unused imports 2019-03-14 15:34:14 +11:00
Campbell Barton
7894d6c6f1 Cleanup: line length 2019-01-30 09:06:44 +11:00
Campbell Barton
63fcbfc3a7 RNA: naming, user-preferences -> preferences 2018-12-21 12:55:02 +11:00
Campbell Barton
e71d489254 Cleanup: style 2018-12-20 13:11:04 +11:00
Campbell Barton
8ec7429a70 Merge branch 'master' into blender2.8 2018-12-17 17:32:42 +11:00
Campbell Barton
1a8d998868 Tool System: support for dynamic tooltips
Tools can define a function that generates the tooltip using a function,
this takes the tools keymap as an argument which can be used
to extract keys to include in the tip.
2018-11-28 23:53:27 +11:00
Campbell Barton
1944bca49a Tool System: use tools for node editor 2018-11-27 18:43:08 +11:00
Campbell Barton
3b7daa5bf4 Tool System: Updates for keymap stored as string 2018-11-22 11:13:53 +11:00
Campbell Barton
f44a8bd257 Tool System: store keymap name in tool instead of the keymap
Resetting keymaps caused them to become invalid (crashing on access).
2018-11-22 10:25:24 +11:00
Campbell Barton
057ba2eb68 Fix error generating toolbar tooltip
C code needed to be updated for module move.
2018-11-20 21:35:24 +11:00
Campbell Barton
bb5a96e76e Cleanup: move toolbar keymap generation to bl_keymap_utils
The function is getting complicated, any refactoring
would be best done outside of 'space_toolsystem_common'.
2018-11-20 11:17:36 +11:00
Campbell Barton
f8c16b0175 Cleanup: move bpy_extras.keyconfig_utils to own module
bpy_extras were meant to be useful high-level helper functions for
script authors to perform common operations,
to avoid writing to verbose API's.

bpy_extras.keymap_utils contains some specialized API calls
mainly intended for Blender's own internal use.

Move keymap import export to internal API.
2018-11-20 11:06:01 +11:00
Campbell Barton
b33afe4df3 Tool System: improve popup w/ modifier keys
When the toolbar is accessed with modifiers (eg shift-space):

- Check if we can use the key without any modifiers to set the cursor.
- Pie-menu stile release event no longer checks for modifiers.
2018-11-19 14:39:25 +11:00
Campbell Barton
3d92afca7e Fix tool-system popup and tips w/ empty keymap
That this looks like an issue loading keymaps correctly,
needs to be investigated.
2018-11-19 11:58:09 +11:00
Campbell Barton
3b48620098 Cleanup: naming 2018-11-19 07:04:24 +11:00
Brecht Van Lommel
bf7af31e9f Keymaps: left click select keymap changes
Both the active tools and selection are now on LMB, which leads to
various conflicts.

For that reason the LMB keymap now has a couple of differences
compared to before. These changes do not affect the RMB keymap.

* Context Menu: W -> RMB
* Select Tool activate: None -> W
* Set Cursor: RMB -> Shift+RMB
* Loop Select: Alt+LMB -> double click LMB
* Mask Feather Vertex Slide: Shift+RMB -> Ctrl+Shift+RMB
* Node Select: only with LMB now, no RMB

The idea behind the W key Select Tool shortcut is that various
tools can't be combined with selection, unlike the RMB keymap.
So this works as a quick shortcut to drop a tool
and go back to selection.

Tools: set Select Box tool as default, rather than Cursor.

This goes along with coming LMB select keymap changes,
where we want the user to be able to LMB click to select by default,
rather than set the cursor.
The cursor will still be directly setabble with shift+RMB.
2018-11-16 09:54:50 +11:00
Brecht Van Lommel
088be7eb2f Keymaps: replace select / action mouse system
For Blender builtin configurations the option to choose the select mouse remains
and is now also in the splash screen. It works by changing the keymap dynamically
in the script, rather than using special events.

The system of automatic switching of events was not flexible enough to deal with
side effects that require further keymap changes, so it is now under more manual
control in the script.

This breaks compatibility for some scripts and exported key configurations.
These can be fixed by replacing SELECTMOUSE, ACTIONMOUSE, EVT_TWEAK_S and
EVT_TWEAK_A with appropriate LEFTMOUSE, RIGHTMOUSE, EVT_TWEAK_L and
EVT_TWEAK_R events.

Other than that, there should be no functional changes.
2018-11-16 08:31:00 +11:00
Campbell Barton
7c03365861 WM: use spacebar press event (not double click)
Functionality) is nicer but this uses a hack to make it work,
keep the code under a variable in case we want to remove.
2018-11-15 17:12:33 +11:00
Campbell Barton
8734a09379 Tool System: use preset keymap loading logic
The data structures for tool keymaps and presets were different,
use the same structure and expose function publicly.
2018-11-15 13:38:27 +11:00
Campbell Barton
cf6a101d23 Correct assert generating tool tip/keymap 2018-11-14 17:40:12 +11:00
Brecht Van Lommel
520f71b43a Fix tool keymaps not working properly after recent changes.
Not sure this is the best fix, but this should be working. Regardless it seems
good to tag active tool keymaps as such.
2018-11-13 21:02:40 +01:00