diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-08-02 11:08:51 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-08-02 11:08:51 +0400 |
commit | 0bbc1229b90ce15c14d4df2f28a85eefc0b20078 (patch) | |
tree | 99f67475f1a3852dc8aaa6f011744d475004e233 | |
parent | a0e252c25f356e13149840eb922595d06cd58eea (diff) |
2.5 - Bugfixes
* Added operator for jumping to the start and end frames. Shift Up/Down
* Fixed bad spacing for buttons in Graph Editor header
-rw-r--r-- | source/blender/editors/screen/screen_ops.c | 35 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_header.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_time/time_header.c | 24 |
3 files changed, 43 insertions, 20 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c9e30b8c879..6f9765ff3b3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1411,6 +1411,37 @@ static void SCREEN_OT_frame_offset(wmOperatorType *ot) RNA_def_int(ot->srna, "delta", 0, INT_MIN, INT_MAX, "Delta", "", INT_MIN, INT_MAX); } + +/* function to be called outside UI context, or for redo */ +static int frame_jump_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + + if (RNA_boolean_get(op->ptr, "end")) + CFRA= PEFRA; + else + CFRA= PSFRA; + + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); + + return OPERATOR_FINISHED; +} + +static void SCREEN_OT_frame_jump(wmOperatorType *ot) +{ + ot->name = "Jump to Endpoint"; + ot->idname = "SCREEN_OT_frame_jump"; + + ot->exec= frame_jump_exec; + + ot->poll= ED_operator_screenactive; + ot->flag= 0; + + /* rna */ + RNA_def_boolean(ot->srna, "end", 0, "Last Frame", "Jump to the last frame of the frame range."); +} + + /* ************** jump to keyframe operator ***************************** */ /* helper function - find actkeycolumn that occurs on cframe, or the nearest one if not found */ @@ -3062,6 +3093,7 @@ void ED_operatortypes_screen(void) /*frame changes*/ WM_operatortype_append(SCREEN_OT_frame_offset); + WM_operatortype_append(SCREEN_OT_frame_jump); WM_operatortype_append(SCREEN_OT_keyframe_jump); WM_operatortype_append(SCREEN_OT_animation_step); @@ -3174,6 +3206,9 @@ void ED_keymap_screen(wmWindowManager *wm) RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", LEFTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", -1); RNA_int_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_offset", RIGHTARROWKEY, KM_PRESS, 0, 0)->ptr, "delta", 1); + WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", DOWNARROWKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_frame_jump", UPARROWKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "end", 1); + WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEUPKEY, KM_PRESS, KM_CTRL, 0); RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_keyframe_jump", PAGEDOWNKEY, KM_PRESS, KM_CTRL, 0)->ptr, "next", 0); diff --git a/source/blender/editors/space_graph/graph_header.c b/source/blender/editors/space_graph/graph_header.c index 4369c321c5e..5a7b7d654b1 100644 --- a/source/blender/editors/space_graph/graph_header.c +++ b/source/blender/editors/space_graph/graph_header.c @@ -307,11 +307,11 @@ void graph_header_buttons(const bContext *C, ARegion *ar) uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Curves"); uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Particles"); uiBlockEndAlign(block); - xco += 15; + xco += 30; } else { // XXX this case shouldn't happen at all... for now, just pad out same amount of space - xco += 6*XIC + 15; + xco += 9*XIC + 30; } /* auto-snap selector */ diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c index fb8c28fd751..f74810156c3 100644 --- a/source/blender/editors/space_time/time_header.c +++ b/source/blender/editors/space_time/time_header.c @@ -360,10 +360,8 @@ static uiBlock *time_framemenu(bContext *C, ARegion *ar, void *arg_unused) #define B_REDRAWALL 750 -#define B_TL_REW 751 #define B_TL_PLAY 752 #define B_TL_RPLAY 760 -#define B_TL_FF 753 #define B_TL_STOP 756 #define B_TL_PREVIEWON 757 @@ -385,11 +383,6 @@ void do_time_buttons(bContext *C, void *arg, int event) case B_NEWFRAME: WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); break; - case B_TL_REW: - scene->r.cfra= PSFRA; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); - //update_for_newframe(); - break; case B_TL_PLAY: ED_screen_animation_timer(C, stime->redraws, 1); @@ -417,12 +410,6 @@ void do_time_buttons(bContext *C, void *arg, int event) case B_TL_STOP: ED_screen_animation_timer(C, 0, 0); break; - case B_TL_FF: - /* end frame */ - scene->r.cfra= PEFRA; - WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); - //update_for_newframe(); - break; case B_TL_PREVIEWON: if (scene->r.psfra) { @@ -528,9 +515,9 @@ void time_header_buttons(const bContext *C, ARegion *ar) xco += (short)(3.5 * XIC); uiBlockBeginAlign(block); - - uiDefIconBut(block, BUT, B_TL_REW, ICON_REW, - xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Skip to Start frame (Shift DownArrow)"); + + but= uiDefIconButO(block, BUT, "SCREEN_OT_frame_jump", WM_OP_INVOKE_REGION_WIN, ICON_REW, xco,yco,XIC,YIC, "Skip to Start frame (Shift DownArrow)"); + RNA_boolean_set(uiButGetOperatorPtrRNA(but), "end", 0); xco+= XIC; but= uiDefIconButO(block, BUT, "SCREEN_OT_keyframe_jump", WM_OP_INVOKE_REGION_WIN, ICON_PREV_KEYFRAME, xco,yco,XIC,YIC, "Skip to previous keyframe (Ctrl PageDown)"); @@ -559,8 +546,9 @@ void time_header_buttons(const bContext *C, ARegion *ar) RNA_boolean_set(uiButGetOperatorPtrRNA(but), "next", 1); xco+= XIC; - uiDefIconBut(block, BUT, B_TL_FF, ICON_FF, - xco, yco, XIC, YIC, 0, 0, 0, 0, 0, "Skip to End frame (Shift UpArrow)"); + but= uiDefIconButO(block, BUT, "SCREEN_OT_frame_jump", WM_OP_INVOKE_REGION_WIN, ICON_FF, xco,yco,XIC,YIC, "Skip to End frame (Shift UpArrow)"); + RNA_boolean_set(uiButGetOperatorPtrRNA(but), "end", 1); + xco+= XIC; uiBlockEndAlign(block); xco+= 2*XIC; |