Sunday, September 28, 2014

Blender Dev Tip: Modal Keymaps for Select Circle

Doh! The answer in retrospect seems so simple (and it was, if I'd remembered this quirk from the last time I'd encountered it several years ago), but you'd be stuck if you didn't know where to look...

For a bit of a fun break from the work I've been doing recently for my research work, I've been hacking some new features for Blender. However, this evening, I ended up wasting quite a bit of time trying to figure out why the circle-select operator I'd been working on was not working. Namely, it wasn't responding to any events once activated.

Long story short: If you're coding a "Select Circle" operator, you need to add the following line at the end of gesture_circle_modal_keymap() in wm_operators.c:
WM_modalkeymap_assign("<your_operator_id_name_here>");

This basically says that the modal keymap needed by these operator should be used when doling out events to your operator. Otherwise, the events simply won't get passed down, and you'll be left wondering why it's not working...

1 comment:

  1. Hi Aligorith, I was just wondering what's the status on the depsgraph work of yours?

    ReplyDelete