diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-04-19 20:38:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-04-19 21:00:00 +0300 |
commit | cedd8b8c56b944ffdabadc4339d2d1e5c6651dd6 (patch) | |
tree | 2a248a245ade585858997b8418fdabb33c6960d9 /source/blender/depsgraph/intern/depsgraph_tag.cc | |
parent | d7caae56c4e33c21453fdeebab6c519e7cb99de6 (diff) |
Fix T87535, T87295: issues with new persistent data option
Some persistent data code was disable due to a deeper design issue, which
meant some updates were not communicated to renderers.
Dependency graph updates work in two passes, once where Blender scene
animation updates are done, then app handler scripts can run to make further
scene modifications, and then the depsgraph is updated again to take those
into account.
Previously the viewport would update renderers twice when such app handler
scripts were present. Now both viewport and persistent data rendering update
the renderers only once, accumulating updates from both passes.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_tag.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_tag.cc | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index d658fcce08a..608ec6292f6 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -824,23 +824,26 @@ void DEG_enable_editors_update(Depsgraph *depsgraph) /* Check if something was changed in the database and inform * editors about this. */ -void DEG_editors_update( - Main *bmain, Depsgraph *depsgraph, Scene *scene, ViewLayer *view_layer, bool time) +void DEG_editors_update(Depsgraph *depsgraph, bool time) { deg::Depsgraph *graph = (deg::Depsgraph *)depsgraph; + if (!graph->use_editors_update) { + return; + } - if (graph->use_editors_update) { - bool updated = time || DEG_id_type_any_updated(depsgraph); + Scene *scene = DEG_get_input_scene(depsgraph); + ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); + Main *bmain = DEG_get_bmain(depsgraph); + bool updated = time || DEG_id_type_any_updated(depsgraph); - DEGEditorUpdateContext update_ctx = {nullptr}; - update_ctx.bmain = bmain; - update_ctx.depsgraph = depsgraph; - update_ctx.scene = scene; - update_ctx.view_layer = view_layer; - deg::deg_editors_scene_update(&update_ctx, updated); - } + DEGEditorUpdateContext update_ctx = {nullptr}; + update_ctx.bmain = bmain; + update_ctx.depsgraph = depsgraph; + update_ctx.scene = scene; + update_ctx.view_layer = view_layer; + deg::deg_editors_scene_update(&update_ctx, updated); - DEG_ids_clear_recalc(depsgraph); + DEG_ids_clear_recalc(depsgraph, false); } static void deg_graph_clear_id_recalc_flags(ID *id) @@ -854,7 +857,7 @@ static void deg_graph_clear_id_recalc_flags(ID *id) /* XXX And what about scene's master collection here? */ } -void DEG_ids_clear_recalc(Depsgraph *depsgraph) +void DEG_ids_clear_recalc(Depsgraph *depsgraph, const bool backup) { deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph); /* TODO(sergey): Re-implement POST_UPDATE_HANDLER_WORKAROUND using entry_tags @@ -864,6 +867,9 @@ void DEG_ids_clear_recalc(Depsgraph *depsgraph) } /* Go over all ID nodes nodes, clearing tags. */ for (deg::IDNode *id_node : deg_graph->id_nodes) { + if (backup) { + id_node->id_cow_recalc_backup |= id_node->id_cow->recalc; + } /* TODO: we clear original ID recalc flags here, but this may not work * correctly when there are multiple depsgraph with others still using * the recalc flag. */ @@ -875,3 +881,13 @@ void DEG_ids_clear_recalc(Depsgraph *depsgraph) } memset(deg_graph->id_type_updated, 0, sizeof(deg_graph->id_type_updated)); } + +void DEG_ids_restore_recalc(Depsgraph *depsgraph) +{ + deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(depsgraph); + + for (deg::IDNode *id_node : deg_graph->id_nodes) { + id_node->id_cow->recalc |= id_node->id_cow_recalc_backup; + id_node->id_cow_recalc_backup = 0; + } +} |