From bf2c5217b317d03051399da2020b209d27515cfb Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 8 Feb 2019 12:13:02 +0100 Subject: [PATCH] Fix T61231: File open and undo looses unkeyed changes Only flush copy-on-write to animation when user makes changes. --- .../intern/builder/deg_builder_relations.cc | 16 ++++++++++++++-- source/blender/depsgraph/intern/depsgraph.h | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index a15e4e7a56f..c62fc604f94 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -2534,11 +2534,23 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) * CoW update when it's changed) but yet guarantee evaluation order * with objects which are using that action. */ if (comp_node->type == NodeType::PARAMETERS || - comp_node->type == NodeType::LAYER_COLLECTIONS || - (comp_node->type == NodeType::ANIMATION && id_type == ID_AC)) + comp_node->type == NodeType::LAYER_COLLECTIONS) { rel_flag &= ~RELATION_FLAG_NO_FLUSH; } + if (comp_node->type == NodeType::ANIMATION && id_type == ID_AC) { + rel_flag &= ~RELATION_FLAG_NO_FLUSH; + /* NOTE: We only allow flush on user edits. If the action block is + * just brought into the dependency graph it is either due to + * initial graph construction or due to some property got animated. + * In first case all the related datablocks will be tagged for an + * update as well. In the second case it is up to the editing + * function to tag changed datablock. + * + * This logic allows to preserve unkeyed changes on file load and on + * undo. */ + rel_flag |= RELATION_FLAG_FLUSH_USER_EDIT_ONLY; + } /* All entry operations of each component should wait for a proper * copy of ID. */ OperationNode *op_entry = comp_node->get_entry_operation(); diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h index 9a0b01d8679..d33b8945d17 100644 --- a/source/blender/depsgraph/intern/depsgraph.h +++ b/source/blender/depsgraph/intern/depsgraph.h @@ -73,9 +73,9 @@ enum RelationFlag { * affected by user input. */ RELATION_FLAG_FLUSH_USER_EDIT_ONLY = (1 << 2), /* The relation can not be killed by the cyclic dependencies solver. */ - RELATION_FLAG_GODMODE = (1 << 3), + RELATION_FLAG_GODMODE = (1 << 4), /* Relation will check existance before being added. */ - RELATION_CHECK_BEFORE_ADD = (1 << 4), + RELATION_CHECK_BEFORE_ADD = (1 << 5), }; /* B depends on A (A -> B) */