LibOverride: Add update of overrides when reloading library data.

Pretty straight-forward, although it does not rebuild relationships
(this is a heavy process we do not want to automate for now, will be a
separate operator in near future).

Fix T78179: Library Overrides - Additional geometry not updating without reloading scene.
This commit is contained in:
Bastien Montagne 2020-07-23 17:07:48 +02:00
parent 50cb693f1d
commit ad586e7eeb
Notes: blender-bot 2023-02-14 06:19:41 +01:00
Referenced by issue #78179, Library Overrides - Additional geometry not updating without reloading scene.
1 changed files with 15 additions and 0 deletions

View File

@ -939,6 +939,21 @@ static void lib_relocate_do(Main *bmain,
}
}
/* Update overrides of reloaded linked data-blocks.
* Note that this will not necessarily fully update the override, it might need to be manually
* 're-generated' depending on changes in linked data. */
ID *id;
FOREACH_MAIN_ID_BEGIN (bmain, id) {
if (ID_IS_LINKED(id) || !ID_IS_OVERRIDE_LIBRARY_REAL(id) ||
(id->tag & LIB_TAG_PRE_EXISTING) == 0) {
continue;
}
if (id->override_library->reference->lib == library) {
BKE_lib_override_library_update(bmain, id);
}
}
FOREACH_MAIN_ID_END;
BKE_main_collection_sync(bmain);
BKE_main_lib_objects_recalc_all(bmain);