diff options
author | Joshua Leung <aligorith@gmail.com> | 2014-05-08 09:43:11 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2014-05-08 09:43:11 +0400 |
commit | d20c9e491c4f158330029c6cccfc50216843fbb5 (patch) | |
tree | 412e19f5c1b42faee866ddb6e04242e841565a53 /source/blender/editors | |
parent | 88e5705a3fe04cf9e83baa4007c06e35d19156ae (diff) |
Bugfix: "Lock time to frame range" didn't work in the Graph Editor
This uses a different operator than the other time editors (as it needs to support
the setting of the value-cursor too), so the changes here didn't get propagated through.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 16 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index d9a5d713480..88429aa3867 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -128,11 +128,11 @@ static int frame_from_event(bContext *C, const wmEvent *event) /* round result to nearest int (frames are ints!) */ frame = iroundf(viewx); - + if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) { CLAMP(frame, PSFRA, PEFRA); } - + return frame; } diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index eacbca38305..cfd82b67289 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -110,19 +110,27 @@ static int graphview_cursor_exec(bContext *C, wmOperator *op) /* set the operator properties from the initial event */ static void graphview_cursor_setprops(bContext *C, wmOperator *op, const wmEvent *event) { + Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); float viewx, viewy; - + int frame; + /* abort if not active region (should not really be possible) */ if (ar == NULL) return; - + /* convert from region coordinates to View2D 'tot' space */ UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy); - /* store the values in the operator properties */ /* frame is rounded to the nearest int, since frames are ints */ - RNA_int_set(op->ptr, "frame", iroundf(viewx)); + frame = iroundf(viewx); + + if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) { + CLAMP(frame, PSFRA, PEFRA); + } + + /* store the values in the operator properties */ + RNA_int_set(op->ptr, "frame", frame); RNA_float_set(op->ptr, "value", viewy); } |