[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49265] trunk/blender/source/blender/ editors: code cleanup: minor edits for mask/transform

Campbell Barton ideasman42 at gmail.com
Thu Jul 26 23:22:43 CEST 2012


Revision: 49265
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49265
Author:   campbellbarton
Date:     2012-07-26 21:22:42 +0000 (Thu, 26 Jul 2012)
Log Message:
-----------
code cleanup: minor edits for mask/transform

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_mask.h
    trunk/blender/source/blender/editors/mask/mask_intern.h
    trunk/blender/source/blender/editors/transform/transform.c

Modified: trunk/blender/source/blender/editors/include/ED_mask.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_mask.h	2012-07-26 18:05:42 UTC (rev 49264)
+++ trunk/blender/source/blender/editors/include/ED_mask.h	2012-07-26 21:22:42 UTC (rev 49265)
@@ -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);

Modified: trunk/blender/source/blender/editors/mask/mask_intern.h
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_intern.h	2012-07-26 18:05:42 UTC (rev 49264)
+++ trunk/blender/source/blender/editors/mask/mask_intern.h	2012-07-26 21:22:42 UTC (rev 49265)
@@ -99,15 +99,6 @@
 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);

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2012-07-26 18:05:42 UTC (rev 49264)
+++ trunk/blender/source/blender/editors/transform/transform.c	2012-07-26 21:22:42 UTC (rev 49265)
@@ -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 @@
 			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 @@
 
 		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;




More information about the Bf-blender-cvs mailing list