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:
authorMartin Poirier <theeth@yahoo.com>2009-11-30 01:16:29 +0300
committerMartin Poirier <theeth@yahoo.com>2009-11-30 01:16:29 +0300
commitcd154da9732962870339952898499ed1b1c32d93 (patch)
treef59446523990d985a92542ab781d7707c8753009 /source/blender/editors/physics
parent92b4316708bad0448f4c433ef9c6c2d3cc1f4fb5 (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')
-rw-r--r--source/blender/editors/physics/particle_edit.c69
-rw-r--r--source/blender/editors/physics/physics_intern.h2
-rw-r--r--source/blender/editors/physics/physics_ops.c4
3 files changed, 55 insertions, 20 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;
diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h
index e7543cbb83e..085332b1788 100644
--- a/source/blender/editors/physics/physics_intern.h
+++ b/source/blender/editors/physics/physics_intern.h
@@ -36,7 +36,7 @@
struct wmOperatorType;
/* particle_edit.c */
-void PARTICLE_OT_select_all_toggle(struct wmOperatorType *ot);
+void PARTICLE_OT_select_all(struct wmOperatorType *ot);
void PARTICLE_OT_select_first(struct wmOperatorType *ot);
void PARTICLE_OT_select_last(struct wmOperatorType *ot);
void PARTICLE_OT_select_linked(struct wmOperatorType *ot);
diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c
index b0d804da457..09b4ebec7a2 100644
--- a/source/blender/editors/physics/physics_ops.c
+++ b/source/blender/editors/physics/physics_ops.c
@@ -43,7 +43,7 @@
static void operatortypes_particle(void)
{
- WM_operatortype_append(PARTICLE_OT_select_all_toggle);
+ WM_operatortype_append(PARTICLE_OT_select_all);
WM_operatortype_append(PARTICLE_OT_select_first);
WM_operatortype_append(PARTICLE_OT_select_last);
WM_operatortype_append(PARTICLE_OT_select_linked);
@@ -94,7 +94,7 @@ static void keymap_particle(wmKeyConfig *keyconf)
keymap= WM_keymap_find(keyconf, "Particle", 0, 0);
keymap->poll= PE_poll;
- WM_keymap_add_item(keymap, "PARTICLE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "PARTICLE_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, 0, 0);