[Bf-blender-cvs] [ece6d8b25ad] master: Fix (unreported) bad handling of detection of what to override from 3DView in some cases.
Bastien Montagne
noreply at git.blender.org
Tue Jul 21 12:04:57 CEST 2020
Commit: ece6d8b25ad2814933c0507e9d52bf2cafe42dc0
Author: Bastien Montagne
Date: Tue Jul 21 11:58:20 2020 +0200
Branches: master
https://developer.blender.org/rBece6d8b25ad2814933c0507e9d52bf2cafe42dc0
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...
===================================================================
M source/blender/editors/object/object_relations.c
===================================================================
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) {
More information about the Bf-blender-cvs
mailing list