diff options
author | Nathan Vegdahl <cessen@cessen.com> | 2012-05-25 01:05:27 +0400 |
---|---|---|
committer | Nathan Vegdahl <cessen@cessen.com> | 2012-05-25 01:05:27 +0400 |
commit | 19e1d05461abafc32b5d952d5121f765f4208f94 (patch) | |
tree | 5c1f496aa0f00bb605b5c7bd8d69d02534d4c5c6 /source/blender/editors/physics | |
parent | 9dc161e8edc421463d4bb0b6237770b4656ca2a7 (diff) |
Modifications to the view3d.select() operator:
1. Two new boolean options have been added to the operator: "deselect"
and "toggle".
2. The previous behavior of "extend" (toggling the selection) has
been moved to the "toggle" option.
3. "extend" now only extends the selection, it never deselects.
4. "deselect" is pretty self-explanatory: it deselects (i.e. opposite
of extend).
5. The built-in keymap has been changed to use "toggle" where
"extend" was used before for this operator, to maintain the
previous behavior in the default keymap.
In short, this works towards making "extend" and "deselect" fully
consistent across all selection tools (adding to and removing from
selection, respectively), but still preserves the old behavior
as well.
(Patch reviewed by Brecht.)
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index adb5cdede2a..d6cf46363d3 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1294,6 +1294,26 @@ static void select_keys(PEData *data, int point_index, int UNUSED(key_index)) point->flag |= PEP_EDIT_RECALC; } +static void extend_key_select(PEData *data, int point_index, int key_index) +{ + PTCacheEdit *edit = data->edit; + PTCacheEditPoint *point = edit->points + point_index; + PTCacheEditKey *key = point->keys + key_index; + + key->flag |= PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; +} + +static void deselect_key_select(PEData *data, int point_index, int key_index) +{ + PTCacheEdit *edit = data->edit; + PTCacheEditPoint *point = edit->points + point_index; + PTCacheEditKey *key = point->keys + key_index; + + key->flag &= ~PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; +} + static void toggle_key_select(PEData *data, int point_index, int key_index) { PTCacheEdit *edit = data->edit; @@ -1381,7 +1401,7 @@ void PARTICLE_OT_select_all(wmOperatorType *ot) /************************ pick select operator ************************/ -int PE_mouse_particles(bContext *C, const int mval[2], int extend) +int PE_mouse_particles(bContext *C, const int mval[2], int extend, int deselect, int toggle) { PEData data; Scene *scene= CTX_data_scene(C); @@ -1392,7 +1412,7 @@ int PE_mouse_particles(bContext *C, const int mval[2], int extend) if (!PE_start_edit(edit)) return OPERATOR_CANCELLED; - if (!extend) { + if (!extend && !deselect && !toggle) { LOOP_VISIBLE_POINTS { LOOP_SELECTED_KEYS { key->flag &= ~PEK_SELECT; @@ -1405,7 +1425,13 @@ int PE_mouse_particles(bContext *C, const int mval[2], int extend) data.mval= mval; data.rad= 75.0f; - for_mouse_hit_keys(&data, toggle_key_select, 1); /* nearest only */ + /* 1 = nearest only */ + if (extend) + for_mouse_hit_keys(&data, extend_key_select, 1); + else if (deselect) + for_mouse_hit_keys(&data, deselect_key_select, 1); + else + for_mouse_hit_keys(&data, toggle_key_select, 1); PE_update_selection(scene, ob, 1); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_SELECTED, data.ob); |