[Bf-committers] Developer support for new keymap

Nathan Vegdahl cessen at cessen.com
Fri May 11 22:07:41 CEST 2012


Hi everyone,
As I'm working on the new keymap, I'm running into cases where I need
certain operators to be extended or added.  In most cases I am able to
do this via writing my own operators in Python, but there are a few
cases where this is not the case.

The main ones right now relate to selection.  My intent is to make it
so that all selection tools Replace Selection by default, but can also
Add To Selection and Remove From Selection via the shift and ctrl
modifier keys respectively.  I am at a loss in many cases for how I
would accomplish this via pure python.

For example, the view3d.select() operator has the following options:
- extend
- center
- enumerate
- object

I propose that we add two more options:
- add_to_selection
- remove_from_selection
(The names aren't important to me--these may be too verbose.  Or we
could instead, perhaps, add a "selection_model" enum that would
replace "extend" and have three possible values.  Or whatever.  The
specific mechanism is not important.)

add_to_selection would make the operator add whatever is clicked upon
to the selection if it is not already selected, making it active as
well.  But unlike extend, it will _not_ unselect an item if it is
already selected/active (acting as a sort of toggle), it will instead
at most make the item active if it is not already.

Complementary to that, remove_from_selection will unselect the clicked
upon item, and will do nothing if the item is already unselected.

That is just one example, but other changes I need are similar sorts
of things.  The intent is to keep the operators fully compatible with
the current keymap, whilst also adding support for the needs of the
new keymap.  The intent is also to only add/modify C operators in
cases where accomplishing the goal via python is not reasonable.

I am happy to either attempt to make these changes myself in Blender's
C code (I will submit patches since I am not familiar enough with
those areas of the code to be confident yet), or if these sorts of
things are fairly quick changes then I would be very appreciative if
someone familiar with the code would be willing to work with me.

Any volunteers?

Thanks!

--Nathan


More information about the Bf-committers mailing list