ID: Add run-time flag indicating that ID is coming from copy-on-write

This commit is contained in:
Sergey Sharybin
2017-07-19 10:34:21 +02:00
parent 44c6d45c2e
commit 49e496118b
3 changed files with 5 additions and 0 deletions

View File

@@ -576,6 +576,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
if (newid != NULL) {
MEM_freeN(newid);
}
id_cow->tag |= LIB_TAG_COPY_ON_WRITE;
return id_cow;
}

View File

@@ -182,6 +182,7 @@ void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
id_cow = (ID *)BKE_libblock_alloc_notest(GS(id->name));
DEG_COW_PRINT("Create shallow copy for %s: id_orig=%p id_cow=%p\n",
id_orig->name, id_orig, id_cow);
id_cow->tag |= LIB_TAG_COPY_ON_WRITE;
#else
id_cow = id_orig;
#endif

View File

@@ -363,6 +363,9 @@ enum {
LIB_TAG_ID_RECALC_DATA = 1 << 13,
LIB_TAG_ANIM_NO_RECALC = 1 << 14,
LIB_TAG_ID_RECALC_ALL = (LIB_TAG_ID_RECALC | LIB_TAG_ID_RECALC_DATA),
/* The datablock is a copy-on-write version. */
LIB_TAG_COPY_ON_WRITE = (1 << 15),
};
/* To filter ID types (filter_id) */