svn merge -r41638:41648 ^/trunk/blender
[blender.git] / source / blender / editors / transform / transform_generics.c
index 409dbdf33afd38e62c2bce325b3f0c888976d104..82920ca51ffe3bca70e1be1888451faf10a76d5a 100644 (file)
@@ -619,6 +619,65 @@ static void recalcData_nla(TransInfo *t)
        }
 }
 
+/* helper for recalcData() - for Image Editor transforms */
+static void recalcData_image(TransInfo *t)
+{
+       if (t->obedit && t->obedit->type == OB_MESH) {
+               SpaceImage *sima= t->sa->spacedata.first;
+               
+               flushTransUVs(t);
+               if(sima->flag & SI_LIVE_UNWRAP)
+                       ED_uvedit_live_unwrap_re_solve();
+               
+               DAG_id_tag_update(t->obedit->data, 0);
+       }
+}
+
+/* helper for recalcData() - for Movie Clip transforms */
+static void recalcData_clip(TransInfo *t)
+{
+       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);
+}
+
 /* helper for recalcData() - for 3d-view transforms */
 static void recalcData_view3d(TransInfo *t)
 {
@@ -855,60 +914,13 @@ void recalcData(TransInfo *t)
                recalcData_nla(t);
        }
        else if (t->spacetype == SPACE_IMAGE) {
-               if (t->obedit && t->obedit->type == OB_MESH) {
-                       SpaceImage *sima= t->sa->spacedata.first;
-                       
-                       flushTransUVs(t);
-                       if(sima->flag & SI_LIVE_UNWRAP)
-                               ED_uvedit_live_unwrap_re_solve();
-                       
-                       DAG_id_tag_update(t->obedit->data, 0);
-               }
+               recalcData_image(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);
+               recalcData_clip(t);
        }
 }