diff options
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index be7ce34f7e6..0cba26dd3d2 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -1087,8 +1087,6 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int fl /* alphabetic insertion: is in new_id */ BKE_main_unlock(bmain); - BKE_lib_libblock_session_uuid_ensure(id); - /* TODO to be removed from here! */ if ((flag & LIB_ID_CREATE_NO_DEG_TAG) == 0) { DEG_id_type_tag(bmain, type); @@ -1097,6 +1095,13 @@ void *BKE_libblock_alloc(Main *bmain, short type, const char *name, const int fl else { BLI_strncpy(id->name + 2, name, sizeof(id->name) - 2); } + + /* We also need to ensure a valid `session_uuid` for some non-main data (like embedded IDs). + * IDs not allocated however should not need those (this would e.g. avoid generating session + * uuids for depsgraph CoW IDs, if it was using this function). */ + if ((flag & LIB_ID_CREATE_NO_ALLOCATE) == 0) { + BKE_lib_libblock_session_uuid_ensure(id); + } } return id; |