Depsgraph: simplify build API

Reviewers: sergey, sybren

Differential Revision: https://developer.blender.org/D8611
This commit is contained in:
2020-08-18 15:51:32 +02:00
parent d9f7cbb8af
commit 6a4f5e6a8c
31 changed files with 61 additions and 122 deletions

View File

@@ -1485,7 +1485,7 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on
for (int pass = 0; pass < 2; pass++) { for (int pass = 0; pass < 2; pass++) {
/* (Re-)build dependency graph if needed. */ /* (Re-)build dependency graph if needed. */
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); DEG_graph_relations_update(depsgraph);
/* Uncomment this to check if graph was properly tagged for update. */ /* Uncomment this to check if graph was properly tagged for update. */
// DEG_debug_graph_relations_validate(depsgraph, bmain, scene); // DEG_debug_graph_relations_validate(depsgraph, bmain, scene);
/* Flush editing data if needed. */ /* Flush editing data if needed. */
@@ -1512,7 +1512,7 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on
* be tagged for an update anyway. * be tagged for an update anyway.
* *
* If there are no relations changed by the callback this call will do nothing. */ * If there are no relations changed by the callback this call will do nothing. */
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); DEG_graph_relations_update(depsgraph);
} }
/* Inform editors about possible changes. */ /* Inform editors about possible changes. */
DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, false); DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, false);
@@ -1556,7 +1556,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
*/ */
BKE_image_editors_update_frame(bmain, scene->r.cfra); BKE_image_editors_update_frame(bmain, scene->r.cfra);
BKE_sound_set_cfra(scene->r.cfra); BKE_sound_set_cfra(scene->r.cfra);
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); DEG_graph_relations_update(depsgraph);
/* Update all objects: drivers, matrices, displists, etc. flags set /* Update all objects: drivers, matrices, displists, etc. flags set
* by depgraph or manual, no layer check here, gets correct flushed. * by depgraph or manual, no layer check here, gets correct flushed.
* *
@@ -1579,7 +1579,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph)
/* NOTE: Similar to this case in scene_graph_update_tagged(). Need to ensure that /* NOTE: Similar to this case in scene_graph_update_tagged(). Need to ensure that
* DEG_ids_clear_recalc() doesn't access freed memory of possibly removed ID. */ * DEG_ids_clear_recalc() doesn't access freed memory of possibly removed ID. */
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); DEG_graph_relations_update(depsgraph);
} }
/* Inform editors about possible changes. */ /* Inform editors about possible changes. */

View File

@@ -220,7 +220,7 @@ static void seq_prefetch_init_depsgraph(PrefetchJob *pfjob)
DEG_debug_name_set(pfjob->depsgraph, "SEQUENCER PREFETCH"); DEG_debug_name_set(pfjob->depsgraph, "SEQUENCER PREFETCH");
/* Make sure there is a correct evaluated scene pointer. */ /* Make sure there is a correct evaluated scene pointer. */
DEG_graph_build_for_render_pipeline(pfjob->depsgraph, bmain, scene, view_layer); DEG_graph_build_for_render_pipeline(pfjob->depsgraph);
/* Update immediately so we have proper evaluated scene. */ /* Update immediately so we have proper evaluated scene. */
seq_prefetch_update_depsgraph(pfjob); seq_prefetch_update_depsgraph(pfjob);

View File

@@ -148,7 +148,7 @@ void BlendfileLoadingBaseTest::depsgraph_create(eEvaluationMode depsgraph_evalua
{ {
depsgraph = DEG_graph_new( depsgraph = DEG_graph_new(
bfile->main, bfile->curscene, bfile->cur_view_layer, depsgraph_evaluation_mode); bfile->main, bfile->curscene, bfile->cur_view_layer, depsgraph_evaluation_mode);
DEG_graph_build_from_view_layer(depsgraph, bfile->main, bfile->curscene, bfile->cur_view_layer); DEG_graph_build_from_view_layer(depsgraph);
BKE_scene_graph_update_tagged(depsgraph, bfile->main); BKE_scene_graph_update_tagged(depsgraph, bfile->main);
} }

View File

@@ -51,50 +51,29 @@ extern "C" {
/* Graph Building -------------------------------- */ /* Graph Building -------------------------------- */
/* Build depsgraph for the given scene, and dump results in given graph container. */ /* Build depsgraph for the given scene, and dump results in given graph container. */
void DEG_graph_build_from_view_layer(struct Depsgraph *graph, void DEG_graph_build_from_view_layer(struct Depsgraph *graph);
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer);
/* Build depsgraph for all objects (so also invisible ones) in the given view layer. */ /* Build depsgraph for all objects (so also invisible ones) in the given view layer. */
void DEG_graph_build_for_all_objects(struct Depsgraph *graph, void DEG_graph_build_for_all_objects(struct Depsgraph *graph);
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer);
/* Special version of builder which produces dependency graph suitable for the render pipeline. /* Special version of builder which produces dependency graph suitable for the render pipeline.
* It will contain sequencer and compositor (if needed) and all their dependencies. */ * It will contain sequencer and compositor (if needed) and all their dependencies. */
void DEG_graph_build_for_render_pipeline(struct Depsgraph *graph, void DEG_graph_build_for_render_pipeline(struct Depsgraph *graph);
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer);
/* Builds minimal dependency graph for compositor preview. /* Builds minimal dependency graph for compositor preview.
* *
* Note that compositor editor might have pinned node tree, which is different from scene's node * Note that compositor editor might have pinned node tree, which is different from scene's node
* tree. * tree.
*/ */
void DEG_graph_build_for_compositor_preview(struct Depsgraph *graph, void DEG_graph_build_for_compositor_preview(struct Depsgraph *graph, struct bNodeTree *nodetree);
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer,
struct bNodeTree *nodetree);
void DEG_graph_build_from_ids(struct Depsgraph *graph, void DEG_graph_build_from_ids(struct Depsgraph *graph, struct ID **ids, const int num_ids);
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer,
struct ID **ids,
const int num_ids);
/* Tag relations from the given graph for update. */ /* Tag relations from the given graph for update. */
void DEG_graph_tag_relations_update(struct Depsgraph *graph); void DEG_graph_tag_relations_update(struct Depsgraph *graph);
/* Create or update relations in the specified graph. */ /* Create or update relations in the specified graph. */
void DEG_graph_relations_update(struct Depsgraph *graph, void DEG_graph_relations_update(struct Depsgraph *graph);
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer);
/* Tag all relations in the database for update.*/ /* Tag all relations in the database for update.*/
void DEG_relations_tag_update(struct Main *bmain); void DEG_relations_tag_update(struct Main *bmain);

View File

@@ -33,14 +33,11 @@
namespace blender { namespace blender {
namespace deg { namespace deg {
AbstractBuilderPipeline::AbstractBuilderPipeline(::Depsgraph *graph, AbstractBuilderPipeline::AbstractBuilderPipeline(::Depsgraph *graph)
Main *bmain,
Scene *scene,
ViewLayer *view_layer)
: deg_graph_(reinterpret_cast<Depsgraph *>(graph)), : deg_graph_(reinterpret_cast<Depsgraph *>(graph)),
bmain_(bmain), bmain_(deg_graph_->bmain),
scene_(scene), scene_(deg_graph_->scene),
view_layer_(view_layer), view_layer_(deg_graph_->view_layer),
builder_cache_() builder_cache_()
{ {
} }

View File

@@ -49,7 +49,7 @@ class DepsgraphRelationBuilder;
*/ */
class AbstractBuilderPipeline { class AbstractBuilderPipeline {
public: public:
AbstractBuilderPipeline(::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer); AbstractBuilderPipeline(::Depsgraph *graph);
virtual ~AbstractBuilderPipeline(); virtual ~AbstractBuilderPipeline();
void build(); void build();

View File

@@ -58,11 +58,8 @@ class AllObjectsRelationBuilder : public DepsgraphRelationBuilder {
} // namespace } // namespace
AllObjectsBuilderPipeline::AllObjectsBuilderPipeline(::Depsgraph *graph, AllObjectsBuilderPipeline::AllObjectsBuilderPipeline(::Depsgraph *graph)
Main *bmain, : ViewLayerBuilderPipeline(graph)
Scene *scene,
ViewLayer *view_layer)
: ViewLayerBuilderPipeline(graph, bmain, scene, view_layer)
{ {
} }

View File

@@ -33,7 +33,7 @@ namespace deg {
* (and their dependencies). */ * (and their dependencies). */
class AllObjectsBuilderPipeline : public ViewLayerBuilderPipeline { class AllObjectsBuilderPipeline : public ViewLayerBuilderPipeline {
public: public:
AllObjectsBuilderPipeline(::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer); AllObjectsBuilderPipeline(::Depsgraph *graph);
protected: protected:
virtual unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override; virtual unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;

View File

@@ -26,9 +26,8 @@
namespace blender { namespace blender {
namespace deg { namespace deg {
CompositorBuilderPipeline::CompositorBuilderPipeline( CompositorBuilderPipeline::CompositorBuilderPipeline(::Depsgraph *graph, bNodeTree *nodetree)
::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer, bNodeTree *nodetree) : AbstractBuilderPipeline(graph), nodetree_(nodetree)
: AbstractBuilderPipeline(graph, bmain, scene, view_layer), nodetree_(nodetree)
{ {
deg_graph_->is_render_pipeline_depsgraph = true; deg_graph_->is_render_pipeline_depsgraph = true;
} }

View File

@@ -32,8 +32,7 @@ namespace deg {
class CompositorBuilderPipeline : public AbstractBuilderPipeline { class CompositorBuilderPipeline : public AbstractBuilderPipeline {
public: public:
CompositorBuilderPipeline( CompositorBuilderPipeline(::Depsgraph *graph, bNodeTree *nodetree);
::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer, bNodeTree *nodetree);
protected: protected:
virtual void build_nodes(DepsgraphNodeBuilder &node_builder) override; virtual void build_nodes(DepsgraphNodeBuilder &node_builder) override;

View File

@@ -114,9 +114,8 @@ class DepsgraphFromIDsRelationBuilder : public DepsgraphRelationBuilder {
} // namespace } // namespace
FromIDsBuilderPipeline::FromIDsBuilderPipeline( FromIDsBuilderPipeline::FromIDsBuilderPipeline(::Depsgraph *graph, Span<ID *> ids)
::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer, Span<ID *> ids) : AbstractBuilderPipeline(graph), ids_(ids)
: AbstractBuilderPipeline(graph, bmain, scene, view_layer), ids_(ids)
{ {
} }

View File

@@ -43,8 +43,7 @@ namespace deg {
class FromIDsBuilderPipeline : public AbstractBuilderPipeline { class FromIDsBuilderPipeline : public AbstractBuilderPipeline {
public: public:
FromIDsBuilderPipeline( FromIDsBuilderPipeline(::Depsgraph *graph, Span<ID *> ids);
::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer, Span<ID *> ids);
protected: protected:
virtual unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override; virtual unique_ptr<DepsgraphNodeBuilder> construct_node_builder() override;

View File

@@ -26,11 +26,7 @@
namespace blender { namespace blender {
namespace deg { namespace deg {
RenderBuilderPipeline::RenderBuilderPipeline(::Depsgraph *graph, RenderBuilderPipeline::RenderBuilderPipeline(::Depsgraph *graph) : AbstractBuilderPipeline(graph)
Main *bmain,
Scene *scene,
ViewLayer *view_layer)
: AbstractBuilderPipeline(graph, bmain, scene, view_layer)
{ {
deg_graph_->is_render_pipeline_depsgraph = true; deg_graph_->is_render_pipeline_depsgraph = true;
} }

View File

@@ -30,7 +30,7 @@ namespace deg {
class RenderBuilderPipeline : public AbstractBuilderPipeline { class RenderBuilderPipeline : public AbstractBuilderPipeline {
public: public:
RenderBuilderPipeline(::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer); RenderBuilderPipeline(::Depsgraph *graph);
protected: protected:
virtual void build_nodes(DepsgraphNodeBuilder &node_builder) override; virtual void build_nodes(DepsgraphNodeBuilder &node_builder) override;

View File

@@ -26,11 +26,8 @@
namespace blender { namespace blender {
namespace deg { namespace deg {
ViewLayerBuilderPipeline::ViewLayerBuilderPipeline(::Depsgraph *graph, ViewLayerBuilderPipeline::ViewLayerBuilderPipeline(::Depsgraph *graph)
Main *bmain, : AbstractBuilderPipeline(graph)
Scene *scene,
ViewLayer *view_layer)
: AbstractBuilderPipeline(graph, bmain, scene, view_layer)
{ {
} }

View File

@@ -30,7 +30,7 @@ namespace deg {
class ViewLayerBuilderPipeline : public AbstractBuilderPipeline { class ViewLayerBuilderPipeline : public AbstractBuilderPipeline {
public: public:
ViewLayerBuilderPipeline(::Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer); ViewLayerBuilderPipeline(::Depsgraph *graph);
protected: protected:
virtual void build_nodes(DepsgraphNodeBuilder &node_builder) override; virtual void build_nodes(DepsgraphNodeBuilder &node_builder) override;

View File

@@ -210,49 +210,33 @@ struct Depsgraph *DEG_get_graph_from_handle(struct DepsNodeHandle *node_handle)
/* Graph Building API's */ /* Graph Building API's */
/* Build depsgraph for the given scene layer, and dump results in given graph container. */ /* Build depsgraph for the given scene layer, and dump results in given graph container. */
void DEG_graph_build_from_view_layer(Depsgraph *graph, void DEG_graph_build_from_view_layer(Depsgraph *graph)
Main *bmain,
Scene *scene,
ViewLayer *view_layer)
{ {
deg::ViewLayerBuilderPipeline builder(graph, bmain, scene, view_layer); deg::ViewLayerBuilderPipeline builder(graph);
builder.build(); builder.build();
} }
void DEG_graph_build_for_all_objects(struct Depsgraph *graph, void DEG_graph_build_for_all_objects(struct Depsgraph *graph)
struct Main *bmain,
struct Scene *scene,
struct ViewLayer *view_layer)
{ {
deg::AllObjectsBuilderPipeline builder(graph, bmain, scene, view_layer); deg::AllObjectsBuilderPipeline builder(graph);
builder.build(); builder.build();
} }
void DEG_graph_build_for_render_pipeline(Depsgraph *graph, void DEG_graph_build_for_render_pipeline(Depsgraph *graph)
Main *bmain,
Scene *scene,
ViewLayer *view_layer)
{ {
deg::RenderBuilderPipeline builder(graph, bmain, scene, view_layer); deg::RenderBuilderPipeline builder(graph);
builder.build(); builder.build();
} }
void DEG_graph_build_for_compositor_preview( void DEG_graph_build_for_compositor_preview(Depsgraph *graph, bNodeTree *nodetree)
Depsgraph *graph, Main *bmain, Scene *scene, struct ViewLayer *view_layer, bNodeTree *nodetree)
{ {
deg::CompositorBuilderPipeline builder(graph, bmain, scene, view_layer, nodetree); deg::CompositorBuilderPipeline builder(graph, nodetree);
builder.build(); builder.build();
} }
void DEG_graph_build_from_ids(Depsgraph *graph, void DEG_graph_build_from_ids(Depsgraph *graph, ID **ids, const int num_ids)
Main *bmain,
Scene *scene,
ViewLayer *view_layer,
ID **ids,
const int num_ids)
{ {
deg::FromIDsBuilderPipeline builder( deg::FromIDsBuilderPipeline builder(graph, blender::Span(ids, num_ids));
graph, bmain, scene, view_layer, blender::Span(ids, num_ids));
builder.build(); builder.build();
} }
@@ -275,14 +259,14 @@ void DEG_graph_tag_relations_update(Depsgraph *graph)
} }
/* Create or update relations in the specified graph. */ /* Create or update relations in the specified graph. */
void DEG_graph_relations_update(Depsgraph *graph, Main *bmain, Scene *scene, ViewLayer *view_layer) void DEG_graph_relations_update(Depsgraph *graph)
{ {
deg::Depsgraph *deg_graph = (deg::Depsgraph *)graph; deg::Depsgraph *deg_graph = (deg::Depsgraph *)graph;
if (!deg_graph->need_update) { if (!deg_graph->need_update) {
/* Graph is up to date, nothing to do. */ /* Graph is up to date, nothing to do. */
return; return;
} }
DEG_graph_build_from_view_layer(graph, bmain, scene, view_layer); DEG_graph_build_from_view_layer(graph);
} }
/* Tag all relations for update. */ /* Tag all relations for update. */

View File

@@ -93,7 +93,7 @@ bool DEG_debug_graph_relations_validate(Depsgraph *graph,
{ {
Depsgraph *temp_depsgraph = DEG_graph_new(bmain, scene, view_layer, DEG_get_mode(graph)); Depsgraph *temp_depsgraph = DEG_graph_new(bmain, scene, view_layer, DEG_get_mode(graph));
bool valid = true; bool valid = true;
DEG_graph_build_from_view_layer(temp_depsgraph, bmain, scene, view_layer); DEG_graph_build_from_view_layer(temp_depsgraph);
if (!DEG_debug_compare(temp_depsgraph, graph)) { if (!DEG_debug_compare(temp_depsgraph, graph)) {
fprintf(stderr, "ERROR! Depsgraph wasn't tagged for update when it should have!\n"); fprintf(stderr, "ERROR! Depsgraph wasn't tagged for update when it should have!\n");
BLI_assert(!"This should not happen!"); BLI_assert(!"This should not happen!");

View File

@@ -1302,7 +1302,7 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float
EEVEE_LightBake *lbake = (EEVEE_LightBake *)custom_data; EEVEE_LightBake *lbake = (EEVEE_LightBake *)custom_data;
Depsgraph *depsgraph = lbake->depsgraph; Depsgraph *depsgraph = lbake->depsgraph;
DEG_graph_relations_update(depsgraph, lbake->bmain, lbake->scene, lbake->view_layer_input); DEG_graph_relations_update(depsgraph);
DEG_evaluate_on_framechange(lbake->bmain, depsgraph, lbake->frame); DEG_evaluate_on_framechange(lbake->bmain, depsgraph, lbake->frame);
lbake->view_layer = DEG_get_evaluated_view_layer(depsgraph); lbake->view_layer = DEG_get_evaluated_view_layer(depsgraph);

View File

@@ -91,7 +91,7 @@ Depsgraph *animviz_depsgraph_build(Main *bmain,
} }
/* Build graph from all requested IDs. */ /* Build graph from all requested IDs. */
DEG_graph_build_from_ids(depsgraph, bmain, scene, view_layer, ids, num_ids); DEG_graph_build_from_ids(depsgraph, ids, num_ids);
MEM_freeN(ids); MEM_freeN(ids);
/* Update once so we can access pointers of evaluated animation data. */ /* Update once so we can access pointers of evaluated animation data. */

View File

@@ -745,7 +745,7 @@ static int bake(Render *re,
/* We build a depsgraph for the baking, /* We build a depsgraph for the baking,
* so we don't need to change the original data to adjust visibility and modifiers. */ * so we don't need to change the original data to adjust visibility and modifiers. */
Depsgraph *depsgraph = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_RENDER); Depsgraph *depsgraph = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_RENDER);
DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer); DEG_graph_build_from_view_layer(depsgraph);
int op_result = OPERATOR_CANCELLED; int op_result = OPERATOR_CANCELLED;
bool ok = false; bool ok = false;

View File

@@ -119,7 +119,7 @@ void ED_scene_change_update(Main *bmain, Scene *scene, ViewLayer *layer)
Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, layer, true); Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, layer, true);
BKE_scene_set_background(bmain, scene); BKE_scene_set_background(bmain, scene);
DEG_graph_relations_update(depsgraph, bmain, scene, layer); DEG_graph_relations_update(depsgraph);
DEG_on_visible_update(bmain, false); DEG_on_visible_update(bmain, false);
ED_render_engine_changed(bmain, false); ED_render_engine_changed(bmain, false);

View File

@@ -207,8 +207,7 @@ static void compo_initjob(void *cjv)
ViewLayer *view_layer = cj->view_layer; ViewLayer *view_layer = cj->view_layer;
cj->compositor_depsgraph = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_RENDER); cj->compositor_depsgraph = DEG_graph_new(bmain, scene, view_layer, DAG_EVAL_RENDER);
DEG_graph_build_for_compositor_preview( DEG_graph_build_for_compositor_preview(cj->compositor_depsgraph, cj->ntree);
cj->compositor_depsgraph, bmain, scene, view_layer, cj->ntree);
/* NOTE: Don't update animation to preserve unkeyed changes, this means can not use /* NOTE: Don't update animation to preserve unkeyed changes, this means can not use
* evaluate_on_framechange. */ * evaluate_on_framechange. */

View File

@@ -357,7 +357,7 @@ static void set_trans_object_base_flags(TransInfo *t)
/* Makes sure base flags and object flags are identical. */ /* Makes sure base flags and object flags are identical. */
BKE_scene_base_flag_to_objects(t->view_layer); BKE_scene_base_flag_to_objects(t->view_layer);
/* Make sure depsgraph is here. */ /* Make sure depsgraph is here. */
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); DEG_graph_relations_update(depsgraph);
/* Clear all flags we need. It will be used to detect dependencies. */ /* Clear all flags we need. It will be used to detect dependencies. */
trans_object_base_deps_flag_prepare(view_layer); trans_object_base_deps_flag_prepare(view_layer);
/* Traverse all bases and set all possible flags. */ /* Traverse all bases and set all possible flags. */

View File

@@ -869,8 +869,7 @@ Render *BlenderStrokeRenderer::RenderScene(Render * /*re*/, bool render)
#endif #endif
Render *freestyle_render = RE_NewSceneRender(freestyle_scene); Render *freestyle_render = RE_NewSceneRender(freestyle_scene);
ViewLayer *view_layer = (ViewLayer *)freestyle_scene->view_layers.first; DEG_graph_relations_update(freestyle_depsgraph);
DEG_graph_relations_update(freestyle_depsgraph, freestyle_bmain, freestyle_scene, view_layer);
RE_RenderFreestyleStrokes( RE_RenderFreestyleStrokes(
freestyle_render, freestyle_bmain, freestyle_scene, render && get_stroke_count() > 0); freestyle_render, freestyle_bmain, freestyle_scene, render && get_stroke_count() > 0);

View File

@@ -67,16 +67,13 @@ namespace io {
namespace alembic { namespace alembic {
// Construct the depsgraph for exporting. // Construct the depsgraph for exporting.
static void build_depsgraph(Depsgraph *depsgraph, Main *bmain, const bool visible_objects_only) static void build_depsgraph(Depsgraph *depsgraph, const bool visible_objects_only)
{ {
Scene *scene = DEG_get_input_scene(depsgraph);
ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
if (visible_objects_only) { if (visible_objects_only) {
DEG_graph_build_from_view_layer(depsgraph, bmain, scene, view_layer); DEG_graph_build_from_view_layer(depsgraph);
} }
else { else {
DEG_graph_build_for_all_objects(depsgraph, bmain, scene, view_layer); DEG_graph_build_for_all_objects(depsgraph);
} }
} }
@@ -97,7 +94,7 @@ static void export_startjob(void *customdata,
*progress = 0.0f; *progress = 0.0f;
*do_update = true; *do_update = true;
build_depsgraph(data->depsgraph, data->bmain, data->params.visible_objects_only); build_depsgraph(data->depsgraph, data->params.visible_objects_only);
SubdivModifierDisabler subdiv_disabler(data->depsgraph); SubdivModifierDisabler subdiv_disabler(data->depsgraph);
if (!data->params.apply_subdiv) { if (!data->params.apply_subdiv) {
subdiv_disabler.disable_modifiers(); subdiv_disabler.disable_modifiers();

View File

@@ -328,8 +328,7 @@ class AbstractHierarchyIteratorInvisibleTest : public AbstractHierarchyIteratorT
{ {
depsgraph = DEG_graph_new( depsgraph = DEG_graph_new(
bfile->main, bfile->curscene, bfile->cur_view_layer, depsgraph_evaluation_mode); bfile->main, bfile->curscene, bfile->cur_view_layer, depsgraph_evaluation_mode);
DEG_graph_build_for_all_objects( DEG_graph_build_for_all_objects(depsgraph);
depsgraph, bfile->main, bfile->curscene, bfile->cur_view_layer);
BKE_scene_graph_update_tagged(depsgraph, bfile->main); BKE_scene_graph_update_tagged(depsgraph, bfile->main);
} }
}; };

View File

@@ -75,12 +75,11 @@ static void export_startjob(void *customdata,
// Construct the depsgraph for exporting. // Construct the depsgraph for exporting.
Scene *scene = DEG_get_input_scene(data->depsgraph); Scene *scene = DEG_get_input_scene(data->depsgraph);
ViewLayer *view_layer = DEG_get_input_view_layer(data->depsgraph);
if (data->params.visible_objects_only) { if (data->params.visible_objects_only) {
DEG_graph_build_from_view_layer(data->depsgraph, data->bmain, scene, view_layer); DEG_graph_build_from_view_layer(data->depsgraph);
} }
else { else {
DEG_graph_build_for_all_objects(data->depsgraph, data->bmain, scene, view_layer); DEG_graph_build_for_all_objects(data->depsgraph);
} }
BKE_scene_graph_update_tagged(data->depsgraph, data->bmain); BKE_scene_graph_update_tagged(data->depsgraph, data->bmain);

View File

@@ -609,7 +609,7 @@ static void engine_depsgraph_init(RenderEngine *engine, ViewLayer *view_layer)
if (engine->re->r.scemode & R_BUTS_PREVIEW) { if (engine->re->r.scemode & R_BUTS_PREVIEW) {
Depsgraph *depsgraph = engine->depsgraph; Depsgraph *depsgraph = engine->depsgraph;
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); DEG_graph_relations_update(depsgraph);
DEG_evaluate_on_framechange(bmain, depsgraph, CFRA); DEG_evaluate_on_framechange(bmain, depsgraph, CFRA);
DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, true); DEG_ids_check_recalc(bmain, depsgraph, scene, view_layer, true);
DEG_ids_clear_recalc(bmain, depsgraph); DEG_ids_clear_recalc(bmain, depsgraph);

View File

@@ -1977,7 +1977,7 @@ static void render_init_depsgraph(Render *re)
DEG_debug_name_set(re->pipeline_depsgraph, "RENDER PIPELINE"); DEG_debug_name_set(re->pipeline_depsgraph, "RENDER PIPELINE");
/* Make sure there is a correct evaluated scene pointer. */ /* Make sure there is a correct evaluated scene pointer. */
DEG_graph_build_for_render_pipeline(re->pipeline_depsgraph, re->main, scene, view_layer); DEG_graph_build_for_render_pipeline(re->pipeline_depsgraph);
/* Update immediately so we have proper evaluated scene. */ /* Update immediately so we have proper evaluated scene. */
render_update_depsgraph(re); render_update_depsgraph(re);

View File

@@ -352,7 +352,7 @@ void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
*/ */
Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true); Depsgraph *depsgraph = BKE_scene_get_depsgraph(bmain, scene, view_layer, true);
if (is_after_open_file) { if (is_after_open_file) {
DEG_graph_relations_update(depsgraph, bmain, scene, view_layer); DEG_graph_relations_update(depsgraph);
DEG_graph_on_visible_update(bmain, depsgraph, true); DEG_graph_on_visible_update(bmain, depsgraph, true);
} }
DEG_make_active(depsgraph); DEG_make_active(depsgraph);