diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-06-06 17:01:51 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-06-06 17:44:51 +0300 |
commit | 4e213d42162b8d38435911352e52dbb609e36769 (patch) | |
tree | b70fd088d8ba5452aaf9fc4a88876a0cdfbdc2b1 | |
parent | 9a0506ea185c0ca6505e85ea0f5f5dc5fc48aa62 (diff) |
Depsgraph iterator: Remove explicit mode
We can get the mode from the depsgraph itself.
6 files changed, 11 insertions, 29 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h index 7a4d9a19335..1c4e11d1197 100644 --- a/source/blender/depsgraph/DEG_depsgraph_query.h +++ b/source/blender/depsgraph/DEG_depsgraph_query.h @@ -107,14 +107,8 @@ enum { DEG_ITER_OBJECT_FLAG_DUPLI = (1 << 4), }; -typedef enum eDepsObjectIteratorMode { - DEG_ITER_OBJECT_MODE_VIEWPORT = 0, - DEG_ITER_OBJECT_MODE_RENDER = 1, -} eDepsObjectIteratorMode; - typedef struct DEGObjectIterData { struct Depsgraph *graph; - eDepsObjectIteratorMode mode; int flag; struct Scene *scene; @@ -152,11 +146,10 @@ void DEG_iterator_objects_end(struct BLI_Iterator *iter); * Although they are available they have no overrides (collection_properties) * and will crash if you try to access it. */ -#define DEG_OBJECT_ITER_BEGIN(graph_, instance_, mode_, flag_) \ +#define DEG_OBJECT_ITER_BEGIN(graph_, instance_, flag_) \ { \ DEGObjectIterData data_ = { \ graph_, \ - mode_, \ flag_ \ }; \ \ @@ -172,8 +165,8 @@ void DEG_iterator_objects_end(struct BLI_Iterator *iter); /** * Depsgraph objects iterator for draw manager and final render */ -#define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(graph_, instance_, mode_) \ - DEG_OBJECT_ITER_BEGIN(graph_, instance_, mode_, \ +#define DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(graph_, instance_) \ + DEG_OBJECT_ITER_BEGIN(graph_, instance_, \ DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | \ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | \ DEG_ITER_OBJECT_FLAG_VISIBLE | \ diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index f9bc0da7d28..97a28038b7b 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -211,7 +211,9 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data) data->scene = DEG_get_evaluated_scene(depsgraph); data->id_node_index = 0; data->num_id_nodes = num_id_nodes; - data->visibility_check = (data->mode == DEG_ITER_OBJECT_MODE_RENDER) + eEvaluationMode eval_mode = DEG_get_mode(depsgraph); + /* Viewport rendered mode is DAG_EVAL_PREVIEW but still treated as viewport. */ + data->visibility_check = (eval_mode == DAG_EVAL_RENDER) ? OB_VISIBILITY_CHECK_FOR_RENDER : OB_VISIBILITY_CHECK_FOR_VIEWPORT; diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 935a6d362f1..9f1bfa6ee33 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -523,8 +523,6 @@ bool DRW_state_show_text(void); bool DRW_state_draw_support(void); bool DRW_state_draw_background(void); -enum eDepsObjectIteratorMode DRW_iterator_mode_get(void); - struct DRWTextStore *DRW_state_text_cache_get(void); /* Avoid too many lookups while drawing */ diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 63631dd4a18..a9263abbfaa 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1295,7 +1295,7 @@ void DRW_draw_render_loop_ex( PROFILE_START(stime); drw_engines_cache_init(); - DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob, DRW_iterator_mode_get()) + DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { drw_engines_cache_populate(ob); } @@ -1547,7 +1547,7 @@ void DRW_render_object_iter( { DRW_hair_init(); - DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob, DRW_iterator_mode_get()) + DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { DST.ob_state = NULL; callback(vedata, ob, engine, depsgraph); @@ -1692,7 +1692,7 @@ void DRW_draw_select_loop( } else { DEG_OBJECT_ITER_BEGIN( - depsgraph, ob, DRW_iterator_mode_get(), + depsgraph, ob, DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI) @@ -1863,7 +1863,7 @@ void DRW_draw_depth_loop( if (cache_is_dirty) { drw_engines_cache_init(); - DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob, DRW_iterator_mode_get()) + DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) { drw_engines_cache_populate(ob); } @@ -1978,15 +1978,6 @@ bool DRW_state_is_opengl_render(void) } /** - * Gives you the iterator mode to use for depsgraph. - */ -eDepsObjectIteratorMode DRW_iterator_mode_get(void) -{ - return DRW_state_is_scene_render() ? DEG_ITER_OBJECT_MODE_RENDER : - DEG_ITER_OBJECT_MODE_VIEWPORT; -} - -/** * Should text draw in this mode? */ bool DRW_state_show_text(void) diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp index 6cbdca756d5..f41a9b58085 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp @@ -95,7 +95,7 @@ NodeGroup *BlenderFileLoader::Load() int id = 0; DEG_OBJECT_ITER_BEGIN( - depsgraph, ob, DEG_ITER_OBJECT_MODE_RENDER, + depsgraph, ob, DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | DEG_ITER_OBJECT_FLAG_VISIBLE | diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index e0c9a901282..41e69b0d9d7 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -208,7 +208,6 @@ static void rna_Depsgraph_objects_begin(CollectionPropertyIterator *iter, Pointe data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET; - data->mode = DEG_ITER_OBJECT_MODE_RENDER; ((BLI_Iterator *)iter->internal.custom)->valid = true; DEG_iterator_objects_begin(iter->internal.custom, data); @@ -249,7 +248,6 @@ static void rna_Depsgraph_object_instances_begin(CollectionPropertyIterator *ite DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET | DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI; - data->mode = DEG_ITER_OBJECT_MODE_RENDER; ((BLI_Iterator *)iter->internal.custom)->valid = true; DEG_iterator_objects_begin(iter->internal.custom, data); |