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).
This commit is contained in:
@@ -172,18 +172,25 @@ static int id_free(Main *bmain, void *idv, int flag, const bool use_flag_from_id
|
||||
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
|
||||
* between the Scene's master collection and its view_layers become invalid
|
||||
* (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 && (flag & LIB_ID_FREE_NO_MAIN) == 0) {
|
||||
BKE_main_collection_sync_remap(bmain);
|
||||
if (bmain) {
|
||||
if ((flag_orig & LIB_ID_FREE_NO_MAIN) == 0) {
|
||||
BKE_layer_collection_resync_allow();
|
||||
}
|
||||
|
||||
if ((flag_final & LIB_ID_FREE_NO_MAIN) == 0) {
|
||||
BKE_main_collection_sync_remap(bmain);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user