[Bf-blender-cvs] [681236d] depsgraph_refactor: Depsgraph: Fix missing animation update when tweaking fcurves in graph editor

Sergey Sharybin noreply at git.blender.org
Mon Feb 16 16:18:17 CET 2015


Commit: 681236de3bd427d1c5ef17e604e44280cd75a8c3
Author: Sergey Sharybin
Date:   Mon Feb 16 20:12:35 2015 +0500
Branches: depsgraph_refactor
https://developer.blender.org/rB681236de3bd427d1c5ef17e604e44280cd75a8c3

Depsgraph: Fix missing animation update when tweaking fcurves in graph editor

Not totally happy with this solution, mainly:

- It's a bit weird to explicitly tag ID for update when updating animation data,
  thinking maybe we can have function like DAG_anim_data_tag_update(). But it is
  also a bit tricky to get back from animation data to ID it seems.

- Re-scheduling time update tags is not supported at this moment. This means if
  both relations are tagged for update and animation data is tagged for update
  the animation update will be missing.

Anyway, it's an interesting issue and think it's good starting patch for it.

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

M	source/blender/depsgraph/intern/depsgraph_tag.cpp
M	source/blender/editors/animation/anim_deps.c

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

diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cpp b/source/blender/depsgraph/intern/depsgraph_tag.cpp
index 44c5615..498d00a 100644
--- a/source/blender/depsgraph/intern/depsgraph_tag.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_tag.cpp
@@ -84,6 +84,17 @@ static void lib_id_recalc_tag_flag(Main *bmain, ID *id, int flag)
 	}
 }
 
+static void anim_data_tag_update(Depsgraph *graph, ID *id)
+{
+	IDDepsNode *id_node = graph->find_id_node(id);
+	if (id_node != NULL) {
+		ComponentDepsNode *anim_comp = id_node->find_component(DEPSNODE_TYPE_ANIMATION);
+		if (anim_comp != NULL) {
+			anim_comp->tag_update(graph);
+		}
+	}
+}
+
 /* Tag all nodes in ID-block for update.
  * This is a crude measure, but is most convenient for old code.
  */
@@ -147,15 +158,24 @@ void DEG_id_tag_update_ex(Main *bmain, ID *id, short flag)
 	     scene = (Scene *)scene->id.next)
 	{
 		if (scene->depsgraph) {
+			Depsgraph *graph = scene->depsgraph;
 			if (flag & OB_RECALC_DATA && GS(id->name) == ID_OB) {
 				Object *object = (Object*)id;
 				if (object->data != NULL) {
 					DEG_graph_id_tag_update(bmain,
-					                        scene->depsgraph,
+					                        graph,
 					                        (ID*)object->data);
 				}
+				if (flag & OB_RECALC_TIME) {
+					anim_data_tag_update(graph, (ID*)object->data);
+				}
+			}
+			if (flag & (OB_RECALC_OB|OB_RECALC_DATA)) {
+				DEG_graph_id_tag_update(bmain, graph, id);
+			}
+			if (flag & OB_RECALC_TIME) {
+				anim_data_tag_update(graph, id);
 			}
-			DEG_graph_id_tag_update(bmain, scene->depsgraph, id);
 		}
 	}
 }
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c
index eb57907..a38f5db 100644
--- a/source/blender/editors/animation/anim_deps.c
+++ b/source/blender/editors/animation/anim_deps.c
@@ -73,8 +73,10 @@ void ANIM_list_elem_update(Scene *scene, bAnimListElem *ale)
 	
 	/* tag AnimData for refresh so that other views will update in realtime with these changes */
 	adt = BKE_animdata_from_id(id);
-	if (adt)
+	if (adt) {
 		adt->recalc |= ADT_RECALC_ANIM;
+		DAG_id_tag_update(id, OB_RECALC_TIME);
+	}
 
 	/* update data */
 	fcu = (ale->datatype == ALE_FCURVE) ? ale->key_data : NULL;




More information about the Bf-blender-cvs mailing list