ID Creation: generate `session_uuid` in more cases.
Previous code would not generate a session uuid for embedded IDs (like root node trees or master collections). While this is not a problem currently since those are not directly stored in Main data-base, this is conceptually wrong, since those IDs still pertain the Main data. Further more, this is blocking using `session_uuid` more in depsgraph in place from ID pointer itself, as identifier (related to T84397).
This commit is contained in:
parent
1a26d15763
commit
bf90fcda47
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue