Commit Graph

115 Commits

Author SHA1 Message Date
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
Campbell Barton
48ad67f4a3 Tool System: support for 'dropping' tools
While there is no support for dropping tools exactly,
the cursor tool supports a keyboard oriented workflow
which is often over-ridden by other tools key-maps

While many tools had shortcuts there was no fast way to get back to
the cursor tool.

Now double-tapping space sets the cursor tool
(as long as this tool doesn't have a key mapped).
2018-11-12 13:18:08 +11:00
Campbell Barton
423668765a Missed last commit 2018-11-12 11:19:30 +11:00
Campbell Barton
c19dafd2a6 Paint: paint.brush_select now supports gpencil
Replace grease pencil specific brush select operator.
2018-11-07 11:42:30 +11:00
Campbell Barton
895295a9f0 Paint: update shortcut detection for new logic 2018-11-07 10:54:56 +11:00
Campbell Barton
80109c976c Brush: split out vertex paint tool & blend mode
- Vertex & weight paint now use the 'blend' setting.
- Weight paint now has it's own tool setting,
  since weight paint doesn't deal with color - we'll likely
  support different tools eventually.
2018-11-06 18:06:33 +11:00
Campbell Barton
642fe9e0f2 PyAPI: use keywords for ToolDef.from_fn.with_args
Enforces explicit names,
allows for keywords to be forwarded to the dictionary.
2018-11-05 11:58:23 +11:00
Campbell Barton
2f8a45e314 Tool System: support passing in args to ToolDef functions
Needed since class aren't yet defined
so we can't access their namespace.

This avoids intermediate draw functions.
2018-11-05 07:12:57 +11:00
Campbell Barton
7e3e26d00a Tool System: pie menu style activate-on-release
Support activate on release for the popup toolbar.
2018-10-27 12:25:05 +11:00
Campbell Barton
9a6d8f809d Tool System: support custom cursor drawing 2018-10-25 21:05:47 +11:00
Campbell Barton
23fdac8672 Cleanup: unused variables 2018-10-25 12:03:34 +11:00
Campbell Barton
bf34f95a9e UI: move 2d paint panels to topbar & toolsettings
Removed 'Tool' and 'Options' panels,
both these settings are quite obscure and
already available in the 'Brush' menu.
2018-10-25 11:15:48 +11:00
Campbell Barton
108475dc01 PyAPI: Support for custom tool registration
Added a module bpy.utils.toolsystem which only exposes ToolDef,
to avoid scripts referencing bl_ui internals.
2018-10-18 17:13:22 +11:00
Campbell Barton
1c3411ac89 Keymap: expose tool keymaps in the preferences
Currently some modes share tool keymaps, we might want to disable
this since it's confusing editing one thing in multiple places.

However this should be resolved in the tool definitions.
2018-10-03 15:55:57 +10:00
Campbell Barton
e8fa13b01e Fix leak in tool tooltip creation 2018-09-13 18:21:54 +10:00
Campbell Barton
b05f9e35cb Cleanup: unused variables 2018-09-11 18:15:55 +10:00
Campbell Barton
5f66924066 Fix exception w/ grease pencil brush tooltips 2018-09-06 18:28:33 +10:00
Campbell Barton
f428efc6db Correct toolbar tips for non sculpt modes 2018-09-04 08:13:54 +10:00
Campbell Barton
e152483a32 Tool System: add paint brush shortcut 2018-09-03 23:19:27 +10:00
Campbell Barton
0e09ee3350 Tool System: map keys bound directly to a tools
If a key is bound to activate a tool in the tool-system,
add this to the popup keymap.
2018-09-03 11:11:56 +10:00
Campbell Barton
4893b8c693 Fix toolbar popup outside the window region 2018-09-03 10:19:30 +10:00
Campbell Barton
b1ccb6ad25 Tool System: support tool description for tips
When the description isn't set, the operators is used instead.
2018-08-31 14:37:10 +10:00
Campbell Barton
add923f98a UI: add active tool panel to tool settings 2018-08-30 09:00:39 +10:00
Campbell Barton
e81c352746 Tool System: hide paint options for non brush tools 2018-08-29 23:58:44 +10:00
Campbell Barton
e1ec93ce75 UI: use keyword arguments
Prepare for keyword only args.
2018-08-28 13:41:47 +10:00
Campbell Barton
e9fb2feb2e UI: text keyword argument to label
Prepare for keyword only args
2018-08-28 12:34:51 +10:00
Campbell Barton
b35b10e1af Tool System: Popup toolbar keymap improvements
- Add support for key_modifiers, so grease pencil gets "D".

- Assign number keys for unmapped items

  This means all tools get keyboard access,
  use number/numpad to avoid confusion with other keymap items
  which directly activate the tool.
2018-08-23 16:18:09 +10:00