code cleanup: minor edits for mask/transform
[blender.git] / source / blender / editors / transform / transform.c
index 63161bc058f3335ee4a47fae9ec4a14e41fb9880..4f26f563ac60ec2c3225259e49c52fd44fea46d6 100644 (file)
@@ -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;