[Bf-blender-cvs] [17689f8bb6d] master: Fix T50904: Imprecise timeline frame selection using mouse

Joshua Leung noreply at git.blender.org
Fri Mar 10 03:18:06 CET 2017


Commit: 17689f8bb6df2421211173b1b7963b6d53ad4e41
Author: Joshua Leung
Date:   Fri Mar 10 13:38:02 2017 +1300
Branches: master
https://developer.blender.org/rB17689f8bb6df2421211173b1b7963b6d53ad4e41

Fix T50904: Imprecise timeline frame selection using mouse

The changes introduced in rB3e628eefa9f55fac7b0faaec4fd4392c2de6b20e
made the non-subframe frame change behaviour less intuitive, by always
truncating downwards, instead of rounding to the nearest frame instead.
This made the UI a lot less forgiving of pointing precision errors
(for example, as a result of hand shake, or using a tablet on a highres scren)

This commit restores the old behaviour in this case only (subframe inspection
isn't affected by these changes)

===================================================================

M	source/blender/editors/animation/anim_ops.c

===================================================================

diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index bb73cbf03b4..0eb6508f7b2 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -103,11 +103,12 @@ static void change_frame_apply(bContext *C, wmOperator *op)
 	}
 
 	/* set the new frame number */
-	CFRA = (int)frame;
 	if (scene->r.flag & SCER_SHOW_SUBFRAME) {
+		CFRA = (int)frame;
 		SUBFRA = frame - (int)frame;
 	}
 	else {
+		CFRA = iroundf(frame);
 		SUBFRA = 0.0f;
 	}
 	FRAMENUMBER_MIN_CLAMP(CFRA);
@@ -134,15 +135,12 @@ static float frame_from_event(bContext *C, const wmEvent *event)
 {
 	ARegion *region = CTX_wm_region(C);
 	Scene *scene = CTX_data_scene(C);
-	float viewx;
 	float frame;
 
 	/* convert from region coordinates to View2D 'tot' space */
-	viewx = UI_view2d_region_to_view_x(&region->v2d, event->mval[0]);
-	
-	/* round result to nearest int (frames are ints!) */
-	frame = viewx;
+	frame = UI_view2d_region_to_view_x(&region->v2d, event->mval[0]);
 	
+	/* respect preview range restrictions (if only allowed to move around within that range) */
 	if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {
 		CLAMP(frame, PSFRA, PEFRA);
 	}




More information about the Bf-blender-cvs mailing list