Merging r37437 through r37478 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 14 Jun 2011 16:08:39 +0000 (16:08 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 14 Jun 2011 16:08:39 +0000 (16:08 +0000)
1  2 
CMakeLists.txt
source/blender/blenloader/intern/readfile.c
source/blender/editors/transform/transform_generics.c

diff --combined CMakeLists.txt
index 77c3cf01d8f9067bba8afc9c2f1dc6b111c4f383,2c27076c10ef1c6304385035ce6991e34cafe423..5b2caf4c9f9cf3a50916bd0928a88d4ab693e70f
@@@ -154,9 -154,6 +154,9 @@@ option(WITH_SAMPLERATE    "Enable sampl
  option(WITH_LZO           "Enable fast LZO compression (used for pointcache)" ON)
  option(WITH_LZMA          "Enable best LZMA compression, (used for pointcache)" ON)
  
 +# Tracking
 +option(WITH_LIBMV         "Enable libmv structure from motion library" ON)
 +
  # Misc
  option(WITH_RAYOPTIMIZATION   "Enable use of SIMD (SSE) optimizations for the raytracer" ON) 
  if(UNIX AND NOT APPLE)
@@@ -226,9 -223,6 +226,6 @@@ if(WITH_PYTHON_MODULE
        set(WITH_HEADLESS ON)
  endif()
  
- # remove old vars
- unset(WITH_INSTALL CACHE)
  TEST_SSE_SUPPORT()
  
  #-----------------------------------------------------------------------------
  # linux only, not cached
  set(WITH_BINRELOC OFF)
  
+ # MAXOSX only, set to avoid uninitialized 
+ set(EXETYPE "")
  # these are added to later on.
  set(C_WARNINGS "")
  set(CXX_WARNINGS "")
index 726e13372a7ae33caa9e840eddc6fce00876511c,1e604c45772fa884eccbf7a63ddf54363133e2ef..c8ea7a081a3091d23539eec725b3c0dd019bc3b4
@@@ -88,7 -88,6 +88,7 @@@
  #include "DNA_space_types.h"
  #include "DNA_vfont_types.h"
  #include "DNA_world_types.h"
 +#include "DNA_movieclip_types.h"
  
  #include "MEM_guardedalloc.h"
  
@@@ -1033,8 -1032,6 +1033,8 @@@ void blo_freefiledata(FileData *fd
                        oldnewmap_free(fd->globmap);
                if (fd->imamap)
                        oldnewmap_free(fd->imamap);
 +              if (fd->movieclipmap)
 +                      oldnewmap_free(fd->movieclipmap);
                if (fd->libmap && !(fd->flags & FD_FLAGS_NOT_MY_LIBMAP))
                        oldnewmap_free(fd->libmap);
                if (fd->bheadmap)
@@@ -1110,13 -1107,6 +1110,13 @@@ static void *newimaadr(FileData *fd, vo
        return NULL;
  }
  
 +static void *newmclipadr(FileData *fd, void *adr)              /* used to restore movie clip data after undo */
 +{
 +      if(fd->movieclipmap && adr)
 +              return oldnewmap_lookup_and_inc(fd->movieclipmap, adr);
 +      return NULL;
 +}
 +
  
  static void *newlibadr(FileData *fd, void *lib, void *adr)            /* only lib data */
  {
@@@ -1245,38 -1235,6 +1245,38 @@@ void blo_end_image_pointer_map(FileDat
        }
  }
  
 +void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain)
 +{
 +      MovieClip *clip= oldmain->movieclip.first;
 +
 +      fd->movieclipmap= oldnewmap_new();
 +
 +      for(;clip; clip= clip->id.next) {
 +              if(clip->ibuf_cache)
 +                      oldnewmap_insert(fd->movieclipmap, clip->ibuf_cache, clip->ibuf_cache, 0);
 +      }
 +}
 +
 +/* set old main movie clips caches to zero if it has been restored */
 +/* this works because freeing old main only happens after this call */
 +void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain)
 +{
 +      OldNew *entry= fd->movieclipmap->entries;
 +      MovieClip *clip= oldmain->movieclip.first;
 +      int i;
 +
 +      /* used entries were restored, so we put them to zero */
 +      for (i=0; i<fd->movieclipmap->nentries; i++, entry++) {
 +              if (entry->nr>0)
 +                              entry->newp= NULL;
 +      }
 +
 +      for(;clip; clip= clip->id.next) {
 +              clip->ibuf_cache= newmclipadr(fd, clip->ibuf_cache);
 +      }
 +}
 +
 +
  /* undo file support: add all library pointers in lookup */
  void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd)
  {
@@@ -4844,7 -4802,6 +4844,7 @@@ static void lib_link_screen(FileData *f
  
                                                for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
                                                        bgpic->ima= newlibadr_us(fd, sc->id.lib, bgpic->ima);
 +                                                      bgpic->clip= newlibadr_us(fd, sc->id.lib, bgpic->clip);
                                                }
                                                if(v3d->localvd) {
                                                        v3d->localvd->camera= newlibadr(fd, sc->id.lib, v3d->localvd->camera);
                                                
                                                snode->linkdrag.first = snode->linkdrag.last = NULL;
                                        }
 +                                      else if(sl->spacetype==SPACE_CLIP) {
 +                                              SpaceClip *sclip= (SpaceClip *)sl;
 +
 +                                              sclip->clip= newlibadr_us(fd, sc->id.lib, sclip->clip);
 +                                      }
                                }
                                sa= sa->next;
                        }
@@@ -5062,7 -5014,6 +5062,7 @@@ void lib_link_screen_restore(Main *newm
                                        
                                        for(bgpic= v3d->bgpicbase.first; bgpic; bgpic= bgpic->next) {
                                                bgpic->ima= restore_pointer_by_name(newmain, (ID *)bgpic->ima, 1);
 +                                              bgpic->clip= restore_pointer_by_name(newmain, (ID *)bgpic->clip, 1);
                                        }
                                        if(v3d->localvd) {
                                                /*Base *base;*/
                                                        snode->nodetree= ((Tex *)snode->id)->nodetree;
                                        }
                                }
 +                              else if(sl->spacetype==SPACE_CLIP) {
 +                                      SpaceClip *sclip= (SpaceClip *)sl;
 +
 +                                      sclip->clip= restore_pointer_by_name(newmain, (ID *)sclip->clip, 1);
 +                              }
                        }
                        sa= sa->next;
                }
@@@ -5651,59 -5597,6 +5651,59 @@@ static void lib_link_group(FileData *fd
        }
  }
  
 +/* ***************** READ MOVIECLIP *************** */
 +
 +static void direct_link_movieclip(FileData *fd, MovieClip *clip)
 +{
 +      MovieTrackingTrack *track;
 +      MovieTrackingBundle *bundle;
 +
 +      if(fd->movieclipmap) clip->ibuf_cache= newmclipadr(fd, clip->ibuf_cache);
 +      else clip->ibuf_cache= NULL;
 +
 +      clip->adt= newdataadr(fd, clip->adt);
 +      direct_link_animdata(fd, clip->adt);
 +
 +      link_list(fd, &clip->tracking.tracks);
 +
 +      track= clip->tracking.tracks.first;
 +      while(track) {
 +              track->bundle= newdataadr(fd, track->bundle);
 +              track->markers= newdataadr(fd, track->markers);
 +
 +              track= track->next;
 +      }
 +
 +      link_list(fd, &clip->tracking.bundles);
 +      bundle= clip->tracking.bundles.first;
 +      while(bundle) {
 +              bundle->track= newdataadr(fd, bundle->track);
 +
 +              bundle= bundle->next;
 +      }
 +
 +      clip->last_sel= newdataadr(fd, clip->last_sel);
 +      if(clip->last_sel==NULL)
 +              clip->sel_type= MCLIP_SEL_NONE;
 +
 +      clip->anim= NULL;
 +}
 +
 +static void lib_link_movieclip(FileData *fd, Main *main)
 +{
 +      MovieClip *clip;
 +
 +      clip= main->movieclip.first;
 +      while(clip) {
 +              if(clip->id.flag & LIB_NEEDLINK) {
 +                      if(clip->adt) lib_link_animdata(fd, &clip->id, clip->adt);
 +
 +                      clip->id.flag -= LIB_NEEDLINK;
 +              }
 +              clip= clip->id.next;
 +      }
 +}
 +
  /* ************** GENERAL & MAIN ******************** */
  
  
@@@ -5737,7 -5630,6 +5737,7 @@@ static const char *dataname(short id_co
                case ID_BR: return "Data from BR";
                case ID_PA: return "Data from PA";
                case ID_GD: return "Data from GD";
 +              case ID_MC: return "Data from MC";
        }
        return "Data from Lib Block";
        
@@@ -5904,9 -5796,6 +5904,9 @@@ static BHead *read_libblock(FileData *f
                case ID_GD:
                        direct_link_gpencil(fd, (bGPdata *)id);
                        break;
 +              case ID_MC:
 +                      direct_link_movieclip(fd, (MovieClip *)id);
 +                      break;
        }
        
        /*link direct data of ID properties*/
@@@ -11758,6 -11647,21 +11758,21 @@@ static void do_versions(FileData *fd, L
                                }
                        }
                }
+               {
+                       /* add default value for behind strength of camera actuator */
+                       Object *ob;
+                       bActuator *act;
+                       for(ob = main->object.first; ob; ob= ob->id.next) {
+                               for(act= ob->actuators.first; act; act= act->next) {
+                                       if (act->type == ACT_CAMERA) {
+                                               bCameraActuator *ba= act->data;
+                                               ba->damping = 1.0/32.0;
+                                       }
+                               }
+                       }
+               }
        }
        
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
@@@ -11803,7 -11707,6 +11818,7 @@@ static void lib_link_all(FileData *fd, 
        lib_link_nodetree(fd, main);    /* has to be done after scene/materials, this will verify group nodes */
        lib_link_brush(fd, main);
        lib_link_particlesettings(fd, main);
 +      lib_link_movieclip(fd, main);
  
        lib_link_mesh(fd, main);                /* as last: tpage images with users at zero */
  
index dd9c639a4f202307a44f8db80be3c34e93f5320d,71ebe5e051cc8ff5db1bf5f8a6e92a764b095906..0345c8834a6784537524bc998d7854de4b4b7fb4
@@@ -49,7 -49,6 +49,7 @@@
  #include "DNA_meshdata_types.h"
  #include "DNA_view3d_types.h"
  #include "DNA_modifier_types.h"
 +#include "DNA_movieclip_types.h"
  
  #include "RNA_access.h"
  
@@@ -73,7 -72,6 +73,7 @@@
  #include "BKE_mesh.h"
  #include "BKE_nla.h"
  #include "BKE_context.h"
 +#include "BKE_tracking.h"
  
  #include "ED_anim_api.h"
  #include "ED_armature.h"
@@@ -87,7 -85,6 +87,7 @@@
  #include "ED_uvedit.h"
  #include "ED_view3d.h"
  #include "ED_curve.h" /* for ED_curve_editnurbs */
 +#include "ED_clip.h"
  
  //#include "BDR_unwrapper.h"
  
@@@ -678,8 -675,9 +678,9 @@@ void recalcData(TransInfo *t
                                EditMesh *em = ((Mesh*)t->obedit->data)->edit_mesh;
                                /* mirror modifier clipping? */
                                if(t->state != TRANS_CANCEL) {
-                                       clipMirrorModifier(t, t->obedit);
+                                       /* apply clipping after so we never project past the clip plane [#25423] */
                                        applyProject(t);
+                                       clipMirrorModifier(t, t->obedit);
                                }
                                if((t->options & CTX_NO_MIRROR) == 0 && (t->flag & T_MIRROR))
                                        editmesh_apply_to_mirror(t);
                if(((View3D*)t->view)->drawtype == OB_SHADED)
                        reshadeall_displist(t->scene);
        }
 +      else if (t->spacetype == SPACE_CLIP) {
 +              SpaceClip *sc= t->sa->spacedata.first;
 +              MovieClip *clip= ED_space_clip(sc);
 +              MovieTrackingTrack *track;
 +              flushTransTracking(t);
 +
 +              track= clip->tracking.tracks.first;
 +              while(track) {
 +                      if(TRACK_SELECTED(track)) {
 +                              if (t->mode == TFM_TRANSLATION) {
 +                                      if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
 +                                              BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
 +                                      if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
 +                                              BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
 +                              }
 +                              else if (t->mode == TFM_RESIZE) {
 +                                      if(TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
 +                                              BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
 +                                      if(TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
 +                                              BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
 +                              }
 +                      }
 +
 +                      track= track->next;
 +              }
 +      }
  }
  
  void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)