[Bf-blender-cvs] [d20c9e4] master: Bugfix: "Lock time to frame range" didn't work in the Graph Editor
Joshua Leung
noreply at git.blender.org
Thu May 8 07:57:20 CEST 2014
Commit: d20c9e491c4f158330029c6cccfc50216843fbb5
Author: Joshua Leung
Date: Thu May 8 17:43:11 2014 +1200
https://developer.blender.org/rBd20c9e491c4f158330029c6cccfc50216843fbb5
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.
===================================================================
M source/blender/editors/animation/anim_ops.c
M source/blender/editors/space_graph/graph_ops.c
===================================================================
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index d9a5d71..88429aa 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 eacbca3..cfd82b6 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);
}
More information about the Bf-blender-cvs
mailing list