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/curve
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/curve')
-rw-r--r--source/blender/editors/curve/curve_intern.h2
-rw-r--r--source/blender/editors/curve/curve_ops.c4
-rw-r--r--source/blender/editors/curve/editcurve.c82
3 files changed, 76 insertions, 12 deletions
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index ad3e9427861..6c477bd011a 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -84,7 +84,7 @@ void CURVE_OT_smooth_radius(struct wmOperatorType *ot);
void CURVE_OT_de_select_first(struct wmOperatorType *ot);
void CURVE_OT_de_select_last(struct wmOperatorType *ot);
-void CURVE_OT_select_all_toggle(struct wmOperatorType *ot);
+void CURVE_OT_select_all(struct wmOperatorType *ot);
void CURVE_OT_select_inverse(struct wmOperatorType *ot);
void CURVE_OT_select_linked(struct wmOperatorType *ot);
void CURVE_OT_select_row(struct wmOperatorType *ot);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index 15ff971b9cf..c54739902d0 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -139,7 +139,7 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(CURVE_OT_de_select_first);
WM_operatortype_append(CURVE_OT_de_select_last);
- WM_operatortype_append(CURVE_OT_select_all_toggle);
+ WM_operatortype_append(CURVE_OT_select_all);
WM_operatortype_append(CURVE_OT_select_inverse);
WM_operatortype_append(CURVE_OT_select_linked);
WM_operatortype_append(CURVE_OT_select_row);
@@ -222,7 +222,7 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "OBJECT_OT_curve_add", AKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_vertex_add", LEFTMOUSE, KM_CLICK, KM_CTRL, 0);
- WM_keymap_add_item(keymap, "CURVE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "CURVE_OT_select_all", AKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_row", RKEY, KM_PRESS, KM_SHIFT, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_more", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_add_item(keymap, "CURVE_OT_select_less", PADMINUS, KM_PRESS, KM_CTRL, 0);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index e53b419c6ea..a65e1164a27 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -83,6 +83,9 @@
#include "RNA_access.h"
#include "RNA_define.h"
+void selectend_nurb(Object *obedit, short selfirst, short doswap, short selstatus);
+static void select_adjacent_cp(ListBase *editnurb, short next, short cont, short selstatus);
+
/* still need to eradicate a few :( */
#define callocstructN(x,y,name) (x*)MEM_callocN((y)* sizeof(x),name)
@@ -363,6 +366,26 @@ void free_editNurb(Object *obedit)
}
}
+void CU_deselect_all(Object *obedit)
+{
+ ListBase *editnurb= curve_get_editcurve(obedit);
+
+ if (editnurb) {
+ selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
+ select_adjacent_cp(editnurb, 1, 1, DESELECT); /* cascade selection */
+ }
+}
+
+void CU_select_all(Object *obedit)
+{
+ ListBase *editnurb= curve_get_editcurve(obedit);
+
+ if (editnurb) {
+ selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
+ select_adjacent_cp(editnurb, 1, 1, DESELECT); /* cascade selection */
+ }
+}
+
/******************** separate operator ***********************/
static int separate_exec(bContext *C, wmOperator *op)
@@ -1580,26 +1603,67 @@ static int de_select_all_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
+ int action = RNA_enum_get(op->ptr, "action");
- if(nurb_has_selected_cps(editnurb)) { /* deselect all */
- selectend_nurb(obedit, FIRST, 0, DESELECT); /* set first control points as unselected */
- select_adjacent_cp(editnurb, 1, 1, DESELECT); /* cascade selection */
+ if (action == SEL_TOGGLE) {
+ action = SEL_SELECT;
+ if(nurb_has_selected_cps(editnurb))
+ action = SEL_DESELECT;
+ }
+
+ switch (action) {
+ case SEL_SELECT:
+ CU_select_all(obedit);
+ break;
+ case SEL_DESELECT:
+ CU_deselect_all(obedit);
+ break;
+ case SEL_INVERT:
+ {
+ Curve *cu= obedit->data;
+ Nurb *nu;
+ BPoint *bp;
+ BezTriple *bezt;
+ int a;
+
+ for(nu= editnurb->first; nu; nu= nu->next) {
+ if(nu->type == CU_BEZIER) {
+ bezt= nu->bezt;
+ a= nu->pntsu;
+ while(a--) {
+ if(bezt->hide==0) {
+ bezt->f2 ^= SELECT; /* always do the center point */
+ if((cu->drawflag & CU_HIDE_HANDLES)==0) {
+ bezt->f1 ^= SELECT;
+ bezt->f3 ^= SELECT;
+ }
+ }
+ bezt++;
+ }
+ }
+ else {
+ bp= nu->bp;
+ a= nu->pntsu*nu->pntsv;
+ while(a--) {
+ swap_selection_bpoint(bp);
+ bp++;
+ }
+ }
+ }
+ break;
+ }
}
- else { /* select all */
- selectend_nurb(obedit, FIRST, 0, SELECT); /* set first control points as selected */
- select_adjacent_cp(editnurb, 1, 1, SELECT); /* cascade selection */
- }
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data);
return OPERATOR_FINISHED;
}
-void CURVE_OT_select_all_toggle(wmOperatorType *ot)
+void CURVE_OT_select_all(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Select or Deselect All";
- ot->idname= "CURVE_OT_select_all_toggle";
+ ot->idname= "CURVE_OT_select_all";
/* api callbacks */
ot->exec= de_select_all_exec;