Fix T61231: File open and undo looses unkeyed changes

Only flush copy-on-write to animation when user makes changes.
This commit is contained in:
Sergey Sharybin 2019-02-08 12:13:02 +01:00
parent e418777109
commit bf2c5217b3
Notes: blender-bot 2023-02-14 06:17:17 +01:00
Referenced by commit 872ff507a2, Fix Spring characters being in the rest pose on file open
Referenced by issue #61477, Freestyle not updating in animation
Referenced by issue #61231, Undo -ing during weight painting reverts (temporarily set) pose to keyframed pose
2 changed files with 16 additions and 4 deletions

View File

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

View File

@ -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) */