[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [49248] trunk/blender/source/blender/ editors: add ED_space_image_get_size_fl, ED_space_clip_get_size_fl

Campbell Barton ideasman42 at gmail.com
Thu Jul 26 13:47:48 CEST 2012


Revision: 49248
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49248
Author:   campbellbarton
Date:     2012-07-26 11:47:47 +0000 (Thu, 26 Jul 2012)
Log Message:
-----------
add ED_space_image_get_size_fl, ED_space_clip_get_size_fl

Modified Paths:
--------------
    trunk/blender/source/blender/editors/include/ED_clip.h
    trunk/blender/source/blender/editors/include/ED_image.h
    trunk/blender/source/blender/editors/mask/mask_edit.c
    trunk/blender/source/blender/editors/space_clip/clip_editor.c
    trunk/blender/source/blender/editors/space_image/image_edit.c
    trunk/blender/source/blender/editors/transform/transform_generics.c
    trunk/blender/source/blender/editors/uvedit/uvedit_ops.c

Modified: trunk/blender/source/blender/editors/include/ED_clip.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_clip.h	2012-07-26 11:40:58 UTC (rev 49247)
+++ trunk/blender/source/blender/editors/include/ED_clip.h	2012-07-26 11:47:47 UTC (rev 49248)
@@ -53,6 +53,7 @@
 int ED_space_clip_maskedit_mask_poll(bContext *C);
 
 void ED_space_clip_get_size(const struct bContext *C, int *width, int *height);
+void ED_space_clip_get_size_fl(const struct bContext *C, float size[2]);
 void ED_space_clip_get_zoom(const struct bContext *C, float *zoomx, float *zoomy);
 void ED_space_clip_get_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
 void ED_space_clip_get_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);

Modified: trunk/blender/source/blender/editors/include/ED_image.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_image.h	2012-07-26 11:40:58 UTC (rev 49247)
+++ trunk/blender/source/blender/editors/include/ED_image.h	2012-07-26 11:47:47 UTC (rev 49248)
@@ -52,6 +52,7 @@
 int ED_space_image_has_buffer(struct SpaceImage *sima);
 
 void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height);
+void ED_space_image_get_size_fl(struct SpaceImage *sima, float size[2]);
 void ED_space_image_get_aspect(struct SpaceImage *sima, float *aspx, float *aspy);
 void ED_space_image_get_zoom(struct SpaceImage *sima, struct ARegion *ar, float *zoomx, float *zoomy);
 void ED_space_image_get_uv_aspect(struct SpaceImage *sima, float *aspx, float *aspy);

Modified: trunk/blender/source/blender/editors/mask/mask_edit.c
===================================================================
--- trunk/blender/source/blender/editors/mask/mask_edit.c	2012-07-26 11:40:58 UTC (rev 49247)
+++ trunk/blender/source/blender/editors/mask/mask_edit.c	2012-07-26 11:47:47 UTC (rev 49248)
@@ -110,13 +110,10 @@
 			}
 			case SPACE_IMAGE:
 			{
-				int width, height;
 				float frame_size[2];
 				SpaceImage *sima = sa->spacedata.first;
 				ARegion *ar = CTX_wm_region(C);
-				ED_space_image_get_size(sima, &width, &height);
-				frame_size[0] = width;
-				frame_size[1] = height;
+				ED_space_image_get_size_fl(sima, frame_size);
 				ED_image_mouse_pos(sima, ar, event, co);
 				BKE_mask_coord_from_frame(co, co, frame_size);
 				break;
@@ -155,13 +152,10 @@
 				break;
 			case SPACE_IMAGE:
 			{
-				int width, height;
 				float frame_size[2];
 				SpaceImage *sima = sa->spacedata.first;
 				ARegion *ar = CTX_wm_region(C);
-				ED_space_image_get_size(sima, &width, &height);
-				frame_size[0] = width;
-				frame_size[1] = height;
+				ED_space_image_get_size_fl(sima, frame_size);
 				ED_image_point_pos(sima, ar, x, y, &co[0], &co[1]);
 				BKE_mask_coord_from_frame(co, co, frame_size);
 				break;
@@ -203,13 +197,10 @@
 				break;
 			case SPACE_IMAGE:
 			{
-				int width, height;
 				float frame_size[2];
 				SpaceImage *sima = sa->spacedata.first;
 				ARegion *ar = CTX_wm_region(C);
-				ED_space_image_get_size(sima, &width, &height);
-				frame_size[0] = width;
-				frame_size[1] = height;
+				ED_space_image_get_size_fl(sima, frame_size);
 
 				co[0] = x;
 				co[1] = y;

Modified: trunk/blender/source/blender/editors/space_clip/clip_editor.c
===================================================================
--- trunk/blender/source/blender/editors/space_clip/clip_editor.c	2012-07-26 11:40:58 UTC (rev 49247)
+++ trunk/blender/source/blender/editors/space_clip/clip_editor.c	2012-07-26 11:47:47 UTC (rev 49248)
@@ -136,6 +136,14 @@
 	}
 }
 
+void ED_space_clip_get_size_fl(const bContext *C, float size[2])
+{
+	int size_i[2];
+	ED_space_clip_get_size(C, &size_i[0], &size_i[1]);
+	size[0] = size_i[0];
+	size[1] = size_i[1];
+}
+
 void ED_space_clip_get_zoom(const bContext *C, float *zoomx, float *zoomy)
 {
 	ARegion *ar = CTX_wm_region(C);

Modified: trunk/blender/source/blender/editors/space_image/image_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_image/image_edit.c	2012-07-26 11:40:58 UTC (rev 49247)
+++ trunk/blender/source/blender/editors/space_image/image_edit.c	2012-07-26 11:47:47 UTC (rev 49248)
@@ -192,6 +192,14 @@
 	ED_space_image_release_buffer(sima, lock);
 }
 
+void ED_space_image_get_size_fl(SpaceImage *sima, float size[2])
+{
+	int size_i[2];
+	ED_space_image_get_size(sima, &size_i[0], &size_i[1]);
+	size[0] = size_i[0];
+	size[1] = size_i[1];
+}
+
 void ED_image_get_aspect(Image *ima, float *aspx, float *aspy)
 {
 	*aspx = *aspy = 1.0;

Modified: trunk/blender/source/blender/editors/transform/transform_generics.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_generics.c	2012-07-26 11:40:58 UTC (rev 49247)
+++ trunk/blender/source/blender/editors/transform/transform_generics.c	2012-07-26 11:47:47 UTC (rev 49248)
@@ -1452,12 +1452,9 @@
 	if (cursor) {
 		if (t->options & CTX_MASK) {
 			float co[2];
-			int width, height;
 			float frame_size[2];
 			SpaceImage *sima = (SpaceImage *)t->sa->spacedata.first;
-			ED_space_image_get_size(sima, &width, &height);
-			frame_size[0] = width;
-			frame_size[1] = height;
+			ED_space_image_get_size_fl(sima, frame_size);
 
 			BKE_mask_coord_from_frame(co, cursor, frame_size);
 

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_ops.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_ops.c	2012-07-26 11:40:58 UTC (rev 49247)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_ops.c	2012-07-26 11:47:47 UTC (rev 49248)
@@ -295,8 +295,8 @@
 		ED_space_image_get_size(sima, &width, &height);
 	}
 	else {
-		width = 256;
-		height = 256;
+		width =  IMG_SIZE_FALLBACK;
+		height = IMG_SIZE_FALLBACK;
 	}
 
 	dist[0] = pixeldist / width;




More information about the Bf-blender-cvs mailing list