Depsgraph: Only run editors ID update on manual edits

This is how it worked in 2.79 and it is how it is expected to be working.

Avoids unintended icons update during animation playback.

Fixes T64318: Update of material icons during animation 2x performance penalty
This commit is contained in:
2019-06-04 11:33:41 +02:00
parent 04bac38731
commit 30c0d780f9
4 changed files with 11 additions and 1 deletions

View File

@@ -741,6 +741,8 @@ static void deg_graph_clear_id_node_func(void *__restrict data_v,
* the recalc flag. */
DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(data_v);
DEG::IDNode *id_node = deg_graph->id_nodes[i];
id_node->is_user_modified = false;
id_node->id_cow->recalc &= ~ID_RECALC_ALL;
/* Clear embedded node trees too. */

View File

@@ -187,6 +187,10 @@ BLI_INLINE OperationNode *flush_schedule_children(OperationNode *op_node, FlushQ
if (rel->flag & RELATION_FLAG_NO_FLUSH) {
continue;
}
if (op_node->flag & DEPSOP_FLAG_USER_MODIFIED) {
IDNode *id_node = op_node->owner->owner;
id_node->is_user_modified = true;
}
/* Relation only allows flushes on user changes, but the node was not
* affected by user. */
if ((rel->flag & RELATION_FLAG_FLUSH_USER_EDIT_ONLY) &&
@@ -257,7 +261,7 @@ void flush_editors_id_update(Depsgraph *graph, const DEGEditorUpdateContext *upd
* TODO: image datablocks do not use COW, so might not be detected
* correctly. */
if (deg_copy_on_write_is_expanded(id_cow)) {
if (graph->is_active) {
if (graph->is_active && id_node->is_user_modified) {
deg_editors_id_update(update_ctx, id_orig);
}
/* ID may need to get its auto-override operations refreshed. */

View File

@@ -112,6 +112,7 @@ void IDNode::init(const ID *id, const char *UNUSED(subdata))
is_directly_visible = true;
is_collection_fully_expanded = false;
has_base = false;
is_user_modified = false;
visible_components_mask = 0;
previously_visible_components_mask = 0;

View File

@@ -99,6 +99,9 @@ struct IDNode : public Node {
/* Is used to figure out whether object came to the dependency graph via a base. */
bool has_base;
/* Accumulated flag from operation. Is initialized and used during updates flush. */
bool is_user_modified;
IDComponentsMask visible_components_mask;
IDComponentsMask previously_visible_components_mask;