diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-10-20 16:04:56 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-10-20 16:04:56 +0400 |
commit | 00f3d83b6ab5f4f9ee4f69457e492db72a03cf30 (patch) | |
tree | dd57f5d8b0bb859a0403225a11d118844a728c68 /source/blender/editors/animation | |
parent | ec6bccfad1609fa09a703d7496310da246fd5825 (diff) |
Graph Editor: Added 2D Cursor
I've finally given in, and implemented a '2d-cursor' for the Graph Editor. This is simply represented as an additional horizontal line that meets with the current frame indicator, forming a cross-hair. It can be disabled from the View menu.
Currently, the only tool which takes this into account is the Snapping tools (Shift-S), where I've hooked up a tool I added some time ago.
TODO:
- expose this cursor to the transform tools for scaling/rotation options...
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r-- | source/blender/editors/animation/anim_draw.c | 2 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_ops.c | 26 |
2 files changed, 18 insertions, 10 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 2dc4aa09407..aa581a7d15a 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -156,7 +156,7 @@ static void draw_cfra_number (Scene *scene, View2D *v2d, float cfra, short time) glScalef(xscale, 1.0, 1.0); } -/* General call for drawing current frame indicator in a */ +/* General call for drawing current frame indicator in animation editor */ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) { Scene *scene= CTX_data_scene(C); diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 35eac6d23f1..33eed1ff2a4 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -62,6 +62,18 @@ /* ********************** frame change operator ***************************/ +/* Check if the operator can be run from the current context */ +static int change_frame_poll(bContext *C) +{ + ScrArea *curarea= CTX_wm_area(C); + + /* as long as there is an active area, and it isn't a Graph Editor + * (since the Graph Editor has its own version which does extra stuff), + * we're fine + */ + return ((curarea) && (curarea->spacetype != SPACE_IPO)); +} + /* Set any flags that are necessary to indicate modal time-changing operation */ static int change_frame_init(bContext *C, wmOperator *op) { @@ -85,18 +97,12 @@ static int change_frame_init(bContext *C, wmOperator *op) static void change_frame_apply(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - int cfra; - - /* get frame, and clamp to MINAFRAME - * - not MINFRAME, since it's useful to be able to key a few-frames back - */ - cfra= RNA_int_get(op->ptr, "frame"); - if (cfra < MINAFRAME) cfra= MINAFRAME; - CFRA= cfra; + /* set the new frame number */ + CFRA= RNA_int_get(op->ptr, "frame"); + /* do updates */ sound_scrub(C); - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); } @@ -210,12 +216,14 @@ void ANIM_OT_change_frame(wmOperatorType *ot) /* identifiers */ ot->name= "Change frame"; ot->idname= "ANIM_OT_change_frame"; + ot->description= "Interactively change the current frame number."; /* api callbacks */ ot->exec= change_frame_exec; ot->invoke= change_frame_invoke; ot->cancel= change_frame_cancel; ot->modal= change_frame_modal; + ot->poll= change_frame_poll; /* flags */ ot->flag= OPTYPE_BLOCKING; |