Core: ID remapping: Do remap 'not owning embedded' ID pointers.

This should not have much effective consequences with current code, but
fixes potential missed remappings for e.g. some nodetree pointers in the
node editor, or the `parent` pointer of collections to a scene's master
collection.
This commit is contained in:
Bastien Montagne
2023-04-17 15:32:01 +02:00
parent 0bc957063c
commit a16bcb6576

View File

@@ -170,7 +170,10 @@ static int foreach_libblock_remap_callback(LibraryIDLinkCallbackData *cb_data)
{
const int cb_flag = cb_data->cb_flag;
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING)) {
/* NOTE: Support remapping of `IDWALK_CB_EMBEDDED_NON_OWNING` pointers, this is necessary in some
* complex low-level ID manipulation cases (e.g. in ID swapping, see #BKE_lib_id_swap & co).
*/
if (cb_flag & IDWALK_CB_EMBEDDED) {
return IDWALK_RET_NOP;
}
@@ -890,8 +893,8 @@ static void libblock_relink_to_newid_prepare_data(Main *bmain,
static int id_relink_to_newid_looper(LibraryIDLinkCallbackData *cb_data)
{
const int cb_flag = cb_data->cb_flag;
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_EMBEDDED_NOT_OWNING |
IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
/* NOTE: For now, support remapping `IDWALK_CB_EMBEDDED_NON_OWNING` pointers. */
if (cb_flag & (IDWALK_CB_EMBEDDED | IDWALK_CB_OVERRIDE_LIBRARY_REFERENCE)) {
return IDWALK_RET_NOP;
}