Merged changes in the trunk up to revision 30397.
[blender.git] / source / blender / blenloader / intern / writefile.c
index 902f572b2f3cd6ebaa2453d111526c8a0f9f02a0..27832243ceba2f52d7c865a9f4983323657fb38f 100644 (file)
@@ -1786,6 +1786,8 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
        TimeMarker *marker;
        TransformOrientation *ts;
        SceneRenderLayer *srl;
+       FreestyleModuleConfig *fmc;
+       FreestyleLineSet *fls;
        ToolSettings *tos;
        
        sce= scebase->first;
@@ -1910,8 +1912,19 @@ static void write_scenes(WriteData *wd, ListBase *scebase)
                for(ts = sce->transform_spaces.first; ts; ts = ts->next)
                        writestruct(wd, DATA, "TransformOrientation", 1, ts);
                
-               for(srl= sce->r.layers.first; srl; srl= srl->next)
+               for(srl= sce->r.layers.first; srl; srl= srl->next) {
                        writestruct(wd, DATA, "SceneRenderLayer", 1, srl);
+                       
+                       for(fmc= srl->freestyleConfig.modules.first; fmc; fmc = fmc->next) {
+                               writestruct(wd, DATA, "FreestyleModuleConfig", 1, fmc);
+                       }
+                       
+                       for(fls= srl->freestyleConfig.linesets.first; fls; fls = fls->next) {
+                               writestruct(wd, DATA, "FreestyleLineSet", 1, fls);
+                               writestruct(wd, DATA, "FreestyleLineStyle", 1, fls->linestyle);
+                       }
+
+               }
                
                if(sce->nodetree) {
                        writestruct(wd, DATA, "bNodeTree", 1, sce->nodetree);
@@ -2361,6 +2374,17 @@ static void write_scripts(WriteData *wd, ListBase *idbase)
        }
 }
 
+static void write_linestyles(WriteData *wd, ListBase *idbase)
+{
+       FreestyleLineStyle *linestyle;
+       
+       for(linestyle=idbase->first; linestyle; linestyle= linestyle->id.next) {
+               if(linestyle->id.us>0 || wd->current) {
+                       writestruct(wd, ID_LS, "FreestyleLineStyle", 1, linestyle);
+               }
+       }
+}
+
 /* context is usually defined by WM, two cases where no WM is available:
  * - for forward compatibility, curscreen has to be saved
  * - for undofile, curscene needs to be saved */
@@ -2450,6 +2474,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
        write_brushes  (wd, &mainvar->brush);
        write_scripts  (wd, &mainvar->script);
        write_gpencils (wd, &mainvar->gpencil);
+       write_linestyles(wd, &mainvar->linestyle);
        write_libraries(wd,  mainvar->next);
 
        if (write_user_block) {