Applying similar optimisations as r.55092 for Animation Data
authorJoshua Leung <aligorith@gmail.com>
Fri, 8 Mar 2013 10:59:43 +0000 (10:59 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 8 Mar 2013 10:59:43 +0000 (10:59 +0000)
source/blender/blenloader/intern/writefile.c

index 538f636..7772bc2 100644 (file)
@@ -470,6 +470,9 @@ static void write_fmodifiers(WriteData *wd, ListBase *fmodifiers)
 {
        FModifier *fcm;
        
+       /* Write all modifiers first (for faster reloading) */
+       writelist(wd, DATA, "FModifier", fmodifiers);
+       
        /* Modifiers */
        for (fcm= fmodifiers->first; fcm; fcm= fcm->next) {
                FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
@@ -510,9 +513,6 @@ static void write_fmodifiers(WriteData *wd, ListBase *fmodifiers)
                                        break;
                        }
                }
-               
-               /* Write the modifier */
-               writestruct(wd, DATA, "FModifier", 1, fcm);
        }
 }
 
@@ -520,10 +520,8 @@ static void write_fcurves(WriteData *wd, ListBase *fcurves)
 {
        FCurve *fcu;
        
+       writelist(wd, DATA, "FCurve", fcurves);
        for (fcu=fcurves->first; fcu; fcu=fcu->next) {
-               /* F-Curve */
-               writestruct(wd, DATA, "FCurve", 1, fcu);
-               
                /* curve data */
                if (fcu->bezt)
                        writestruct(wd, DATA, "BezTriple", fcu->totvert, fcu->bezt);
@@ -541,9 +539,8 @@ static void write_fcurves(WriteData *wd, ListBase *fcurves)
                        writestruct(wd, DATA, "ChannelDriver", 1, driver);
                        
                        /* variables */
-                       for (dvar= driver->variables.first; dvar; dvar= dvar->next) {
-                               writestruct(wd, DATA, "DriverVar", 1, dvar);
-                               
+                       writelist(wd, DATA, "DriverVar", &driver->variables);
+                       for (dvar= driver->variables.first; dvar; dvar= dvar->next) {                           
                                DRIVER_TARGETS_USED_LOOPER(dvar)
                                {
                                        if (dtar->rna_path)
@@ -609,10 +606,8 @@ static void write_nlastrips(WriteData *wd, ListBase *strips)
 {
        NlaStrip *strip;
        
+       writelist(wd, DATA, "NlaStrip", strips);
        for (strip= strips->first; strip; strip= strip->next) {
-               /* write the strip first */
-               writestruct(wd, DATA, "NlaStrip", 1, strip);
-               
                /* write the strip's F-Curves and modifiers */
                write_fcurves(wd, &strip->fcurves);
                write_fmodifiers(wd, &strip->modifiers);