diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 15:15:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-09-13 15:15:44 +0300 |
commit | 00bdd0457023aa1ebc7fcf7891171d6ff373b6ac (patch) | |
tree | 42aa398e55b2ee84093503e3cfa545041a439028 /source/blender/editors/gizmo_library | |
parent | 5a90ebc278898cb5c5c2ccee224da52ddc33eee0 (diff) |
Gizmo: set header text when editing the value
Diffstat (limited to 'source/blender/editors/gizmo_library')
-rw-r--r-- | source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c index 1212d0e0839..fd695eec2ba 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/value2d_gizmo.c @@ -40,7 +40,9 @@ #include "MEM_guardedalloc.h" #include "BKE_context.h" +#include "BLI_string.h" +#include "ED_screen.h" #include "ED_gizmo_library.h" #include "WM_types.h" @@ -85,12 +87,21 @@ static int gizmo_value_modal( if (tweak_flag & WM_GIZMO_TWEAK_PRECISE) { value_delta *= 0.1f; } + const float value_final = inter->init_prop_value + value_delta; /* set the property for the operator and call its modal function */ wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset"); if (WM_gizmo_target_property_is_valid(gz_prop)) { - WM_gizmo_target_property_float_set(C, gz, gz_prop, inter->init_prop_value + value_delta); + WM_gizmo_target_property_float_set(C, gz, gz_prop, value_final); } + + { + ScrArea *sa = CTX_wm_area(C); + char str[64]; + SNPRINTF(str, "%.4f", value_final); + ED_area_status_text(sa, str); + } + return OPERATOR_RUNNING_MODAL; } @@ -119,6 +130,8 @@ static int gizmo_value_invoke( static void gizmo_value_exit(bContext *C, wmGizmo *gz, const bool cancel) { + ScrArea *sa = CTX_wm_area(C); + ED_area_status_text(sa, NULL); if (cancel) { ValueInteraction *inter = gz->interaction_data; wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, "offset"); |