[Bf-blender-cvs] [28c85fc] compositor-2016: Depsgraph: Solve wrong datamask calculated by depsgraph

Sergey Sharybin noreply at git.blender.org
Wed Jun 8 21:50:03 CEST 2016


Commit: 28c85fcf272b8069734ebe76284ed09ad38c9419
Author: Sergey Sharybin
Date:   Wed May 25 13:00:30 2016 +0200
Branches: compositor-2016
https://developer.blender.org/rB28c85fcf272b8069734ebe76284ed09ad38c9419

Depsgraph: Solve wrong datamask calculated by depsgraph

This is a weak concept, but nice t support it for now, so we can enable
new depsgraph by default earlier.

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

M	source/blender/depsgraph/intern/depsgraph_build.h
M	source/blender/depsgraph/intern/depsgraph_build_nodes.cc
M	source/blender/depsgraph/intern/depsgraph_build_relations.cc
M	source/blender/depsgraph/intern/depsnode_operation.cc
M	source/blender/depsgraph/intern/depsnode_operation.h

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

diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index c5b04ec..14b1b0f 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -282,6 +282,9 @@ struct DepsgraphRelationBuilder
 	void build_compositor(Scene *scene);
 	void build_gpencil(ID *owner, bGPdata *gpd);
 
+	template <typename KeyType>
+	OperationDepsNode *find_operation_node(const KeyType &key);
+
 protected:
 	RootDepsNode *find_node(const RootKey &key) const;
 	TimeSourceDepsNode *find_node(const TimeSourceKey &key) const;
@@ -323,6 +326,12 @@ struct DepsNodeHandle
 /* Get unique identifier for FCurves and Drivers */
 string deg_fcurve_id_name(const FCurve *fcu);
 
+template <typename KeyType>
+OperationDepsNode *DepsgraphRelationBuilder::find_operation_node(const KeyType& key) {
+	DepsNode *node = find_node(key);
+	return node != NULL ? node->get_exit_operation() : NULL;
+}
+
 template <typename KeyFrom, typename KeyTo>
 void DepsgraphRelationBuilder::add_relation(const KeyFrom &key_from,
                                             const KeyTo &key_to,
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cc b/source/blender/depsgraph/intern/depsgraph_build_nodes.cc
index be706ff..acb8738 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cc
@@ -381,11 +381,11 @@ void DepsgraphNodeBuilder::build_object(Scene *scene, Base *base, Object *ob)
 
 	IDDepsNode *id_node = add_id_node(&ob->id);
 	id_node->layers = base->lay;
+	ob->customdata_mask = 0;
 
 	/* standard components */
 	build_object_transform(scene, ob);
 
-
 	/* object data */
 	if (ob->data) {
 		/* type-specific data... */
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cc b/source/blender/depsgraph/intern/depsgraph_build_relations.cc
index 52af483..126b34c 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cc
@@ -304,6 +304,19 @@ void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene)
 	if (scene->gpd) {
 		build_gpencil(&scene->id, scene->gpd);
 	}
+
+	for (Depsgraph::OperationNodes::const_iterator it_op = m_graph->operations.begin();
+	     it_op != m_graph->operations.end();
+	     ++it_op)
+	{
+		OperationDepsNode *node = *it_op;
+		IDDepsNode *id_node = node->owner->owner;
+		ID *id = id_node->id;
+		if (GS(id->name) == ID_OB) {
+			Object *object = (Object *)id;
+			object->customdata_mask |= node->customdata_mask;
+		}
+	}
 }
 
 void DepsgraphRelationBuilder::build_group(Main *bmain,
@@ -473,8 +486,12 @@ void DepsgraphRelationBuilder::build_object_parent(Object *ob)
 		{
 			ComponentKey parent_key(&ob->parent->id, DEPSNODE_TYPE_GEOMETRY);
 			add_relation(parent_key, ob_key, DEPSREL_TYPE_GEOMETRY_EVAL, "Vertex Parent");
+
 			/* XXX not sure what this is for or how you could be done properly - lukas */
-			//parent_node->customdata_mask |= CD_MASK_ORIGINDEX;
+			OperationDepsNode *parent_node = find_operation_node(parent_key);
+			if (parent_node != NULL) {
+				parent_node->customdata_mask |= CD_MASK_ORIGINDEX;
+			}
 
 			ComponentKey transform_key(&ob->parent->id, DEPSNODE_TYPE_TRANSFORM);
 			add_relation(transform_key, ob_key, DEPSREL_TYPE_TRANSFORM, "Vertex Parent TFM");
@@ -625,7 +642,10 @@ void DepsgraphRelationBuilder::build_constraints(Scene *scene, ID *id, eDepsNode
 					add_relation(target_key, constraint_op_key, DEPSREL_TYPE_GEOMETRY_EVAL, cti->name);
 
 					if (ct->tar->type == OB_MESH) {
-						//node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+						OperationDepsNode *node2 = find_operation_node(target_key);
+						if (node2 != NULL) {
+							node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+						}
 					}
 				}
 				else if (con->type == CONSTRAINT_TYPE_SHRINKWRAP) {
@@ -1202,7 +1222,10 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob,
 			add_relation(target_key, solver_key, DEPSREL_TYPE_GEOMETRY_EVAL, con->name);
 
 			if (data->tar->type == OB_MESH) {
-				//node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+				OperationDepsNode *node2 = find_operation_node(target_key);
+				if (node2 != NULL) {
+					node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+				}
 			}
 		}
 		else {
@@ -1234,7 +1257,10 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *ob,
 			add_relation(target_key, solver_key, DEPSREL_TYPE_GEOMETRY_EVAL, con->name);
 
 			if (data->poletar->type == OB_MESH) {
-				//node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+				OperationDepsNode *node2 = find_operation_node(target_key);
+				if (node2 != NULL) {
+					node2->customdata_mask |= CD_MASK_MDEFORMVERT;
+				}
 			}
 		}
 		else {
diff --git a/source/blender/depsgraph/intern/depsnode_operation.cc b/source/blender/depsgraph/intern/depsnode_operation.cc
index 6aeb163..6fe0fae 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.cc
+++ b/source/blender/depsgraph/intern/depsnode_operation.cc
@@ -56,7 +56,8 @@ const char *DEG_OPNAMES[] = {
 
 OperationDepsNode::OperationDepsNode() :
     eval_priority(0.0f),
-    flag(0)
+    flag(0),
+    customdata_mask(0)
 {
 }
 
diff --git a/source/blender/depsgraph/intern/depsnode_operation.h b/source/blender/depsgraph/intern/depsnode_operation.h
index 1119e10..8d81931 100644
--- a/source/blender/depsgraph/intern/depsnode_operation.h
+++ b/source/blender/depsgraph/intern/depsnode_operation.h
@@ -82,6 +82,9 @@ struct OperationDepsNode : public DepsNode {
 
 	int flag;                     /* (eDepsOperation_Flag) extra settings affecting evaluation */
 
+	/* Extra customdata mask which needs to be evaluated for the object. */
+	uint64_t customdata_mask;
+
 	DEG_DEPSNODE_DECLARE;
 };




More information about the Bf-blender-cvs mailing list