diff options
author | Martin Poirier <theeth@yahoo.com> | 2009-11-30 01:16:29 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2009-11-30 01:16:29 +0300 |
commit | cd154da9732962870339952898499ed1b1c32d93 (patch) | |
tree | f59446523990d985a92542ab781d7707c8753009 /source/blender/editors/physics/particle_edit.c | |
parent | 92b4316708bad0448f4c433ef9c6c2d3cc1f4fb5 (diff) |
1. Extend option for 3d view border select now does something (default True to keep same behavior)
2. Add action parameter to Select_All_Toggle operators, rename to Select_All.
Options are Toggle (default), Select, Deselect, Invert (same as select swap). This makes it possible to map separate hotkeys for select all and deselect all.
NOTE for Aligorith: I didn't change animation operators for select_all which already had an Invert operator. These should be fixed eventually.
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r-- | source/blender/editors/physics/particle_edit.c | 69 |
1 files changed, 52 insertions, 17 deletions
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index b5007ff72ce..68e673c31b1 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -1261,29 +1261,51 @@ static void toggle_key_select(PEData *data, int point_index, int key_index) /************************ de select all operator ************************/ -static int de_select_all_exec(bContext *C, wmOperator *op) +static int select_all_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); PTCacheEdit *edit= PE_get_current(scene, ob); POINT_P; KEY_K; - int sel= 0; - - LOOP_VISIBLE_POINTS { - LOOP_SELECTED_KEYS { - sel= 1; - key->flag &= ~PEK_SELECT; - point->flag |= PEP_EDIT_RECALC; + int action = RNA_enum_get(op->ptr, "action"); + + if (action == SEL_TOGGLE) { + action = SEL_SELECT; + LOOP_VISIBLE_POINTS { + LOOP_SELECTED_KEYS { + action = SEL_DESELECT; + break; + } + + if (action == SEL_DESELECT) + break; } } - if(sel==0) { - LOOP_VISIBLE_POINTS { - LOOP_KEYS { - if(!(key->flag & PEK_SELECT)) { + LOOP_VISIBLE_POINTS { + LOOP_VISIBLE_KEYS { + switch (action) { + case SEL_SELECT: + if ((key->flag & PEK_SELECT) == 0) { key->flag |= PEK_SELECT; point->flag |= PEP_EDIT_RECALC; } + break; + case SEL_DESELECT: + if (key->flag & PEK_SELECT) { + key->flag &= ~PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } + break; + case SEL_INVERT: + if ((key->flag & PEK_SELECT) == 0) { + key->flag |= PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } else { + key->flag &= ~PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } + break; } } } @@ -1294,18 +1316,20 @@ static int de_select_all_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void PARTICLE_OT_select_all_toggle(wmOperatorType *ot) +void PARTICLE_OT_select_all(wmOperatorType *ot) { /* identifiers */ - ot->name= "Select or Deselect All"; - ot->idname= "PARTICLE_OT_select_all_toggle"; + ot->name= "Selection of all particles"; + ot->idname= "PARTICLE_OT_select_all"; /* api callbacks */ - ot->exec= de_select_all_exec; + ot->exec= select_all_exec; ot->poll= PE_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + WM_operator_properties_select_all(ot); } /************************ pick select operator ************************/ @@ -1472,7 +1496,7 @@ void PARTICLE_OT_select_linked(wmOperatorType *ot) /************************ border select operator ************************/ -int PE_border_select(bContext *C, rcti *rect, int select) +int PE_border_select(bContext *C, rcti *rect, int select, int extend) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -1482,6 +1506,17 @@ int PE_border_select(bContext *C, rcti *rect, int select) if(!PE_start_edit(edit)) return OPERATOR_CANCELLED; + if (extend == 0 && select) { + POINT_P; KEY_K; + + LOOP_VISIBLE_POINTS { + LOOP_SELECTED_KEYS { + key->flag &= ~PEK_SELECT; + point->flag |= PEP_EDIT_RECALC; + } + } + } + PE_set_view3d_data(C, &data); data.rect= rect; data.select= select; |