Fix crash with Alembic export after recent persistent data bugfix

We weren't clearing the recalc flags for that case.
This commit is contained in:
Brecht Van Lommel 2021-04-19 22:37:39 +02:00
parent cedd8b8c56
commit 0566ebdebe
5 changed files with 31 additions and 14 deletions

View File

@ -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,

View File

@ -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;

View File

@ -143,8 +143,7 @@ void DEG_id_type_tag(struct Main *bmain, short id_type);
* for viewport depsgraphs, but not render or export depsgraph for example. */
void DEG_enable_editors_update(struct Depsgraph *depsgraph);
/* Check if something was changed in the database and inform editors about this,
* then clear recalc flags. */
/* Check if something was changed in the database and inform editors about this. */
void DEG_editors_update(struct Depsgraph *depsgraph, bool time);
/* Clear recalc flags after editors or renderers have handled updates. */

View File

@ -842,8 +842,6 @@ void DEG_editors_update(Depsgraph *depsgraph, bool time)
update_ctx.scene = scene;
update_ctx.view_layer = view_layer;
deg::deg_editors_scene_update(&update_ctx, updated);
DEG_ids_clear_recalc(depsgraph, false);
}
static void deg_graph_clear_id_recalc_flags(ID *id)

View File

@ -690,7 +690,7 @@ static void engine_depsgraph_init(RenderEngine *engine, ViewLayer *view_layer)
}
else {
/* Go through update with full Python callbacks for regular render. */
BKE_scene_graph_update_for_newframe(engine->depsgraph);
BKE_scene_graph_update_for_newframe_ex(engine->depsgraph, false);
}
engine->has_grease_pencil = DRW_render_check_grease_pencil(engine->depsgraph);
@ -725,7 +725,7 @@ void RE_engine_frame_set(RenderEngine *engine, int frame, float subframe)
CLAMP(cfra, MINAFRAME, MAXFRAME);
BKE_scene_frame_set(re->scene, cfra);
BKE_scene_graph_update_for_newframe(engine->depsgraph);
BKE_scene_graph_update_for_newframe_ex(engine->depsgraph, false);
BKE_scene_camera_switch_update(re->scene);
}