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:
authorDalai Felinto <dfelinto@gmail.com>2014-02-12 20:06:45 +0400
committerDalai Felinto <dfelinto@gmail.com>2014-02-12 20:07:43 +0400
commit9388061738f9e991c7078d3d6d45dfeb1ae78f2d (patch)
tree3025e379db2ccf483b5ade0cdcce5c9b4755e319 /source/blender/editors/space_view3d/view3d_fly.c
parentf49e89fa378cde3bae9020985ed6e55724ae1ae1 (diff)
Add header info for the Fly Navigation operator
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_fly.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index bfb7b36318a..9f8d1e14601 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -39,6 +39,8 @@
#include "BKE_context.h"
#include "BKE_report.h"
+#include "BLF_translation.h"
+
#include "BIF_gl.h"
#include "WM_api.h"
@@ -271,6 +273,28 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar),
glEnd();
}
+static void fly_update_header(bContext *C, FlyInfo *fly)
+{
+#define HEADER_LENGTH 256
+ char header[HEADER_LENGTH];
+
+ BLI_snprintf(header, HEADER_LENGTH, IFACE_("LMB/Return: confirm, "
+ "RMB/Esc: cancel, "
+ "MMB: pan, "
+ "WASDRF: direction, "
+ "Shift: slow, "
+ "Ctrl: free look, "
+ "X: Upright x axis (%s), "
+ "Z: Upright z axis (%s), "
+ "(+/- | Wheel): speed, "),
+
+ WM_bool_as_string(fly->xlock != FLY_AXISLOCK_STATE_OFF),
+ WM_bool_as_string(fly->zlock != FLY_AXISLOCK_STATE_OFF));
+
+ ED_area_headerprint(CTX_wm_area(C), header);
+#undef HEADER_LENGTH
+}
+
/* FlyInfo->state */
enum {
FLY_RUNNING = 0,
@@ -376,6 +400,7 @@ static bool initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, const wmEvent
/* center the mouse, probably the UI mafia are against this but without its quite annoying */
WM_cursor_warp(win, fly->ar->winrct.xmin + fly->center_mval[0], fly->ar->winrct.ymin + fly->center_mval[1]);
+ fly_update_header(C, fly);
return 1;
}
@@ -414,7 +439,7 @@ static int flyEnd(bContext *C, FlyInfo *fly)
return OPERATOR_CANCELLED;
}
-static void flyEvent(FlyInfo *fly, const wmEvent *event)
+static void flyEvent(bContext *C, FlyInfo *fly, const wmEvent *event)
{
if (event->type == TIMER && event->customdata == fly->timer) {
fly->redraw = 1;
@@ -622,6 +647,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event)
fly->xlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->xlock_momentum = 0.0;
}
+ fly_update_header(C, fly);
break;
case FLY_MODAL_AXIS_LOCK_Z:
if (fly->zlock != FLY_AXISLOCK_STATE_OFF)
@@ -630,6 +656,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event)
fly->zlock = FLY_AXISLOCK_STATE_ACTIVE;
fly->zlock_momentum = 0.0;
}
+ fly_update_header(C, fly);
break;
case FLY_MODAL_PRECISION_ENABLE:
@@ -1055,7 +1082,7 @@ static int fly_invoke(bContext *C, wmOperator *op, const wmEvent *event)
return OPERATOR_CANCELLED;
}
- flyEvent(fly, event);
+ flyEvent(C, fly, event);
WM_event_add_modal_handler(C, op);
@@ -1081,7 +1108,7 @@ static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
fly->redraw = 0;
- flyEvent(fly, event);
+ flyEvent(C, fly, event);
if (fly->ndof) { /* 3D mouse overrules [2D mouse + timer] */
if (event->type == NDOF_MOTION) {
@@ -1108,6 +1135,9 @@ static int fly_modal(bContext *C, wmOperator *op, const wmEvent *event)
ED_region_tag_redraw(CTX_wm_region(C));
}
+ if (ELEM(exit_code, OPERATOR_FINISHED, OPERATOR_CANCELLED))
+ ED_area_headerprint(CTX_wm_area(C), NULL);
+
return exit_code;
}