Merge with trunk r41625
[blender.git] / source / blender / blenloader / intern / writefile.c
index cb94ebc..11a80d0 100644 (file)
@@ -129,6 +129,7 @@ Any case: direct data is ALWAYS after the lib block
 #include "DNA_vfont_types.h"
 #include "DNA_world_types.h"
 #include "DNA_windowmanager_types.h"
+#include "DNA_movieclip_types.h"
 
 #include "MEM_guardedalloc.h" // MEM_freeN
 #include "BLI_blenlib.h"
@@ -711,6 +712,8 @@ static void write_nodetree(WriteData *wd, bNodeTree *ntree)
                                write_curvemapping(wd, node->storage);
                        else if(ntree->type==NTREE_TEXTURE && (node->type==TEX_NODE_CURVE_RGB || node->type==TEX_NODE_CURVE_TIME) )
                                write_curvemapping(wd, node->storage);
+                       else if(ntree->type==NTREE_COMPOSIT && node->type==CMP_NODE_MOVIEDISTORTION)
+                               /* pass */ ;
                        else
                                writestruct(wd, DATA, node->typeinfo->storagename, 1, node->storage);
                }
@@ -2284,6 +2287,9 @@ static void write_screens(WriteData *wd, ListBase *scrbase)
                                else if(sl->spacetype==SPACE_USERPREF) {
                                        writestruct(wd, DATA, "SpaceUserPref", 1, sl);
                                }
+                               else if(sl->spacetype==SPACE_CLIP) {
+                                       writestruct(wd, DATA, "SpaceClip", 1, sl);
+                               }
 
                                sl= sl->next;
                        }
@@ -2532,6 +2538,38 @@ static void write_scripts(WriteData *wd, ListBase *idbase)
        }
 }
 
+static void write_movieclips(WriteData *wd, ListBase *idbase)
+{
+       MovieClip *clip;
+
+       clip= idbase->first;
+       while(clip) {
+               if(clip->id.us>0 || wd->current) {
+                       MovieTracking *tracking= &clip->tracking;
+                       MovieTrackingTrack *track;
+                       writestruct(wd, ID_MC, "MovieClip", 1, clip);
+
+                       if(tracking->reconstruction.camnr)
+                               writestruct(wd, DATA, "MovieReconstructedCamera", tracking->reconstruction.camnr, tracking->reconstruction.cameras);
+
+                       track= tracking->tracks.first;
+                       while(track) {
+                               writestruct(wd, DATA, "MovieTrackingTrack", 1, track);
+
+                               if(track->markers)
+                                       writestruct(wd, DATA, "MovieTrackingMarker", track->markersnr, track->markers);
+
+                               track= track->next;
+                       }
+               }
+
+               clip= clip->id.next;
+       }
+
+       /* flush helps the compression for undo-save */
+       mywrite(wd, MYWRITE_FLUSH, 0);
+}
+
 /* 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 */
@@ -2608,6 +2646,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
                write_windowmanagers(wd, &mainvar->wm);
                write_screens  (wd, &mainvar->screen);
        }
+       write_movieclips (wd, &mainvar->movieclip);
        write_scenes   (wd, &mainvar->scene);
        write_curves   (wd, &mainvar->curve);
        write_mballs   (wd, &mainvar->mball);