diff --git a/source/blender/blenkernel/BKE_lib_remap.hh b/source/blender/blenkernel/BKE_lib_remap.hh index 50c252d25ae..f3bb494bbe3 100644 --- a/source/blender/blenkernel/BKE_lib_remap.hh +++ b/source/blender/blenkernel/BKE_lib_remap.hh @@ -72,6 +72,13 @@ enum { * the 'separate' mesh operator. */ ID_REMAP_FORCE_OBDATA_IN_EDITMODE = 1 << 7, + /** Do remapping of `lib` Library pointers of IDs (by default these are completely ignored). + * + * WARNING: Use with caution. This is currently a 'raw' remapping, with no further processing. In + * particular, DO NOT use this to make IDs local (i.e. remap a library pointer to NULL), unless + * the calling code takes care of the rest of the required changes (ID tags & flags updates, + * etc.). */ + ID_REMAP_DO_LIBRARY_POINTERS = 1 << 8, /** * Don't touch the special user counts (use when the 'old' remapped ID remains in use): diff --git a/source/blender/blenkernel/intern/lib_remap.cc b/source/blender/blenkernel/intern/lib_remap.cc index 4059877a761..cc926238fd6 100644 --- a/source/blender/blenkernel/intern/lib_remap.cc +++ b/source/blender/blenkernel/intern/lib_remap.cc @@ -487,13 +487,15 @@ static void libblock_remap_data( { IDRemap id_remap_data = {eIDRemapType(0)}; const bool include_ui = (remap_flags & ID_REMAP_FORCE_UI_POINTERS) != 0; - const int foreach_id_flags = (((remap_flags & ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS) != 0 ? - IDWALK_DO_INTERNAL_RUNTIME_POINTERS : - IDWALK_NOP) | - (include_ui ? IDWALK_INCLUDE_UI : IDWALK_NOP) | - ((remap_flags & ID_REMAP_NO_ORIG_POINTERS_ACCESS) != 0 ? - IDWALK_NO_ORIG_POINTERS_ACCESS : - IDWALK_NOP)); + const int foreach_id_flags = + (((remap_flags & ID_REMAP_FORCE_INTERNAL_RUNTIME_POINTERS) != 0 ? + IDWALK_DO_INTERNAL_RUNTIME_POINTERS : + IDWALK_NOP) | + (include_ui ? IDWALK_INCLUDE_UI : IDWALK_NOP) | + + ((remap_flags & ID_REMAP_NO_ORIG_POINTERS_ACCESS) != 0 ? IDWALK_NO_ORIG_POINTERS_ACCESS : + IDWALK_NOP) | + ((remap_flags & ID_REMAP_DO_LIBRARY_POINTERS) != 0 ? IDWALK_DO_LIBRARY_POINTER : IDWALK_NOP)); id_remap_data.id_remapper = id_remapper; id_remap_data.type = remap_type;