diff options
author | Joshua Leung <aligorith@gmail.com> | 2013-03-06 05:59:09 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2013-03-06 05:59:09 +0400 |
commit | c27010582e25968a2c4e87d6090a1d1ba763b714 (patch) | |
tree | 6d4d1ba4d1d184b8cef3c76b4382ddb268bab6e5 | |
parent | 8ebd5ddd0e9c3be35a5da1b9b5e06ea2e0393761 (diff) |
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.
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index ec6172d5041..e1ac5fa605b 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -983,22 +983,39 @@ static short skip_fcurve_with_name(bDopeSheet *ads, FCurve *fcu, ID *owner_id) /* 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 @@ static FCurve *animfilter_fcurve_next(bDopeSheet *ads, FCurve *first, bActionGro /* 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; } |