[Bf-blender-cvs] [333d4f34475] blender2.8: Depsgraph: Use more const qualifiers

Sergey Sharybin noreply at git.blender.org
Wed Jan 17 12:27:55 CET 2018


Commit: 333d4f34475267e60b316cbe9c96dfebaca8d148
Author: Sergey Sharybin
Date:   Wed Jan 17 12:26:43 2018 +0100
Branches: blender2.8
https://developer.blender.org/rB333d4f34475267e60b316cbe9c96dfebaca8d148

Depsgraph: Use more const qualifiers

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

M	source/blender/depsgraph/DEG_depsgraph_query.h
M	source/blender/depsgraph/intern/depsgraph_query.cc

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

diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 83fb100436c..adfda27117e 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -53,19 +53,21 @@ extern "C" {
 bool DEG_id_type_tagged(struct Main *bmain, short id_type);
 
 /* Get additional evaluation flags for the given ID. */
-short DEG_get_eval_flags_for_id(struct Depsgraph *graph, struct ID *id);
+short DEG_get_eval_flags_for_id(const struct Depsgraph *graph, struct ID *id);
 
 /* Get scene the despgraph is created for. */
-struct Scene *DEG_get_evaluated_scene(struct Depsgraph *graph);
+struct Scene *DEG_get_evaluated_scene(const struct Depsgraph *graph);
 
 /* Get scene layer the despgraph is created for. */
-struct ViewLayer *DEG_get_evaluated_view_layer(struct Depsgraph *graph);
+struct ViewLayer *DEG_get_evaluated_view_layer(const struct Depsgraph *graph);
 
 /* Get evaluated version of object for given original one. */
-struct Object *DEG_get_evaluated_object(struct Depsgraph *depsgraph, struct Object *object);
+struct Object *DEG_get_evaluated_object(const struct Depsgraph *depsgraph,
+                                        struct Object *object);
 
 /* Get evaluated version of given ID datablock. */
-struct ID *DEG_get_evaluated_id(struct Depsgraph *depsgraph, struct ID *id);
+struct ID *DEG_get_evaluated_id(const struct Depsgraph *depsgraph,
+                                struct ID *id);
 
 /* ************************ DEG iterators ********************* */
 
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 98bf335f89e..63c9aa1407a 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -53,7 +53,7 @@ bool DEG_id_type_tagged(Main *bmain, short id_type)
 	return bmain->id_tag_update[BKE_idcode_to_index(id_type)] != 0;
 }
 
-short DEG_get_eval_flags_for_id(Depsgraph *graph, ID *id)
+short DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id)
 {
 	if (graph == NULL) {
 		/* Happens when converting objects to mesh from a python script
@@ -65,9 +65,8 @@ short DEG_get_eval_flags_for_id(Depsgraph *graph, ID *id)
 		return 0;
 	}
 
-	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
-
-	DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
+	const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
+	const DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
 	if (id_node == NULL) {
 		/* TODO(sergey): Does it mean we need to check set scene? */
 		return 0;
@@ -76,16 +75,16 @@ short DEG_get_eval_flags_for_id(Depsgraph *graph, ID *id)
 	return id_node->eval_flags;
 }
 
-Scene *DEG_get_evaluated_scene(Depsgraph *graph)
+Scene *DEG_get_evaluated_scene(const Depsgraph *graph)
 {
-	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
+	const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
 	Scene *scene_orig = deg_graph->scene;
 	return reinterpret_cast<Scene *>(deg_graph->get_cow_id(&scene_orig->id));
 }
 
-ViewLayer *DEG_get_evaluated_view_layer(Depsgraph *graph)
+ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph)
 {
-	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
+	const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph);
 	Scene *scene_cow = DEG_get_evaluated_scene(graph);
 	ViewLayer *view_layer_orig = deg_graph->view_layer;
 	ViewLayer *view_layer_cow =
@@ -95,19 +94,19 @@ ViewLayer *DEG_get_evaluated_view_layer(Depsgraph *graph)
 	return view_layer_cow;
 }
 
-Object *DEG_get_evaluated_object(Depsgraph *depsgraph, Object *object)
+Object *DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
 {
 	return (Object *)DEG_get_evaluated_id(depsgraph, &object->id);
 }
 
-ID *DEG_get_evaluated_id(struct Depsgraph *depsgraph, ID *id)
+ID *DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
 {
 	/* TODO(sergey): This is a duplicate of Depsgraph::get_cow_id(),
 	 * but here we never do assert, since we don't know nature of the
 	 * incoming ID datablock.
 	 */
-	DEG::Depsgraph *deg_graph = (DEG::Depsgraph *)depsgraph;
-	DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
+	const DEG::Depsgraph *deg_graph = (const DEG::Depsgraph *)depsgraph;
+	const DEG::IDDepsNode *id_node = deg_graph->find_id_node(id);
 	if (id_node == NULL) {
 		return id;
 	}



More information about the Bf-blender-cvs mailing list