From 19e1d05461abafc32b5d952d5121f765f4208f94 Mon Sep 17 00:00:00 2001 From: Nathan Vegdahl Date: Thu, 24 May 2012 21:05:27 +0000 Subject: 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.) --- source/blender/editors/object/object_lattice.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/object/object_lattice.c') diff --git a/source/blender/editors/object/object_lattice.c b/source/blender/editors/object/object_lattice.c index 7b37ca8ab95..f6e8ccf4ec9 100644 --- a/source/blender/editors/object/object_lattice.c +++ b/source/blender/editors/object/object_lattice.c @@ -335,7 +335,7 @@ static BPoint *findnearestLattvert(ViewContext *vc, const int mval[2], int sel) return data.bp; } -int mouse_lattice(bContext *C, const int mval[2], int extend) +int mouse_lattice(bContext *C, const int mval[2], int extend, int deselect, int toggle) { ViewContext vc; BPoint *bp = NULL; @@ -344,12 +344,20 @@ int mouse_lattice(bContext *C, const int mval[2], int extend) bp = findnearestLattvert(&vc, mval, 1); if (bp) { - if (extend == 0) { - ED_setflagsLatt(vc.obedit, 0); - bp->f1 |= SELECT; + if (extend) { + bp->f1 |= SELECT; + } + else if (deselect) { + bp->f1 &= ~SELECT; + } + else if (toggle) { + bp->f1 ^= SELECT; /* swap */ } else - bp->f1 ^= SELECT; /* swap */ + { + ED_setflagsLatt(vc.obedit, 0); + bp->f1 |= SELECT; + } WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit->data); -- cgit v1.2.3