Bugfix: copying drivers did not set compiled expression to NULL, also tweak

to set it to NULL on file read instead of write as is done usually.
This commit is contained in:
Brecht Van Lommel
2010-01-20 18:27:19 +00:00
parent a035dafd27
commit 9857ffde31
3 changed files with 3 additions and 7 deletions

View File

@@ -1205,6 +1205,7 @@ ChannelDriver *fcurve_copy_driver (ChannelDriver *driver)
/* copy all data */
ndriver= MEM_dupallocN(driver);
ndriver->expr_comp= NULL;
/* copy variables */
ndriver->variables.first= ndriver->variables.last= NULL;

View File

@@ -1780,6 +1780,8 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
if (fcu->driver) {
ChannelDriver *driver= fcu->driver;
DriverVar *dvar;
driver->expr_comp= NULL;
/* relink variables, targets and their paths */
link_list(fd, &driver->variables);

View File

@@ -935,15 +935,8 @@ static void write_fcurves(WriteData *wd, ListBase *fcurves)
ChannelDriver *driver= fcu->driver;
DriverVar *dvar;
/* don't save compiled python bytecode */
void *expr_comp= driver->expr_comp;
driver->expr_comp= NULL;
writestruct(wd, DATA, "ChannelDriver", 1, driver);
driver->expr_comp= expr_comp; /* restore */
/* variables */
for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
writestruct(wd, DATA, "DriverVar", 1, dvar);