Tomato: fixes for marker sliding operator
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 15 May 2012 15:05:45 +0000 (15:05 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 15 May 2012 15:05:45 +0000 (15:05 +0000)
- Fixed crash on slide undo. Was caused by some typos in slide
  data initialization and not checking for slide action in
  cancel callback
- Always create keyframe for frame when marker is stared sliding.

source/blender/editors/space_clip/tracking_ops.c

index d50bed005abfce2d4bf3b94452898cf343612d2f..89b14b06220c0638e7eaa4d0d2df4c203c0eba87 100644 (file)
@@ -315,7 +315,7 @@ static SlideMarkerData *create_slide_marker_data(SpaceClip *sc, MovieTrackingTra
        }
 
        if ((area == TRACK_AREA_SEARCH) ||
-               (area == TRACK_AREA_PAT && !ELEM(action, SLIDE_ACTION_OFFSET, SLIDE_ACTION_POS)))
+               (area == TRACK_AREA_PAT && action != SLIDE_ACTION_OFFSET))
        {
                if (data->corners) {
                        memcpy(data->scorners, data->corners, sizeof(data->scorners));
@@ -591,7 +591,9 @@ static void cancel_mouse_slide(SlideMarkerData *data)
                        copy_v2_v2(data->pos, data->spos);
        }
        else {
-               if (data->action == SLIDE_ACTION_SIZE) {
+               if ((data->action == SLIDE_ACTION_SIZE) ||
+                   (data->action == SLIDE_ACTION_POS && data->area == TRACK_AREA_PAT))
+               {
                        if (data->corners) {
                                memcpy(data->corners, data->scorners, sizeof(data->scorners));
                        }
@@ -663,8 +665,6 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
                                else {
                                        data->pos[0] = data->spos[0] + dx;
                                        data->pos[1] = data->spos[1] + dy;
-
-                                       data->marker->flag &= ~MARKER_TRACKED;
                                }
 
                                WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
@@ -734,6 +734,8 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event)
                                }
                        }
 
+                       data->marker->flag &= ~MARKER_TRACKED;
+
                        WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
 
                        break;