From ebc2cc15c0dc6a00f47b951401eaf2c78547ffe6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Oct 2013 02:23:28 +0000 Subject: [PATCH] fix [#37067] Bone Crash Holding Ctrl+RMB is supposed to select objects, while in editmode, however it would end up calling editmode selection as well as pose selection while an armature was in editmode (which caused the crash). Add the ability for view3d_opengl_select() to skip editmode selection. --- .../blender/editors/space_view3d/view3d_select.c | 14 +++++++++++--- .../blender/editors/space_view3d/view3d_view.c | 16 +++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index c48ce8a2343..ff17c2eedc1 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -1374,13 +1374,15 @@ static void deselect_all_tracks(MovieTracking *tracking) } /* mval is region coords */ -static bool mouse_select(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle, bool obcenter, short enumerate) +static bool mouse_select(bContext *C, const int mval[2], + bool extend, bool deselect, bool toggle, bool obcenter, bool enumerate, bool object) { ViewContext vc; ARegion *ar = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); Scene *scene = CTX_data_scene(C); Base *base, *startbase = NULL, *basact = NULL, *oldbasact = NULL; + bool is_obedit; float dist = 100.0f; int retval = false; short hits; @@ -1389,6 +1391,12 @@ static bool mouse_select(bContext *C, const int mval[2], bool extend, bool desel /* setup view context for argument to callbacks */ view3d_set_viewcontext(C, &vc); + + is_obedit = (vc.obedit != NULL); + if (object) { + /* signal for view3d_opengl_select to skip editmode objects */ + vc.obedit = NULL; + } /* always start list from basact in wire mode */ startbase = FIRSTBASE; @@ -1564,7 +1572,7 @@ static bool mouse_select(bContext *C, const int mval[2], bool extend, bool desel ED_base_object_select(basact, BA_SELECT); } - if (oldbasact != basact) { + if ((oldbasact != basact) && (is_obedit == false)) { ED_base_object_activate(C, basact); /* adds notifier */ } } @@ -2256,7 +2264,7 @@ static int view3d_select_exec(bContext *C, wmOperator *op) else if (paint_vertsel_test(obact)) retval = mouse_weight_paint_vertex_select(C, location, extend, deselect, toggle, obact); else - retval = mouse_select(C, location, extend, deselect, toggle, center, enumerate); + retval = mouse_select(C, location, extend, deselect, toggle, center, enumerate, object); /* passthrough allows tweaks * FINISHED to signal one operator worked diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 74d72061995..b74527159c2 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -876,10 +876,12 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d) } } -/* IGLuint-> GLuint */ -/* Warning: be sure to account for a negative return value - * This is an error, "Too many objects in select buffer" - * and no action should be taken (can crash blender) if this happens +/** + * \warning be sure to account for a negative return value + * This is an error, "Too many objects in select buffer" + * and no action should be taken (can crash blender) if this happens + * + * \note (vc->obedit == NULL) can be set to explicitly skip edit-object selection. */ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int bufsize, rcti *input) { @@ -890,6 +892,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b short code, hits; char dt; short dtx; + const bool use_obedit_skip = (scene->obedit != NULL) && (vc->obedit == NULL); G.f |= G_PICKSEL; @@ -937,8 +940,11 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b for (base = scene->base.first; base; base = base->next) { if (base->lay & v3d->lay) { - if (base->object->restrictflag & OB_RESTRICT_SELECT) + if ((base->object->restrictflag & OB_RESTRICT_SELECT) || + (use_obedit_skip && (scene->obedit->data == base->object->data))) + { base->selcol = 0; + } else { base->selcol = code; glLoadName(code);