[Bf-blender-cvs] [9151095] master: Fix T48328: Outliner: Armature EditMode: crash when selecting bone of a shared amrature in another object's bone list.

Bastien Montagne noreply at git.blender.org
Tue May 3 15:11:53 CEST 2016


Commit: 9151095dbe1d43eb1af978e86233e6eb9dd29f26
Author: Bastien Montagne
Date:   Tue May 3 15:05:24 2016 +0200
Branches: master
https://developer.blender.org/rB9151095dbe1d43eb1af978e86233e6eb9dd29f26

Fix T48328: Outliner: Armature EditMode: crash when selecting bone of a shared amrature in another object's bone list.

Basically, issue is that outliner stores editbones for an edited armature, which are only valid during EditMode.

When more than one object use the same armature, selecting ebones from same armature but under non-edited object
would first select that object (and hence switch out of editmode), and then try to select editbone while editdata
no more exist.

Solution for now is to not change active object in this case - it's not totally ideal (not consistent),
but other solutions (like switching edited object without leaving editmode, or rebuilding (part of)
outliner tree in-between) are horribly hackish and most likely prone to epic failure anyway.

===================================================================

M	source/blender/editors/space_outliner/outliner_select.c

===================================================================

diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c
index 84f8c62..21bee2c 100644
--- a/source/blender/editors/space_outliner/outliner_select.c
+++ b/source/blender/editors/space_outliner/outliner_select.c
@@ -612,6 +612,8 @@ static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature
 static eOLDrawState tree_element_active_ebone(
         bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), const eOLSetState set, bool recursive)
 {
+	BLI_assert(scene->obedit != NULL);
+
 	bArmature *arm = scene->obedit->data;
 	EditBone *ebone = te->directdata;
 	eOLDrawState status = OL_DRAWSEL_NONE;
@@ -915,11 +917,14 @@ static bool do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Sp
 		/* name and first icon */
 		else if (mval[0] > te->xs + UI_UNIT_X && mval[0] < te->xend) {
 			
-			/* always makes active object */
-			if (tselem->type != TSE_SEQUENCE && tselem->type != TSE_SEQ_STRIP && tselem->type != TSE_SEQUENCE_DUP)
+			/* always makes active object, except for some specific types.
+			 * Note about TSE_EBONE: In case of a same ID_AR datablock shared among several objects, we do not want
+			 * to switch out of edit mode (see T48328 for details). */
+			if (!ELEM(tselem->type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP, TSE_EBONE)) {
 				tree_element_set_active_object(C, scene, soops, te,
 				                               (extend && tselem->type == 0) ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL,
 				                               recursive && tselem->type == 0);
+			}
 			
 			if (tselem->type == 0) { // the lib blocks
 				/* editmode? */




More information about the Bf-blender-cvs mailing list