LibOverride: protect better against using on complex inter-dependency cases.

Do not allow 3DView operator to run on the liboverride of an
instantiating Empty object. And tweak behavior in the Outliner
operations too.

Related to T94226.

Note that this remains fairly exotic, bad idea not recommended cases,
such complex inter-dependencies between different libraries inside a
same liboverride hierarchy is just not possible to handle properly.
This commit is contained in:
Bastien Montagne 2021-12-23 10:10:05 +01:00
parent 710e279b19
commit 00965c98cb
Notes: blender-bot 2023-02-14 06:00:49 +01:00
Referenced by issue #94338, bpy.data.libraries.load does not return the right thing (Geometry Nodes, Collections, Shader nodes are fine)
2 changed files with 3 additions and 2 deletions

View File

@ -2355,7 +2355,8 @@ static bool make_override_library_poll(bContext *C)
/* Object must be directly linked to be overridable. */
return (ED_operator_objectmode(C) && obact != NULL &&
(ID_IS_LINKED(obact) || (obact->instance_collection != NULL &&
ID_IS_OVERRIDABLE_LIBRARY(obact->instance_collection))));
ID_IS_OVERRIDABLE_LIBRARY(obact->instance_collection) &&
!ID_IS_OVERRIDE_LIBRARY(obact))));
}
static const EnumPropertyItem *make_override_collections_of_linked_object_itemf(

View File

@ -817,7 +817,7 @@ static void id_override_library_create_fn(bContext *C,
ID *id_reference = NULL;
bool is_override_instancing_object = false;
if (tsep != NULL && tsep->type == TSE_SOME_ID && tsep->id != NULL &&
GS(tsep->id->name) == ID_OB) {
GS(tsep->id->name) == ID_OB && !ID_IS_OVERRIDE_LIBRARY(tsep->id)) {
Object *ob = (Object *)tsep->id;
if (ob->type == OB_EMPTY && &ob->instance_collection->id == id_root) {
BLI_assert(GS(id_root->name) == ID_GR);