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
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-10-14 00:46:02 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-10-14 00:46:02 +0400
commitee63ef7af17cb793d9c6947e6f47de7c36df58af (patch)
treee493aacd90fbfa4c91896438b6c1b97bae0299ca /source/blender/editors/animation/anim_ops.c
parent98d66aeb973f91b8dd13ab082b16f3d45e47636b (diff)
Project Pampa request: option to lock frame selection to the range
This means when you've got "Lock Frame Selection" option (which is in the timeline next to the preview range button) you're not able to go to the frames which are out of current frame range with your mouse. TODO: Make it so current frame slider also respects this setting? Not so much important for tonight.
Diffstat (limited to 'source/blender/editors/animation/anim_ops.c')
-rw-r--r--source/blender/editors/animation/anim_ops.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 15a75c57758..af9b58736ef 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -118,13 +118,21 @@ static int change_frame_exec(bContext *C, wmOperator *op)
static int frame_from_event(bContext *C, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
+ Scene *scene = CTX_data_scene(C);
float viewx;
+ int frame;
/* convert from region coordinates to View2D 'tot' space */
UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &viewx, NULL);
/* round result to nearest int (frames are ints!) */
- return (int)floor(viewx + 0.5f);
+ frame = (int)floor(viewx + 0.5f);
+
+ if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) {
+ CLAMP(frame, PSFRA, PEFRA);
+ }
+
+ return frame;
}
/* Modal Operator init */