Motion tracking curves: correct some operator's poll functions
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Dec 2013 13:35:29 +0000 (19:35 +0600)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 25 Dec 2013 13:36:54 +0000 (19:36 +0600)
Curve selection and transform were allowed in cases track's motion
curve wasn't visible.

source/blender/editors/space_clip/clip_graph_ops.c
source/blender/editors/transform/transform_conversions.c

index 22b14df2b38f414742f83740cbfe6dca9f9aa9cf..44261b8b500e38a373e5d252aebbb331f383bf1e 100644 (file)
@@ -72,6 +72,16 @@ static int ED_space_clip_graph_poll(bContext *C)
        return FALSE;
 }
 
+static int clip_graph_knots_poll(bContext *C)
+{
+       if (ED_space_clip_graph_poll(C)) {
+               SpaceClip *sc = CTX_wm_space_clip(C);
+
+               return (sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) != 0;
+       }
+       return FALSE;
+}
+
 typedef struct {
        int action;
 } SelectUserData;
@@ -302,7 +312,7 @@ void CLIP_OT_graph_select(wmOperatorType *ot)
        /* api callbacks */
        ot->exec = select_exec;
        ot->invoke = select_invoke;
-       ot->poll = ED_space_clip_graph_poll;
+       ot->poll = clip_graph_knots_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -394,7 +404,7 @@ void CLIP_OT_graph_select_border(wmOperatorType *ot)
        ot->invoke = WM_border_select_invoke;
        ot->exec = border_select_graph_exec;
        ot->modal = WM_border_select_modal;
-       ot->poll = ED_space_clip_graph_poll;
+       ot->poll = clip_graph_knots_poll;
 
        /* flags */
        ot->flag = OPTYPE_UNDO;
@@ -461,7 +471,7 @@ void CLIP_OT_graph_select_all_markers(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = graph_select_all_markers_exec;
-       ot->poll = ED_space_clip_graph_poll;
+       ot->poll = clip_graph_knots_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -496,7 +506,7 @@ void CLIP_OT_graph_delete_curve(wmOperatorType *ot)
        /* api callbacks */
        ot->invoke = WM_operator_confirm;
        ot->exec = delete_curve_exec;
-       ot->poll = ED_space_clip_tracking_poll;
+       ot->poll = clip_graph_knots_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
@@ -536,7 +546,7 @@ void CLIP_OT_graph_delete_knot(wmOperatorType *ot)
 
        /* api callbacks */
        ot->exec = delete_knot_exec;
-       ot->poll = ED_space_clip_graph_poll;
+       ot->poll = clip_graph_knots_poll;
 
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
index ce11400646a0dcd92b42928a51cf1b1076e06197..c06ccccf88d374780dbbaf87c0577efd0c407d93 100644 (file)
@@ -6380,6 +6380,10 @@ static void createTransTrackingCurvesData(bContext *C, TransInfo *t)
        /* count */
        t->total = 0;
 
+       if ((sc->flag & SC_SHOW_GRAPH_TRACKS_MOTION) == 0) {
+               return;
+       }
+
        track = tracksbase->first;
        while (track) {
                if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED) == 0) {