[Bf-blender-cvs] [ad7980a] master: Image and clip editor: change zoom step to end up at powers of two.
Harshit Mehta
noreply at git.blender.org
Tue Apr 1 18:00:39 CEST 2014
Commit: ad7980a51a7e1c2492691e403ffdf84a29081c35
Author: Harshit Mehta
Date: Tue Apr 1 17:33:43 2014 +0200
https://developer.blender.org/rBad7980a51a7e1c2492691e403ffdf84a29081c35
Image and clip editor: change zoom step to end up at powers of two.
When you press zoom 3 times you will now get 2:1, 4:1, 8:1, etc. Fixes T36916.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D409
===================================================================
M source/blender/editors/space_clip/clip_ops.c
M source/blender/editors/space_image/image_ops.c
===================================================================
diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c
index 2b425e2..b901ff4 100644
--- a/source/blender/editors/space_clip/clip_ops.c
+++ b/source/blender/editors/space_clip/clip_ops.c
@@ -620,7 +620,7 @@ static int view_zoom_in_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "location", location);
- sclip_zoom_set_factor(C, 1.25f, location);
+ sclip_zoom_set_factor(C, powf(2.0f, 1.0f/3.0f), location);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -663,7 +663,7 @@ static int view_zoom_out_exec(bContext *C, wmOperator *op)
RNA_float_get_array(op->ptr, "location", location);
- sclip_zoom_set_factor(C, 0.8f, location);
+ sclip_zoom_set_factor(C, powf(0.5f, 1.0f/3.0f), location);
ED_region_tag_redraw(CTX_wm_region(C));
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 93cb1ac..109525f 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -776,10 +776,10 @@ static int image_view_zoom_in_exec(bContext *C, wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
ARegion *ar = CTX_wm_region(C);
float location[2];
-
+
RNA_float_get_array(op->ptr, "location", location);
- sima_zoom_set_factor(sima, ar, 1.25f, location);
+ sima_zoom_set_factor(sima, ar, powf(2.0f, 1.0f/3.0f), location);
ED_region_tag_redraw(CTX_wm_region(C));
@@ -821,11 +821,11 @@ static int image_view_zoom_out_exec(bContext *C, wmOperator *op)
SpaceImage *sima = CTX_wm_space_image(C);
ARegion *ar = CTX_wm_region(C);
float location[2];
-
+
RNA_float_get_array(op->ptr, "location", location);
- sima_zoom_set_factor(sima, ar, 0.8f, location);
-
+ sima_zoom_set_factor(sima, ar, powf(0.5f, 1.0f/3.0f), location);
+
ED_region_tag_redraw(CTX_wm_region(C));
return OPERATOR_FINISHED;
More information about the Bf-blender-cvs
mailing list