Bugfix: copying drivers did not set compiled expression to NULL, also tweak
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 20 Jan 2010 18:27:19 +0000 (18:27 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 20 Jan 2010 18:27:19 +0000 (18:27 +0000)
to set it to NULL on file read instead of write as is done usually.

source/blender/blenkernel/intern/fcurve.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c

index 9b6063f..28de10a 100644 (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;
index 11a9a6e..5b75912 100644 (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);
index 7064b8c..f7bd5a0 100644 (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);