diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/engines/external/external_engine.c | 4 | ||||
-rw-r--r-- | source/blender/editors/render/render_update.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 20 | ||||
-rw-r--r-- | source/blender/render/extern/include/RE_engine.h | 8 |
4 files changed, 28 insertions, 9 deletions
diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c index 643f51facd4..1223e31b891 100644 --- a/source/blender/draw/engines/external/external_engine.c +++ b/source/blender/draw/engines/external/external_engine.c @@ -221,7 +221,7 @@ static void external_draw_scene_do(void *vedata) RenderEngine *engine = RE_engine_create_ex(engine_type, true); engine->tile_x = scene->r.tilex; engine->tile_y = scene->r.tiley; - engine_type->view_update(engine, draw_ctx->evil_C); + engine_type->view_update(engine, draw_ctx->evil_C, draw_ctx->depsgraph); rv3d->render_engine = engine; } @@ -231,7 +231,7 @@ static void external_draw_scene_do(void *vedata) /* Render result draw. */ type = rv3d->render_engine->type; - type->view_draw(rv3d->render_engine, draw_ctx->evil_C); + type->view_draw(rv3d->render_engine, draw_ctx->evil_C, draw_ctx->depsgraph); GPU_matrix_pop_projection(); diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 55353039b24..64869b71746 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -132,7 +132,10 @@ void ED_render_scene_update(const DEGEditorUpdateContext *update_ctx, int update CTX_wm_region_set(C, ar); engine->flag &= ~RE_ENGINE_DO_UPDATE; - engine->type->view_update(engine, C); + /* NOTE: Important to pass non-updated depsgraph, This is because this function is called + * from inside dependency graph evaluation. Additionally, if we pass fully evaluated one + * we will loose updates stored in the graph. */ + engine->type->view_update(engine, C, CTX_data_depsgraph(C)); } else { RenderEngineType *engine_type = ED_view3d_engine_type(scene, v3d->shading.type); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 81ec7857487..2dc873ca17d 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -206,7 +206,9 @@ static void engine_bake(RenderEngine *engine, RNA_parameter_list_free(&list); } -static void engine_view_update(RenderEngine *engine, const struct bContext *context) +static void engine_view_update(RenderEngine *engine, + const struct bContext *context, + Depsgraph *depsgraph) { extern FunctionRNA rna_RenderEngine_view_update_func; PointerRNA ptr; @@ -218,12 +220,15 @@ static void engine_view_update(RenderEngine *engine, const struct bContext *cont RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &context); + RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); } -static void engine_view_draw(RenderEngine *engine, const struct bContext *context) +static void engine_view_draw(RenderEngine *engine, + const struct bContext *context, + Depsgraph *depsgraph) { extern FunctionRNA rna_RenderEngine_view_draw_func; PointerRNA ptr; @@ -235,6 +240,7 @@ static void engine_view_draw(RenderEngine *engine, const struct bContext *contex RNA_parameter_list_create(&list, &ptr, func); RNA_parameter_set_lookup(&list, "context", &context); + RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph); engine->type->ext.call(NULL, &ptr, func, &list); RNA_parameter_list_free(&list); @@ -554,12 +560,18 @@ static void rna_def_render_engine(BlenderRNA *brna) func = RNA_def_function(srna, "view_update", NULL); RNA_def_function_ui_description(func, "Update on data changes for viewport render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE); - RNA_def_pointer(func, "context", "Context", "", ""); + parm = RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); func = RNA_def_function(srna, "view_draw", NULL); RNA_def_function_ui_description(func, "Draw viewport render"); RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); - RNA_def_pointer(func, "context", "Context", "", ""); + parm = RNA_def_pointer(func, "context", "Context", "", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", ""); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); /* shader script callbacks */ func = RNA_def_function(srna, "update_script_node", NULL); diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index 1092ab553e9..4f51f9874f8 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -93,8 +93,12 @@ typedef struct RenderEngineType { const int depth, void *result); - void (*view_update)(struct RenderEngine *engine, const struct bContext *context); - void (*view_draw)(struct RenderEngine *engine, const struct bContext *context); + void (*view_update)(struct RenderEngine *engine, + const struct bContext *context, + struct Depsgraph *depsgraph); + void (*view_draw)(struct RenderEngine *engine, + const struct bContext *context, + struct Depsgraph *depsgraph); void (*update_script_node)(struct RenderEngine *engine, struct bNodeTree *ntree, |