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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-06-20 14:28:51 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-06-20 14:28:51 +0400
commit4b955a60eda06526e3a793fd9bb3c942b641d877 (patch)
treee5706d5afef06f2b2e09b4022bfb537acf5d24d8
parentfca0112ba3e534c90fd0afaca9e901bc9c022b47 (diff)
Cleanup up space clip API:
- Remove clip/mask specific size/aspect getters, they shall just use the same size/aspect ratio. - Made size getter (and some other public functions) accept context instead of SpaceClip. Currently only SpaceClip is being get from this context, but later it'll be helpful when adding support of editing mask without opening clip in clip editor (in this case using render resolution for mask would be ideal, but this requires knowing scene in size getter). - Rearrange some functions in clip_editor.c for easier navigation in the file.
-rw-r--r--source/blender/editors/include/ED_clip.h22
-rw-r--r--source/blender/editors/mask/mask_edit.c14
-rw-r--r--source/blender/editors/mask/mask_select.c6
-rw-r--r--source/blender/editors/space_clip/clip_draw.c14
-rw-r--r--source/blender/editors/space_clip/clip_editor.c349
-rw-r--r--source/blender/editors/space_clip/clip_intern.h4
-rw-r--r--source/blender/editors/space_clip/clip_ops.c50
-rw-r--r--source/blender/editors/space_clip/clip_utils.c7
-rw-r--r--source/blender/editors/space_clip/space_clip.c97
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c13
-rw-r--r--source/blender/editors/space_clip/tracking_select.c15
-rw-r--r--source/blender/editors/transform/transform.c16
-rw-r--r--source/blender/editors/transform/transform_conversions.c8
13 files changed, 292 insertions, 323 deletions
diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h
index 3a9d73ccf10..2670fb5b042 100644
--- a/source/blender/editors/include/ED_clip.h
+++ b/source/blender/editors/include/ED_clip.h
@@ -42,6 +42,8 @@ struct SpaceClip;
struct wmEvent;
/* ** clip_editor.c ** */
+
+/* common poll functions */
int ED_space_clip_poll(struct bContext *C);
int ED_space_clip_view_clip_poll(struct bContext *C);
@@ -50,14 +52,10 @@ int ED_space_clip_tracking_poll(struct bContext *C);
int ED_space_clip_maskedit_poll(struct bContext *C);
int ED_space_clip_maskedit_mask_poll(bContext *C);
-struct MovieClip *ED_space_clip_get_clip(struct SpaceClip *sc);
-void ED_space_clip_set_clip(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip);
-
-void ED_space_clip_get_zoom(struct SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy);
-
-void ED_space_clip_get_clip_size(struct SpaceClip *sc, int *width, int *height);
-void ED_space_clip_get_clip_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
-void ED_space_clip_get_clip_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
+void ED_space_clip_get_size(const struct bContext *C, int *width, int *height);
+void ED_space_clip_get_zoom(const struct bContext *C, float *zoomx, float *zoomy);
+void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
+void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
int ED_space_clip_get_clip_frame_number(struct SpaceClip *sc);
@@ -65,18 +63,18 @@ 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);
-int ED_clip_view_selection(struct SpaceClip *sc, struct ARegion *ar, int fit);
+int ED_clip_view_selection(const struct bContext *C, struct ARegion *ar, int fit);
void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[2]);
void ED_clip_point_stable_pos(const struct bContext *C, float x, float y, float *xr, float *yr);
-void ED_clip_point_stable_pos__reverse(SpaceClip *sc, ARegion *ar, const float co[2], float r_co[2]);
+void ED_clip_point_stable_pos__reverse(const struct bContext *C, const float co[2], float r_co[2]);
void ED_clip_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]);
int ED_space_clip_check_show_trackedit(struct SpaceClip *sc);
int ED_space_clip_check_show_maskedit(struct SpaceClip *sc);
-void ED_space_clip_get_mask_size(struct SpaceClip *sc, int *width, int *height);
-void ED_space_clip_get_mask_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
+struct MovieClip *ED_space_clip_get_clip(struct SpaceClip *sc);
+void ED_space_clip_set_clip(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip);
struct Mask *ED_space_clip_get_mask(struct SpaceClip *sc);
void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct Mask *mask);
diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c
index fdf72043464..76fc7126cf2 100644
--- a/source/blender/editors/mask/mask_edit.c
+++ b/source/blender/editors/mask/mask_edit.c
@@ -121,7 +121,7 @@ void ED_mask_point_pos__reverse(const bContext *C, float x, float y, float *xr,
co[0] = x;
co[1] = y;
BKE_mask_coord_to_movieclip(sc->clip, &sc->user, co, co);
- ED_clip_point_stable_pos__reverse(sc, ar, co, co);
+ ED_clip_point_stable_pos__reverse(C, co, co);
}
else {
/* possible other spaces from which mask editing is available */
@@ -137,8 +137,7 @@ void ED_mask_size(const bContext *C, int *width, int *height)
ScrArea *sa = CTX_wm_area(C);
if (sa && sa->spacedata.first) {
if (sa->spacetype == SPACE_CLIP) {
- SpaceClip *sc = sa->spacedata.first;
- ED_space_clip_get_mask_size(sc, width, height);
+ ED_space_clip_get_size(C, width, height);
return;
}
else if (sa->spacetype == SPACE_SEQ) {
@@ -159,7 +158,7 @@ void ED_mask_aspect(const bContext *C, float *aspx, float *aspy)
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc) {
- ED_space_clip_get_mask_aspect(sc, aspx, aspy);
+ ED_space_clip_get_aspect(sc, aspx, aspy);
}
else {
/* possible other spaces from which mask editing is available */
@@ -173,13 +172,12 @@ void ED_mask_pixelspace_factor(const bContext *C, float *scalex, float *scaley)
SpaceClip *sc = CTX_wm_space_clip(C);
if (sc) {
- ARegion *ar = CTX_wm_region(C);
int width, height;
float zoomx, zoomy, aspx, aspy;
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
*scalex = ((float)width * aspx) * zoomx;
*scaley = ((float)height * aspy) * zoomy;
diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c
index e34823278cb..e619277456e 100644
--- a/source/blender/editors/mask/mask_select.c
+++ b/source/blender/editors/mask/mask_select.c
@@ -581,8 +581,6 @@ static int circle_select_exec(bContext *C, wmOperator *op)
MaskLayer *masklay;
int i;
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
int x, y, radius, width, height, mode, change = FALSE;
float zoomx, zoomy, offset[2], ellipse[2];
@@ -595,8 +593,8 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* TODO - make generic! - this is SpaceClip only! */
/* compute ellipse and position in unified coordinates */
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
width = height = MAX2(width, height);
ellipse[0] = width * zoomx / radius;
diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c
index 9b9e2223ae6..936c462a161 100644
--- a/source/blender/editors/space_clip/clip_draw.c
+++ b/source/blender/editors/space_clip/clip_draw.c
@@ -1408,19 +1408,23 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
glPopMatrix();
}
-void clip_draw_main(SpaceClip *sc, ARegion *ar, Scene *scene)
+void clip_draw_main(const bContext *C, ARegion *ar)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
+ Scene *scene = CTX_data_scene(C);
ImBuf *ibuf;
int width, height;
float zoomx, zoomy;
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+
/* if no clip, nothing to do */
- if (!clip)
+ if (!clip) {
+ ED_region_grid_draw(ar, zoomx, zoomy);
return;
-
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ }
if (sc->flag & SC_SHOW_STABLE) {
float smat[4][4], ismat[4][4];
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index 4dd2f82df02..6aacd4d5450 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -122,90 +122,12 @@ int ED_space_clip_maskedit_mask_poll(bContext *C)
return FALSE;
}
-/* ******** editing functions ******** */
+/* ******** common editing functions ******** */
-void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip)
+void ED_space_clip_get_size(const bContext *C, int *width, int *height)
{
- MovieClip *old_clip;
-
- if (!screen && C)
- screen = CTX_wm_screen(C);
-
- old_clip = sc->clip;
- sc->clip = clip;
-
- if (sc->clip && sc->clip->id.us == 0)
- sc->clip->id.us = 1;
-
- if (screen && sc->view == SC_VIEW_CLIP) {
- ScrArea *area;
- SpaceLink *sl;
-
- for (area = screen->areabase.first; area; area = area->next) {
- for (sl = area->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_CLIP) {
- SpaceClip *cur_sc = (SpaceClip *) sl;
-
- if (cur_sc != sc && cur_sc->view != SC_VIEW_CLIP) {
- if (cur_sc->clip == old_clip || cur_sc->clip == NULL) {
- cur_sc->clip = clip;
- }
- }
- }
- }
- }
- }
-
- if (C)
- WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip);
-}
-
-MovieClip *ED_space_clip_get_clip(SpaceClip *sc)
-{
- return sc->clip;
-}
-
-Mask *ED_space_clip_get_mask(SpaceClip *sc)
-{
- return sc->mask;
-}
-
-ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
-{
- if (sc->clip) {
- ImBuf *ibuf;
-
- ibuf = BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
-
- if (ibuf && (ibuf->rect || ibuf->rect_float))
- return ibuf;
-
- if (ibuf)
- IMB_freeImBuf(ibuf);
- }
-
- return NULL;
-}
-
-ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale, float *angle)
-{
- if (sc->clip) {
- ImBuf *ibuf;
-
- ibuf = BKE_movieclip_get_stable_ibuf(sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
-
- if (ibuf && (ibuf->rect || ibuf->rect_float))
- return ibuf;
-
- if (ibuf)
- IMB_freeImBuf(ibuf);
- }
-
- return NULL;
-}
+ SpaceClip *sc = CTX_wm_space_clip(C);
-void ED_space_clip_get_clip_size(SpaceClip *sc, int *width, int *height)
-{
if (!sc->clip) {
*width = *height = 0;
}
@@ -214,40 +136,25 @@ void ED_space_clip_get_clip_size(SpaceClip *sc, int *width, int *height)
}
}
-void ED_space_clip_get_mask_size(SpaceClip *sc, int *width, int *height)
+void ED_space_clip_get_zoom(const bContext *C, float *zoomx, float *zoomy)
{
- /* quite the same as ED_space_clip_size, but it also runs aspect correction on output resolution
- * this is needed because mask should be rasterized with exactly the same resolution as
- * currently displaying frame and it doesn't have access to aspect correction currently
- * used for display. (sergey)
- */
-
- if (!sc->mask) {
- *width = 0;
- *height = 0;
- } else {
- float aspx, aspy;
+ ARegion *ar = CTX_wm_region(C);
+ int width, height;
- ED_space_clip_get_clip_size(sc, width, height);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_size(C, &width, &height);
- *width *= aspx;
- *height *= aspy;
- }
+ *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
+ *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
}
-void ED_space_clip_get_mask_aspect(SpaceClip *sc, float *aspx, float *aspy)
+void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy)
{
- int w, h;
-
- ED_space_clip_get_clip_aspect(sc, aspx, aspy);
- ED_space_clip_get_clip_size(sc, &w, &h);
+ MovieClip *clip = ED_space_clip_get_clip(sc);
- /* now this is not accounted for! */
-#if 0
- *aspx *= (float)w;
- *aspy *= (float)h;
-#endif
+ if (clip)
+ BKE_movieclip_aspect(clip, aspx, aspy);
+ else
+ *aspx = *aspy = 1.0f;
if (*aspx < *aspy) {
*aspy = *aspy / *aspx;
@@ -259,27 +166,7 @@ void ED_space_clip_get_mask_aspect(SpaceClip *sc, float *aspx, float *aspy)
}
}
-void ED_space_clip_get_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
-{
- int width, height;
-
- ED_space_clip_get_clip_size(sc, &width, &height);
-
- *zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin) * width);
- *zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin) * height);
-}
-
-void ED_space_clip_get_clip_aspect(SpaceClip *sc, float *aspx, float *aspy)
-{
- MovieClip *clip = ED_space_clip_get_clip(sc);
-
- if (clip)
- BKE_movieclip_aspect(clip, aspx, aspy);
- else
- *aspx = *aspy = 1.0f;
-}
-
-void ED_space_clip_get_clip_aspect_dimension_aware(SpaceClip *sc, float *aspx, float *aspy)
+void ED_space_clip_get_aspect_dimension_aware(SpaceClip *sc, float *aspx, float *aspy)
{
int w, h;
@@ -290,11 +177,11 @@ void ED_space_clip_get_clip_aspect_dimension_aware(SpaceClip *sc, float *aspx, f
* mainly this is sued for transformation stuff
*/
- ED_space_clip_get_clip_aspect(sc, aspx, aspy);
- ED_space_clip_get_clip_size(sc, &w, &h);
+ ED_space_clip_get_aspect(sc, aspx, aspy);
+ BKE_movieclip_get_size(sc->clip, &sc->user, &w, &h);
- *aspx *= (float)w;
- *aspy *= (float)h;
+ *aspx *= (float) w;
+ *aspy *= (float) h;
if (*aspx < *aspy) {
*aspy = *aspy / *aspx;
@@ -306,6 +193,48 @@ void ED_space_clip_get_clip_aspect_dimension_aware(SpaceClip *sc, float *aspx, f
}
}
+/* return current frame number in clip space */
+int ED_space_clip_get_clip_frame_number(SpaceClip *sc)
+{
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+
+ return BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr);
+}
+
+ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
+{
+ if (sc->clip) {
+ ImBuf *ibuf;
+
+ ibuf = BKE_movieclip_get_postprocessed_ibuf(sc->clip, &sc->user, sc->postproc_flag);
+
+ if (ibuf && (ibuf->rect || ibuf->rect_float))
+ return ibuf;
+
+ if (ibuf)
+ IMB_freeImBuf(ibuf);
+ }
+
+ return NULL;
+}
+
+ImBuf *ED_space_clip_get_stable_buffer(SpaceClip *sc, float loc[2], float *scale, float *angle)
+{
+ if (sc->clip) {
+ ImBuf *ibuf;
+
+ ibuf = BKE_movieclip_get_stable_ibuf(sc->clip, &sc->user, loc, scale, angle, sc->postproc_flag);
+
+ if (ibuf && (ibuf->rect || ibuf->rect_float))
+ return ibuf;
+
+ if (ibuf)
+ IMB_freeImBuf(ibuf);
+ }
+
+ return NULL;
+}
+
void ED_clip_update_frame(const Main *mainp, int cfra)
{
wmWindowManager *wm;
@@ -329,16 +258,9 @@ void ED_clip_update_frame(const Main *mainp, int cfra)
}
}
-/* return current frame number in clip space */
-int ED_space_clip_get_clip_frame_number(SpaceClip *sc)
-{
- MovieClip *clip = ED_space_clip_get_clip(sc);
-
- return BKE_movieclip_remap_scene_to_clip_frame(clip, sc->user.framenr);
-}
-
-static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
+static int selected_boundbox(const bContext *C, float min[2], float max[2])
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTrackingTrack *track;
int width, height, ok = FALSE;
@@ -346,7 +268,7 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
INIT_MINMAX2(min, max);
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
track = tracksbase->first;
while (track) {
@@ -383,22 +305,23 @@ static int selected_boundbox(SpaceClip *sc, float min[2], float max[2])
return ok;
}
-int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
+int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
int w, h, frame_width, frame_height;
float min[2], max[2];
- ED_space_clip_get_clip_size(sc, &frame_width, &frame_height);
+ ED_space_clip_get_size(C, &frame_width, &frame_height);
if (frame_width == 0 || frame_height == 0)
return FALSE;
- if (!selected_boundbox(sc, min, max))
+ if (!selected_boundbox(C, min, max))
return FALSE;
/* center view */
- clip_view_center_to_point(sc, (max[0] + min[0]) / (2 * frame_width),
- (max[1] + min[1]) / (2 * frame_height));
+ clip_view_center_to_point(C, (max[0] + min[0]) / (2 * frame_width),
+ (max[1] + min[1]) / (2 * frame_height));
w = max[0] - min[0];
h = max[1] - min[1];
@@ -408,7 +331,7 @@ int ED_clip_view_selection(SpaceClip *sc, ARegion *ar, int fit)
int width, height;
float zoomx, zoomy, newzoom, aspx, aspy;
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
width = ar->winrct.xmax - ar->winrct.xmin + 1;
height = ar->winrct.ymax - ar->winrct.ymin + 1;
@@ -434,7 +357,7 @@ void ED_clip_point_undistorted_pos(SpaceClip *sc, const float co[2], float r_co[
float aspy = 1.0f / clip->tracking.camera.pixel_aspect;
int width, height;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ BKE_movieclip_get_size(sc->clip, &sc->user, &width, &height);
r_co[0] *= width;
r_co[1] *= height * aspy;
@@ -453,8 +376,8 @@ void ED_clip_point_stable_pos(const bContext *C, float x, float y, float *xr, fl
int sx, sy, width, height;
float zoomx, zoomy, pos[3], imat[4][4];
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
@@ -485,16 +408,18 @@ void ED_clip_point_stable_pos(const bContext *C, float x, float y, float *xr, fl
* \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, const float co[2], float r_co[2])
+void ED_clip_point_stable_pos__reverse(const bContext *C, const float co[2], float r_co[2])
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ ARegion *ar = CTX_wm_region(C);
float zoomx, zoomy;
float pos[3];
int width, height;
int sx, sy;
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &sx, &sy);
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
ED_clip_point_undistorted_pos(sc, co, pos);
pos[2] = 0.0f;
@@ -511,6 +436,87 @@ void ED_clip_mouse_pos(const bContext *C, wmEvent *event, float co[2])
ED_clip_point_stable_pos(C, event->mval[0], event->mval[1], &co[0], &co[1]);
}
+int ED_space_clip_check_show_trackedit(SpaceClip *sc)
+{
+ if (sc) {
+ return ELEM3(sc->mode, SC_MODE_TRACKING, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION);
+ }
+
+ return FALSE;
+}
+
+int ED_space_clip_check_show_maskedit(SpaceClip *sc)
+{
+ if (sc) {
+ return sc->mode == SC_MODE_MASKEDIT;
+ }
+
+ return FALSE;
+}
+
+/* ******** clip editing functions ******** */
+
+MovieClip *ED_space_clip_get_clip(SpaceClip *sc)
+{
+ return sc->clip;
+}
+
+void ED_space_clip_set_clip(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip)
+{
+ MovieClip *old_clip;
+
+ if (!screen && C)
+ screen = CTX_wm_screen(C);
+
+ old_clip = sc->clip;
+ sc->clip = clip;
+
+ if (sc->clip && sc->clip->id.us == 0)
+ sc->clip->id.us = 1;
+
+ if (screen && sc->view == SC_VIEW_CLIP) {
+ ScrArea *area;
+ SpaceLink *sl;
+
+ for (area = screen->areabase.first; area; area = area->next) {
+ for (sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_CLIP) {
+ SpaceClip *cur_sc = (SpaceClip *) sl;
+
+ if (cur_sc != sc && cur_sc->view != SC_VIEW_CLIP) {
+ if (cur_sc->clip == old_clip || cur_sc->clip == NULL) {
+ cur_sc->clip = clip;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (C)
+ WM_event_add_notifier(C, NC_MOVIECLIP | NA_SELECTED, sc->clip);
+}
+
+/* ******** masking editing functions ******** */
+
+Mask *ED_space_clip_get_mask(SpaceClip *sc)
+{
+ return sc->mask;
+}
+
+void ED_space_clip_set_mask(bContext *C, SpaceClip *sc, Mask *mask)
+{
+ sc->mask = mask;
+
+ 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);
+ }
+}
+
/* OpenGL draw context */
typedef struct SpaceClipDrawContext {
@@ -654,36 +660,3 @@ void ED_space_clip_free_texture_buffer(SpaceClip *sc)
MEM_freeN(context);
}
}
-
-/* ******** masking editing related functions ******** */
-
-int ED_space_clip_check_show_trackedit(SpaceClip *sc)
-{
- if (sc) {
- return ELEM3(sc->mode, SC_MODE_TRACKING, SC_MODE_RECONSTRUCTION, SC_MODE_DISTORTION);
- }
-
- return FALSE;
-}
-
-int ED_space_clip_check_show_maskedit(SpaceClip *sc)
-{
- if (sc) {
- return sc->mode == SC_MODE_MASKEDIT;
- }
-
- return FALSE;
-}
-
-void ED_space_clip_set_mask(bContext *C, SpaceClip *sc, Mask *mask)
-{
- sc->mask = mask;
-
- 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);
- }
-}
diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h
index 5bc195a1ae2..c61a0baa82e 100644
--- a/source/blender/editors/space_clip/clip_intern.h
+++ b/source/blender/editors/space_clip/clip_intern.h
@@ -69,7 +69,7 @@ void clip_draw_dopesheet_channels(const struct bContext *C, struct ARegion *ar);
void CLIP_OT_dopesheet_select_channel(struct wmOperatorType *ot);
/* clip_draw.c */
-void clip_draw_main(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
+void clip_draw_main(const struct bContext *C, struct ARegion *ar);
void clip_draw_grease_pencil(struct bContext *C, int onlyv2d);
void clip_draw_curfra_label(struct SpaceClip *sc, float x, float y);
@@ -125,7 +125,7 @@ void clip_graph_tracking_iterate(struct SpaceClip *sc, int selected_only, int in
void clip_delete_track(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track);
void clip_delete_marker(struct bContext *C, struct MovieClip *clip, struct ListBase *tracksbase, struct MovieTrackingTrack *track, struct MovieTrackingMarker *marker);
-void clip_view_center_to_point(struct SpaceClip *sc, float x, float y);
+void clip_view_center_to_point(const struct bContext *C, float x, float y);
void clip_draw_cfra(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene);
void clip_draw_sfra_efra(struct View2D *v2d, struct Scene *scene);
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index b3f7b221af0..e76edcf0290 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -69,8 +69,10 @@
/******************** view navigation utilities *********************/
-static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float location[2])
+static void sclip_zoom_set(const bContext *C, float zoom, float location[2])
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ ARegion *ar = CTX_wm_region(C);
float oldzoom = sc->zoom;
int width, height;
@@ -78,7 +80,7 @@ static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float locatio
if (sc->zoom < 0.1f || sc->zoom > 4.0f) {
/* check zoom limits */
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
width *= sc->zoom;
height *= sc->zoom;
@@ -92,22 +94,22 @@ static void sclip_zoom_set(SpaceClip *sc, ARegion *ar, float zoom, float locatio
}
if ((U.uiflag & USER_ZOOM_TO_MOUSEPOS) && location) {
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
sc->xof += ((location[0] - 0.5f) * width - sc->xof) * (sc->zoom - oldzoom) / sc->zoom;
sc->yof += ((location[1] - 0.5f) * height - sc->yof) * (sc->zoom - oldzoom) / sc->zoom;
}
}
-static void sclip_zoom_set_factor(SpaceClip *sc, ARegion *ar, float zoomfac, float location[2])
+static void sclip_zoom_set_factor(const bContext *C, float zoomfac, float location[2])
{
- sclip_zoom_set(sc, ar, sc->zoom*zoomfac, location);
+ SpaceClip *sc = CTX_wm_space_clip(C);
+
+ sclip_zoom_set(C, sc->zoom * zoomfac, location);
}
static void sclip_zoom_set_factor_exec(bContext *C, wmEvent *event, float factor)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
float location[2], *mpos = NULL;
if (event) {
@@ -115,7 +117,7 @@ static void sclip_zoom_set_factor_exec(bContext *C, wmEvent *event, float factor
mpos = location;
}
- sclip_zoom_set_factor(sc, ar, factor, mpos);
+ sclip_zoom_set_factor(C, factor, mpos);
ED_region_tag_redraw(CTX_wm_region(C));
}
@@ -494,10 +496,7 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel)
static int view_zoom_exec(bContext *C, wmOperator *op)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
-
- sclip_zoom_set_factor(sc, ar, RNA_float_get(op->ptr, "factor"), NULL);
+ sclip_zoom_set_factor(C, RNA_float_get(op->ptr, "factor"), NULL);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -525,8 +524,6 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
ViewZoomData *vpd = op->customdata;
float factor;
@@ -534,7 +531,7 @@ static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event)
case MOUSEMOVE:
factor = 1.0f + (vpd->x - event->x + vpd->y - event->y) / 300.0f;
RNA_float_set(op->ptr, "factor", factor);
- sclip_zoom_set(sc, ar, vpd->zoom * factor, vpd->location);
+ sclip_zoom_set(C, vpd->zoom * factor, vpd->location);
ED_region_tag_redraw(CTX_wm_region(C));
break;
default:
@@ -582,13 +579,11 @@ void CLIP_OT_view_zoom(wmOperatorType *ot)
static int view_zoom_in_exec(bContext *C, wmOperator *op)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
- sclip_zoom_set_factor(sc, ar, 1.25f, location);
+ sclip_zoom_set_factor(C, 1.25f, location);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -624,13 +619,11 @@ void CLIP_OT_view_zoom_in(wmOperatorType *ot)
static int view_zoom_out_exec(bContext *C, wmOperator *op)
{
- SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
float location[2];
RNA_float_get_array(op->ptr, "location", location);
- sclip_zoom_set_factor(sc, ar, 0.8f, location);
+ sclip_zoom_set_factor(C, 0.8f, location);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -669,9 +662,8 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot)
static int view_zoom_ratio_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
- ARegion *ar = CTX_wm_region(C);
- sclip_zoom_set(sc, ar, RNA_float_get(op->ptr, "ratio"), NULL);
+ sclip_zoom_set(C, RNA_float_get(op->ptr, "ratio"), NULL);
/* ensure pixel exact locations for draw */
sc->xof = (int) sc->xof;
@@ -713,8 +705,8 @@ static int view_all_exec(bContext *C, wmOperator *op)
sc = CTX_wm_space_clip(C);
ar = CTX_wm_region(C);
- ED_space_clip_get_clip_size(sc, &w, &h);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_size(C, &w, &h);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
w = w * aspx;
h = h * aspy;
@@ -729,7 +721,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
zoomx = (float) width / (w + 2 * margin);
zoomy = (float) height / (h + 2 * margin);
- sclip_zoom_set(sc, ar, MIN2(zoomx, zoomy), NULL);
+ sclip_zoom_set(C, MIN2(zoomx, zoomy), NULL);
}
else {
if ((w >= width || h >= height) && (width > 0 && height > 0)) {
@@ -737,10 +729,10 @@ static int view_all_exec(bContext *C, wmOperator *op)
zoomy = (float) height / h;
/* find the zoom value that will fit the image in the image space */
- sclip_zoom_set(sc, ar, 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)), NULL);
+ sclip_zoom_set(C, 1.0f / power_of_2(1.0f / MIN2(zoomx, zoomy)), NULL);
}
else
- sclip_zoom_set(sc, ar, 1.0f, NULL);
+ sclip_zoom_set(C, 1.0f, NULL);
}
sc->xof = sc->yof = 0.0f;
@@ -775,7 +767,7 @@ static int view_selected_exec(bContext *C, wmOperator *UNUSED(op))
sc->xlockof = 0.0f;
sc->ylockof = 0.0f;
- ED_clip_view_selection(sc, ar, 1);
+ ED_clip_view_selection(C, ar, 1);
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 1c040c69fa9..d9c9f63e4a3 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -223,13 +223,14 @@ void clip_delete_marker(bContext *C, MovieClip *clip, ListBase *tracksbase,
}
}
-void clip_view_center_to_point(SpaceClip *sc, float x, float y)
+void clip_view_center_to_point(const bContext *C, float x, float y)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
int width, height;
float aspx, aspy;
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
sc->xof = (x - 0.5f) * width * aspx;
sc->yof = (y - 0.5f) * height * aspy;
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 49ee6b65256..0a6a4af6960 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -1008,13 +1008,14 @@ static void clip_refresh(const bContext *C, ScrArea *sa)
/********************* main region ********************/
/* sets up the fields of the View2D from zoom and offset */
-static void movieclip_main_area_set_view2d(SpaceClip *sc, ARegion *ar)
+static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
float x1, y1, w, h;
int width, height, winx, winy;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
w = width;
h = height;
@@ -1074,11 +1075,54 @@ static void clip_main_area_init(wmWindowManager *wm, ARegion *ar)
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
}
+static void clip_main_area_draw_mask(const bContext *C, ARegion *ar)
+{
+ SpaceClip *sc = CTX_wm_space_clip(C);
+ int x, y;
+ int width, height;
+ float zoomx, zoomy;
+
+ /* frame image */
+ float maxdim;
+ float xofs, yofs;
+
+ /* find window pixel coordinates of origin */
+ UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
+
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
+
+ /* frame the image */
+ maxdim = maxf(width, height);
+ if (width == height) {
+ xofs = yofs = 0;
+ }
+ else if (width < height) {
+ xofs = ((height - width) / -2.0f) * zoomx;
+ yofs = 0.0f;
+ }
+ else { /* (width > height) */
+ xofs = 0.0f;
+ yofs = ((width - height) / -2.0f) * zoomy;
+ }
+
+ /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
+ glPushMatrix();
+ glTranslatef(x + xofs, y + yofs, 0);
+ glScalef(maxdim * zoomx, maxdim * zoomy, 0);
+ glMultMatrixf(sc->stabmat);
+
+ ED_mask_draw(C, sc->mask_draw_flag, sc->mask_draw_type);
+
+ ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+
+ glPopMatrix();
+}
+
static void clip_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
SpaceClip *sc = CTX_wm_space_clip(C);
- Scene *scene = CTX_data_scene(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
/* if tracking is in progress, we should synchronize framenr from clipuser
@@ -1093,7 +1137,7 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
tmpibuf = ED_space_clip_get_stable_buffer(sc, NULL, NULL, NULL);
}
- if (ED_clip_view_selection(sc, ar, 0)) {
+ if (ED_clip_view_selection(C, ar, 0)) {
sc->xof += sc->xlockof;
sc->yof += sc->ylockof;
}
@@ -1107,51 +1151,12 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
glClear(GL_COLOR_BUFFER_BIT);
/* data... */
- movieclip_main_area_set_view2d(sc, ar);
+ movieclip_main_area_set_view2d(C, ar);
- clip_draw_main(sc, ar, scene);
+ clip_draw_main(C, ar);
if (sc->mode == SC_MODE_MASKEDIT) {
- int x, y;
- int width, height;
- float zoomx, zoomy, aspx, aspy;
-
- /* frame image */
- float maxdim;
- float xofs, yofs;
-
- /* find window pixel coordinates of origin */
- UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
-
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
- ED_space_clip_get_clip_aspect(sc, &aspx, &aspy);
-
- /* frame the image */
- maxdim = maxf(width, height);
- if (width == height) {
- xofs = yofs = 0;
- }
- else if (width < height) {
- xofs = ((height - width) / -2.0f) * zoomx;
- yofs = 0.0f;
- }
- else { /* (width > height) */
- xofs = 0.0f;
- yofs = ((width - height) / -2.0f) * zoomy;
- }
-
- /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
- glPushMatrix();
- glTranslatef(x + xofs, y + yofs, 0);
- glScalef(maxdim * zoomx, maxdim * zoomy, 0);
- glMultMatrixf(sc->stabmat);
-
- ED_mask_draw(C, sc->mask_draw_flag, sc->mask_draw_type);
-
- ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
-
- glPopMatrix();
+ clip_main_area_draw_mask(C, ar);
}
/* Grease Pencil */
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index 8f58df1cb2c..af2847492ad 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -81,8 +81,9 @@
/********************** add marker operator *********************/
-static void add_marker(SpaceClip *sc, float x, float y)
+static void add_marker(const bContext *C, float x, float y)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
@@ -90,7 +91,7 @@ static void add_marker(SpaceClip *sc, float x, float y)
int width, height;
int framenr = ED_space_clip_get_clip_frame_number(sc);
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
track = BKE_tracking_track_add(tracking, tracksbase, x, y, framenr, width, height);
@@ -106,14 +107,14 @@ static int add_marker_exec(bContext *C, wmOperator *op)
float pos[2];
int width, height;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
if (!width || !height)
return OPERATOR_CANCELLED;
RNA_float_get_array(op->ptr, "location", pos);
- add_marker(sc, pos[0], pos[1]);
+ add_marker(C, pos[0], pos[1]);
/* reset offset from locked position, so frame jumping wouldn't be so confusing */
sc->xlockof = 0;
@@ -532,7 +533,7 @@ MovieTrackingTrack *tracking_marker_check_slide(bContext *C, wmEvent *event, int
int framenr = ED_space_clip_get_clip_frame_number(sc);
int action = -1, area = 0, corner = -1;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
if (width == 0 || height == 0)
return NULL;
@@ -628,7 +629,7 @@ static void *slide_marker_customdata(bContext *C, wmEvent *event)
int framenr = ED_space_clip_get_clip_frame_number(sc);
int area, action, corner;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
if (width == 0 || height == 0)
return NULL;
diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c
index f8f786e549c..0ebb84b3953 100644
--- a/source/blender/editors/space_clip/tracking_select.c
+++ b/source/blender/editors/space_clip/tracking_select.c
@@ -110,15 +110,16 @@ static int mouse_on_crns(float co[2], float pos[2], float crns[4][2], float epsx
return dist < MAX2(epsx, epsy);
}
-static int track_mouse_area(SpaceClip *sc, float co[2], MovieTrackingTrack *track)
+static int track_mouse_area(const bContext *C, float co[2], MovieTrackingTrack *track)
{
+ SpaceClip *sc = CTX_wm_space_clip(C);
int framenr = ED_space_clip_get_clip_frame_number(sc);
MovieTrackingMarker *marker = BKE_tracking_marker_get(track, framenr);
float pat_min[2], pat_max[2];
float epsx, epsy;
int width, height;
- ED_space_clip_get_clip_size(sc, &width, &height);
+ ED_space_clip_get_size(C, &width, &height);
BKE_tracking_marker_pattern_minmax(marker, pat_min, pat_max);
@@ -235,7 +236,7 @@ static int mouse_select(bContext *C, float co[2], int extend)
track = find_nearest_track(sc, tracksbase, co);
if (track) {
- int area = track_mouse_area(sc, co, track);
+ int area = track_mouse_area(C, co, track);
if (!extend || !TRACK_VIEW_SELECTED(sc, track))
area = TRACK_AREA_ALL;
@@ -412,7 +413,6 @@ void CLIP_OT_select_border(wmOperatorType *ot)
static int do_lasso_select_marker(bContext *C, int mcords[][2], short moves, short select)
{
- ARegion *ar = CTX_wm_region(C);
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
MovieTracking *tracking = &clip->tracking;
@@ -435,7 +435,7 @@ static int do_lasso_select_marker(bContext *C, int mcords[][2], short moves, sho
float screen_co[2];
/* marker in screen coords */
- ED_clip_point_stable_pos__reverse(sc, ar, marker->pos, screen_co);
+ ED_clip_point_stable_pos__reverse(C, marker->pos, screen_co);
if (BLI_in_rcti(&rect, screen_co[0], screen_co[1]) &&
BLI_lasso_is_point_inside(mcords, moves, screen_co[0], screen_co[1], V2D_IS_CLIPPED))
@@ -520,7 +520,6 @@ static int circle_select_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
- ARegion *ar = CTX_wm_region(C);
MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
@@ -536,8 +535,8 @@ static int circle_select_exec(bContext *C, wmOperator *op)
mode = RNA_int_get(op->ptr, "gesture_mode");
/* compute ellipse and position in unified coordinates */
- ED_space_clip_get_clip_size(sc, &width, &height);
- ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy);
+ ED_space_clip_get_size(C, &width, &height);
+ ED_space_clip_get_zoom(C, &zoomx, &zoomy);
ellipse[0] = width * zoomx / radius;
ellipse[1] = height * zoomy / radius;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 67e87afc5c3..cedb09e187c 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -183,11 +183,11 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
r_vec[2] = 0.0f;
if (t->options & CTX_MOVIECLIP) {
- ED_space_clip_get_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
}
else if (t->options & CTX_MASK) {
/* TODO - NOT WORKING, this isnt so bad since its only display aspect */
- ED_space_clip_get_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
}
r_vec[0] *= aspx;
@@ -254,9 +254,9 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
copy_v2_v2(v, vec);
if (t->options & CTX_MOVIECLIP)
- ED_space_clip_get_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
else if (t->options & CTX_MASK)
- ED_space_clip_get_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
+ ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
v[0] /= aspx;
v[1] /= aspy;
@@ -317,13 +317,13 @@ void applyAspectRatio(TransInfo *t, float vec[2])
if (t->options & CTX_MOVIECLIP) {
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
vec[0] /= aspx;
vec[1] /= aspy;
}
else if (t->options & CTX_MASK) {
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
vec[0] /= aspx;
vec[1] /= aspy;
@@ -356,10 +356,10 @@ void removeAspectRatio(TransInfo *t, float vec[2])
float aspx = 1.0f, aspy = 1.0f;
if (t->options & CTX_MOVIECLIP) {
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
}
else if (t->options & CTX_MASK) {
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
}
vec[0] *= aspx;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index a9716483db7..e924ce15286 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -5736,7 +5736,7 @@ static void createTransTrackingTracksData(bContext *C, TransInfo *t)
if (t->total == 0)
return;
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
td = t->data = MEM_callocN(t->total * sizeof(TransData), "TransTracking TransData");
td2d = t->data2d = MEM_callocN(t->total * sizeof(TransData2D), "TransTracking TransData2D");
@@ -5992,7 +5992,7 @@ void flushTransTracking(TransInfo *t)
int a;
float aspx, aspy;
- ED_space_clip_get_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect_dimension_aware(sc, &aspx, &aspy);
if (t->state == TRANS_CANCEL)
cancelTransTracking(t);
@@ -6072,7 +6072,7 @@ static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point,
tdm->point = point;
copy_m3_m3(tdm->vec, bezt->vec);
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
if (propmode || is_sel_point) {
int i;
@@ -6250,7 +6250,7 @@ void flushTransMasking(TransInfo *t)
int a;
float aspx, aspy, invx, invy;
- ED_space_clip_get_mask_aspect(sc, &aspx, &aspy);
+ ED_space_clip_get_aspect(sc, &aspx, &aspy);
invx = 1.0f / aspx;
invy = 1.0f / aspy;