[Bf-blender-cvs] [156c0ab255b] blender2.8: Depsgraph: Don't case ID_Type to short

Sergey Sharybin noreply at git.blender.org
Mon Aug 28 11:52:13 CEST 2017


Commit: 156c0ab255bb10db550b65a03bf0e9af019020ed
Author: Sergey Sharybin
Date:   Mon Aug 28 11:51:53 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB156c0ab255bb10db550b65a03bf0e9af019020ed

Depsgraph: Don't case ID_Type to short

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

M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/depsgraph.cc
M	source/blender/depsgraph/intern/depsgraph_tag.cc
M	source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 611eb2d7df9..18326baab45 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -974,7 +974,7 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
 	                        fcu->array_index);
 	bPoseChannel *pchan = NULL;
 	const char *rna_path = fcu->rna_path ? fcu->rna_path : "";
-	const short id_type = GS(id->name);
+	const ID_Type id_type = GS(id->name);
 
 	/* Create dependency between driver and data affected by it. */
 	/* - direct property relationship... */
@@ -1102,6 +1102,8 @@ void DepsgraphRelationBuilder::build_driver(ID *id, FCurve *fcu)
 				             "[Driver -> NTree Shading Update]");
 				break;
 			}
+			default:
+				break;
 		}
 	}
 	/* Ensure that affected prop's update callbacks will be triggered once
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 9664d389794..9f25fcaaa32 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -319,7 +319,7 @@ void Depsgraph::clear_id_nodes()
 		if (!deg_copy_on_write_is_expanded(id_node->id_cow)) {
 			continue;
 		}
-		const short id_type = GS(id_node->id_cow->name);
+		const ID_Type id_type = GS(id_node->id_cow->name);
 		if (id_type != ID_PA) {
 			id_node->destroy();
 		}
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc
index 6d5a2e3628e..46557b93aa5 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cc
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cc
@@ -151,7 +151,7 @@ void id_tag_update_object_transform(Depsgraph *graph, IDDepsNode *id_node)
 /* Tag corresponding to OB_RECALC_DATA. */
 void id_tag_update_object_data(Depsgraph *graph, IDDepsNode *id_node)
 {
-	const short id_type = GS(id_node->id_orig->name);
+	const ID_Type id_type = GS(id_node->id_orig->name);
 	ComponentDepsNode *data_comp = NULL;
 	switch (id_type) {
 		case ID_OB:
@@ -177,6 +177,8 @@ void id_tag_update_object_data(Depsgraph *graph, IDDepsNode *id_node)
 			break;
 		case ID_PA:
 			return;
+		default:
+			break;
 	}
 	if (data_comp == NULL) {
 #ifdef STRICT_COMPONENT_TAGGING
@@ -290,7 +292,7 @@ void deg_graph_id_tag_update(Main *bmain, Depsgraph *graph, ID *id, int flag)
 		id_tag_update_object_data(graph, id_node);
 #ifdef WITH_COPY_ON_WRITE
 		if (flag & DEG_TAG_COPY_ON_WRITE) {
-			const short id_type = GS(id_node->id_orig->name);
+			const ID_Type id_type = GS(id_node->id_orig->name);
 			if (id_type == ID_OB) {
 				Object *object = (Object *)id_node->id_orig;
 				ID *ob_data = (ID *)object->data;
@@ -334,7 +336,7 @@ void deg_graph_on_visible_update(Main *bmain, Scene *scene, Depsgraph *graph)
 	/* Make sure objects are up to date. */
 	GHASH_FOREACH_BEGIN(DEG::IDDepsNode *, id_node, graph->id_hash)
 	{
-		const short id_type = GS(id_node->id_orig->name);
+		const ID_Type id_type = GS(id_node->id_orig->name);
 		if (id_type != ID_OB) {
 			/* Ignore non-object nodes on visibility changes. */
 			continue;
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
index 63b52af7c70..bd1d0dc0504 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_copy_on_write.cc
@@ -320,7 +320,7 @@ BLI_INLINE bool check_datablock_expanded(const ID *id_cow)
  */
 static bool check_datablock_expanded_at_construction(const ID *id_orig)
 {
-	const short id_type = GS(id_orig->name);
+	const ID_Type id_type = GS(id_orig->name);
 	return (id_type == ID_SCE) ||
 	       (id_type == ID_OB && ((Object *)id_orig)->type == OB_ARMATURE) ||
 	       (id_type == ID_AR);
@@ -334,7 +334,7 @@ static bool check_datablock_expanded_at_construction(const ID *id_orig)
  */
 static bool check_datablocks_copy_on_writable(const ID *id_orig)
 {
-	const short id_type = GS(id_orig->name);
+	const ID_Type id_type = GS(id_orig->name);
 	/* We shouldn't bother if copied ID is same as original one. */
 	if (!deg_copy_on_write_is_needed(id_orig)) {
 		return false;
@@ -398,8 +398,8 @@ int foreach_libblock_remap_callback(void *user_data_v,
 				 * those or at least make it more reliable check where the
 				 * pointer is coming from.
 				 */
-				const short id_type = GS(id_orig->name);
-				const short id_type_self = GS(id_self->name);
+				const ID_Type id_type = GS(id_orig->name);
+				const ID_Type id_type_self = GS(id_self->name);
 				if (id_type == ID_OB && id_type_self == ID_SCE) {
 					IDDepsNode *id_node = depsgraph->find_id_node(id_orig);
 					if (id_node == NULL) {
@@ -433,7 +433,7 @@ int foreach_libblock_remap_callback(void *user_data_v,
 void update_special_pointers(const Depsgraph *depsgraph,
                              const ID *id_orig, ID *id_cow)
 {
-	const short type = GS(id_orig->name);
+	const ID_Type type = GS(id_orig->name);
 	switch (type) {
 		case ID_OB:
 		{
@@ -480,6 +480,8 @@ void update_special_pointers(const Depsgraph *depsgraph,
 			}
 			break;
 		}
+		default:
+			break;
 	}
 }
 
@@ -560,7 +562,7 @@ void update_copy_on_write_datablock(const Depsgraph *depsgraph,
                                     const ID *id_orig, ID *id_cow)
 {
 	bool ok = false;
-	const short id_type = GS(id_orig->name);
+	const ID_Type id_type = GS(id_orig->name);
 	switch (id_type) {
 		case ID_SCE: {
 			const Scene *scene_orig = (const Scene *)id_orig;
@@ -584,6 +586,8 @@ void update_copy_on_write_datablock(const Depsgraph *depsgraph,
 			/* Nothing to do currently. */
 			ok = true;
 			break;
+		default:
+			break;
 	}
 	// TODO(sergey): Other ID types here.
 	if (!ok) {
@@ -663,7 +667,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
 	 * or cases where we want to do something smarter than simple datablock
 	 * copy.
 	 */
-	const short id_type = GS(id_orig->name);
+	const ID_Type id_type = GS(id_orig->name);
 	switch (id_type) {
 		case ID_SCE:
 		{
@@ -680,6 +684,8 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
 			 */
 			break;
 		}
+		default:
+			break;
 	}
 	if (!done) {
 		if (id_copy_no_main(id_orig, &newid)) {
@@ -749,7 +755,7 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
                                        const IDDepsNode *id_node)
 {
 	const ID *id_orig = id_node->id_orig;
-	const short id_type = GS(id_orig->name);
+	const ID_Type id_type = GS(id_orig->name);
 	ID *id_cow = id_node->id_cow;
 	/* Similar to expansion, no need to do anything here. */
 	if (!deg_copy_on_write_is_needed(id_orig)) {
@@ -805,6 +811,8 @@ ID *deg_update_copy_on_write_datablock(const Depsgraph *depsgraph,
 				}
 				break;
 			}
+			default:
+				break;
 		}
 		if (gpumaterial_ptr != NULL) {
 			gpumaterial_backup = *gpumaterial_ptr;
@@ -860,7 +868,7 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
 		 */
 		return;
 	}
-	const short type = GS(id_cow->name);
+	const ID_Type type = GS(id_cow->name);
 #ifdef NESTED_ID_NASTY_WORKAROUND
 	nested_id_hack_discard_pointers(id_cow);
 #endif
@@ -896,6 +904,8 @@ void deg_free_copy_on_write_datablock(ID *id_cow)
 			id_cow->name[0] = '\0';
 			return;
 		}
+		default:
+			break;
 	}
 	BKE_libblock_free_datablock(id_cow, 0);
 	BKE_libblock_free_data(id_cow, false);
@@ -940,7 +950,7 @@ bool deg_copy_on_write_is_expanded(const ID *id_cow)
 
 bool deg_copy_on_write_is_needed(const ID *id_orig)
 {
-	const short id_type = GS(id_orig->name);
+	const ID_Type id_type = GS(id_orig->name);
 	return !ELEM(id_type, ID_IM);
 }



More information about the Bf-blender-cvs mailing list