diff options
author | Bastien Montagne <bastien@blender.org> | 2022-02-01 14:09:26 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-02-02 11:47:10 +0300 |
commit | 049df7ef943917fe1e86f84cc6213d319fa4c138 (patch) | |
tree | d686591bd185ddeb833f5bf077d946f5a4fa990c /source/blender/blenkernel/intern/blendfile_link_append.c | |
parent | 286fcb3a605a51a2d8e542095ffa87ceb71fdd08 (diff) |
Proxies Removal: Handle conversion to liboverrides also for linked data.
So far linked proxies were just kept as-is, this is no longer an option.
Attempt to convert them into liboverrides as much as possible, though
some cases won't be supported:
- Appending proxies is broken since a long time, so conversion will fail
here as well.
- When linking data, some cases will fail to convert properly. in
particular, if the linked proxy object is not instanced in a scene
(e.g. when linking a collection containing a proxy as an
epty-instanced collection instead of a view-layer-instanced collection).
NOTE: converion when linking/appending is done unconditionnaly, option
to not convert on file load will be removed in next commit anyway.
Part of T91671.
Diffstat (limited to 'source/blender/blenkernel/intern/blendfile_link_append.c')
-rw-r--r-- | source/blender/blenkernel/intern/blendfile_link_append.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/blendfile_link_append.c b/source/blender/blenkernel/intern/blendfile_link_append.c index 9b3f4c2fae8..4149821b67b 100644 --- a/source/blender/blenkernel/intern/blendfile_link_append.c +++ b/source/blender/blenkernel/intern/blendfile_link_append.c @@ -993,6 +993,24 @@ static int foreach_libblock_link_append_callback(LibraryIDLinkCallbackData *cb_d /** \name Library link/append code. * \{ */ +static void blendfile_link_append_proxies_convert(Main *bmain, ReportList *reports) +{ + BlendFileReadReport bf_reports = {.reports = reports}; + BKE_lib_override_library_main_proxy_convert(bmain, &bf_reports); + + if (bf_reports.count.proxies_to_lib_overrides_success != 0 || + bf_reports.count.proxies_to_lib_overrides_failures != 0) { + BKE_reportf( + bf_reports.reports, + RPT_WARNING, + "Proxies have been removed from Blender (%d proxies were automatically converted " + "to library overrides, %d proxies could not be converted and were cleared). " + "Please consider re-saving any library .blend file with the newest Blender version.", + bf_reports.count.proxies_to_lib_overrides_success, + bf_reports.count.proxies_to_lib_overrides_failures); + } +} + void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList *reports) { if (lapp_context->num_items == 0) { @@ -1259,6 +1277,8 @@ void BKE_blendfile_append(BlendfileLinkAppendContext *lapp_context, ReportList * } BKE_main_id_newptr_and_tag_clear(bmain); + + blendfile_link_append_proxies_convert(bmain, reports); } void BKE_blendfile_link(BlendfileLinkAppendContext *lapp_context, ReportList *reports) @@ -1361,6 +1381,10 @@ void BKE_blendfile_link(BlendfileLinkAppendContext *lapp_context, ReportList *re .active_collection = NULL}; loose_data_instantiate(&instantiate_context); } + + if ((lapp_context->params->flag & FILE_LINK) != 0) { + blendfile_link_append_proxies_convert(lapp_context->params->bmain, reports); + } } /** \} */ |