Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2017-03-10 03:38:02 +0300
committerJoshua Leung <aligorith@gmail.com>2017-03-10 05:07:17 +0300
commit17689f8bb6df2421211173b1b7963b6d53ad4e41 (patch)
tree84e9b1e6c2b3b34cf0479d20d222b50f0ace38ad /source
parent62cc226101fab61b5ae2f18f8cbe8f1e5ac6ce82 (diff)
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)
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/anim_ops.c10
1 files changed, 4 insertions, 6 deletions
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);
}