LibOverride: Add a new 'leftover' flag to ID.

This flag is set for liboverride IDs that are detected as no longer
needed by resync process, while having been user-edited, so
auto-handling code cannot silently delete them.

Exposing those to users will be part of the new incoming Override
Outliner view.

Part of D10855.
This commit is contained in:
Bastien Montagne 2021-04-07 15:50:53 +02:00
parent de6f19ce22
commit 8b68a75872
2 changed files with 15 additions and 0 deletions

View File

@ -702,6 +702,9 @@ static void lib_override_library_create_post_process(Main *bmain,
base = BKE_view_layer_base_find(view_layer, ob_new);
DEG_id_tag_update_ex(
bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS);
if (is_resync) {
ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
}
}
if (ob_new == (Object *)ob_reference->id.newid && base != NULL) {
@ -713,6 +716,9 @@ static void lib_override_library_create_post_process(Main *bmain,
view_layer, ob_new, is_resync)) {
BKE_collection_object_add(bmain, collection_new, ob_new);
DEG_id_tag_update_ex(bmain, &ob_new->id, ID_RECALC_TRANSFORM | ID_RECALC_BASE_FLAGS);
if (is_resync) {
ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
}
}
}
}
@ -729,6 +735,9 @@ static void lib_override_library_create_post_process(Main *bmain,
else {
BKE_collection_object_add_from(bmain, scene, (Object *)id_root, ob_new);
}
if (is_resync) {
ob_new->id.flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
}
}
break;
}
@ -1087,6 +1096,7 @@ bool BKE_lib_override_library_resync(Main *bmain,
/* Otherwise, keep them, user needs to decide whether what to do with them. */
BLI_assert((id->tag & LIB_TAG_DOIT) == 0);
id_fake_user_set(id);
id->flag |= LIB_LIB_OVERRIDE_RESYNC_LEFTOVER;
CLOG_INFO(&LOG, 2, "Old override %s is being kept around as it was user-edited", id->name);
}
}

View File

@ -491,6 +491,11 @@ enum {
* Note that this also applies to shapekeys, even though they are not 100% embedded data...
*/
LIB_EMBEDDED_DATA_LIB_OVERRIDE = 1 << 12,
/**
* The override data-block appears to not be needed anymore after resync with linked data, but it
* was kept around (because e.g. detected as user-edited).
*/
LIB_LIB_OVERRIDE_RESYNC_LEFTOVER = 1 << 13,
};
/**