Post #3808: Think I found a workaround.

📋 Metadata

🏷️ Tags

sticky-key hotkeys scripting advanced solved

  • Sticky Key Editor
  • Python Scripting
  • Custom brush workflows

💬 Content

Think I found a workaround.

I was trying to get different types of mask with the same keymap using shift,alt,ctrl (add/substract/smooth) and it seems adding the draw operator at the end does the trick

so:

Create Sticky Key

On press, add the mask brush from the menu

Save and Restore Previous Value

You should get this

image

After adding the draw operator:

value = paint_settings(C).brush; paint_settings(C).brush = D.brushes["Mask"]; bpy.ops.sculpt.brush_stroke('INVOKE_DEFAULT')

Now you can call the mask brush with alt and left mouse

image


Extra Options

If you want to customize different brush settings you can add them before the operator by taking them from the info panel in scripting

image

For example I want to smooth the mask at .5 strength

I will have to add
bpy.data.brushes[“Mask”].mask_tool = ‘SMOOTH’
bpy.data.brushes[“Mask”].strength = 0.5

and would look like this

value = paint_settings(C).brush; paint_settings(C).brush = D.brushes["Mask"]; bpy.data.brushes["Mask"].mask_tool = 'SMOOTH'; bpy.data.brushes["Mask"].strength = 0.5; bpy.ops.sculpt.brush_stroke('INVOKE_DEFAULT')

The only “but” from adding those it that it leaves the brush with those settings so every time I use the shortcut its going to change the brush to smooth and 0.5 strength


❤️ 1 likes


🔗 View on Blender Artists