[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60766] trunk/blender/source/blender/ editors/space_view3d: fix [#37067] Bone Crash

Campbell Barton ideasman42 at gmail.com
Tue Oct 15 04:23:29 CEST 2013


Revision: 60766
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60766
Author:   campbellbarton
Date:     2013-10-15 02:23:28 +0000 (Tue, 15 Oct 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_select.c
    trunk/blender/source/blender/editors/space_view3d/view3d_view.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_select.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2013-10-15 01:46:05 UTC (rev 60765)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_select.c	2013-10-15 02:23:28 UTC (rev 60766)
@@ -1374,13 +1374,15 @@
 }
 
 /* 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 @@
 	
 	/* 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 @@
 				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 @@
 	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

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2013-10-15 01:46:05 UTC (rev 60765)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c	2013-10-15 02:23:28 UTC (rev 60766)
@@ -876,10 +876,12 @@
 	}
 }
 
-/* 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 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 @@
 		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);




More information about the Bf-blender-cvs mailing list