diff options
Diffstat (limited to 'source/blender/editors/space_clip')
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 5 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_graph_ops.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_ops.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_clip/tracking_ops.c | 35 |
5 files changed, 44 insertions, 20 deletions
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index bf8976035a8..2f9956fc143 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -1380,7 +1380,12 @@ void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene) if (ibuf) { draw_movieclip_buffer(sc, ar, ibuf, width, height, zoomx, zoomy); IMB_freeImBuf(ibuf); + } + else { + ED_region_grid_draw(ar, zoomx, zoomy); + } + if (width && height) { draw_tracking_tracks(sc, ar, clip, width, height, zoomx, zoomy); draw_distortion(sc, ar, clip, width, height, zoomx, zoomy); } diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index f8c81c2944a..b569469d304 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -82,7 +82,7 @@ static void toggle_selection_cb(void *userdata, MovieTrackingMarker *marker) { SelectUserData *data = (SelectUserData *)userdata; - switch(data->action) { + switch (data->action) { case SEL_SELECT: marker->flag |= MARKER_GRAPH_SEL; break; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 7e1bbc254e9..c7033b0db99 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -157,7 +157,7 @@ static int open_exec(bContext *C, wmOperator *op) errno = 0; - clip = BKE_add_movieclip_file(str); + clip = BKE_movieclip_file_add(str); if (!clip) { if (op->customdata) @@ -361,7 +361,7 @@ static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) ViewPanData *vpd = op->customdata; float offset[2]; - switch(event->type) { + switch (event->type) { case MOUSEMOVE: copy_v2_v2(vpd->vec, &vpd->xorig); offset[0] = (vpd->x - event->x) / sc->zoom; @@ -496,7 +496,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) ViewZoomData *vpd = op->customdata; float factor; - switch(event->type) { + switch (event->type) { case MOUSEMOVE: factor = 1.0f + (vpd->x-event->x + vpd->y - event->y) / 300.0f; RNA_float_set(op->ptr, "factor", factor); diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 228c716e3b6..4de790bc00c 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -236,9 +236,9 @@ static SpaceLink *clip_duplicate(SpaceLink *sl) static void clip_listener(ScrArea *sa, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SCENE: - switch(wmn->data) { + switch (wmn->data) { case ND_FRAME: clip_scopes_tag_refresh(sa); /* no break! */ @@ -249,14 +249,14 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn) } break; case NC_MOVIECLIP: - switch(wmn->data) { + switch (wmn->data) { case ND_DISPLAY: case ND_SELECT: clip_scopes_tag_refresh(sa); ED_area_tag_redraw(sa); break; } - switch(wmn->action) { + switch (wmn->action) { case NA_REMOVED: case NA_EDITED: case NA_EVALUATED: @@ -270,7 +270,7 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn) } break; case NC_GEOM: - switch(wmn->data) { + switch (wmn->data) { case ND_SELECT: clip_scopes_tag_refresh(sa); ED_area_tag_redraw(sa); @@ -808,7 +808,7 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar) static void clip_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SCREEN: if (wmn->data == ND_GPENCIL) ED_region_tag_redraw(ar); @@ -896,7 +896,7 @@ static void clip_tools_area_draw(const bContext *C, ARegion *ar) static void clip_props_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_WM: if (wmn->data == ND_HISTORY) ED_region_tag_redraw(ar); @@ -941,7 +941,7 @@ static void clip_properties_area_draw(const bContext *C, ARegion *ar) static void clip_properties_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ - switch(wmn->category) { + switch (wmn->category) { case NC_SCREEN: if (wmn->data ==ND_GPENCIL) ED_region_tag_redraw(ar); diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 35986fa2700..f4454394ca3 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -92,6 +92,25 @@ static int space_clip_frame_poll(bContext *C) return FALSE; } +static int space_clip_size_poll(bContext *C) +{ + SpaceClip *sc = CTX_wm_space_clip(C); + + if (sc) { + MovieClip *clip = ED_space_clip(sc); + + if (clip) { + int width, height; + + BKE_movieclip_get_size(clip, &sc->user, &width, &height); + + return width > 0 && height > 0; + } + } + + return FALSE; +} + /********************** add marker operator *********************/ static void add_marker(SpaceClip *sc, float x, float y) @@ -156,7 +175,7 @@ void CLIP_OT_add_marker(wmOperatorType *ot) /* api callbacks */ ot->invoke = add_marker_invoke; ot->exec = add_marker_exec; - ot->poll = space_clip_frame_poll; + ot->poll = space_clip_size_poll; /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; @@ -526,7 +545,7 @@ static int slide_marker_modal(bContext *C, wmOperator *op, wmEvent *event) SlideMarkerData *data = (SlideMarkerData *)op->customdata; float dx, dy, mdelta[2]; - switch(event->type) { + switch (event->type) { case LEFTCTRLKEY: case RIGHTCTRLKEY: case LEFTSHIFTKEY: @@ -643,7 +662,7 @@ void CLIP_OT_slide_marker(wmOperatorType *ot) ot->idname = "CLIP_OT_slide_marker"; /* api callbacks */ - ot->poll = space_clip_frame_poll; + ot->poll = space_clip_size_poll; ot->invoke = slide_marker_invoke; ot->modal = slide_marker_modal; @@ -1200,7 +1219,7 @@ void CLIP_OT_select_grouped(wmOperatorType *ot) /* api callbacks */ ot->exec = select_groped_exec; - ot->poll = space_clip_frame_poll; + ot->poll = space_clip_size_poll; /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; @@ -2016,7 +2035,7 @@ static Object *get_orientation_object(bContext *C) static int set_orientation_poll(bContext *C) { - if (space_clip_frame_poll(C)) { + if (space_clip_size_poll(C)) { Scene *scene = CTX_data_scene(C); SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); @@ -2626,7 +2645,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot) static int set_solution_scale_poll(bContext *C) { - if (space_clip_frame_poll(C)) { + if (space_clip_size_poll(C)) { SpaceClip *sc = CTX_wm_space_clip(C); MovieClip *clip = ED_space_clip(sc); MovieTracking *tracking = &clip->tracking; @@ -2974,7 +2993,7 @@ void CLIP_OT_frame_jump(wmOperatorType *ot) /* api callbacks */ ot->exec = frame_jump_exec; - ot->poll = space_clip_frame_poll; + ot->poll = ED_space_clip_poll; /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; @@ -3031,7 +3050,7 @@ void CLIP_OT_join_tracks(wmOperatorType *ot) /* api callbacks */ ot->exec = join_tracks_exec; - ot->poll = space_clip_frame_poll; + ot->poll = space_clip_size_poll; /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; |