[Bf-blender-cvs] [bf2c5217b31] master: Fix T61231: File open and undo looses unkeyed changes

Sergey Sharybin noreply at git.blender.org
Fri Feb 8 12:26:45 CET 2019


Commit: bf2c5217b317d03051399da2020b209d27515cfb
Author: Sergey Sharybin
Date:   Fri Feb 8 12:13:02 2019 +0100
Branches: master
https://developer.blender.org/rBbf2c5217b317d03051399da2020b209d27515cfb

Fix T61231: File open and undo looses unkeyed changes

Only flush copy-on-write to animation when user makes changes.

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/depsgraph.h

===================================================================

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



More information about the Bf-blender-cvs mailing list