[Bf-blender-cvs] [9683807] master: Fix T45938: Ocean modifier animation not working with NLA action-strip (old depsgraph only)

Joshua Leung noreply at git.blender.org
Sat Sep 5 14:09:14 CEST 2015


Commit: 9683807459947330d50e8e38edae430d10d53ffc
Author: Joshua Leung
Date:   Sun Sep 6 00:05:46 2015 +1200
Branches: master
https://developer.blender.org/rB9683807459947330d50e8e38edae430d10d53ffc

Fix T45938: Ocean modifier animation not working with NLA action-strip (old depsgraph only)

When a modifier was animated by a NLA strip, this animation was not working when using
the old depsgraph. This was because the code which checks if a NLA strip affects any
modifiers was missing - specifically, it was originally left out as it was thought
that it was unlikely that many users would need this, but adding in those checks
would have a (slight) negative effect files where there are heaps of NLA strips
but modifiers animated this way were absent.

The new depsgraph however doesn't suffer from this problem, as these sorts of checks
need ot be built into the graph-building stage for everything to work, so these links
had already been added.

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

M	source/blender/blenkernel/intern/depsgraph.c

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

diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 82ec960..4373e79 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2019,25 +2019,50 @@ void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, const sho
 	dag_tag_renderlayers(sce, lay);
 }
 
-static int object_modifiers_use_time(Object *ob)
+static bool modifier_nlastrips_use_time(ListBase *strips)
+{
+	NlaStrip *strip;
+	
+	if (strips) {
+		for (strip = strips->first; strip; strip = strip->next) {
+			if (modifier_nlastrips_use_time(&strip->strips)) {
+				return true;
+			}
+			else if (strip->act) {
+				FCurve *fcu;
+				
+				for (fcu = strip->act->curves.first; fcu; fcu = fcu->next) {
+					if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
+						return true;
+				}
+			}
+		}
+	}
+	
+	return false;
+}
+
+static bool object_modifiers_use_time(Object *ob)
 {
 	ModifierData *md;
 	
 	/* check if a modifier in modifier stack needs time input */
-	for (md = ob->modifiers.first; md; md = md->next)
+	for (md = ob->modifiers.first; md; md = md->next) {
 		if (modifier_dependsOnTime(md))
-			return 1;
+			return true;
+	}
 	
 	/* check whether any modifiers are animated */
 	if (ob->adt) {
 		AnimData *adt = ob->adt;
+		NlaTrack *nlt;
 		FCurve *fcu;
 		
 		/* action - check for F-Curves with paths containing 'modifiers[' */
 		if (adt->action) {
 			for (fcu = adt->action->curves.first; fcu; fcu = fcu->next) {
 				if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
-					return 1;
+					return true;
 			}
 		}
 		
@@ -2049,14 +2074,17 @@ static int object_modifiers_use_time(Object *ob)
 		 */
 		for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
 			if (fcu->rna_path && strstr(fcu->rna_path, "modifiers["))
-				return 1;
+				return true;
 		}
 		
-		/* XXX: also, should check NLA strips, though for now assume that nobody uses
-		 * that and we can omit that for performance reasons... */
+		/* Also check NLA Strips... [#T45938] */
+		for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+			if (modifier_nlastrips_use_time(&nlt->strips))
+				return true;
+		}
 	}
 	
-	return 0;
+	return false;
 }
 
 static short animdata_use_time(AnimData *adt)




More information about the Bf-blender-cvs mailing list