Lib reload/relocate: Improve performances.

Reduce amounts of viewlayer updates during remapping while relocating
libraries. Gives some improvements on relocating process, depending on
complexity of existing scene and reloaded libraries, whether there is
liboverrides to resync, etc., can give up to 10% speedup.
This commit is contained in:
Bastien Montagne 2022-10-20 11:29:47 +02:00
parent bd9d68e4dc
commit 40afb8ae6a
1 changed files with 3 additions and 0 deletions

View File

@ -1494,6 +1494,7 @@ void BKE_blendfile_library_relocate(BlendfileLinkAppendContext *lapp_context,
* code is wrong, we need to redo it here after adding them back to main. */
BKE_main_id_refcount_recompute(bmain, false);
BKE_layer_collection_resync_forbid();
/* Note that in reload case, we also want to replace indirect usages. */
const short remap_flags = ID_REMAP_SKIP_NEVER_NULL_USAGE |
(do_reload ? 0 : ID_REMAP_SKIP_INDIRECT_USAGE);
@ -1523,6 +1524,8 @@ void BKE_blendfile_library_relocate(BlendfileLinkAppendContext *lapp_context,
id_us_plus_no_lib(&old_key->id);
}
}
BKE_layer_collection_resync_allow();
BKE_main_collection_sync_remap(bmain);
BKE_main_unlock(bmain);