diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-04-19 23:37:39 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-04-19 23:39:36 +0300 |
commit | 0566ebdebeeb658300e6c45b805075ada9c02c0a (patch) | |
tree | 656d4004b376d4286cff9c45b2ab609553f061b5 /source/blender/blenkernel | |
parent | cedd8b8c56b944ffdabadc4339d2d1e5c6651dd6 (diff) |
Fix crash with Alembic export after recent persistent data bugfix
We weren't clearing the recalc flags for that case.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_scene.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 35 |
2 files changed, 28 insertions, 8 deletions
diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 66edb00e83c..9792f819bf9 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -152,6 +152,7 @@ void BKE_scene_graph_update_tagged(struct Depsgraph *depsgraph, struct Main *bma void BKE_scene_graph_evaluated_ensure(struct Depsgraph *depsgraph, struct Main *bmain); void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph); +void BKE_scene_graph_update_for_newframe_ex(struct Depsgraph *depsgraph, const bool clear_recalc); void BKE_scene_view_layer_graph_evaluated_ensure(struct Main *bmain, struct Scene *scene, diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 47b6817d429..e1f013eb589 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -2682,7 +2682,8 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on } /* Clear recalc flags for second pass, but back them up for editors update. */ - DEG_ids_clear_recalc(depsgraph, true); + const bool backup = true; + DEG_ids_clear_recalc(depsgraph, backup); used_multiple_passes = true; run_callbacks = false; } @@ -2691,7 +2692,11 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on if (used_multiple_passes) { DEG_ids_restore_recalc(depsgraph); } - DEG_editors_update(depsgraph, false); + const bool is_time_update = false; + DEG_editors_update(depsgraph, is_time_update); + + const bool backup = false; + DEG_ids_clear_recalc(depsgraph, backup); } void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain) @@ -2705,10 +2710,9 @@ void BKE_scene_graph_evaluated_ensure(Depsgraph *depsgraph, Main *bmain) } /* applies changes right away, does all sets too */ -void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph) +void BKE_scene_graph_update_for_newframe_ex(Depsgraph *depsgraph, const bool clear_recalc) { Scene *scene = DEG_get_input_scene(depsgraph); - ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph); Main *bmain = DEG_get_bmain(depsgraph); bool used_multiple_passes = false; @@ -2755,7 +2759,8 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph) } /* Clear recalc flags for second pass, but back them up for editors update. */ - DEG_ids_clear_recalc(depsgraph, true); + const bool backup = true; + DEG_ids_clear_recalc(depsgraph, backup); used_multiple_passes = true; } @@ -2763,7 +2768,21 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph) if (used_multiple_passes) { DEG_ids_restore_recalc(depsgraph); } - DEG_editors_update(depsgraph, true); + + const bool is_time_update = true; + DEG_editors_update(depsgraph, is_time_update); + + /* Clear recalc flags, can be skipped for e.g. renderers that will read these + * and clear the flags later. */ + if (clear_recalc) { + const bool backup = false; + DEG_ids_clear_recalc(depsgraph, backup); + } +} + +void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph) +{ + BKE_scene_graph_update_for_newframe_ex(depsgraph, true); } /** @@ -3523,8 +3542,8 @@ GHash *BKE_scene_undo_depsgraphs_extract(Main *bmain) for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { if (scene->depsgraph_hash == NULL) { - /* In some cases, e.g. when undo has to perform multiple steps at once, no depsgraph will be - * built so this pointer may be NULL. */ + /* In some cases, e.g. when undo has to perform multiple steps at once, no depsgraph will + * be built so this pointer may be NULL. */ continue; } for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL; |