diff options
author | Bastien Montagne <bastien@blender.org> | 2020-07-21 12:58:20 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-07-21 12:59:50 +0300 |
commit | ece6d8b25ad2814933c0507e9d52bf2cafe42dc0 (patch) | |
tree | e5c9fc35a6edabb4a7330a3bdb48d417340e9035 /source/blender/editors/object | |
parent | b277a75a3b5f77158a60d843be6c012837c70f39 (diff) |
Fix (unreported) bad handling of detection of what to override from 3DView in some cases.
Having a directly linked object does not always mean it should be
considered as really overridable...
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r-- | source/blender/editors/object/object_relations.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index d8c8bdc3968..7d40b48dd83 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2242,9 +2242,22 @@ void OBJECT_OT_make_local(wmOperatorType *ot) /** \name Make Library Override Operator * \{ */ +static bool make_override_library_ovject_overridable_check(Main *bmain, Object *object) +{ + /* An object is actually overridable only if it is in at least one local collections... + * Unfortunatly 'direct link' flag is not enough here. */ + LISTBASE_FOREACH (Collection *, collection, &bmain->collections) { + if (!ID_IS_LINKED(collection) && BKE_collection_has_object(collection, object)) { + return true; + } + } + return false; +} + /* Set the object to override. */ static int make_override_library_invoke(bContext *C, wmOperator *op, const wmEvent *event) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); Object *obact = ED_object_active_context(C); @@ -2255,7 +2268,7 @@ static int make_override_library_invoke(bContext *C, wmOperator *op, const wmEve if ((!ID_IS_LINKED(obact) && obact->instance_collection != NULL && ID_IS_OVERRIDABLE_LIBRARY(obact->instance_collection)) || - ID_IS_OVERRIDABLE_LIBRARY(obact)) { + make_override_library_ovject_overridable_check(bmain, obact)) { uiPopupMenu *pup = UI_popup_menu_begin(C, IFACE_("OK?"), ICON_QUESTION); uiLayout *layout = UI_popup_menu_layout(pup); @@ -2303,7 +2316,7 @@ static int make_override_library_exec(bContext *C, wmOperator *op) id_root = &obact->instance_collection->id; } - else if (!ID_IS_OVERRIDABLE_LIBRARY(obact)) { + else if (!make_override_library_ovject_overridable_check(bmain, obact)) { const int i = RNA_property_enum_get(op->ptr, op->type->prop); const uint collection_session_uuid = *((uint *)&i); if (collection_session_uuid == MAIN_ID_SESSION_UUID_UNSET) { |