diff options
author | Martin Poirier <theeth@yahoo.com> | 2010-02-20 23:29:09 +0300 |
---|---|---|
committer | Martin Poirier <theeth@yahoo.com> | 2010-02-20 23:29:09 +0300 |
commit | aa67aa9ecc05efeb2546e41d85f6975e77157e3d (patch) | |
tree | 1465032d2ddd648e1887768f441960bfbc91520c /source/blender/editors/animation/anim_markers.c | |
parent | 02e7871149fb369a12725a319cb09accad7790b9 (diff) |
Split numinput from transform (reusable in other operator).
Use in marker move operator.
Diffstat (limited to 'source/blender/editors/animation/anim_markers.c')
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 1d4773b0202..e6280a2556c 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -67,6 +67,7 @@ #include "ED_screen.h" #include "ED_types.h" #include "ED_util.h" +#include "ED_numinput.h" /* ************* Marker API **************** */ @@ -407,6 +408,7 @@ typedef struct MarkerMove { ListBase *markers; int event_type; /* store invoke-event, to verify */ int *oldframe, evtx, firstx; + NumInput num; } MarkerMove; /* copy selection to temp buffer */ @@ -430,6 +432,10 @@ static int ed_marker_move_init(bContext *C, wmOperator *op) mm->slink= CTX_wm_space_data(C); mm->markers= markers; mm->oldframe= MEM_callocN(totmark*sizeof(int), "MarkerMove oldframe"); + + initNumInput(&mm->num); + mm->num.idx_max = 0; /* one axis */ + mm->num.flag |= NUM_NO_FRACTION; for (a=0, marker= markers->first; marker; marker= marker->next) { if (marker->flag & SELECT) { @@ -518,6 +524,8 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) ed_marker_move_cancel(C, op); return OPERATOR_CANCELLED; + case RETKEY: + case PADENTER: case LEFTMOUSE: case MIDDLEMOUSE: case RIGHTMOUSE: @@ -529,6 +537,9 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) break; case MOUSEMOVE: + if(hasNumInput(&mm->num)) + break; + dx= v2d->mask.xmax-v2d->mask.xmin; dx= (v2d->cur.xmax-v2d->cur.xmin)/dx; @@ -602,6 +613,26 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) } } + if(evt->val==KM_PRESS) { + float vec[3]; + char str_tx[256]; + + if (handleNumInput(&mm->num, evt, 1.0)) + { + applyNumInput(&mm->num, vec); + outputNumInput(&mm->num, str_tx); + + RNA_int_set(op->ptr, "frames", vec[0]); + ed_marker_move_apply(C, op); + // ed_marker_header_update(C, op, str, (int)vec[0]); + // strcat(str, str_tx); + sprintf(str, "Marker offset %s", str_tx); + ED_area_headerprint(CTX_wm_area(C), str); + + WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); + } + } + return OPERATOR_RUNNING_MODAL; } |