[Bf-blender-cvs] [27a1bd445bc] blender2.8: Depsgraph: Cleanup, naming

Sergey Sharybin noreply at git.blender.org
Fri Dec 1 13:04:37 CET 2017


Commit: 27a1bd445bc157d0798a1106573d750208de9d2f
Author: Sergey Sharybin
Date:   Thu Nov 30 16:44:35 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB27a1bd445bc157d0798a1106573d750208de9d2f

Depsgraph: Cleanup, naming

It makes more sense to stick to DEG_iterator_object order in name, since we can
have functions to iterate over different entities and we want all of them to
have common prefix.

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

M	source/blender/depsgraph/DEG_depsgraph_query.h
M	source/blender/depsgraph/intern/depsgraph_query.cc
M	source/blender/draw/intern/draw_manager.c
M	source/blender/makesrna/intern/rna_depsgraph.c
M	source/blender/makesrna/intern/rna_layer.c

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

diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 36d44a06eac..dd7d6182081 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -70,13 +70,13 @@ struct ID *DEG_get_evaluated_id(struct Depsgraph *depsgraph, struct ID *id);
 /* ************************ DAG iterators ********************* */
 
 enum {
-	DEG_OBJECT_ITER_FLAG_SET = (1 << 0),
-	DEG_OBJECT_ITER_FLAG_DUPLI = (1 << 1),
+	DEG_ITER_OBJECT_FLAG_SET = (1 << 0),
+	DEG_ITER_OBJECT_FLAG_DUPLI = (1 << 1),
 };
 
-#define DEG_OBJECT_ITER_FLAG_ALL (DEG_OBJECT_ITER_FLAG_SET | DEG_OBJECT_ITER_FLAG_DUPLI)
+#define DEG_ITER_OBJECT_FLAG_ALL (DEG_ITER_OBJECT_FLAG_SET | DEG_ITER_OBJECT_FLAG_DUPLI)
 
-typedef struct DEGObjectsIteratorData {
+typedef struct DEGOIterObjectData {
 	struct Depsgraph *graph;
 	struct Scene *scene;
 	struct EvaluationContext eval_ctx;
@@ -103,22 +103,22 @@ typedef struct DEGObjectsIteratorData {
 	/* **** Iteration ober ID nodes **** */
 	size_t id_node_index;
 	size_t num_id_nodes;
-} DEGObjectsIteratorData;
+} DEGOIterObjectData;
 
-void DEG_objects_iterator_begin(struct BLI_Iterator *iter, DEGObjectsIteratorData *data);
-void DEG_objects_iterator_next(struct BLI_Iterator *iter);
-void DEG_objects_iterator_end(struct BLI_Iterator *iter);
+void DEG_iterator_objects_begin(struct BLI_Iterator *iter, DEGOIterObjectData *data);
+void DEG_iterator_objects_next(struct BLI_Iterator *iter);
+void DEG_iterator_objects_end(struct BLI_Iterator *iter);
 
 #define DEG_OBJECT_ITER(graph_, instance_, flag_)                                 \
 	{                                                                             \
-		DEGObjectsIteratorData data_ = {                                          \
+		DEGOIterObjectData data_ = {                                          \
 			.graph = (graph_),                                                    \
 			.flag = (flag_),                                                      \
 		};                                                                        \
                                                                                   \
-		ITER_BEGIN(DEG_objects_iterator_begin,                                    \
-		           DEG_objects_iterator_next,                                     \
-		           DEG_objects_iterator_end,                                      \
+		ITER_BEGIN(DEG_iterator_objects_begin,                                    \
+		           DEG_iterator_objects_next,                                     \
+		           DEG_iterator_objects_end,                                      \
 		           &data_, Object *, instance_)
 
 #define DEG_OBJECT_ITER_END                                                       \
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index f2288e93beb..992097c9d31 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -126,7 +126,7 @@ ID *DEG_get_evaluated_id(struct Depsgraph *depsgraph, ID *id)
 
 static bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
 {
-	DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
+	DEGOIterObjectData *data = (DEGOIterObjectData *)iter->data;
 	while (data->dupli_object_next != NULL) {
 		DupliObject *dob = data->dupli_object_next;
 		Object *obd = dob->ob;
@@ -166,12 +166,12 @@ static bool deg_objects_dupli_iterator_next(BLI_Iterator *iter)
 	return false;
 }
 
-static void deg_objects_iterator_step(BLI_Iterator *iter, DEG::IDDepsNode *id_node)
+static void DEG_iterator_objects_step(BLI_Iterator *iter, DEG::IDDepsNode *id_node)
 {
 	/* Reset the skip in case we are running from within a loop. */
 	iter->skip = false;
 
-	DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
+	DEGOIterObjectData *data = (DEGOIterObjectData *)iter->data;
 	const ID_Type id_type = GS(id_node->id_orig->name);
 
 	if (id_type != ID_OB) {
@@ -183,7 +183,7 @@ static void deg_objects_iterator_step(BLI_Iterator *iter, DEG::IDDepsNode *id_no
 		case DEG::DEG_ID_LINKED_DIRECTLY:
 			break;
 		case DEG::DEG_ID_LINKED_VIA_SET:
-			if (data->flag & DEG_OBJECT_ITER_FLAG_SET) {
+			if (data->flag & DEG_ITER_OBJECT_FLAG_SET) {
 				break;
 			}
 			else {
@@ -197,7 +197,7 @@ static void deg_objects_iterator_step(BLI_Iterator *iter, DEG::IDDepsNode *id_no
 	Object *object = (Object *)id_node->id_cow;
 	BLI_assert(DEG::deg_validate_copy_on_write_datablock(&object->id));
 
-	if ((data->flag & DEG_OBJECT_ITER_FLAG_DUPLI) && (object->transflag & OB_DUPLI)) {
+	if ((data->flag & DEG_ITER_OBJECT_FLAG_DUPLI) && (object->transflag & OB_DUPLI)) {
 		data->dupli_parent = object;
 		data->dupli_list = object_duplilist(&data->eval_ctx, data->scene, object);
 		data->dupli_object_next = (DupliObject *)data->dupli_list->first;
@@ -206,7 +206,7 @@ static void deg_objects_iterator_step(BLI_Iterator *iter, DEG::IDDepsNode *id_no
 	iter->current = object;
 }
 
-void DEG_objects_iterator_begin(BLI_Iterator *iter, DEGObjectsIteratorData *data)
+void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGOIterObjectData *data)
 {
 	Depsgraph *depsgraph = data->graph;
 	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
@@ -231,16 +231,16 @@ void DEG_objects_iterator_begin(BLI_Iterator *iter, DEGObjectsIteratorData *data
 	data->num_id_nodes = num_id_nodes;
 
 	DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
-	deg_objects_iterator_step(iter, id_node);
+	DEG_iterator_objects_step(iter, id_node);
 
 	if (iter->skip) {
-		DEG_objects_iterator_next(iter);
+		DEG_iterator_objects_next(iter);
 	}
 }
 
-void DEG_objects_iterator_next(BLI_Iterator *iter)
+void DEG_iterator_objects_next(BLI_Iterator *iter)
 {
-	DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
+	DEGOIterObjectData *data = (DEGOIterObjectData *)iter->data;
 	Depsgraph *depsgraph = data->graph;
 	DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
 	do {
@@ -264,14 +264,14 @@ void DEG_objects_iterator_next(BLI_Iterator *iter)
 		}
 
 		DEG::IDDepsNode *id_node = deg_graph->id_nodes[data->id_node_index];
-		deg_objects_iterator_step(iter, id_node);
+		DEG_iterator_objects_step(iter, id_node);
 	} while (iter->skip);
 }
 
-void DEG_objects_iterator_end(BLI_Iterator *iter)
+void DEG_iterator_objects_end(BLI_Iterator *iter)
 {
 #ifndef NDEBUG
-	DEGObjectsIteratorData *data = (DEGObjectsIteratorData *)iter->data;
+	DEGOIterObjectData *data = (DEGOIterObjectData *)iter->data;
 	/* Force crash in case the iterator data is referenced and accessed down the line. (T51718) */
 	memset(&data->temp_dupli_object, 0xff, sizeof(data->temp_dupli_object));
 #else
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 57dd2e9cf5d..436bcbaad9f 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -3386,7 +3386,7 @@ void DRW_draw_render_loop_ex(
 		PROFILE_START(stime);
 		drw_engines_cache_init();
 
-		DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_ALL);
+		DEG_OBJECT_ITER(graph, ob, DEG_ITER_OBJECT_FLAG_ALL);
 		{
 			drw_engines_cache_populate(ob);
 		}
@@ -3595,7 +3595,7 @@ void DRW_draw_select_loop(
 			drw_engines_cache_populate(scene->obedit);
 		}
 		else {
-			DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_DUPLI)
+			DEG_OBJECT_ITER(graph, ob, DEG_ITER_OBJECT_FLAG_DUPLI)
 			{
 				if ((ob->base_flag & BASE_SELECTABLED) != 0) {
 					DRW_select_load_id(ob->select_color);
@@ -3687,7 +3687,7 @@ void DRW_draw_depth_loop(
 	if (cache_is_dirty) {
 		drw_engines_cache_init();
 
-		DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_ALL)
+		DEG_OBJECT_ITER(graph, ob, DEG_ITER_OBJECT_FLAG_ALL)
 		{
 			drw_engines_cache_populate(ob);
 		}
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index 04c8352833e..7d520ec6abd 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -61,7 +61,7 @@ static PointerRNA rna_DepsgraphIter_object_get(PointerRNA *ptr)
 static PointerRNA rna_DepsgraphIter_instance_object_get(PointerRNA *ptr)
 {
 	BLI_Iterator *iterator = ptr->data;
-	DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data;
+	DEGOIterObjectData *deg_iter = (DEGOIterObjectData *)iterator->data;
 	Object *instance_object = NULL;
 	if (deg_iter->dupli_object_current != NULL) {
 		instance_object = deg_iter->dupli_object_current->ob;
@@ -72,7 +72,7 @@ static PointerRNA rna_DepsgraphIter_instance_object_get(PointerRNA *ptr)
 static PointerRNA rna_DepsgraphIter_parent_get(PointerRNA *ptr)
 {
 	BLI_Iterator *iterator = ptr->data;
-	DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data;
+	DEGOIterObjectData *deg_iter = (DEGOIterObjectData *)iterator->data;
 	Object *dupli_parent = NULL;
 	if (deg_iter->dupli_object_current != NULL) {
 		dupli_parent = deg_iter->dupli_parent;
@@ -83,7 +83,7 @@ static PointerRNA rna_DepsgraphIter_parent_get(PointerRNA *ptr)
 static void rna_DepsgraphIter_persistent_id_get(PointerRNA *ptr, int *persistent_id)
 {
 	BLI_Iterator *iterator = ptr->data;
-	DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data;
+	DEGOIterObjectData *deg_iter = (DEGOIterObjectData *)iterator->data;
 	memcpy(persistent_id, deg_iter->dupli_object_current->persistent_id,
 	       sizeof(deg_iter->dupli_object_current->persistent_id));
 }
@@ -91,7 +91,7 @@ static void rna_DepsgraphIter_persistent_id_get(PointerRNA *ptr, int *persistent
 static void rna_DepsgraphIter_orco_get(PointerRNA *ptr, float *orco)
 {
 	BLI_Iterator *iterator = ptr->data;
-	DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data;
+	DEGOIterObjectData *deg_iter = (DEGOIterObjectData *)iterator->data;
 	memcpy(orco, deg_iter->dupli_object_current->orco,
 	       sizeof(deg_iter->dupli_object_current->orco));
 }
@@ -99,14 +99,14 @@ static void rna_DepsgraphIter_orco_get(PointerRNA *ptr, float *orco)
 static unsigned int rna_DepsgraphIter_random_id_get(Poi

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list