diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_mask.h | 2 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_draw.c | 37 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_draw.c | 26 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_clip/clip_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 36 |
6 files changed, 65 insertions, 40 deletions
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 9dd25114957..88667729eee 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -61,6 +61,8 @@ void ED_mask_draw_region(struct Mask *mask, struct ARegion *ar, float stabmat[4][4], const bContext *C); +void ED_mask_draw_frames(struct Mask *mask, struct ARegion *ar, const int cfra, const int sfra, const int efra); + /* mask_shapekey.c */ void ED_mask_layer_shape_auto_key(struct MaskLayer *masklay, const int frame); int ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index f01fad10034..2f5a918a488 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -482,7 +482,7 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, struct View2D *v2d = &ar->v2d; int x, y; - int w, h; + /* int w, h; */ float zoomx, zoomy; /* frame image */ @@ -492,8 +492,10 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, /* find window pixel coordinates of origin */ UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y); - w = v2d->tot.xmax - v2d->tot.xmin; - h = v2d->tot.ymax - v2d->tot.ymin; + + /* w = v2d->tot.xmax - v2d->tot.xmin; */ + /* h = v2d->tot.ymax - v2d->tot.ymin;/*/ + zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin)); zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin)); @@ -538,3 +540,32 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, glPopMatrix(); } + +void ED_mask_draw_frames(Mask *mask, ARegion *ar, const int cfra, const int sfra, const int efra) +{ + const float framelen = ar->winx / (float)(efra - sfra + 1); + + MaskLayer *masklay = BKE_mask_layer_active(mask); + + glBegin(GL_LINES); + glColor4ub(255, 175, 0, 255); + + if (masklay) { + MaskLayerShape *masklay_shape; + + for (masklay_shape = masklay->splines_shapes.first; + masklay_shape; + masklay_shape = masklay_shape->next) + { + int frame = masklay_shape->frame; + + /* draw_keyframe(i, CFRA, sfra, framelen, 1); */ + int height = (frame == cfra) ? 22 : 10; + int x = (frame - sfra) * framelen; + glVertex2i(x, 0); + glVertex2i(x, height); + } + } + + glEnd(); +} diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index 96eb6002840..c24cdab29e5 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -53,6 +53,7 @@ #include "ED_screen.h" #include "ED_clip.h" +#include "ED_mask.h" #include "ED_gpencil.h" #include "BIF_gl.h" @@ -73,7 +74,7 @@ /*********************** main area drawing *************************/ -void clip_draw_curfra_label(SpaceClip *sc, float x, float y) +void clip_draw_curfra_label(const int framenr, const float x, const float y) { uiStyle *style = UI_GetStyle(); int fontid = style->widget.uifont_id; @@ -82,7 +83,7 @@ void clip_draw_curfra_label(SpaceClip *sc, float x, float y) /* frame number */ BLF_size(fontid, 11.0f, U.dpi); - BLI_snprintf(numstr, sizeof(numstr), "%d", sc->user.framenr); + BLI_snprintf(numstr, sizeof(numstr), "%d", framenr); BLF_width_and_height(fontid, numstr, &font_dims[0], &font_dims[1]); @@ -212,7 +213,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc UI_ThemeColor(TH_CFRAME); glRecti(x, 0, x + framelen, 8); - clip_draw_curfra_label(sc, x, 8.0f); + clip_draw_curfra_label(sc->user.framenr, x, 8.0f); /* solver keyframes */ glColor4ub(175, 255, 0, 255); @@ -221,24 +222,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc /* movie clip animation */ if ((sc->mode == SC_MODE_MASKEDIT) && sc->mask_info.mask) { - MaskLayer *masklay = BKE_mask_layer_active(sc->mask_info.mask); - if (masklay) { - MaskLayerShape *masklay_shape; - - glColor4ub(255, 175, 0, 255); - glBegin(GL_LINES); - - for (masklay_shape = masklay->splines_shapes.first; - masklay_shape; - masklay_shape = masklay_shape->next) - { - i = masklay_shape->frame; - - draw_keyframe(i, CFRA, sfra, framelen, 1); - } - - glEnd(); - } + ED_mask_draw_frames(sc->mask_info.mask, ar, CFRA, sfra, efra); } } diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 3422aacf264..392367f9071 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -71,7 +71,7 @@ void CLIP_OT_dopesheet_select_channel(struct wmOperatorType *ot); /* clip_draw.c */ void clip_draw_main(const struct bContext *C, struct SpaceClip *sc, 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); +void clip_draw_curfra_label(const int framenr, const float x, const float y); /* clip_graph_draw.c */ void clip_draw_graph(struct SpaceClip *sc, struct ARegion *ar, struct Scene *scene); diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 9e93aed6df7..ddc624b4cdf 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -263,7 +263,7 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene) UI_view2d_getscale(v2d, &xscale, &yscale); glScalef(1.0f / xscale, 1.0f, 1.0f); - clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18); + clip_draw_curfra_label(sc->user.framenr, (float)sc->user.framenr * xscale, 18); /* restore view transform */ glScalef(xscale, 1.0, 1.0); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 79cc1eba898..f97813d3dd3 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -430,22 +430,28 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) } break; case NC_MASK: - switch (wmn->data) { - case ND_SELECT: - case ND_DATA: - case ND_DRAW: - ED_area_tag_redraw(sa); - break; - } - switch (wmn->action) { - case NA_SELECTED: - ED_area_tag_redraw(sa); - break; - case NA_EDITED: - ED_area_tag_redraw(sa); - break; + { + // Scene *scene = wmn->window->screen->scene; + /* ideally would check for: ED_space_image_check_show_maskedit(scene, sima) but we cant get the scene */ + if (sima->mode == SI_MODE_MASK) { + switch (wmn->data) { + case ND_SELECT: + case ND_DATA: + case ND_DRAW: + ED_area_tag_redraw(sa); + break; + } + switch (wmn->action) { + case NA_SELECTED: + ED_area_tag_redraw(sa); + break; + case NA_EDITED: + ED_area_tag_redraw(sa); + break; + } } break; + } case NC_GEOM: switch (wmn->data) { case ND_DATA: @@ -643,6 +649,8 @@ static void image_main_area_draw(const bContext *C, ARegion *ar) TRUE, FALSE, NULL, C); + ED_mask_draw_frames(mask, ar, CFRA, mask->sfra, mask->efra); + draw_image_cursor(sima, ar); } |