Bugfix [#32155] Driver error saves in file and isnt reset on load

Error flags set on Drivers and F-Curves when they can't be evaluated or flushed
properly are now cleared when loading files, allowing drivers to be re-evaluated
when a file is reloaded. This means that if a driver couldn't be used in the
previous session due to the set of extension modules active at the time (and was
thus disabled), reloading the file with the necessary extensions loaded means
that the driver can work out of the box without manually re-enabling.
This commit is contained in:
Joshua Leung 2012-07-23 12:10:02 +00:00
parent 02b9ba16bc
commit e92fea3efb

@ -1913,14 +1913,25 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
/* group */ /* group */
fcu->grp = newdataadr(fd, fcu->grp); fcu->grp = newdataadr(fd, fcu->grp);
/* clear disabled flag - allows disabled drivers to be tried again ([#32155]),
* but also means that another method for "reviving disabled F-Curves" exists
*/
fcu->flag &= ~FCURVE_DISABLED;
/* driver */ /* driver */
fcu->driver= newdataadr(fd, fcu->driver); fcu->driver= newdataadr(fd, fcu->driver);
if (fcu->driver) { if (fcu->driver) {
ChannelDriver *driver= fcu->driver; ChannelDriver *driver= fcu->driver;
DriverVar *dvar; DriverVar *dvar;
/* compiled expression data will need to be regenerated (old pointer may still be set here) */
driver->expr_comp = NULL; driver->expr_comp = NULL;
/* give the driver a fresh chance - the operating environment may be different now
* (addons, etc. may be different) so the driver namespace may be sane now [#32155]
*/
driver->flag &= ~DRIVER_FLAG_INVALID;
/* relink variables, targets and their paths */ /* relink variables, targets and their paths */
link_list(fd, &driver->variables); link_list(fd, &driver->variables);
for (dvar= driver->variables.first; dvar; dvar= dvar->next) { for (dvar= driver->variables.first; dvar; dvar= dvar->next) {