diff options
-rw-r--r-- | source/blender/blenkernel/BKE_lib_remap.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/lib_remap.c | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_lib_remap.h b/source/blender/blenkernel/BKE_lib_remap.h index 6e81273b82b..705d2b030e5 100644 --- a/source/blender/blenkernel/BKE_lib_remap.h +++ b/source/blender/blenkernel/BKE_lib_remap.h @@ -78,6 +78,13 @@ enum { ID_REMAP_SKIP_OVERRIDE_LIBRARY = 1 << 5, /** Don't touch the user count (use for low level actions such as swapping pointers). */ ID_REMAP_SKIP_USER_CLEAR = 1 << 6, + /** + * Force internal ID runtime pointers (like `ID.newid`, `ID.orig_id` etc.) to also be processed. + * This should only be needed in some very specific cases, typically only BKE ID management code + * should need it (e.g. required from `id_delete` to ensure no runtime pointer remains using + * freed ones). + */ + ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS = 1 << 7, }; /* Note: Requiring new_id to be non-null, this *may* not be the case ultimately, diff --git a/source/blender/blenkernel/intern/lib_remap.c b/source/blender/blenkernel/intern/lib_remap.c index 0218cb913a8..1f597bbb9a6 100644 --- a/source/blender/blenkernel/intern/lib_remap.c +++ b/source/blender/blenkernel/intern/lib_remap.c @@ -373,9 +373,12 @@ static void libblock_remap_data( Main *bmain, ID *id, ID *old_id, ID *new_id, const short remap_flags, IDRemap *r_id_remap_data) { IDRemap id_remap_data; - const int foreach_id_flags = (remap_flags & ID_REMAP_NO_INDIRECT_PROXY_DATA_USAGE) != 0 ? - IDWALK_NO_INDIRECT_PROXY_DATA_USAGE : - IDWALK_NOP; + const int foreach_id_flags = ((remap_flags & ID_REMAP_NO_INDIRECT_PROXY_DATA_USAGE) != 0 ? + IDWALK_NO_INDIRECT_PROXY_DATA_USAGE : + IDWALK_NOP) | + ((remap_flags & ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS) != 0 ? + IDWALK_DO_INTERNAL_RUNTIME_POINTERS : + IDWALK_NOP); if (r_id_remap_data == NULL) { r_id_remap_data = &id_remap_data; |