[Bf-blender-cvs] [49e496118b5] blender2.8: ID: Add run-time flag indicating that ID is coming from copy-on-write

Sergey Sharybin noreply at git.blender.org
Wed Jul 19 17:34:01 CEST 2017


Commit: 49e496118b5d76f323ceff60cfd552f08c127c76
Author: Sergey Sharybin
Date:   Wed Jul 19 10:34:21 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB49e496118b5d76f323ceff60cfd552f08c127c76

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

===================================================================

M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
M	source/blender/depsgraph/intern/nodes/deg_node.cc
M	source/blender/makesdna/DNA_ID.h

===================================================================

diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index aa34ce0c670..b8eb35747c8 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -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;
 }
 
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc
index a652cf284b1..889d1dc4243 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node.cc
@@ -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
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index ed29f2336de..48da28b6bbe 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -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) */




More information about the Bf-blender-cvs mailing list