Depsgraph iterator: Remove explicit mode
We can get the mode from the depsgraph itself.
This commit is contained in:
@@ -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 | \
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -1977,15 +1977,6 @@ bool DRW_state_is_opengl_render(void)
|
||||
return DST.options.is_image_render && !DST.options.is_scene_render;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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?
|
||||
*/
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user