[Bf-blender-cvs] [1b98fff7130] blender2.8: Depsgraph: Make geoemtry to tag function more reusable

Sergey Sharybin noreply at git.blender.org
Wed Sep 19 16:10:23 CEST 2018


Commit: 1b98fff7130dbd5c371b8387b60f11a95f0977e5
Author: Sergey Sharybin
Date:   Wed Sep 19 15:06:18 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB1b98fff7130dbd5c371b8387b60f11a95f0977e5

Depsgraph: Make geoemtry to tag function more reusable

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

M	source/blender/depsgraph/intern/depsgraph_intern.h
M	source/blender/depsgraph/intern/depsgraph_tag.cc

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

diff --git a/source/blender/depsgraph/intern/depsgraph_intern.h b/source/blender/depsgraph/intern/depsgraph_intern.h
index aa67226c47e..069407e855e 100644
--- a/source/blender/depsgraph/intern/depsgraph_intern.h
+++ b/source/blender/depsgraph/intern/depsgraph_intern.h
@@ -146,4 +146,8 @@ struct ListBase *deg_build_effector_relations(Depsgraph *graph, struct Collectio
 struct ListBase *deg_build_collision_relations(Depsgraph *graph, struct Collection *collection, unsigned int modifier_type);
 void deg_clear_physics_relations(Depsgraph *graph);
 
+/* Tagging Utilities -------------------------------------------------------- */
+
+eDepsNode_Type deg_geometry_tag_to_component(const ID *id);
+
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 42db6af797b..79f103a3b8f 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -89,44 +89,9 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag);
 void depsgraph_geometry_tag_to_component(const ID *id,
                                          eDepsNode_Type *component_type)
 {
-	const ID_Type id_type = GS(id->name);
-	switch (id_type) {
-		case ID_OB:
-		{
-			const Object *object = (Object *)id;
-			switch (object->type) {
-				case OB_MESH:
-				case OB_CURVE:
-				case OB_SURF:
-				case OB_FONT:
-				case OB_LATTICE:
-				case OB_MBALL:
-				case OB_GPENCIL:
-					*component_type = DEG_NODE_TYPE_GEOMETRY;
-					break;
-				case OB_ARMATURE:
-					*component_type = DEG_NODE_TYPE_EVAL_POSE;
-					break;
-					/* TODO(sergey): More cases here? */
-			}
-			break;
-		}
-		case ID_ME:
-			*component_type = DEG_NODE_TYPE_GEOMETRY;
-			break;
-		case ID_PA: /* Particles */
-			return;
-		case ID_LP:
-			*component_type = DEG_NODE_TYPE_PARAMETERS;
-			break;
-		case ID_GD:
-			*component_type = DEG_NODE_TYPE_GEOMETRY;
-			break;
-		case ID_PAL: /* Palettes */
-			*component_type = DEG_NODE_TYPE_PARAMETERS;
-			break;
-		default:
-			break;
+	const eDepsNode_Type result = deg_geometry_tag_to_component(id);
+	if (result != DEG_NODE_TYPE_UNDEFINED) {
+		*component_type = result;
 	}
 }
 
@@ -568,6 +533,44 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph)
 
 }  /* namespace */
 
+eDepsNode_Type deg_geometry_tag_to_component(const ID *id)
+{
+	const ID_Type id_type = GS(id->name);
+	switch (id_type) {
+		case ID_OB:
+		{
+			const Object *object = (Object *)id;
+			switch (object->type) {
+				case OB_MESH:
+				case OB_CURVE:
+				case OB_SURF:
+				case OB_FONT:
+				case OB_LATTICE:
+				case OB_MBALL:
+				case OB_GPENCIL:
+					return DEG_NODE_TYPE_GEOMETRY;
+				case OB_ARMATURE:
+					return DEG_NODE_TYPE_EVAL_POSE;
+					/* TODO(sergey): More cases here? */
+			}
+			break;
+		}
+		case ID_ME:
+			return DEG_NODE_TYPE_GEOMETRY;
+		case ID_PA: /* Particles */
+			return DEG_NODE_TYPE_UNDEFINED;
+		case ID_LP:
+			return DEG_NODE_TYPE_PARAMETERS;
+		case ID_GD:
+			return DEG_NODE_TYPE_GEOMETRY;
+		case ID_PAL: /* Palettes */
+			return DEG_NODE_TYPE_PARAMETERS;
+		default:
+			break;
+	}
+	return DEG_NODE_TYPE_UNDEFINED;
+}
+
 }  // namespace DEG
 
 const char *DEG_update_tag_as_string(eDepsgraph_Tag flag)



More information about the Bf-blender-cvs mailing list