[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25090] trunk/blender: Bugfix #20219: Timeline navigation
Joshua Leung
aligorith at gmail.com
Thu Dec 3 10:56:31 CET 2009
Revision: 25090
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25090
Author: aligorith
Date: 2009-12-03 10:56:31 +0100 (Thu, 03 Dec 2009)
Log Message:
-----------
Bugfix #20219: Timeline navigation
Added missing "View All" (HomeKey) operator for TimeLine
Modified Paths:
--------------
trunk/blender/release/scripts/ui/space_time.py
trunk/blender/source/blender/editors/space_time/time_ops.c
Modified: trunk/blender/release/scripts/ui/space_time.py
===================================================================
--- trunk/blender/release/scripts/ui/space_time.py 2009-12-03 09:51:02 UTC (rev 25089)
+++ trunk/blender/release/scripts/ui/space_time.py 2009-12-03 09:56:31 UTC (rev 25090)
@@ -91,6 +91,7 @@
st = context.space_data
layout.operator("anim.time_toggle")
+ layout.operator("time.view_all")
layout.separator()
Modified: trunk/blender/source/blender/editors/space_time/time_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_time/time_ops.c 2009-12-03 09:51:02 UTC (rev 25089)
+++ trunk/blender/source/blender/editors/space_time/time_ops.c 2009-12-03 09:56:31 UTC (rev 25090)
@@ -90,7 +90,8 @@
ot->exec= time_set_sfra_exec;
ot->poll= ED_operator_timeline_active;
- // XXX properties???
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
@@ -129,15 +130,59 @@
ot->exec= time_set_efra_exec;
ot->poll= ED_operator_timeline_active;
- // XXX properties???
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/* ************************ View All Operator *******************************/
+
+static int time_view_all_exec (bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ ARegion *ar= CTX_wm_region(C);
+ View2D *v2d= (ar) ? &ar->v2d : NULL;
+ float extra;
+
+ if ELEM(NULL, scene, ar)
+ return OPERATOR_CANCELLED;
+
+ /* set extents of view to start/end frames (Preview Range too) */
+ v2d->cur.xmin= (float)PSFRA;
+ v2d->cur.xmax= (float)PEFRA;
+
+ /* we need an extra "buffer" factor on either side so that the endpoints are visible */
+ extra= 0.01f * (v2d->cur.xmax - v2d->cur.xmin);
+ v2d->cur.xmin -= extra;
+ v2d->cur.xmax += extra;
+
+ /* this only affects this TimeLine instance, so just force redraw of this region */
+ ED_region_tag_redraw(ar);
+
+ return OPERATOR_FINISHED;
+}
+
+void TIME_OT_view_all (wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "View All";
+ ot->idname= "TIME_OT_view_all";
+ ot->description= "Show the entire playable frame range";
+
+ /* api callbacks */
+ ot->exec= time_view_all_exec;
+ ot->poll= ED_operator_timeline_active;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
/* ************************** registration **********************************/
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);
}
void time_keymap(wmKeyConfig *keyconf)
@@ -146,5 +191,6 @@
WM_keymap_add_item(keymap, "TIME_OT_start_frame_set", SKEY, KM_PRESS, 0, 0);
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);
}
More information about the Bf-blender-cvs
mailing list