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:
authorJoshua Leung <aligorith@gmail.com>2009-10-20 16:04:56 +0400
committerJoshua Leung <aligorith@gmail.com>2009-10-20 16:04:56 +0400
commit00f3d83b6ab5f4f9ee4f69457e492db72a03cf30 (patch)
treedd57f5d8b0bb859a0403225a11d118844a728c68 /source/blender/editors/animation/anim_ops.c
parentec6bccfad1609fa09a703d7496310da246fd5825 (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/anim_ops.c')
-rw-r--r--source/blender/editors/animation/anim_ops.c26
1 files changed, 17 insertions, 9 deletions
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;