Invoke select_border()

Hi,

I’m trying with, no luck, to invoke the border select operator so that it draws it’s border rectangle instead of the infinite cross.

The user will have already clicked the mouse and will have begun dragging the cursor when select_border() is called, so I don’t want the user to have to click again to begin the border selection.

I tried checking the source code for the operator and it’s basically saying that it will only draw the rectangle during the INVOKE function if it detects a TWEAK event.

So I tried mapping my operator to a tweak event key map and calling:

if event.type == 'EVT_TWEAK_L':
bpy.ops.view3d.select_border('INVOKE_DEFAULT', gesture_mode=3)

But I’m still getting the infinite cross.

I also tried with gesture_mode=8, which according to source code is the gesture begin event.

There’s a way to script your own border select effect using bgl and python:


I’ve already done this and it’s fine, but the bgl drawing is a little sluggish compared to the compiled select_border() operator so I’d really like to be able to call Blender’s built in operator.

I would like to bump this one. Im trying to do something similar and I am not able to get the “bpy.ops.view3d.select_border” to actually select.

If I do bpy.ops.view3d.select_border(‘INVOKE_DEFAULT’) then I am able to invoke the tool but I get the infinite cross.

But if I try bpy.ops.view3d.select_border(‘INVOKE_DEFAULT’, gesture_mode=3) then I get this error:

“TypeError: Converting py args to operator properties: : keyword “gesture_mode” unrecognized”

How can I make bpy.ops.view3d.select_border actually select?

nevermind, i luckily was able to figured it out after a lot of trial and error. Just writing my solution here in case someone has the same problem:
I was able to make it select by passing “extend” and “deselect” to select_border in addition to ‘INVOKE_DEFAULT’ like this:
bpy.ops.view3d.select_border(‘INVOKE_DEFAULT’, extend=False, deselect=False)

I dont know why I have to do this (for example view3d.select_lasso() does not seem to need those parameters to be explicitly set), but I’m just happy it works.