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>2016-04-16 18:44:10 +0300
committerJoshua Leung <aligorith@gmail.com>2016-04-16 18:44:10 +0300
commitb973911feeec1bf487b35245005406fb32018cbf (patch)
treefe51cfc0ed772e90ff9d4eb9504789b081c19a94 /source/blender/editors/space_time
parent5d6b695f00c839c34e4d9d9b371ca0a71ee46dbc (diff)
Anim Editors: "View Frame" Operator - Code Cleanups/Reshuffling + NLA/Timeline Support
* Reshuffled code for existing "View Frame" implementations, and removed leftover comment from some of the the copy-and-paste used to build it. * Added support for this operator in the NLA and Timeline
Diffstat (limited to 'source/blender/editors/space_time')
-rw-r--r--source/blender/editors/space_time/time_ops.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index e2e861fda38..35f17ee4f00 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -39,6 +39,7 @@
#include "BKE_context.h"
+#include "ED_anim_api.h"
#include "ED_screen.h"
#include "WM_api.h"
@@ -176,6 +177,31 @@ static void TIME_OT_view_all(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
+/* ************************ View Frame Operator *******************************/
+
+static int time_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;
+}
+
+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";
+
+ /* api callbacks */
+ ot->exec = time_view_frame_exec;
+ ot->poll = ED_operator_timeline_active;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+}
+
/* ************************** registration **********************************/
void time_operatortypes(void)
@@ -183,6 +209,7 @@ void time_operatortypes(void)
WM_operatortype_append(TIME_OT_start_frame_set);
WM_operatortype_append(TIME_OT_end_frame_set);
WM_operatortype_append(TIME_OT_view_all);
+ WM_operatortype_append(TIME_OT_view_frame);
}
void time_keymap(wmKeyConfig *keyconf)
@@ -193,5 +220,6 @@ void time_keymap(wmKeyConfig *keyconf)
WM_keymap_add_item(keymap, "TIME_OT_end_frame_set", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TIME_OT_view_all", HOMEKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "TIME_OT_view_all", NDOF_BUTTON_FIT, KM_PRESS, 0, 0);
+ WM_keymap_add_item(keymap, "TIME_OT_view_frame", PAD0, KM_PRESS, 0, 0);
}