Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2021-01-11 18:41:22 +0300
committerBastien Montagne <bastien@blender.org>2021-01-11 18:44:19 +0300
commitbf90fcda4760f52ea7cebcceb7dc0d0e1a7de93a (patch)
tree2b00020df54db1abf395212ec24d7d2e7fc8d633
parent1a26d1576345fb1eb3d31d3048f64b5e4f7a6109 (diff)
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).
-rw-r--r--source/blender/blenkernel/intern/lib_id.c9
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;