LibOverride: Silence some more asserts.

Print out messages into console instead when se cannot find expected
data (this is actually normal when source library gets edited).

Note that there seems to be some issue with the 'auto-cleanup' mechanism
removing no more valid override rules on file save, will check on that
next.

Related to T81059, found while investigating it.
This commit is contained in:
Bastien Montagne 2020-09-25 11:07:04 +02:00
parent db76de147e
commit c67873e49b
2 changed files with 28 additions and 4 deletions

View File

@ -908,9 +908,18 @@ static void rna_property_override_apply_ex(Main *bmain,
if (opop->subitem_local_name != NULL) {
RNA_property_collection_lookup_string(
ptr_src, prop_src, opop->subitem_local_name, &private_ptr_item_src);
if (opop->subitem_reference_name != NULL) {
RNA_property_collection_lookup_string(
ptr_dst, prop_dst, opop->subitem_reference_name, &private_ptr_item_dst);
if (opop->subitem_reference_name != NULL &&
RNA_property_collection_lookup_string(
ptr_dst, prop_dst, opop->subitem_reference_name, &private_ptr_item_dst)) {
/* This is rather fragile, but the fact that local override IDs may have a different name
* than their linked reference makes it necessary.
* Basically, here we are considering that if we cannot find the original linked ID in
* the local override we are (re-)applying the operations, then it may be because soe of
* those operations have already been applied, and we may already have the local ID
* pointer we want to set.
* This happens e.g. during resync of an override, since we have already remapped all ID
* pointers to their expected values.
* In that case we simply try to get the property from the local expected name. */
}
else {
RNA_property_collection_lookup_string(
@ -962,6 +971,17 @@ static void rna_property_override_apply_ex(Main *bmain,
ptr_item_dst = &private_ptr_item_dst;
ptr_item_src = &private_ptr_item_src;
ptr_item_storage = &private_ptr_item_storage;
if (ptr_item_dst->type == NULL) {
printf("Failed to find destination sub-item '%s' in new override data '%s'\n",
opop->subitem_reference_name,
ptr_dst->owner_id->name);
}
if (ptr_item_src->type == NULL) {
printf("Failed to find source sub-item '%s' in old override data '%s'\n",
opop->subitem_local_name,
ptr_src->owner_id->name);
}
}
if (!rna_property_override_operation_apply(bmain,

View File

@ -167,13 +167,17 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
Collection *coll_dst = (Collection *)ptr_dst->owner_id;
if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
BLI_assert(0 && "invalid source or destination object.");
// BLI_assert(0 && "invalid source or destination object.");
return false;
}
Object *ob_dst = ptr_item_dst->data;
Object *ob_src = ptr_item_src->data;
if (ob_src == ob_dst) {
return true;
}
CollectionObject *cob_dst = BLI_findptr(
&coll_dst->gobject, ob_dst, offsetof(CollectionObject, ob));