Depsgraph: Preserve CoW ID recalc flags
Previously they would have been replaced with flag from original datablock, which is not what we want.
This commit is contained in:
parent
29631ff013
commit
e5633114cd
|
@ -490,6 +490,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
|
|||
{
|
||||
const ID *id_orig = id_node->id_orig;
|
||||
ID *id_cow = id_node->id_cow;
|
||||
const int id_cow_recalc = id_cow->recalc;
|
||||
/* No need to expand such datablocks, their copied ID is same as original
|
||||
* one already.
|
||||
*/
|
||||
|
@ -582,6 +583,7 @@ ID *deg_expand_copy_on_write_datablock(const Depsgraph *depsgraph,
|
|||
if (newid != NULL) {
|
||||
MEM_freeN(newid);
|
||||
}
|
||||
id_cow->recalc = id_orig->recalc | id_cow_recalc;
|
||||
return id_cow;
|
||||
}
|
||||
|
||||
|
|
|
@ -301,7 +301,7 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph)
|
|||
flush_editors_id_update(bmain, graph, &update_ctx);
|
||||
}
|
||||
|
||||
static void graph_clear_func(
|
||||
static void graph_clear_operation_func(
|
||||
void *__restrict data_v,
|
||||
const int i,
|
||||
const ParallelRangeTLS *__restrict /*tls*/)
|
||||
|
@ -312,18 +312,41 @@ static void graph_clear_func(
|
|||
node->flag &= ~(DEPSOP_FLAG_DIRECTLY_MODIFIED | DEPSOP_FLAG_NEEDS_UPDATE);
|
||||
}
|
||||
|
||||
static void graph_clear_id_node_func(
|
||||
void *__restrict data_v,
|
||||
const int i,
|
||||
const ParallelRangeTLS *__restrict /*tls*/)
|
||||
{
|
||||
Depsgraph *graph = (Depsgraph *)data_v;
|
||||
IDDepsNode *id_node = graph->id_nodes[i];
|
||||
id_node->id_cow->recalc &= ~ID_RECALC_ALL;
|
||||
}
|
||||
|
||||
/* Clear tags from all operation nodes. */
|
||||
void deg_graph_clear_tags(Depsgraph *graph)
|
||||
{
|
||||
/* Go over all operation nodes, clearing tags. */
|
||||
const int num_operations = graph->operations.size();
|
||||
ParallelRangeSettings settings;
|
||||
BLI_parallel_range_settings_defaults(&settings);
|
||||
settings.min_iter_per_thread = 1024;
|
||||
BLI_task_parallel_range(0, num_operations,
|
||||
graph,
|
||||
graph_clear_func,
|
||||
&settings);
|
||||
{
|
||||
const int num_operations = graph->operations.size();
|
||||
ParallelRangeSettings settings;
|
||||
BLI_parallel_range_settings_defaults(&settings);
|
||||
settings.min_iter_per_thread = 1024;
|
||||
BLI_task_parallel_range(0, num_operations,
|
||||
graph,
|
||||
graph_clear_operation_func,
|
||||
&settings);
|
||||
}
|
||||
/* Go over all ID nodes nodes, clearing tags. */
|
||||
{
|
||||
const int num_id_nodes = graph->id_nodes.size();
|
||||
ParallelRangeSettings settings;
|
||||
BLI_parallel_range_settings_defaults(&settings);
|
||||
settings.min_iter_per_thread = 1024;
|
||||
BLI_task_parallel_range(0, num_id_nodes,
|
||||
graph,
|
||||
graph_clear_id_node_func,
|
||||
&settings);
|
||||
}
|
||||
/* Clear any entry tags which haven't been flushed. */
|
||||
BLI_gset_clear(graph->entry_tags, NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue