'Fix' (unreported) issue that liboverride code can corrupt Main namemap.

Does not happen very often, but that weak handling of copying linked
data as linked data currently can lead to an invalid namemap in Main.

This is a known issue, fixing it requires addressing #107847.

In the mean time, work around it by re-validating and fixing the namemap
after the problematic liboverride calls.

NOTE: only identified issue currently is the proxy conversion of linked
proxies. The other cases *should* be fine.

Found while investigating issues when opening the
`lib/tests/libraries_and_linking/libraries/main_scene.blend` file.
This commit is contained in:
Bastien Montagne
2023-05-26 17:51:52 +02:00
parent e260bc64da
commit ff126ede17
2 changed files with 7 additions and 0 deletions

View File

@@ -442,6 +442,9 @@ static void setup_app_data(bContext *C,
* linked libraries. */
if (mode != LOAD_UNDO && !blendfile_or_libraries_versions_atleast(bmain, 302, 1)) {
BKE_lib_override_library_main_proxy_convert(bmain, reports);
/* Currently liboverride code can generate invalid namemap. This is a known issue, requires
* #107847 to be properly fixed. */
BKE_main_namemap_validate_and_fix(bmain);
}
if (mode != LOAD_UNDO && !blendfile_or_libraries_versions_atleast(bmain, 302, 3)) {

View File

@@ -1011,6 +1011,10 @@ static void blendfile_link_append_proxies_convert(Main *bmain, ReportList *repor
BlendFileReadReport bf_reports = {.reports = reports};
BKE_lib_override_library_main_proxy_convert(bmain, &bf_reports);
/* Currently liboverride code can generate invalid namemap. This is a known issue, requires
* #107847 to be properly fixed. */
BKE_main_namemap_validate_and_fix(bmain);
if (bf_reports.count.proxies_to_lib_overrides_success != 0 ||
bf_reports.count.proxies_to_lib_overrides_failures != 0)
{