"View Frame" now works in the sequencer too
authorJoshua Leung <aligorith@gmail.com>
Sun, 17 Apr 2016 00:26:44 +0000 (12:26 +1200)
committerJoshua Leung <aligorith@gmail.com>
Sun, 17 Apr 2016 00:27:12 +0000 (12:27 +1200)
release/scripts/startup/bl_ui/space_sequencer.py
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/editors/space_time/time_ops.c

index 387638404fdb2500972795775406f33da4e62046..233145819e7f09744bc7a45f947559e3686cd37f 100644 (file)
@@ -180,6 +180,7 @@ class SEQUENCER_MT_view(Menu):
             layout.operator_context = 'INVOKE_REGION_WIN'
             layout.operator("sequencer.view_all", text="View all Sequences")
             layout.operator("sequencer.view_selected")
+            layout.operator("sequencer.view_frame")
             layout.operator_context = 'INVOKE_DEFAULT'
         if is_preview:
             layout.operator_context = 'INVOKE_REGION_PREVIEW'
index df3e508ae0ecea76c9cca12497532ce2aa98b039..e3cdedf042b129fbc4b764da7bfc869e5a26a43a 100644 (file)
@@ -61,6 +61,7 @@
 
 /* for menu/popup icons etc etc*/
 
+#include "ED_anim_api.h"
 #include "ED_numinput.h"
 #include "ED_screen.h"
 #include "ED_transform.h"
@@ -2697,6 +2698,29 @@ void SEQUENCER_OT_view_all(wmOperatorType *ot)
        ot->flag = OPTYPE_REGISTER;
 }
 
+static int sequencer_view_frame_exec(bContext *C, wmOperator *op)
+{
+       const int smooth_viewtx = WM_operator_smooth_viewtx_get(op);
+       ANIM_center_frame(C, smooth_viewtx);
+       
+       return OPERATOR_FINISHED;
+}
+
+void SEQUENCER_OT_view_frame(wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name = "View Frame";
+       ot->idname = "SEQUENCER_OT_view_frame";
+       ot->description = "Reset viewable area to show range around current frame";
+       
+       /* api callbacks */
+       ot->exec = sequencer_view_frame_exec;
+       ot->poll = ED_operator_sequencer_active;
+       
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
 /* view_all operator */
 static int sequencer_view_all_preview_exec(bContext *C, wmOperator *UNUSED(op))
 {
index 3e228fd0b31d73ba389565a0d23aaac3d490cfc6..730cc1172874e8b70c763458f5795d9026d22d09 100644 (file)
@@ -121,6 +121,7 @@ void SEQUENCER_OT_rendersize(struct wmOperatorType *ot);
 void SEQUENCER_OT_view_toggle(struct wmOperatorType *ot);
 void SEQUENCER_OT_view_all(struct wmOperatorType *ot);
 void SEQUENCER_OT_view_selected(struct wmOperatorType *ot);
+void SEQUENCER_OT_view_frame(struct wmOperatorType *ot);
 void SEQUENCER_OT_view_zoom_ratio(struct wmOperatorType *ot);
 void SEQUENCER_OT_view_ghost_border(struct wmOperatorType *ot);
 
index 3d08e0c5ed8a68dfd8ca17aeb9736dc5c2d9f7b4..655e029cfddd3f2628261f65883a68fe735db042 100644 (file)
@@ -84,6 +84,7 @@ void sequencer_operatortypes(void)
 
        WM_operatortype_append(SEQUENCER_OT_view_all);
        WM_operatortype_append(SEQUENCER_OT_view_selected);
+       WM_operatortype_append(SEQUENCER_OT_view_frame);
        WM_operatortype_append(SEQUENCER_OT_view_all_preview);
        WM_operatortype_append(SEQUENCER_OT_view_toggle);
        WM_operatortype_append(SEQUENCER_OT_view_zoom_ratio);
@@ -202,6 +203,7 @@ void sequencer_keymap(wmKeyConfig *keyconf)
        WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "SEQUENCER_OT_view_all", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "SEQUENCER_OT_view_selected", PADPERIOD, KM_PRESS, 0, 0);
+       WM_keymap_add_item(keymap, "SEQUENCER_OT_view_frame", PAD0, KM_PRESS, 0, 0);
 
        kmi = WM_keymap_add_item(keymap, "SEQUENCER_OT_strip_jump", PAGEUPKEY, KM_PRESS, 0, 0);
        RNA_boolean_set(kmi->ptr, "next", true);
index 35f17ee4f00d31923700fb68b203ec02183138f5..a7f549b65ae841a3901e96b339cdb221d884cd8e 100644 (file)
@@ -192,7 +192,7 @@ static void TIME_OT_view_frame(wmOperatorType *ot)
        /* identifiers */
        ot->name = "View Frame";
        ot->idname = "TIME_OT_view_frame";
-       ot->description = "Show the entire playable frame range";
+       ot->description = "Reset viewable area to show range around current frame";
        
        /* api callbacks */
        ot->exec = time_view_frame_exec;