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.
This commit is contained in:
Bastien Montagne 2016-05-03 15:05:24 +02:00
parent cb6307162b
commit 9151095dbe
Notes: blender-bot 2023-04-19 22:54:54 +02:00
Referenced by issue #48328, Blender crashes selecting linked duplicate bone in Edit Mode
1 changed files with 7 additions and 2 deletions

View File

@ -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? */