diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-27 00:23:26 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-08-27 00:23:26 +0400 |
commit | 03dbae07d346dcfb5cdaeeeea3585f642cd90d31 (patch) | |
tree | 866db44539cf778c636cd774f524970d434c77d3 /source/blender/editors/space_clip/space_clip.c | |
parent | 11aa7a76fab53809f891ab8ff7898a2dd70005b8 (diff) |
Mask primitives
Currently only circle and square, might be easily
extended in the future.
New primitives are creating at cursor location.
This also implied adding 2d cursor to space clip.
Also fix set 2D cursor location which didn't work
in image editor's mask mode since 2.67.
TODO: draw_image_cursor better be moved to some
more generic file, but it's not so much
important for now and might be solved later.
Thanks Campbell for the review!
Diffstat (limited to 'source/blender/editors/space_clip/space_clip.c')
-rw-r--r-- | source/blender/editors/space_clip/space_clip.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 8213853c937..a9bbd348135 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -56,6 +56,7 @@ #include "ED_screen.h" #include "ED_clip.h" #include "ED_transform.h" +#include "ED_uvedit.h" /* just for draw_image_cursor */ #include "IMB_imbuf.h" @@ -442,6 +443,7 @@ static void clip_operatortypes(void) WM_operatortype_append(CLIP_OT_view_ndof); WM_operatortype_append(CLIP_OT_prefetch); WM_operatortype_append(CLIP_OT_set_scene_frames); + WM_operatortype_append(CLIP_OT_cursor_set); /* ** clip_toolbar.c ** */ WM_operatortype_append(CLIP_OT_tools); @@ -724,6 +726,9 @@ static void clip_keymap(struct wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "action", TRACK_CLEAR_ALL); RNA_boolean_set(kmi->ptr, "clear_active", FALSE); + /* Cursor */ + WM_keymap_add_item(keymap, "CLIP_OT_cursor_set", ACTIONMOUSE, KM_PRESS, 0, 0); + /* ******** Hotkeys avalaible for preview region only ******** */ keymap = WM_keymap_find(keyconf, "Clip Graph Editor", SPACE_CLIP, 0); @@ -1153,8 +1158,9 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar) if (mask) { ScrArea *sa = CTX_wm_area(C); int width, height; - float aspx, aspy; + float aspx, aspy, zoomx, zoomy, x, y; ED_mask_get_size(sa, &width, &height); + ED_space_clip_get_zoom(sc, ar, &zoomx, &zoomy); ED_space_clip_get_aspect(sc, &aspx, &aspy); ED_mask_draw_region(mask, ar, sc->mask_info.draw_flag, sc->mask_info.draw_type, @@ -1162,9 +1168,18 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar) aspx, aspy, TRUE, TRUE, sc->stabmat, C); - } + /* TODO(sergey): would be nice to find a way to de-duplicate all this space conversions */ + UI_view2d_to_region_float(&ar->v2d, 0.0f, 0.0f, &x, &y); + glPushMatrix(); + glTranslatef(x, y, 0); + glScalef(zoomx, zoomy, 0); + glMultMatrixf(sc->stabmat); + glScalef(width, height, 0); + draw_image_cursor(ar, sc->cursor); + glPopMatrix(); + } } if (sc->flag & SC_SHOW_GPENCIL) { |