Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-03-12 11:41:00 +0300
committerBastien Montagne <bastien@blender.org>2021-03-12 11:46:11 +0300
commit4781ab0969cdb4e39a2a9947f2b1a613b13b6235 (patch)
treeaa80f528821e1f1ecc6ea481a1f3970a8e00ac9e /source/blender/blenkernel/intern/lib_remap.c
parentfd4c01a75c34fa88a20d3967d02996c0c9815efe (diff)
IDRemap: Add option to also remap internal runtime ID pointers.
In some cases (advanced, low-level), we also want to remap pointers like `ID.newid` or `ID.orig_id`. Only known case currently is `id_delete`, to avoid leaving potential access to freed memory. See next commit and T86501.
Diffstat (limited to 'source/blender/blenkernel/intern/lib_remap.c')
-rw-r--r--source/blender/blenkernel/intern/lib_remap.c9
1 files changed, 6 insertions, 3 deletions
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;