diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-08-01 14:50:39 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-08-01 14:50:39 +0400 |
commit | 26cc3dd7086d7e0061322f5b6f29ce10fb9d8abb (patch) | |
tree | 831493412b0fa80ded28b294ab6e4a88602197c6 /source/blender/editors/mask | |
parent | 0fee289551e90865e9f2041d49f19f5a8c065304 (diff) |
misc mask fixes
- image space used wrong notifiers.
- image notifier now checks for mask mode before listening to mask edits.
- mask keyframes now draw in the image space.
Diffstat (limited to 'source/blender/editors/mask')
-rw-r--r-- | source/blender/editors/mask/mask_draw.c | 37 |
1 files changed, 34 insertions, 3 deletions
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(); +} |