2.5 - Bugfixes
authorJoshua Leung <aligorith@gmail.com>
Sun, 2 Aug 2009 07:08:51 +0000 (07:08 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 2 Aug 2009 07:08:51 +0000 (07:08 +0000)
* Added operator for jumping to the start and end frames. Shift Up/Down
* Fixed bad spacing for buttons in Graph Editor header

source/blender/editors/screen/screen_ops.c
source/blender/editors/space_graph/graph_header.c
source/blender/editors/space_time/time_header.c

index c9e30b8c8793d56c2b3dccc82f05982aa636be5e..6f9765ff3b33443256aae2c06145903d9b3c73f2 100644 (file)
@@ -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);
        
index 4369c321c5ef4fe933ec624520a60a229522b808..5a7b7d654b1c2f02ddf8f5393bf79c0211f1a1a6 100644 (file)
@@ -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 */
index fb8c28fd7517846d6cffbbe040cb43cd6728b337..f74810156c3b506ebac215b87bc9997a3f38254c 100644 (file)
@@ -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;