LibOverride: Fix infinite resync loop in some invalid file cases.

Multi-overrides of a same linked ID in a same override hierarchy are
currently not supported and can cause all kind of issues.

In some cases they could lead to infinite loop trying to resync the same
ID over and over, this is now prevented.

Found in some Blender studio production files.
This commit is contained in:
Bastien Montagne 2021-04-30 16:49:59 +02:00
parent aadfa31cf0
commit a8e7c8d59b
1 changed files with 7 additions and 0 deletions

View File

@ -1224,6 +1224,13 @@ void BKE_lib_override_library_main_resync(Main *bmain, Scene *scene, ViewLayer *
}
do_continue = true;
/* In complex non-supported cases, with several different override hierarchies sharing
* relations between each-other, we may end up not actually updating/replacing the given
* root id (see e.g. pro/shots/110_rextoria/110_0150_A/110_0150_A.anim.blend of sprites
* project repository, r2687).
* This can lead to infinite loop here, at least avoid this. */
id->tag &= ~LIB_TAG_LIB_OVERRIDE_NEED_RESYNC;
CLOG_INFO(&LOG, 2, "Resyncing %s...", id->name);
const bool success = BKE_lib_override_library_resync(
bmain, scene, view_layer, id, override_resync_residual_storage, false, false);