diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 0c05659668d..8705831c88f 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -67,6 +67,7 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati { BLI_spin_init(&lock); memset(id_type_updated, 0, sizeof(id_type_updated)); + memset(id_type_updated_backup, 0, sizeof(id_type_updated_backup)); memset(id_type_exist, 0, sizeof(id_type_exist)); memset(physics_relations, 0, sizeof(physics_relations)); diff --git a/source/blender/depsgraph/intern/depsgraph.hh b/source/blender/depsgraph/intern/depsgraph.hh index 0bc8de4c969..dd373f93136 100644 --- a/source/blender/depsgraph/intern/depsgraph.hh +++ b/source/blender/depsgraph/intern/depsgraph.hh @@ -108,6 +108,8 @@ struct Depsgraph { /* Indicates which ID types were updated. */ char id_type_updated[INDEX_ID_MAX]; + /* Accumulate id type updates from multiple update passes. */ + char id_type_updated_backup[INDEX_ID_MAX]; /* Indicates type of IDs present in the depsgraph. */ char id_type_exist[INDEX_ID_MAX]; diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 1f4d9c7ac8a..36615e00d7d 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -14,6 +14,7 @@ #include /* required for memset */ #include +#include "BLI_index_range.hh" #include "BLI_math_bits.h" #include "BLI_task.h" #include "BLI_utildefines.h" @@ -968,6 +969,14 @@ void DEG_ids_clear_recalc(Depsgraph *depsgraph, const bool backup) deg_graph_clear_id_recalc_flags(id_node->id_orig); } } + + if (backup) { + for (const int64_t i : blender::IndexRange(INDEX_ID_MAX)) { + if (deg_graph->id_type_updated[i] != 0) { + deg_graph->id_type_updated_backup[i] = 1; + } + } + } memset(deg_graph->id_type_updated, 0, sizeof(deg_graph->id_type_updated)); } @@ -979,4 +988,11 @@ void DEG_ids_restore_recalc(Depsgraph *depsgraph) id_node->id_cow->recalc |= id_node->id_cow_recalc_backup; id_node->id_cow_recalc_backup = 0; } + + for (const int64_t i : blender::IndexRange(INDEX_ID_MAX)) { + if (deg_graph->id_type_updated_backup[i] != 0) { + deg_graph->id_type_updated[i] = 1; + } + } + memset(deg_graph->id_type_updated_backup, 0, sizeof(deg_graph->id_type_updated_backup)); }