[Bf-blender-cvs] [443789d7c67] master: Depsgraph: Add facilities to store what ID recalc flag component corresponds to

Sergey Sharybin noreply at git.blender.org
Mon Dec 18 16:48:28 CET 2017


Commit: 443789d7c67369d0144545837d52474d797ee459
Author: Sergey Sharybin
Date:   Mon Dec 18 16:46:32 2017 +0100
Branches: master
https://developer.blender.org/rB443789d7c67369d0144545837d52474d797ee459

Depsgraph: Add facilities to store what ID recalc flag component corresponds to

The idea is to de-duplicate logic in DEG_id_tag_update() and flushing where we
need to translate depsgraph tag or component type to ID level recalc flag.

Currently unused, but is required for Blender 2.8.

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

M	source/blender/depsgraph/intern/depsgraph_intern.h
M	source/blender/depsgraph/intern/nodes/deg_node.cc
M	source/blender/depsgraph/intern/nodes/deg_node.h
M	source/blender/depsgraph/intern/nodes/deg_node_component.cc
M	source/blender/depsgraph/intern/nodes/deg_node_component.h

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

diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
index 3aee5536982..f562f5d64f8 100644
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ b/source/blender/depsgraph/intern/depsgraph_intern.h
@@ -61,6 +61,7 @@ struct DepsNodeFactory {
 	virtual eDepsNode_Type type() const = 0;
 	virtual eDepsNode_Class tclass() const = 0;
 	virtual const char *tname() const = 0;
+	virtual int id_recalc_tag() const = 0;
 
 	virtual DepsNode *create_node(const ID *id,
 	                              const char *subdata,
@@ -72,6 +73,7 @@ struct DepsNodeFactoryImpl : public DepsNodeFactory {
 	eDepsNode_Type type() const { return NodeType::typeinfo.type; }
 	eDepsNode_Class tclass() const { return NodeType::typeinfo.tclass; }
 	const char *tname() const { return NodeType::typeinfo.tname; }
+	int id_recalc_tag() const { return NodeType::typeinfo.id_recalc_tag; }
 
 	DepsNode *create_node(const ID *id, const char *subdata, const char *name) const
 	{
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.cc b/source/blender/depsgraph/intern/nodes/deg_node.cc
index 1d4d542e7cc..77182332e02 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node.cc
@@ -57,16 +57,19 @@ namespace DEG {
 
 /* Add ------------------------------------------------ */
 
-DepsNode::TypeInfo::TypeInfo(eDepsNode_Type type, const char *tname)
+DepsNode::TypeInfo::TypeInfo(eDepsNode_Type type,
+                             const char *tname,
+                             int id_recalc_tag)
+        : type(type),
+          tname(tname),
+          id_recalc_tag(id_recalc_tag)
 {
-	this->type = type;
 	if (type == DEG_NODE_TYPE_OPERATION)
 		this->tclass = DEG_NODE_CLASS_OPERATION;
 	else if (type < DEG_NODE_TYPE_PARAMETERS)
 		this->tclass = DEG_NODE_CLASS_GENERIC;
 	else
 		this->tclass = DEG_NODE_CLASS_COMPONENT;
-	this->tname = tname;
 }
 
 DepsNode::DepsNode()
diff --git a/source/blender/depsgraph/intern/nodes/deg_node.h b/source/blender/depsgraph/intern/nodes/deg_node.h
index 9f1b61faf24..b9aa36bbd43 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node.h
@@ -51,11 +51,13 @@ struct OperationDepsNode;
 struct DepsNode {
 	/* Helper class for static typeinfo in subclasses. */
 	struct TypeInfo {
-		TypeInfo(eDepsNode_Type type, const char *tname);
+		TypeInfo(eDepsNode_Type type, const char *tname, int id_recalc_tag = 0);
 
 		eDepsNode_Type type;
 		eDepsNode_Class tclass;
 		const char *tname;
+
+		int id_recalc_tag;
 	};
 
 	/* Identifier - mainly for debugging purposes. */
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.cc b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
index 17f35acee79..8ac73671678 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.cc
@@ -359,26 +359,6 @@ void ComponentDepsNode::finalize_build()
 	operations_map = NULL;
 }
 
-/* Register all components. =============================== */
-
-#define DEG_COMPONENT_DEFINE(name, NAME)                             \
-  DEG_DEPSNODE_DEFINE(name ## ComponentDepsNode,                     \
-                      DEG_NODE_TYPE_ ## NAME,                        \
-                      #name  " Component");                          \
-static DepsNodeFactoryImpl<name ## ComponentDepsNode> DNTI_ ## NAME
-
-
-DEG_COMPONENT_DEFINE(Animation, ANIMATION);
-DEG_COMPONENT_DEFINE(Cache, CACHE);
-DEG_COMPONENT_DEFINE(Geometry, GEOMETRY);
-DEG_COMPONENT_DEFINE(Parameters, PARAMETERS);
-DEG_COMPONENT_DEFINE(Particles, EVAL_PARTICLES);
-DEG_COMPONENT_DEFINE(Proxy, PROXY);
-DEG_COMPONENT_DEFINE(Pose, EVAL_POSE);
-DEG_COMPONENT_DEFINE(Sequencer, SEQUENCER);
-DEG_COMPONENT_DEFINE(Shading, SHADING);
-DEG_COMPONENT_DEFINE(Transform, TRANSFORM);
-
 /* Bone Component ========================================= */
 
 /* Initialize 'bone component' node - from pointer data given */
@@ -398,7 +378,19 @@ void BoneComponentDepsNode::init(const ID *id, const char *subdata)
 	this->pchan = BKE_pose_channel_find_name(object->pose, subdata);
 }
 
-DEG_COMPONENT_DEFINE(Bone, BONE);
+/* Register all components. =============================== */
+
+DEG_COMPONENT_NODE_DEFINE(Animation,         ANIMATION,          ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Bone,              BONE,               ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Cache,             CACHE,              ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Geometry,          GEOMETRY,           ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Parameters,        PARAMETERS,         ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Particles,         EVAL_PARTICLES,     ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Proxy,             PROXY,              ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Pose,              EVAL_POSE,          ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Sequencer,         SEQUENCER,          ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Shading,           SHADING,            ID_RECALC_NONE);
+DEG_COMPONENT_NODE_DEFINE(Transform,         TRANSFORM,          ID_RECALC_NONE);
 
 /* Node Types Register =================================== */
 
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_component.h b/source/blender/depsgraph/intern/nodes/deg_node_component.h
index 1c21a71737f..702697eba3a 100644
--- a/source/blender/depsgraph/intern/nodes/deg_node_component.h
+++ b/source/blender/depsgraph/intern/nodes/deg_node_component.h
@@ -166,21 +166,34 @@ struct ComponentDepsNode : public DepsNode {
 
 /* ---------------------------------------- */
 
-#define DEG_COMPONENT_DECLARE_GENERIC(name)                        \
+#define DEG_COMPONENT_NODE_DEFINE_TYPEINFO(NodeType, type_, tname_, id_recalc_tag) \
+    const DepsNode::TypeInfo NodeType::typeinfo = \
+        DepsNode::TypeInfo(type_, tname_, id_recalc_tag)
+
+#define DEG_COMPONENT_NODE_DECLARE DEG_DEPSNODE_DECLARE
+
+#define DEG_COMPONENT_NODE_DEFINE(name, NAME, id_recalc_tag)            \
+    DEG_COMPONENT_NODE_DEFINE_TYPEINFO(name ## ComponentDepsNode,       \
+                                       DEG_NODE_TYPE_ ## NAME,          \
+                                       #name  " Component",             \
+                                       id_recalc_tag) ;                 \
+    static DepsNodeFactoryImpl<name ## ComponentDepsNode> DNTI_ ## NAME
+
+#define DEG_COMPONENT_NODE_DECLARE_GENERIC(name)                   \
 	struct name ## ComponentDepsNode : public ComponentDepsNode {  \
-		DEG_DEPSNODE_DECLARE;                                      \
+		DEG_COMPONENT_NODE_DECLARE;                                \
 	}
 
-DEG_COMPONENT_DECLARE_GENERIC(Animation);
-DEG_COMPONENT_DECLARE_GENERIC(Cache);
-DEG_COMPONENT_DECLARE_GENERIC(Geometry);
-DEG_COMPONENT_DECLARE_GENERIC(Parameters);
-DEG_COMPONENT_DECLARE_GENERIC(Particles);
-DEG_COMPONENT_DECLARE_GENERIC(Proxy);
-DEG_COMPONENT_DECLARE_GENERIC(Pose);
-DEG_COMPONENT_DECLARE_GENERIC(Sequencer);
-DEG_COMPONENT_DECLARE_GENERIC(Shading);
-DEG_COMPONENT_DECLARE_GENERIC(Transform);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Animation);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Cache);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Geometry);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Parameters);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Particles);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Proxy);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Pose);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Sequencer);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Shading);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Transform);
 
 /* Bone Component */
 struct BoneComponentDepsNode : public ComponentDepsNode {
@@ -188,7 +201,7 @@ struct BoneComponentDepsNode : public ComponentDepsNode {
 
 	struct bPoseChannel *pchan;     /* the bone that this component represents */
 
-	DEG_DEPSNODE_DECLARE;
+	DEG_COMPONENT_NODE_DECLARE;
 };
 
 void deg_register_component_depsnodes();



More information about the Bf-blender-cvs mailing list