Merging r40653 through r40847 from trunk into soc-2011-tomato
[blender.git] / source / blender / editors / transform / transform_generics.c
index 38776b51c62dfb888a5bfdf5b1c4530159700a76..cfdd370e568e443c08bfaef1942833c13935a532 100644 (file)
@@ -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"
 
@@ -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"
@@ -85,6 +87,7 @@
 #include "ED_uvedit.h"
 #include "ED_view3d.h"
 #include "ED_curve.h" /* for curve_editnurbs */
+#include "ED_clip.h"
 
 //#include "BDR_unwrapper.h"
 
@@ -865,6 +868,48 @@ void recalcData(TransInfo *t)
        else if (t->spacetype == SPACE_VIEW3D) {
                recalcData_view3d(t);
        }
+       else if (t->spacetype == SPACE_CLIP) {
+               SpaceClip *sc= t->sa->spacedata.first;
+               MovieClip *clip= ED_space_clip(sc);
+               MovieTrackingTrack *track;
+
+               if(t->state == TRANS_CANCEL) {
+                       track= clip->tracking.tracks.first;
+                       while(track) {
+                               if(TRACK_VIEW_SELECTED(sc, track)) {
+                                       MovieTrackingMarker *marker= BKE_tracking_ensure_marker(track, sc->user.framenr);
+
+                                       marker->flag= track->transflag;
+                               }
+
+                               track= track->next;
+                       }
+               }
+
+               flushTransTracking(t);
+
+               track= clip->tracking.tracks.first;
+               while(track) {
+                       if(TRACK_VIEW_SELECTED(sc, 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;
+               }
+
+               DAG_id_tag_update(&clip->id, 0);
+       }
 }
 
 void drawLine(TransInfo *t, float *center, float *dir, char axis, short options)
@@ -1187,6 +1232,12 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                t->options |= CTX_NO_PET;
        }
        
+       // Mirror is not supported with PET, turn it off.
+       if (t->flag & T_PROP_EDIT)
+       {
+               t->flag &= ~T_MIRROR;
+       }
+
        setTransformViewMatrices(t);
        initNumInput(&t->num);
        
@@ -1270,7 +1321,8 @@ void applyTransObjects(TransInfo *t)
        recalcData(t);
 }
 
-static void restoreElement(TransData *td) {
+static void restoreElement(TransData *td)
+{
        /* TransData for crease has no loc */
        if (td->loc) {
                copy_v3_v3(td->loc, td->iloc);