Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/physics/particle_edit.c')
-rw-r--r--source/blender/editors/physics/particle_edit.c69
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;