Historical · current compatibility unverified Original context: PME version not stated; Blender version not stated; 2021.
Outcome
Hold a modifier key to use a Sculpt mask brush, perform the stroke, and return to the brush that was selected before the key press.
Historical construction
The working forum example combined a PME Sticky Key with a matching Sculpt keymap:
-
Create a Sticky Key for the chosen modifier.
-
On press, select the Mask brush from PME’s menu tools.
-
Enable Save and Restore Previous Value for the brush selection.
-
Add the interactive brush stroke after the brush swap:
value = paint_settings(C).brush paint_settings(C).brush = D.brushes["Mask"] bpy.ops.sculpt.brush_stroke("INVOKE_DEFAULT") -
Add a Sculpt keymap that permits drawing while that modifier is held, such as Alt with the normal stroke button.
The requester confirmed that the combined Sticky Key and stroke invocation worked.
Variants and ownership
The answer used additional modifier combinations for add, subtract, or smooth behavior. Brush settings such as mask tool and strength could be assigned before invoking the stroke.
Those extra settings were not restored by merely restoring the previous brush selection. They changed the Mask brush data itself and therefore persisted into later uses. A more complete adaptation must save and restore every property it changes. Modifier-based strokes may also require a Blender keymap entry in addition to the PME Sticky Key.