Fix T53363: Blender won't update mesh's usercount when deleting object datablocks in Editmode.

Only do special handling of ob->data pointer in case we are remapping to
a valid (non-NULL) other obdata. Otherwise, handle it as any other
'remapping to NULL' case.

Hopefully not breaking anything else...
This commit is contained in:
Bastien Montagne 2018-01-25 10:11:12 +01:00
parent 693b41eb17
commit 566eb60d81
Notes: blender-bot 2023-02-14 19:33:16 +01:00
Referenced by issue blender/blender-addons#53363, Blender won't update mesh's usercount when deleting object datablocks in Editmode
1 changed files with 4 additions and 2 deletions

View File

@ -194,9 +194,11 @@ static int foreach_libblock_remap_callback(void *user_data, ID *id_self, ID **id
id->tag |= LIB_TAG_DOIT;
}
/* Special hack in case it's Object->data and we are in edit mode (skipped_direct too). */
/* Special hack in case it's Object->data and we are in edit mode, and new_id is not NULL
* (otherwise, we follow common NEVER_NULL flags).
* (skipped_indirect too). */
if ((is_never_null && skip_never_null) ||
(is_obj_editmode && (((Object *)id)->data == *id_p)) ||
(is_obj_editmode && (((Object *)id)->data == *id_p) && new_id != NULL) ||
(skip_indirect && is_indirect))
{
if (is_indirect) {