[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55070] trunk/blender/source/blender/ editors/animation/anim_filter.c: Bugfix [#32492] - Part 3: Error filter now includes drivers where there are

Joshua Leung aligorith at gmail.com
Wed Mar 6 02:59:10 CET 2013


Revision: 55070
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55070
Author:   aligorith
Date:     2013-03-06 01:59:09 +0000 (Wed, 06 Mar 2013)
Log Message:
-----------
Bugfix [#32492] - Part 3: Error filter now includes drivers where there are
errors with the variables/targets, even if those errors are for variables which
aren't used (and are hence "harmless" errors)

This means that the filter can be truly useful for helping locate things that
need "cleaning up". For example, previously, there could still have been drivers
where there were some of these "harmless" errors would emit warnings, but would
otherwise appear perfectly functional.

The implementation here uses a slightly slower method of checking any errors in
these driver vars. However, it's no slower than what's done when these are
evaluated, and should be less error prone than introducing yet another type of
error tagging for this one case. The problem here is that the "driver invalid"
flag, which is usually set when a target has errors, gets cleared by the
pydrivers code if nothing went wrong when evaluating the expression. Removing
this clearing step will probably open a can of worms, so unless this method
proves to be far too slow, this simpler fix will do.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/anim_filter.c

Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c	2013-03-06 01:44:12 UTC (rev 55069)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c	2013-03-06 01:59:09 UTC (rev 55070)
@@ -983,22 +983,39 @@
 /* Check if F-Curve has errors and/or is disabled 
  * > returns: (bool) True if F-Curve has errors/is disabled
  */
-static short fcurve_has_errors(FCurve *fcu)
+static bool fcurve_has_errors(FCurve *fcu)
 {
 	/* F-Curve disabled - path eval error */
 	if (fcu->flag & FCURVE_DISABLED) {
-		return 1;
+		return true;
 	}
 	
 	/* driver? */
 	if (fcu->driver) {
-		/* for now, just check if the entire thing got disabled... */
-		if (fcu->driver->flag & DRIVER_FLAG_INVALID)
-			return 1;
+		ChannelDriver *driver = fcu->driver;
+		DriverVar *dvar;
+		
+		/* error flag on driver usually means that there is an error
+		 * BUT this may not hold with PyDrivers as this flag gets cleared
+		 *     if no critical errors prevent the driver from working...
+		 */
+		if (driver->flag & DRIVER_FLAG_INVALID)
+			return true;
+			
+		/* check variables for other things that need linting... */
+		// TODO: maybe it would be more efficient just to have a quick flag for this?
+		for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
+			DRIVER_TARGETS_USED_LOOPER(dvar)
+			{
+				if (dtar->flag & DTAR_FLAG_INVALID)
+					return true;
+			}
+			DRIVER_TARGETS_LOOPER_END
+		}
 	}
 	
 	/* no errors found */
-	return 0;
+	return false;
 }
 
 /* find the next F-Curve that is usable for inclusion */
@@ -1042,7 +1059,7 @@
 						/* error-based filtering... */
 						if ((ads) && (ads->filterflag & ADS_FILTER_ONLY_ERRORS)) {
 							/* skip if no errors... */
-							if (fcurve_has_errors(fcu) == 0)
+							if (fcurve_has_errors(fcu) == false)
 								continue;
 						}
 						




More information about the Bf-blender-cvs mailing list