diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-27 01:22:42 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-27 01:22:42 +0400 |
commit | ee572a9642d5360f0ba852c17cc345f21ad1f985 (patch) | |
tree | 1fef7df2850edcca83bd4f60c8e41879f5524f83 /source/blender/editors | |
parent | 85571c339de9aea49c367b2c0a7a8b8b8649c3b3 (diff) |
code cleanup: minor edits for mask/transform
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_mask.h | 7 | ||||
-rw-r--r-- | source/blender/editors/mask/mask_intern.h | 9 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 29 |
3 files changed, 29 insertions, 16 deletions
diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 758fe6367bb..372d4665a73 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -34,12 +34,19 @@ struct wmKeyConfig; struct MaskLayer; struct MaskLayerShape; +struct wmEvent; /* mask_edit.c */ void ED_mask_size(const struct bContext *C, int *width, int *height); void ED_mask_zoom(const struct bContext *C, float *zoomx, float *zoomy); void ED_mask_aspect(const struct bContext *C, float *aspx, float *aspy); +void ED_mask_pixelspace_factor(const struct bContext *C, float *scalex, float *scaley); +void ED_mask_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]); + +void ED_mask_point_pos(const struct bContext *C, float x, float y, float *xr, float *yr); +void ED_mask_point_pos__reverse(const struct bContext *C, float x, float y, float *xr, float *yr); + void ED_operatortypes_mask(void); void ED_keymap_mask(struct wmKeyConfig *keyconf); void ED_operatormacros_mask(void); diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index b4ff4bc5b31..ffd4afca182 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -99,15 +99,6 @@ void ED_mask_select_flush_all(struct Mask *mask); int ED_maskedit_poll(struct bContext *C); int ED_maskedit_mask_poll(struct bContext *C); -void ED_mask_pixelspace_factor(const struct bContext *C, float *scalex, float *scaley); -void ED_mask_mouse_pos(const struct bContext *C, struct wmEvent *event, float co[2]); - -void ED_mask_point_pos(const struct bContext *C, float x, float y, float *xr, float *yr); -void ED_mask_point_pos__reverse(const struct bContext *C, float x, float y, float *xr, float *yr); - -void ED_mask_get_zoom(const bContext *C, float *zoomx, float *zoomy); -void ED_mask_get_size(const bContext *C, float *zoomx, float *zoomy); - /* mask_shapekey.c */ void MASK_OT_shape_key_insert(struct wmOperatorType *ot); void MASK_OT_shape_key_clear(struct wmOperatorType *ot); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 63161bc058f..4f26f563ac6 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -74,6 +74,7 @@ #include "ED_view3d.h" #include "ED_mesh.h" #include "ED_clip.h" +#include "ED_mask.h" #include "UI_view2d.h" #include "WM_types.h" @@ -225,13 +226,24 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2]) project_int_noclip(t->ar, vec, adr); } else if (t->spacetype == SPACE_IMAGE) { - float aspx, aspy, v[2]; +#if 0 + if (t->options & CTX_MASK) { + float v[2]; + ED_mask_point_pos__reverse(t->context, vec[0], vec[1], &v[0], &v[1]); + adr[0] = v[0]; + adr[1] = v[1]; + } + else +#endif + { + float aspx, aspy, v[2]; - ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); - v[0] = vec[0] / aspx; - v[1] = vec[1] / aspy; + ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy); + v[0] = vec[0] / aspx; + v[1] = vec[1] / aspy; - UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1); + UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr + 1); + } } else if (t->spacetype == SPACE_ACTION) { int out[2] = {0, 0}; @@ -272,10 +284,13 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2]) copy_v2_v2(v, vec); - if (t->options & CTX_MOVIECLIP) + if (t->options & CTX_MOVIECLIP) { ED_space_clip_get_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy); - else if (t->options & CTX_MASK) + } + else if (t->options & CTX_MASK) { + /* MASKTODO - not working as expected */ ED_space_clip_get_aspect(t->sa->spacedata.first, &aspx, &aspy); + } v[0] /= aspx; v[1] /= aspy; |