[Bf-blender-cvs] [0b2b29b] object_nodes: Cleanup: Simplify depsgraph API by using the same depsnode type for each ID.

Lukas Tönne noreply at git.blender.org
Tue Jan 19 16:42:43 CET 2016


Commit: 0b2b29ba56555fb59b58633760567d37fddf4f0c
Author: Lukas Tönne
Date:   Tue Jan 19 16:41:16 2016 +0100
Branches: object_nodes
https://developer.blender.org/rB0b2b29ba56555fb59b58633760567d37fddf4f0c

Cleanup: Simplify depsgraph API by using the same depsnode type for each ID.

This means the user might use an invalid component key for generating dependencies,
but the only consequence is that no relation is created.

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

M	source/blender/blenvm/intern/bvm_api.cc
M	source/blender/depsgraph/DEG_depsgraph.h
M	source/blender/depsgraph/DEG_depsgraph_build.h
M	source/blender/depsgraph/intern/depsgraph_build.cc
M	source/blender/depsgraph/intern/depsgraph_build_nodes.cc
M	source/blender/depsgraph/intern/depsgraph_build_relations.cc
M	source/blender/depsgraph/intern/depsgraph_types.h
M	source/blender/makesrna/intern/rna_depsgraph.c
M	source/blender/modifiers/intern/MOD_armature.c
M	source/blender/modifiers/intern/MOD_array.c
M	source/blender/modifiers/intern/MOD_boolean.c
M	source/blender/modifiers/intern/MOD_cast.c
M	source/blender/modifiers/intern/MOD_cloth.c
M	source/blender/modifiers/intern/MOD_curve.c
M	source/blender/modifiers/intern/MOD_datatransfer.c
M	source/blender/modifiers/intern/MOD_displace.c
M	source/blender/modifiers/intern/MOD_dynamicpaint.c
M	source/blender/modifiers/intern/MOD_fluidsim.c
M	source/blender/modifiers/intern/MOD_hook.c
M	source/blender/modifiers/intern/MOD_lattice.c
M	source/blender/modifiers/intern/MOD_mask.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_normal_edit.c
M	source/blender/modifiers/intern/MOD_particleinstance.c
M	source/blender/modifiers/intern/MOD_screw.c
M	source/blender/modifiers/intern/MOD_shrinkwrap.c
M	source/blender/modifiers/intern/MOD_simpledeform.c
M	source/blender/modifiers/intern/MOD_smoke.c
M	source/blender/modifiers/intern/MOD_uvproject.c
M	source/blender/modifiers/intern/MOD_uvwarp.c
M	source/blender/modifiers/intern/MOD_warp.c
M	source/blender/modifiers/intern/MOD_wave.c
M	source/blender/modifiers/intern/MOD_weightvgedit.c
M	source/blender/modifiers/intern/MOD_weightvgmix.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c

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

diff --git a/source/blender/blenvm/intern/bvm_api.cc b/source/blender/blenvm/intern/bvm_api.cc
index 67d6c60..2d5c67e 100644
--- a/source/blender/blenvm/intern/bvm_api.cc
+++ b/source/blender/blenvm/intern/bvm_api.cc
@@ -347,13 +347,13 @@ namespace bvm {
 
 struct EvalGlobalsHandle
 {
-	static void add_object_relation(DepsNodeHandle *_handle, struct Object *ob, eDepsObjectComponentType /*component*/, const char */*description*/)
+	static void add_object_relation(DepsNodeHandle *_handle, struct Object *ob, eDepsNode_Type /*component*/, const char */*description*/)
 	{
 		EvalGlobalsHandle *handle = (EvalGlobalsHandle *)_handle;
 		handle->globals->add_object(EvalGlobals::get_id_key((ID *)ob), ob);
 	}
 	
-	static void add_bone_relation(DepsNodeHandle *_handle, struct Object *ob, const char */*bone_name*/, eDepsObjectComponentType /*component*/, const char */*description*/)
+	static void add_bone_relation(DepsNodeHandle *_handle, struct Object *ob, const char */*bone_name*/, eDepsNode_Type /*component*/, const char */*description*/)
 	{
 		EvalGlobalsHandle *handle = (EvalGlobalsHandle *)_handle;
 		handle->globals->add_object(EvalGlobals::get_id_key((ID *)ob), ob);
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index f37ba71..dacc533 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -216,6 +216,36 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
 
 void DEG_editors_update_pre(struct Main *bmain, struct Scene *scene, bool time);
 
+
+/* Types of Nodes */
+typedef enum eDepsNode_Type {
+	DEPSNODE_TYPE_UNDEFINED        = -1,       /* fallback type for invalid return value */
+
+	DEPSNODE_TYPE_OPERATION        = 0,        /* Inner Node (Operation) */
+
+	/* Generic Types */
+	DEPSNODE_TYPE_ROOT             = 1,        /* "Current Scene" - basically whatever kicks off the evaluation process */
+	DEPSNODE_TYPE_TIMESOURCE       = 2,        /* Time-Source */
+
+	DEPSNODE_TYPE_ID_REF           = 3,        /* ID-Block reference - used as landmarks/collection point for components, but not usually part of main graph */
+	DEPSNODE_TYPE_SUBGRAPH         = 4,        /* Isolated sub-graph - used for keeping instanced data separate from instances using them */
+
+	/* Outer Types */
+	DEPSNODE_TYPE_PARAMETERS       = 11,       /* Parameters Component - Default when nothing else fits (i.e. just SDNA property setting) */
+	DEPSNODE_TYPE_PROXY            = 12,       /* Generic "Proxy-Inherit" Component */   // XXX: Also for instancing of subgraphs?
+	DEPSNODE_TYPE_ANIMATION        = 13,       /* Animation Component */                 // XXX: merge in with parameters?
+	DEPSNODE_TYPE_TRANSFORM        = 14,       /* Transform Component (Parenting/Constraints) */
+	DEPSNODE_TYPE_GEOMETRY         = 15,       /* Geometry Component (DerivedMesh/Displist) */
+	DEPSNODE_TYPE_SEQUENCER        = 16,       /* Sequencer Component (Scene Only) */
+
+	/* Evaluation-Related Outer Types (with Subdata) */
+	DEPSNODE_TYPE_EVAL_POSE        = 21,       /* Pose Component - Owner/Container of Bones Eval */
+	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;
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index 7f879e2..729b7f5 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -33,6 +33,8 @@
 #ifndef __DEG_DEPSGRAPH_BUILD_H__
 #define __DEG_DEPSGRAPH_BUILD_H__
 
+#include "DEG_depsgraph.h"
+
 /* ************************************************* */
 
 /* Dependency Graph */
@@ -78,35 +80,6 @@ void DEG_scene_graph_free(struct Scene *scene);
 
 /* Add Dependencies  ----------------------------- */
 
-typedef enum eDepsSceneComponentType {
-	DEG_SCENE_COMP_PARAMETERS,     /* Parameters Component - Default when nothing else fits (i.e. just SDNA property setting) */
-	DEG_SCENE_COMP_ANIMATION,      /* Animation Component */                 // XXX: merge in with parameters?
-	DEG_SCENE_COMP_SEQUENCER,      /* Sequencer Component (Scene Only) */
-} eDepsSceneComponentType;
-
-typedef enum eDepsObjectComponentType {
-	DEG_OB_COMP_PARAMETERS,        /* Parameters Component - Default when nothing else fits (i.e. just SDNA property setting) */
-	DEG_OB_COMP_PROXY,             /* Generic "Proxy-Inherit" Component */   // XXX: Also for instancing of subgraphs?
-	DEG_OB_COMP_ANIMATION,         /* Animation Component */                 // XXX: merge in with parameters?
-	DEG_OB_COMP_TRANSFORM,         /* Transform Component (Parenting/Constraints) */
-	DEG_OB_COMP_GEOMETRY,          /* Geometry Component (DerivedMesh/Displist) */
-	
-	/* Evaluation-Related Outer Types (with Subdata) */
-	DEG_OB_COMP_EVAL_POSE,         /* Pose Component - Owner/Container of Bones Eval */
-	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;
-
-typedef enum eDepsTextureComponentType {
-	DEG_TEX_COMP_PARAMETERS,         /* Parameters Component - Default when nothing else fits (i.e. just SDNA property setting) */
-} eDepsTextureComponentType;
-
-typedef enum eDepsNodeTreeComponentType {
-	DEG_NTREE_COMP_PARAMETERS,    /* Parameters Component - Default when nothing else fits (i.e. just SDNA property setting) */
-} eDepsNodeTreeComponentType;
-
 /* Handle for components to define their dependencies from callbacks.
  * This is generated by the depsgraph and passed to dependency callbacks
  * as a symbolic reference to the current DepsNode.
@@ -114,18 +87,18 @@ typedef enum eDepsNodeTreeComponentType {
  */
 struct DepsNodeHandle
 {
-	void (*add_scene_relation)(struct DepsNodeHandle *node, struct Scene *scene, eDepsSceneComponentType component, const char *description);
-	void (*add_object_relation)(struct DepsNodeHandle *node, struct Object *ob, eDepsObjectComponentType component, const char *description);
-	void (*add_bone_relation)(struct DepsNodeHandle *handle, struct Object *ob, const char *bone_name, eDepsObjectComponentType component, const char *description);
-	void (*add_texture_relation)(struct DepsNodeHandle *handle, struct Tex *tex, eDepsTextureComponentType component, const char *description);
-	void (*add_nodetree_relation)(struct DepsNodeHandle *handle, struct bNodeTree *ntree, eDepsNodeTreeComponentType component, const char *description);
+	void (*add_scene_relation)(struct DepsNodeHandle *node, struct Scene *scene, eDepsNode_Type component, const char *description);
+	void (*add_object_relation)(struct DepsNodeHandle *node, struct Object *ob, eDepsNode_Type component, const char *description);
+	void (*add_bone_relation)(struct DepsNodeHandle *handle, struct Object *ob, const char *bone_name, eDepsNode_Type component, const char *description);
+	void (*add_texture_relation)(struct DepsNodeHandle *handle, struct Tex *tex, eDepsNode_Type component, const char *description);
+	void (*add_nodetree_relation)(struct DepsNodeHandle *handle, struct bNodeTree *ntree, eDepsNode_Type component, const char *description);
 };
 
-void DEG_add_scene_relation(struct DepsNodeHandle *node, struct Scene *scene, eDepsSceneComponentType component, const char *description);
-void DEG_add_object_relation(struct DepsNodeHandle *node, struct Object *ob, eDepsObjectComponentType component, const char *description);
-void DEG_add_bone_relation(struct DepsNodeHandle *handle, struct Object *ob, const char *bone_name, eDepsObjectComponentType component, const char *description);
-void DEG_add_texture_relation(struct DepsNodeHandle *handle, struct Tex *tex, eDepsTextureComponentType component, const char *description);
-void DEG_add_nodetree_relation(struct DepsNodeHandle *handle, struct bNodeTree *ntree, eDepsNodeTreeComponentType component, const char *description);
+void DEG_add_scene_relation(struct DepsNodeHandle *node, struct Scene *scene, eDepsNode_Type component, const char *description);
+void DEG_add_object_relation(struct DepsNodeHandle *node, struct Object *ob, eDepsNode_Type component, const char *description);
+void DEG_add_bone_relation(struct DepsNodeHandle *handle, struct Object *ob, const char *bone_name, eDepsNode_Type component, const char *description);
+void DEG_add_texture_relation(struct DepsNodeHandle *handle, struct Tex *tex, eDepsNode_Type component, const char *description);
+void DEG_add_nodetree_relation(struct DepsNodeHandle *handle, struct bNodeTree *ntree, eDepsNode_Type component, const char *description);
 
 /* TODO(sergey): Remove once all geometry update is granular. */
 void DEG_add_special_eval_flag(struct Depsgraph *graph, struct ID *id, short flag);
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index 3f3c6f9..6883ec8 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -105,31 +105,31 @@ extern "C" {
 /* ****************** */
 /* External Build API */
 
-void DEG_add_scene_relation(DepsNodeHandle *handle, struct Scene *scene, eDepsSceneComponentType component, const char *description)
+void DEG_add_scene_relation(DepsNodeHandle *handle, struct Scene *scene, eDepsNode_Type component, const char *description)
 {
 	if (handle->add_scene_relation)
 		handle->add_scene_relation(handle, scene, component, description);
 }
 
-void DEG_add_object_relation(DepsNodeHandle *handle, struct Object *ob, eDepsObjectComponentType component, const char *description)
+void DEG_add_object_relation(DepsNodeHandle *handle, struct Object *ob, eDepsNode_Type component, const char *description)
 {
 	if (handle->add_object_relation)
 		handle->add_object_relation(handle, ob, component, description);
 }
 
-void DEG_add_bone_relation(DepsNodeHandle *handle, struct Object *ob, const char *bone_n

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list