Skip to content
Snippets Groups Projects
Commit adf990f5 authored by Bastien Montagne's avatar Bastien Montagne
Browse files

BKE: id_delete: Do not forbid layer collection resync in non-Main case.

There is no reason to deal with layer collections resync in non-main
case, deletion code should never trigger it anyway.

This will avoid quite a lot of the non-main-thread calls to
`BKE_layer_collection_resync_forbid` (detected and 'fixed' in previous
commit).
parent 087aea87
Branches
Tags
No related merge requests found
...@@ -172,18 +172,25 @@ static int id_free(Main *bmain, void *idv, int flag, const bool use_flag_from_id ...@@ -172,18 +172,25 @@ static int id_free(Main *bmain, void *idv, int flag, const bool use_flag_from_id
return flag; return flag;
} }
void BKE_id_free_ex(Main *bmain, void *idv, int flag, const bool use_flag_from_idtag) void BKE_id_free_ex(Main *bmain, void *idv, const int flag_orig, const bool use_flag_from_idtag)
{ {
/* ViewLayer resync needs to be delayed during Scene freeing, since internal relationships /* ViewLayer resync needs to be delayed during Scene freeing, since internal relationships
* between the Scene's master collection and its view_layers become invalid * between the Scene's master collection and its view_layers become invalid
* (due to remapping). */ * (due to remapping). */
BKE_layer_collection_resync_forbid(); if (bmain && (flag_orig & LIB_ID_FREE_NO_MAIN) == 0) {
BKE_layer_collection_resync_forbid();
}
flag = id_free(bmain, idv, flag, use_flag_from_idtag); int flag_final = id_free(bmain, idv, flag_orig, use_flag_from_idtag);
BKE_layer_collection_resync_allow(); if (bmain) {
if (bmain && (flag & LIB_ID_FREE_NO_MAIN) == 0) { if ((flag_orig & LIB_ID_FREE_NO_MAIN) == 0) {
BKE_main_collection_sync_remap(bmain); BKE_layer_collection_resync_allow();
}
if ((flag_final & LIB_ID_FREE_NO_MAIN) == 0) {
BKE_main_collection_sync_remap(bmain);
}
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment