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:
authorHans Goudey <h.goudey@me.com>2020-10-23 02:13:30 +0300
committerHans Goudey <h.goudey@me.com>2020-10-23 02:13:30 +0300
commit8e060b44da04f4385a36a1a441e2ec45f1fd19f2 (patch)
tree8971d048208a14a418ca78ffe2779ecd07995284
parentbaa24f1c91d21e10f51881f8fad012f30f99e26f (diff)
Fix T81818: Outliner mode column crashes with shared object data
For objects with shared data, it makes sense to show the mode icon for every object sharing the same data if one of them is in edit mode. This also disables the "extend" functionality in this case, because being in edit mode for multiple objects with the same data isn't supported. Differential Revision: https://developer.blender.org/D9273
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 3045529747d..5a789ee0b01 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -1935,8 +1935,14 @@ static void outliner_mode_toggle_fn(bContext *C, void *tselem_poin, void *UNUSED
return;
}
+ /* Check that the the item is actually an object. */
+ BLI_assert(tselem->id != NULL && GS(tselem->id->name) == ID_OB);
+
+ Object *ob = (Object *)tselem->id;
+ const bool object_data_shared = (ob->data == tvc.obact->data);
+
wmWindow *win = CTX_wm_window(C);
- const bool do_extend = win->eventstate->ctrl != 0;
+ const bool do_extend = win->eventstate->ctrl != 0 && !object_data_shared;
outliner_item_mode_toggle(C, &tvc, te, do_extend);
}
@@ -1974,11 +1980,15 @@ static void outliner_draw_mode_column_toggle(uiBlock *block,
draw_active_icon = false;
}
+ const bool object_data_shared = (ob->data == ob_active->data);
+ draw_active_icon = draw_active_icon || object_data_shared;
+
int icon;
const char *tip;
if (draw_active_icon) {
icon = UI_icon_from_object_mode(ob_active->mode);
- tip = TIP_("Remove from the current mode");
+ tip = object_data_shared ? TIP_("Change the object in the current mode") :
+ TIP_("Remove from the current mode");
}
else {
icon = ICON_DOT;