[Bf-blender-cvs] [52e5f3a] depsgraph_refactor: Depsgraph: Add shading component and empty operation in Material node

Sergey Sharybin noreply at git.blender.org
Thu Jan 15 15:23:33 CET 2015


Commit: 52e5f3ad83e9af6128fdb8cab7414df3bb024af3
Author: Sergey Sharybin
Date:   Thu Jan 15 19:16:14 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB52e5f3ad83e9af6128fdb8cab7414df3bb024af3

Depsgraph: Add shading component and empty operation in Material node

This way we can easily define relations between material and other entities, plus
this allows to have generic recalc flush mechanism working just fine.

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

M	source/blender/depsgraph/DEG_depsgraph_build.h
M	source/blender/depsgraph/intern/depsgraph_build.cpp
M	source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M	source/blender/depsgraph/intern/depsgraph_debug.cpp
M	source/blender/depsgraph/intern/depsgraph_types.h
M	source/blender/depsgraph/intern/depsnode_component.cpp
M	source/blender/depsgraph/intern/depsnode_component.h

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

diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index 93a5c77..097b175 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -98,6 +98,7 @@ typedef enum eDepsObjectComponentType {
 	DEG_OB_COMP_BONE,              /* Bone Component - Child/Subcomponent of Pose */
 	
 	DEG_OB_COMP_EVAL_PARTICLES,    /* Particle Systems Component */
+	DEG_OB_COMP_SHADING,           /* Material Shading Component */
 } eDepsObjectComponentType;
 
 void DEG_add_scene_relation(struct DepsNodeHandle *node, struct Scene *scene, eDepsSceneComponentType component, const char *description);
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cpp b/source/blender/depsgraph/intern/depsgraph_build.cpp
index 6917e46..e2682f0 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build.cpp
@@ -126,6 +126,7 @@ static eDepsNode_Type deg_build_object_component_type(eDepsObjectComponentType c
 		case DEG_OB_COMP_EVAL_POSE:         return DEPSNODE_TYPE_EVAL_POSE;
 		case DEG_OB_COMP_BONE:              return DEPSNODE_TYPE_BONE;
 		case DEG_OB_COMP_EVAL_PARTICLES:    return DEPSNODE_TYPE_EVAL_PARTICLES;
+		case DEG_OB_COMP_SHADING:           return DEPSNODE_TYPE_SHADING;
 	}
 	return DEPSNODE_TYPE_UNDEFINED;
 }
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 4653a02..47b2f20 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -837,6 +837,10 @@ void DepsgraphNodeBuilder::build_material(DepsNode *owner_node, Material *ma)
 	/* material itself */
 	add_id_node(ma_id);
 
+	add_operation_node(ma_id, DEPSNODE_TYPE_SHADING,
+	                   DEPSOP_TYPE_EXEC, NULL,
+	                   DEG_OPCODE_PLACEHOLDER, "Material Update");
+
 	/* material animation */
 	build_animdata(ma_id);
 	
diff --git a/source/blender/depsgraph/intern/depsgraph_debug.cpp b/source/blender/depsgraph/intern/depsgraph_debug.cpp
index c21d6c3..9409c77 100644
--- a/source/blender/depsgraph/intern/depsgraph_debug.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_debug.cpp
@@ -95,6 +95,7 @@ static const int deg_debug_node_type_color_map[][2] = {
     {DEPSNODE_TYPE_TRANSFORM,    7},
     {DEPSNODE_TYPE_GEOMETRY,     8},
     {DEPSNODE_TYPE_SEQUENCER,    9},
+    {DEPSNODE_TYPE_SHADING,      10},
     {-1,                         0}
 };
 #endif
@@ -490,6 +491,7 @@ static void deg_debug_graphviz_node(const DebugContext &ctx,
 		case DEPSNODE_TYPE_SEQUENCER:
 		case DEPSNODE_TYPE_EVAL_POSE:
 		case DEPSNODE_TYPE_BONE:
+		case DEPSNODE_TYPE_SHADING:
 		{
 			ComponentDepsNode *comp_node = (ComponentDepsNode *)node;
 			if (!comp_node->operations.empty()) {
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index 6d4ce21..cd2ff00 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -89,6 +89,7 @@ typedef enum eDepsNode_Type {
 	DEPSNODE_TYPE_BONE             = 22,       /* Bone Component - Child/Subcomponent of Pose */
 	
 	DEPSNODE_TYPE_EVAL_PARTICLES   = 23,       /* Particle Systems Component */
+	DEPSNODE_TYPE_SHADING          = 24,       /* Material Shading Component */
 } eDepsNode_Type;
 
 /* Identifiers for common operations (as an enum) */
diff --git a/source/blender/depsgraph/intern/depsnode_component.cpp b/source/blender/depsgraph/intern/depsnode_component.cpp
index fe83b0d..9c0192d 100644
--- a/source/blender/depsgraph/intern/depsnode_component.cpp
+++ b/source/blender/depsgraph/intern/depsnode_component.cpp
@@ -285,6 +285,11 @@ static DepsNodeFactoryImpl<BoneComponentDepsNode> DNTI_BONE;
 DEG_DEPSNODE_DEFINE(ParticlesComponentDepsNode, DEPSNODE_TYPE_EVAL_PARTICLES, "Particles Component");
 static DepsNodeFactoryImpl<ParticlesComponentDepsNode> DNTI_EVAL_PARTICLES;
 
+/* Shading Component Defines ============================ */
+
+DEG_DEPSNODE_DEFINE(ShadingComponentDepsNode, DEPSNODE_TYPE_SHADING, "Shading Component");
+static DepsNodeFactoryImpl<ShadingComponentDepsNode> DNTI_SHADING;
+
 
 /* Node Types Register =================================== */
 
@@ -301,4 +306,5 @@ void DEG_register_component_depsnodes()
 	DEG_register_node_typeinfo(&DNTI_BONE);
 	
 	DEG_register_node_typeinfo(&DNTI_EVAL_PARTICLES);
+	DEG_register_node_typeinfo(&DNTI_SHADING);
 }
diff --git a/source/blender/depsgraph/intern/depsnode_component.h b/source/blender/depsgraph/intern/depsnode_component.h
index 6b321b5..469d26d 100644
--- a/source/blender/depsgraph/intern/depsnode_component.h
+++ b/source/blender/depsgraph/intern/depsnode_component.h
@@ -190,6 +190,10 @@ struct ParticlesComponentDepsNode : public ComponentDepsNode {
 	DEG_DEPSNODE_DECLARE;
 };
 
+struct ShadingComponentDepsNode : public ComponentDepsNode {
+	DEG_DEPSNODE_DECLARE;
+};
+
 
 void DEG_register_component_depsnodes();




More information about the Bf-blender-cvs mailing list