diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-02 21:33:48 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-05-02 21:33:48 +0400 |
commit | 6f3400ca521e84b1b627f2b5a53835d73e3ed2ea (patch) | |
tree | de3f9d78f38aa26b4c46098653d090352d8fb644 /source | |
parent | d64661b5078cd4781bd58fce6fadedac511c4132 (diff) |
Clip editor: cleanup of View menu - do not show operators which doesn't make sense in dopesheet/curve view
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/include/ED_clip.h | 3 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_editor.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 14 |
4 files changed, 22 insertions, 12 deletions
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index db6d9bbd013..03e7bd62a2c 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -42,6 +42,9 @@ struct wmEvent; /* clip_editor.c */ int ED_space_clip_poll(struct bContext *C); + +int ED_space_clip_view_clip_poll(struct bContext *C); + int ED_space_clip_tracking_poll(struct bContext *C); int ED_space_clip_tracking_size_poll(struct bContext *C); int ED_space_clip_tracking_frame_poll(struct bContext *C); diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 443cb8f7ef4..c5c5628abb9 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -73,6 +73,17 @@ int ED_space_clip_poll(bContext *C) return FALSE; } +int ED_space_clip_view_clip_poll(bContext *C) +{ + SpaceClip *sc = CTX_wm_space_clip(C); + + if (sc && sc->clip) { + return sc->view == SC_VIEW_CLIP; + } + + return FALSE; +} + int ED_space_clip_tracking_poll(bContext *C) { SpaceClip *sc= CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 03557a0b264..905aa2d11d4 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -66,11 +66,7 @@ static int ED_space_clip_graph_poll(bContext *C) if (ED_space_clip_tracking_poll(C)) { SpaceClip *sc = CTX_wm_space_clip(C); - if (sc->view == SC_VIEW_GRAPH) { - ARegion *ar = CTX_wm_region(C); - - return ar->regiontype == RGN_TYPE_PREVIEW; - } + return sc->view == SC_VIEW_GRAPH; } return FALSE; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 2bfc7a1dec8..133c807a7ff 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -408,7 +408,7 @@ void CLIP_OT_view_pan(wmOperatorType *ot) ot->invoke = view_pan_invoke; ot->modal = view_pan_modal; ot->cancel = view_pan_cancel; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* flags */ ot->flag = OPTYPE_BLOCKING; @@ -534,7 +534,7 @@ void CLIP_OT_view_zoom(wmOperatorType *ot) ot->invoke = view_zoom_invoke; ot->modal = view_zoom_modal; ot->cancel = view_zoom_cancel; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* flags */ ot->flag = OPTYPE_BLOCKING|OPTYPE_GRAB_POINTER; @@ -580,7 +580,7 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot) /* api callbacks */ ot->exec = view_zoom_in_exec; ot->invoke = view_zoom_in_invoke; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in screen coordinates", -10.0f, 10.0f); @@ -620,7 +620,7 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot) /* api callbacks */ ot->exec = view_zoom_out_exec; ot->invoke = view_zoom_out_invoke; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f); @@ -652,7 +652,7 @@ void CLIP_OT_view_zoom_ratio(wmOperatorType *ot) /* api callbacks */ ot->exec = view_zoom_ratio_exec; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_float(ot->srna, "ratio", 0.0f, 0.0f, FLT_MAX, @@ -719,7 +719,7 @@ void CLIP_OT_view_all(wmOperatorType *ot) /* api callbacks */ ot->exec = view_all_exec; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; /* properties */ RNA_def_boolean(ot->srna, "fit_view", 0, "Fit View", "Fit frame to the viewport"); @@ -749,7 +749,7 @@ void CLIP_OT_view_selected(wmOperatorType *ot) /* api callbacks */ ot->exec = view_selected_exec; - ot->poll = ED_space_clip_poll; + ot->poll = ED_space_clip_view_clip_poll; } /********************** change frame operator *********************/ |