Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_clip/clip_editor.c')
-rw-r--r--source/blender/editors/space_clip/clip_editor.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 504d96df072..0bad9f86ea1 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -113,7 +113,7 @@ int ED_space_clip_maskedit_mask_poll(bContext *C)
MovieClip *clip = CTX_data_edit_movieclip(C);
if (clip) {
- SpaceClip *sc= CTX_wm_space_clip(C);
+ SpaceClip *sc = CTX_wm_space_clip(C);
return sc->mask != NULL;
}
@@ -250,12 +250,12 @@ void ED_space_clip_mask_aspect(SpaceClip *sc, float *aspx, float *aspy)
#endif
if (*aspx < *aspy) {
- *aspy= *aspy / *aspx;
- *aspx= 1.0f;
+ *aspy = *aspy / *aspx;
+ *aspx = 1.0f;
}
else {
- *aspx= *aspx / *aspy;
- *aspy= 1.0f;
+ *aspx = *aspx / *aspy;
+ *aspy = 1.0f;
}
}
@@ -297,12 +297,12 @@ void ED_space_clip_aspect_dimension_aware(SpaceClip *sc, float *aspx, float *asp
*aspy *= (float)h;
if (*aspx < *aspy) {
- *aspy= *aspy / *aspx;
- *aspx= 1.0f;
+ *aspy = *aspy / *aspx;
+ *aspx = 1.0f;
}
else {
- *aspx= *aspx / *aspy;
- *aspy= 1.0f;
+ *aspx = *aspx / *aspy;
+ *aspy = 1.0f;
}
}
@@ -342,7 +342,7 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
MovieClip *clip = ED_space_clip(sc);
MovieTrackingTrack *track;
int width, height, ok = FALSE;
- ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+ ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
INIT_MINMAX2(min, max);
@@ -351,7 +351,7 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
track = tracksbase->first;
while (track) {
if (TRACK_VIEW_SELECTED(sc, track)) {
- MovieTrackingMarker *marker = BKE_tracking_get_marker(track, sc->user.framenr);
+ MovieTrackingMarker *marker = BKE_tracking_marker_get(track, sc->user.framenr);
if (marker) {
float pos[3];
@@ -425,9 +425,9 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
return TRUE;
}
-void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])
+void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[2])
{
- copy_v2_v2(nco, co);
+ copy_v2_v2(r_co, co);
if (sc->user.render_flag & MCLIP_PROXY_RENDER_UNDISTORT) {
MovieClip *clip = ED_space_clip(sc);
@@ -436,13 +436,13 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, float co[2], float nco[2])
ED_space_clip_size(sc, &width, &height);
- nco[0] *= width;
- nco[1] *= height * aspy;
+ r_co[0] *= width;
+ r_co[1] *= height * aspy;
- BKE_tracking_invert_intrinsics(&clip->tracking, nco, nco);
+ BKE_tracking_undistort_v2(&clip->tracking, r_co, r_co);
- nco[0] /= width;
- nco[1] /= height * aspy;
+ r_co[0] /= width;
+ r_co[1] /= height * aspy;
}
}
@@ -451,7 +451,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
ARegion *ar = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
int sx, sy, width, height;
- float zoomx, zoomy, pos[3] = {0.0f, 0.0f, 0.0f}, imat[4][4];
+ float zoomx, zoomy, pos[3], imat[4][4];
ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
ED_space_clip_size(sc, &width, &height);
@@ -460,6 +460,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
pos[0] = (x - sx) / zoomx;
pos[1] = (y - sy) / zoomy;
+ pos[2] = 0.0f;
invert_m4_m4(imat, sc->stabmat);
mul_v3_m4v3(pos, imat, pos);
@@ -473,7 +474,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
float aspy = 1.0f / tracking->camera.pixel_aspect;
float tmp[2] = {*xr * width, *yr * height * aspy};
- BKE_tracking_apply_intrinsics(tracking, tmp, tmp);
+ BKE_tracking_distort_v2(tracking, tmp, tmp);
*xr = tmp[0] / width;
*yr = tmp[1] / (height * aspy);
@@ -484,7 +485,7 @@ void ED_clip_point_stable_pos(bContext *C, float x, float y, float *xr, float *y
* \brief the reverse of ED_clip_point_stable_pos(), gets the marker region coords.
* better name here? view_to_track / track_to_view or so?
*/
-void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, float co[2], float nco[2])
+void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float co[2], float r_co[2])
{
float zoomx, zoomy;
float pos[3];
@@ -496,12 +497,13 @@ void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, float co[2],
ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
ED_clip_point_undistorted_pos(sc, co, pos);
+ pos[2] = 0.0f;
/* untested */
mul_v3_m4v3(pos, sc->stabmat, pos);
- nco[0] = (pos[0] * width * zoomx) + (float)sx;
- nco[1] = (pos[1] * height * zoomy) + (float)sy;
+ r_co[0] = (pos[0] * width * zoomx) + (float)sx;
+ r_co[1] = (pos[1] * height * zoomy) + (float)sy;
}
void ED_clip_mouse_pos(bContext *C, wmEvent *event, float co[2])
@@ -521,7 +523,7 @@ typedef struct SpaceClipDrawContext {
unsigned last_texture; /* ID of previously used texture, so it'll be restored after clip drawing */
/* fields to check if cache is still valid */
- int framenr, start_frame;
+ int framenr, start_frame, frame_offset;
short render_size, render_flag;
} SpaceClipDrawContext;
@@ -563,6 +565,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf)
need_rebind |= context->render_size != sc->user.render_size;
need_rebind |= context->render_flag != sc->user.render_flag;
need_rebind |= context->start_frame != clip->start_frame;
+ need_rebind |= context->frame_offset != clip->frame_offset;
if (need_rebind) {
int width = ibuf->x, height = ibuf->y;
@@ -620,6 +623,7 @@ int ED_space_clip_load_movieclip_buffer(SpaceClip *sc, ImBuf *ibuf)
context->render_size = sc->user.render_size;
context->render_flag = sc->user.render_flag;
context->start_frame = clip->start_frame;
+ context->frame_offset = clip->frame_offset;
}
else {
/* displaying exactly the same image which was loaded t oa texture,
@@ -675,11 +679,11 @@ void ED_space_clip_set_mask(bContext *C, SpaceClip *sc, Mask *mask)
{
sc->mask = mask;
- if (sc->mask && sc->mask->id.us==0) {
+ if (sc->mask && sc->mask->id.us == 0) {
sc->clip->id.us = 1;
}
if (C) {
- WM_event_add_notifier(C, NC_MASK|NA_SELECTED, mask);
+ WM_event_add_notifier(C, NC_MASK | NA_SELECTED, mask);
}
}