From 27a1bd445bc157d0798a1106573d750208de9d2f Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 30 Nov 2017 16:44:35 +0100 Subject: 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. --- source/blender/depsgraph/DEG_depsgraph_query.h | 24 +++++++-------- source/blender/depsgraph/intern/depsgraph_query.cc | 26 ++++++++--------- source/blender/draw/intern/draw_manager.c | 6 ++-- source/blender/makesrna/intern/rna_depsgraph.c | 34 +++++++++++----------- source/blender/makesrna/intern/rna_layer.c | 2 +- 5 files changed, 46 insertions(+), 46 deletions(-) (limited to 'source/blender') 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(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(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(PointerRNA *ptr) { BLI_Iterator *iterator = ptr->data; - DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data; + DEGOIterObjectData *deg_iter = (DEGOIterObjectData *)iterator->data; return deg_iter->dupli_object_current->random_id; } static void rna_DepsgraphIter_uv_get(PointerRNA *ptr, float *uv) { BLI_Iterator *iterator = ptr->data; - DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data; + DEGOIterObjectData *deg_iter = (DEGOIterObjectData *)iterator->data; memcpy(uv, deg_iter->dupli_object_current->uv, sizeof(deg_iter->dupli_object_current->uv)); } @@ -114,7 +114,7 @@ static void rna_DepsgraphIter_uv_get(PointerRNA *ptr, float *uv) static int rna_DepsgraphIter_is_instance_get(PointerRNA *ptr) { BLI_Iterator *iterator = ptr->data; - DEGObjectsIteratorData *deg_iter = (DEGObjectsIteratorData *)iterator->data; + DEGOIterObjectData *deg_iter = (DEGOIterObjectData *)iterator->data; return (deg_iter->dupli_object_current != NULL); } @@ -149,25 +149,25 @@ static void rna_Depsgraph_debug_stats(Depsgraph *graph, char *result) static void rna_Depsgraph_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__); - DEGObjectsIteratorData *data = MEM_callocN(sizeof(DEGObjectsIteratorData), __func__); + DEGOIterObjectData *data = MEM_callocN(sizeof(DEGOIterObjectData), __func__); data->graph = (Depsgraph *)ptr->data; - data->flag = DEG_OBJECT_ITER_FLAG_SET; + data->flag = DEG_ITER_OBJECT_FLAG_SET; ((BLI_Iterator *)iter->internal.custom)->valid = true; - DEG_objects_iterator_begin(iter->internal.custom, data); + DEG_iterator_objects_begin(iter->internal.custom, data); iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid; } static void rna_Depsgraph_objects_next(CollectionPropertyIterator *iter) { - DEG_objects_iterator_next(iter->internal.custom); + DEG_iterator_objects_next(iter->internal.custom); iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid; } static void rna_Depsgraph_objects_end(CollectionPropertyIterator *iter) { - DEG_objects_iterator_end(iter->internal.custom); + DEG_iterator_objects_end(iter->internal.custom); MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data); MEM_freeN(iter->internal.custom); } @@ -186,25 +186,25 @@ static PointerRNA rna_Depsgraph_objects_get(CollectionPropertyIterator *iter) static void rna_Depsgraph_duplis_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__); - DEGObjectsIteratorData *data = MEM_callocN(sizeof(DEGObjectsIteratorData), __func__); + DEGOIterObjectData *data = MEM_callocN(sizeof(DEGOIterObjectData), __func__); data->graph = (Depsgraph *)ptr->data; - data->flag = DEG_OBJECT_ITER_FLAG_ALL; + data->flag = DEG_ITER_OBJECT_FLAG_ALL; ((BLI_Iterator *)iter->internal.custom)->valid = true; - DEG_objects_iterator_begin(iter->internal.custom, data); + DEG_iterator_objects_begin(iter->internal.custom, data); iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid; } static void rna_Depsgraph_duplis_next(CollectionPropertyIterator *iter) { - DEG_objects_iterator_next(iter->internal.custom); + DEG_iterator_objects_next(iter->internal.custom); iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid; } static void rna_Depsgraph_duplis_end(CollectionPropertyIterator *iter) { - DEG_objects_iterator_end(iter->internal.custom); + DEG_iterator_objects_end(iter->internal.custom); MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data); MEM_freeN(iter->internal.custom); } diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 4583774318b..2bdb3035073 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -863,7 +863,7 @@ static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, Po static void rna_ViewLayer_update_tagged(ViewLayer *UNUSED(view_layer), bContext *C) { Depsgraph *graph = CTX_data_depsgraph(C); - DEG_OBJECT_ITER(graph, ob, DEG_OBJECT_ITER_FLAG_ALL) + DEG_OBJECT_ITER(graph, ob, DEG_ITER_OBJECT_FLAG_ALL) { /* Don't do anything, we just need to run the iterator to flush * the base info to the objects. */ -- cgit v1.2.3