Splits285 / Gpencil_draw_switcher

Blender addon to allow making hotkeys which switch between brushes and/or materials. Useful for using holdouts as an eraser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Features

Blender_Render16-07-2024_06 49 40AM_1384x279x Once you've set a binding for gpencil.draw_switcher, you can hold it (or press once and release if you enable 'toggle') whenever you're using your standard gpencil.draw bind to switch to whatever brush/material you'd like.

You can also add a TriggerBrush to only trigger the switching if you're on that brush name. Otherwise, it will use the draw mode specified in the keymap, default: Eraser.

⚠ Notes (mostly blender faults)

  • If you let go of the switcher key without first lifting your pen, the release key will never be given to the addon and the switched-mode will stay until you hit the switcher button again. This is because blender suppresses the release notification to the addon while the drawing key is held down. There's nothing I can do to fix it on blenders' side, but if you really want to use this without this hitch, you can do what I did to fix it with an external mouse-message intercepting program called XBMC.

    If I had added another operator to wrap gpencil.draw and give me the keystroke messages, it would either always require a pen press to start drawing or never end because gpencil.draw() when cast from an addon never ends if "wait for input" is off. And there's no way to early-end it from Python either.

    This bug actually happens on the normal gpencil.draw too if you have it activated by button instead of by the eraser signal from your drawing tablet (which blender uses even without a keymap because it gets its own special API and I get nothing.)


  • Setting the keybind to an 'eraser key' like shown below probably won't work.

    Blender_Render12-07-2024_11 55 23PM_860x157x

    The addon listens for any key type and state, so if you can't set the eraser keybind with a physical press, you should probably bind the eraser button on your pen to something different, like a mouse button or key press.

    I use F13 to not absorb limited free key space (F13 is indeed a real thing, they go up to 25 I think.) For some Eraser isn't a typical key for blender, or at least my wacom tablet doesn't send it as such, and I've never been able to set it by actually pressing an eraser. Using a python key testing script I can't even seem to get it to detect the 'key' at all. I always have to select it in keymaps' mouse dropdown menu. I'm on windows, so I don't know if it would be any different on other OSes. Good luck if your pen driver/software doesn't have per-app keybindings. I'm sorry.


  • If you clear the entry on any field with the X button it may linger and continue switching/acting on trigger as if it was still there. Just manually specify an empty entry (the text box won't be grayed out if you did this right) and that should fix it. You can X it again after if you really want to, it stays fixed after one attempt.

    image Look for INK Pen. (Case-sensitive) image Still looking for it, because X was used to clear it. image Looking for " ". Not good enough. image Won't do any switching, truly empty. The default. Finally.

    Blender moment.

Installation

Install by going to Preferences > Addons > Install. Install the .zip file directly, you can't install it extracted. You can delete the original .zip after installing it, blender makes its own copy in its files somewhere. You'll have to redownload to install it again though.

About

Blender addon to allow making hotkeys which switch between brushes and/or materials. Useful for using holdouts as an eraser.


Languages

Language:Python 100.0%