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:
authorNathan Vegdahl <cessen@cessen.com>2012-05-25 01:05:27 +0400
committerNathan Vegdahl <cessen@cessen.com>2012-05-25 01:05:27 +0400
commit19e1d05461abafc32b5d952d5121f765f4208f94 (patch)
tree5c1f496aa0f00bb605b5c7bd8d69d02534d4c5c6 /source/blender/editors/space_view3d/view3d_select.c
parent9dc161e8edc421463d4bb0b6237770b4656ca2a7 (diff)
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.)
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_select.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 0bbd03c10bb..c2d58349075 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -1311,7 +1311,7 @@ static void deselect_all_tracks(MovieTracking *tracking)
}
/* mval is region coords */
-static int mouse_select(bContext *C, const int mval[2], short extend, short obcenter, short enumerate)
+static int mouse_select(bContext *C, const int mval[2], short extend, short deselect, short toggle, short obcenter, short enumerate)
{
ViewContext vc;
ARegion *ar = CTX_wm_region(C);
@@ -1438,7 +1438,7 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
}
}
}
- else if (ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend) ) { /* then bone is found */
+ else if (ED_do_pose_selectbuffer(scene, basact, buffer, hits, extend, deselect, toggle) ) { /* then bone is found */
/* we make the armature selected:
* not-selected active object in posemode won't work well for tools */
@@ -1477,20 +1477,23 @@ static int mouse_select(bContext *C, const int mval[2], short extend, short obce
oldbasact = BASACT;
- if (!extend) {
- deselectall_except(scene, basact);
+ if (extend) {
ED_base_object_select(basact, BA_SELECT);
}
- else if (0) {
- // XXX select_all_from_groups(basact);
+ else if(deselect) {
+ ED_base_object_select(basact, BA_DESELECT);
}
- else {
+ else if(toggle) {
if (basact->flag & SELECT) {
if (basact == oldbasact)
ED_base_object_select(basact, BA_DESELECT);
}
else ED_base_object_select(basact, BA_SELECT);
}
+ else {
+ deselectall_except(scene, basact);
+ ED_base_object_select(basact, BA_SELECT);
+ }
if (oldbasact != basact) {
ED_base_object_activate(C, basact); /* adds notifier */
@@ -2043,7 +2046,7 @@ static int vertsel_vert_pick(struct bContext *C, Mesh *me, const int mval[2], un
/* mouse selection in weight paint */
/* gets called via generic mouse select operator */
-static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, Object *obact)
+static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], short extend, short deselect, short toggle, Object *obact)
{
Mesh *me = obact->data; /* already checked for NULL */
unsigned int index = 0;
@@ -2052,6 +2055,12 @@ static int mouse_weight_paint_vertex_select(bContext *C, const int mval[2], shor
if (vertsel_vert_pick(C, me, mval, &index, 50)) {
mv = me->mvert + index;
if (extend) {
+ mv->flag |= SELECT;
+ }
+ else if (deselect) {
+ mv->flag &= ~SELECT;
+ }
+ else if (toggle) {
mv->flag ^= SELECT;
}
else {
@@ -2073,6 +2082,8 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
Object *obedit = CTX_data_edit_object(C);
Object *obact = CTX_data_active_object(C);
short extend = RNA_boolean_get(op->ptr, "extend");
+ short deselect = RNA_boolean_get(op->ptr, "deselect");
+ short toggle = RNA_boolean_get(op->ptr, "toggle");
short center = RNA_boolean_get(op->ptr, "center");
short enumerate = RNA_boolean_get(op->ptr, "enumerate");
short object = RNA_boolean_get(op->ptr, "object");
@@ -2092,27 +2103,27 @@ static int view3d_select_invoke(bContext *C, wmOperator *op, wmEvent *event)
if (obedit && object == FALSE) {
if (obedit->type == OB_MESH)
- retval = mouse_mesh(C, event->mval, extend);
+ retval = mouse_mesh(C, event->mval, extend, deselect, toggle);
else if (obedit->type == OB_ARMATURE)
- retval = mouse_armature(C, event->mval, extend);
+ retval = mouse_armature(C, event->mval, extend, deselect, toggle);
else if (obedit->type == OB_LATTICE)
- retval = mouse_lattice(C, event->mval, extend);
+ retval = mouse_lattice(C, event->mval, extend, deselect, toggle);
else if (ELEM(obedit->type, OB_CURVE, OB_SURF))
- retval = mouse_nurb(C, event->mval, extend);
+ retval = mouse_nurb(C, event->mval, extend, deselect, toggle);
else if (obedit->type == OB_MBALL)
- retval = mouse_mball(C, event->mval, extend);
+ retval = mouse_mball(C, event->mval, extend, deselect, toggle);
}
else if (obact && obact->mode & OB_MODE_SCULPT)
return OPERATOR_CANCELLED;
else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT)
- return PE_mouse_particles(C, event->mval, extend);
+ return PE_mouse_particles(C, event->mval, extend, deselect, toggle);
else if (obact && paint_facesel_test(obact))
- retval = paintface_mouse_select(C, obact, event->mval, extend);
+ retval = paintface_mouse_select(C, obact, event->mval, extend, deselect, toggle);
else if (paint_vertsel_test(obact))
- retval = mouse_weight_paint_vertex_select(C, event->mval, extend, obact);
+ retval = mouse_weight_paint_vertex_select(C, event->mval, extend, deselect, toggle, obact);
else
- retval = mouse_select(C, event->mval, extend, center, enumerate);
+ retval = mouse_select(C, event->mval, extend, deselect, toggle, center, enumerate);
/* passthrough allows tweaks
* FINISHED to signal one operator worked
@@ -2139,6 +2150,8 @@ void VIEW3D_OT_select(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend selection instead of deselecting everything first");
+ RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from selection");
+ RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Selection", "Toggles selection");
RNA_def_boolean(ot->srna, "center", 0, "Center", "Use the object center when selecting, in editmode used to extend object selection");
RNA_def_boolean(ot->srna, "enumerate", 0, "Enumerate", "List objects under the mouse (object mode only)");
RNA_def_boolean(ot->srna, "object", 0, "Object", "Use object selection (editmode only)");