diff --git a/source/blender/editors/transform/transform.cc b/source/blender/editors/transform/transform.cc index 7d28e9aa516..24bf9e7a107 100644 --- a/source/blender/editors/transform/transform.cc +++ b/source/blender/editors/transform/transform.cc @@ -1496,19 +1496,44 @@ static void drawTransformView(const bContext *C, ARegion *region, void *arg) /* just draw a little warning message in the top-right corner of the viewport * to warn that autokeying is enabled */ -static void drawAutoKeyWarning(TransInfo * /*t*/, ARegion *region) +static void drawAutoKeyWarning(TransInfo * /*t*/, const bContext *C, ARegion *region) { const char *printable = IFACE_("Auto Keying On"); float printable_size[2]; int xco, yco; + int offset = 0; const rcti *rect = ED_region_visible_rect(region); + View3D *v3d = CTX_wm_view3d(C); - const int font_id = BLF_default(); + const int font_id = BLF_set_default(); BLF_width_and_height( font_id, printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]); - xco = (rect->xmax - U.widget_unit) - int(printable_size[0]); + /* Check to see if the Navigation Gizmo is enabled. */ + if (((U.uiflag & USER_SHOW_GIZMO_NAVIGATE) == 0) || + (v3d->gizmo_flag & (V3D_GIZMO_HIDE | V3D_GIZMO_HIDE_NAVIGATE))) + { + offset = 10; + } + else { + /* Depending on user MINI_AXIS preference, pad accordingly. */ + switch ((eUserpref_MiniAxisType)U.mini_axis_type) { + case USER_MINI_AXIS_TYPE_GIZMO: + offset = U.gizmo_size_navigate_v3d; + break; + case USER_MINI_AXIS_TYPE_MINIMAL: + offset = U.rvisize * MIN2((U.pixelsize / U.scale_factor), 1.0f) * 2.5f; + break; + case USER_MINI_AXIS_TYPE_NONE: + offset = U.rvisize; + break; + } + } + + offset *= U.scale_factor; + + xco = (rect->xmax - U.widget_unit) - (int)printable_size[0] - offset; yco = (rect->ymax - U.widget_unit); /* warning text (to clarify meaning of overlays) @@ -1553,7 +1578,7 @@ static void drawTransformPixel(const bContext *C, ARegion *region, void *arg) if (region == t->region) { if (t->options & (CTX_OBJECT | CTX_POSE_BONE)) { if (ob && autokeyframe_cfra_can_key(scene, &ob->id)) { - drawAutoKeyWarning(t, region); + drawAutoKeyWarning(t, C, region); } } }