svn merge ^/trunk/blender -r47413:47423
[blender.git] / source / blender / blenloader / intern / readfile.c
index 826d9d196b86017616a9ce776bcd84e8dffde39c..4c82e10d717f545325d8d48781b8e4371096aa92 100644 (file)
@@ -6112,14 +6112,15 @@ static void direct_link_movieReconstruction(FileData *fd, MovieTrackingReconstru
        reconstruction->cameras = newdataadr(fd, reconstruction->cameras);
 }
 
-static void direct_link_movieTracks(FileData *fd, ListBase *tracksbase)
+static void direct_link_movieTracks(FileData *fd, MovieClip *clip, ListBase *tracksbase)
 {
        MovieTrackingTrack *track;
        
        link_list(fd, tracksbase);
-       
+
        for (track = tracksbase->first; track; track = track->next) {
                track->markers = newdataadr(fd, track->markers);
+               track->gpd = newlibadr_us(fd, clip->id.lib, track->gpd);
        }
 }
 
@@ -6136,7 +6137,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
        if (fd->movieclipmap) clip->tracking.camera.intrinsics = newmclipadr(fd, clip->tracking.camera.intrinsics);
        else clip->tracking.camera.intrinsics = NULL;
 
-       direct_link_movieTracks(fd, &tracking->tracks);
+       direct_link_movieTracks(fd, clip, &tracking->tracks);
        direct_link_movieReconstruction(fd, &tracking->reconstruction);
 
        clip->tracking.act_track = newdataadr(fd, clip->tracking.act_track);
@@ -6155,7 +6156,7 @@ static void direct_link_movieclip(FileData *fd, MovieClip *clip)
        link_list(fd, &tracking->objects);
        
        for (object = tracking->objects.first; object; object = object->next) {
-               direct_link_movieTracks(fd, &object->tracks);
+               direct_link_movieTracks(fd, clip, &object->tracks);
                direct_link_movieReconstruction(fd, &object->reconstruction);
        }
 }
@@ -7041,12 +7042,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                                        
                                track = clip->tracking.tracks.first;
                                while (track) {
-                                       if (track->pyramid_levels == 0)
-                                               track->pyramid_levels = 2;
-                                       
                                        if (track->minimum_correlation == 0.0f)
                                                track->minimum_correlation = 0.75f;
-                                       
+
                                        track = track->next;
                                }
                        }
@@ -7064,10 +7062,9 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                
                for (clip= main->movieclip.first; clip; clip= clip->id.next) {
                        MovieTrackingSettings *settings= &clip->tracking.settings;
-                       
-                       if (settings->default_pyramid_levels == 0) {
-                               settings->default_tracker= TRACKER_KLT;
-                               settings->default_pyramid_levels = 2;
+
+                       if (settings->default_pattern_size == 0.0f) {
+                               settings->default_motion_model = TRACK_MOTION_MODEL_TRANSLATION;
                                settings->default_minimum_correlation = 0.75;
                                settings->default_pattern_size = 11;
                                settings->default_search_size = 51;
@@ -7595,6 +7592,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+
        if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 8))
        {
                /* set new deactivation values for game settings */
@@ -7622,6 +7620,46 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                }
        }
 
+       {
+               MovieClip *clip;
+
+               for (clip = main->movieclip.first; clip; clip = clip->id.next) {
+                       MovieTrackingTrack *track;
+
+                       track = clip->tracking.tracks.first;
+                       while (track) {
+                               int i;
+
+                               for (i = 0; i < track->markersnr; i++) {
+                                       MovieTrackingMarker *marker = &track->markers[i];
+
+                                       if (is_zero_v2(marker->pattern_corners[0]) && is_zero_v2(marker->pattern_corners[1]) &&
+                                           is_zero_v2(marker->pattern_corners[3]) && is_zero_v2(marker->pattern_corners[3]))
+                                       {
+                                               marker->pattern_corners[0][0] = track->pat_min[0];
+                                               marker->pattern_corners[0][1] = track->pat_min[1];
+
+                                               marker->pattern_corners[1][0] = track->pat_max[0];
+                                               marker->pattern_corners[1][1] = track->pat_min[1];
+
+                                               marker->pattern_corners[2][0] = track->pat_max[0];
+                                               marker->pattern_corners[2][1] = track->pat_max[1];
+
+                                               marker->pattern_corners[3][0] = track->pat_min[0];
+                                               marker->pattern_corners[3][1] = track->pat_max[1];
+                                       }
+
+                                       if (is_zero_v2(marker->search_min) && is_zero_v2(marker->search_max)) {
+                                               copy_v2_v2(marker->search_min, track->search_min);
+                                               copy_v2_v2(marker->search_max, track->search_max);
+                                       }
+                               }
+
+                               track = track->next;
+                       }
+               }
+       }
+
        {
                bScreen *sc;