svn merge ^/trunk/blender -r47184:47201
authorCampbell Barton <ideasman42@gmail.com>
Wed, 30 May 2012 04:48:10 +0000 (04:48 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 30 May 2012 04:48:10 +0000 (04:48 +0000)
1  2 
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c

index edcddd6d54090b1cb793c17b63e192923d2b0baf,62d5459336bd67efa8976a8641045746f567dda1..d9f1a6372ee6e7d8ed6d1909b22d9151ce28d2eb
@@@ -63,7 -63,6 +63,7 @@@
  #include "BKE_idprop.h"
  #include "BKE_library.h"
  #include "BKE_main.h"
 +#include "BKE_mask.h"
  #include "BKE_node.h"
  #include "BKE_object.h"
  #include "BKE_paint.h"
@@@ -517,6 -516,9 +517,9 @@@ Scene *BKE_scene_add(const char *name
        sce->gm.maxlogicstep = 5;
        sce->gm.physubstep = 1;
        sce->gm.maxphystep = 5;
+       sce->gm.lineardeactthreshold = 0.8f;
+       sce->gm.angulardeactthreshold = 1.0f;
+       sce->gm.deactivationtime = 0.0f;
  
        sce->gm.flag = GAME_DISPLAY_LISTS;
        sce->gm.matmode = GAME_MAT_MULTITEX;
@@@ -1002,9 -1004,6 +1005,9 @@@ static void scene_update_tagged_recursi
  
        /* update sound system animation */
        sound_update_scene(scene);
 +
 +      /* update masking curves */
 +      BKE_mask_update_scene(bmain, scene, FALSE);
  }
  
  /* this is called in main loop, doing tagged updates before redraw */
@@@ -1075,8 -1074,6 +1078,8 @@@ void BKE_scene_update_for_newframe(Mai
         * so don't call within 'scene_update_tagged_recursive' */
        DAG_scene_update_flags(bmain, sce, lay, TRUE);   // only stuff that moves or needs display still
  
 +      BKE_mask_evaluate_all_masks(bmain, ctime, TRUE);
 +
        /* All 'standard' (i.e. without any dependencies) animation is handled here,
         * with an 'local' to 'macro' order of evaluation. This should ensure that
         * settings stored nestled within a hierarchy (i.e. settings in a Texture block
index 5c432ae755a9b00f36521d73ec03f75c8c1fc7ea,081264d62df11258de6d0969e5d5f816591bbc2a..21a2d776232820b349c80da38f948ed548ca0915
@@@ -95,7 -95,6 +95,7 @@@
  #include "DNA_vfont_types.h"
  #include "DNA_world_types.h"
  #include "DNA_movieclip_types.h"
 +#include "DNA_mask_types.h"
  
  #include "MEM_guardedalloc.h"
  
@@@ -5346,10 -5345,9 +5346,10 @@@ static void lib_link_screen(FileData *f
                                        }
                                        else if (sl->spacetype == SPACE_CLIP) {
                                                SpaceClip *sclip = (SpaceClip *)sl;
 -                                              
 +
                                                sclip->clip = newlibadr_us(fd, sc->id.lib, sclip->clip);
 -                                              
 +                                              sclip->mask = newlibadr_us(fd, sc->id.lib, sclip->mask);
 +
                                                sclip->scopes.track_preview = NULL;
                                                sclip->draw_context = NULL;
                                                sclip->scopes.ok = 0;
@@@ -5610,10 -5608,9 +5610,10 @@@ void lib_link_screen_restore(Main *newm
                                }
                                else if (sl->spacetype == SPACE_CLIP) {
                                        SpaceClip *sclip = (SpaceClip *)sl;
 -                                      
 +
                                        sclip->clip = restore_pointer_by_name(newmain, (ID *)sclip->clip, 1);
 -                                      
 +                                      sclip->mask = restore_pointer_by_name(newmain, (ID *)sclip->mask, 1);
 +
                                        sclip->scopes.ok = 0;
                                }
                        }
@@@ -6104,15 -6101,14 +6104,15 @@@ static void direct_link_movieReconstruc
        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);
        }
  }
  
@@@ -6129,7 -6125,7 +6129,7 @@@ static void direct_link_movieclip(FileD
        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);
        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);
        }
  }
@@@ -6169,88 -6165,6 +6169,88 @@@ static void lib_link_movieclip(FileDat
        }
  }
  
 +/* ***************** READ MOVIECLIP *************** */
 +
 +static void direct_link_mask(FileData *fd, Mask *mask)
 +{
 +      MaskObject *maskobj;
 +
 +      mask->adt = newdataadr(fd, mask->adt);
 +
 +      link_list(fd, &mask->maskobjs);
 +
 +      for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 +              MaskSpline *spline;
 +              MaskObjectShape *maskobj_shape;
 +
 +              link_list(fd, &maskobj->splines);
 +
 +              for (spline = maskobj->splines.first; spline; spline = spline->next) {
 +                      int i;
 +
 +                      spline->points = newdataadr(fd, spline->points);
 +
 +                      for (i = 0; i < spline->tot_point; i++) {
 +                              MaskSplinePoint *point = &spline->points[i];
 +
 +                              if (point->tot_uw)
 +                                      point->uw = newdataadr(fd, point->uw);
 +                      }
 +              }
 +
 +              link_list(fd, &maskobj->splines_shapes);
 +
 +              for (maskobj_shape = maskobj->splines_shapes.first; maskobj_shape; maskobj_shape = maskobj_shape->next) {
 +                      maskobj_shape->data = newdataadr(fd, maskobj_shape->data);
 +              }
 +
 +              maskobj->act_spline = newdataadr(fd, maskobj->act_spline);
 +              maskobj->act_point = newdataadr(fd, maskobj->act_point);
 +      }
 +}
 +
 +static void lib_link_mask_parent(FileData *fd, Mask *mask, MaskParent *parent)
 +{
 +      parent->id = newlibadr_us(fd, mask->id.lib, parent->id);
 +}
 +
 +static void lib_link_mask(FileData *fd, Main *main)
 +{
 +      Mask *mask;
 +
 +      mask = main->mask.first;
 +      while (mask) {
 +              if(mask->id.flag & LIB_NEEDLINK) {
 +                      MaskObject *maskobj;
 +
 +                      if (mask->adt)
 +                              lib_link_animdata(fd, &mask->id, mask->adt);
 +
 +                      for (maskobj = mask->maskobjs.first; maskobj; maskobj = maskobj->next) {
 +                              MaskSpline *spline;
 +
 +                              spline = maskobj->splines.first;
 +                              while (spline) {
 +                                      int i;
 +
 +                                      for (i = 0; i < spline->tot_point; i++) {
 +                                              MaskSplinePoint *point = &spline->points[i];
 +
 +                                              lib_link_mask_parent(fd, mask, &point->parent);
 +                                      }
 +
 +                                      lib_link_mask_parent(fd, mask, &spline->parent);
 +
 +                                      spline = spline->next;
 +                              }
 +                      }
 +
 +                      mask->id.flag -= LIB_NEEDLINK;
 +              }
 +              mask = mask->id.next;
 +      }
 +}
 +
  /* ************** GENERAL & MAIN ******************** */
  
  
@@@ -6456,9 -6370,6 +6456,9 @@@ static BHead *read_libblock(FileData *f
                case ID_MC:
                        direct_link_movieclip(fd, (MovieClip *)id);
                        break;
 +              case ID_MSK:
 +                      direct_link_mask(fd, (Mask *)id);
 +                      break;
        }
        
        /*link direct data of ID properties*/
@@@ -7035,9 -6946,12 +7035,9 @@@ static void do_versions(FileData *fd, L
                                        
                                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;
                                }
                        }
                
                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;
  
        if (main->versionfile < 263) {
                /* set fluidsim rate. the version patch for this in 2.62 was wrong, so
-                * try to correct it, if rate is 0.0 that's likely not intentional */
+               try to correct it, if rate is 0.0 that's likely not intentional */
                Object *ob;
-               
                for (ob = main->object.first; ob; ob = ob->id.next) {
                        ModifierData *md;
                        for (md = ob->modifiers.first; md; md = md->next) {
                        }
                }
        }
 -      
 +
 +      {
 +              MovieClip *clip;
 +              bScreen *sc;
 +
 +              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;
 +                      }
 +              }
 +
 +              for (sc = main->screen.first; sc; sc = sc->id.next) {
 +                      ScrArea *sa;
 +
 +                      for (sa = sc->areabase.first; sa; sa = sa->next) {
 +                              SpaceLink *sl;
 +
 +                              for (sl = sa->spacedata.first; sl; sl = sl->next) {
 +                                      if (sl->spacetype == SPACE_CLIP) {
 +                                              SpaceClip *sclip = (SpaceClip *)sl;
 +
 +                                              if (sclip->around == 0) {
 +                                                      sclip->around = V3D_CENTROID;
 +                                              }
 +                                      }
 +                              }
 +                      }
 +              }
 +      }
 +
+       if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 8))
+       {
+               /* set new deactivation values for game settings */
+               Scene *sce;
+               for (sce = main->scene.first; sce; sce = sce->id.next) {
+                       /* Game Settings */
+                       sce->gm.lineardeactthreshold = 0.8f;
+                       sce->gm.angulardeactthreshold = 1.0f;
+                       sce->gm.deactivationtime = 2.0f;
+               }
+       }
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
        {
@@@ -7702,8 -7571,7 +7715,8 @@@ static void lib_link_all(FileData *fd, 
        lib_link_brush(fd, main);
        lib_link_particlesettings(fd, main);
        lib_link_movieclip(fd, main);
 -      
 +      lib_link_mask(fd, main);
 +
        lib_link_mesh(fd, main);                /* as last: tpage images with users at zero */
        
        lib_link_library(fd, main);             /* only init users */