Camera tracking integration

===========================

- Fixed jump when sliding movie clip with lock to selection enabled and nothing selected.
- Reset offset from locked position when adding new marker.
This commit is contained in:
Sergey Sharybin
2011-10-29 11:34:26 +00:00
parent 393a95b7e3
commit e4cbb8dd94
4 changed files with 14 additions and 8 deletions

View File

@@ -52,7 +52,7 @@ struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc);
struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2], float *scale, float *angle);
void ED_clip_update_frame(const struct Main *mainp, int cfra);
void ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
int ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2]);
void ED_clip_point_stable_pos(struct bContext *C, float x, float y, float *xr, float *yr);

View File

@@ -202,17 +202,17 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
return ok;
}
void ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
{
int w, h, frame_width, frame_height;
float min[2], max[2];
ED_space_clip_size(sc, &frame_width, &frame_height);
if(frame_width==0 || frame_height==0) return;
if(frame_width==0 || frame_height==0) return 0;
if(!selected_boundbox(sc, min, max))
return;
return 0;
/* center view */
clip_view_center_to_point(sc, (max[0]+min[0])/(2*frame_width), (max[1]+min[1])/(2*frame_height));
@@ -238,6 +238,8 @@ void ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
if(fit || sc->zoom>newzoom)
sc->zoom= newzoom;
}
return 1;
}
void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])

View File

@@ -684,10 +684,10 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
tmpibuf= ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
}
ED_clip_view_selection(sc, ar, 0);
sc->xof+= sc->xlockof;
sc->yof+= sc->ylockof;
if(ED_clip_view_selection(sc, ar, 0)) {
sc->xof+= sc->xlockof;
sc->yof+= sc->ylockof;
}
if(tmpibuf)
IMB_freeImBuf(tmpibuf);

View File

@@ -143,6 +143,10 @@ static int add_marker_exec(bContext *C, wmOperator *op)
add_marker(sc, pos[0], pos[1]);
/* reset offset from locked position, so frame jumping wouldn't be so confusing */
sc->xlockof= 0;
sc->ylockof= 0;
WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
return OPERATOR_FINISHED;