Fix #97049: Auto-keyframe Status Message Overlaps Navigation Gizmo
"Auto Keying On" display now respects users MINI_AXIS preferences (default, minimal, none), as well as the navigation (en)disable option. No more text overlapping. Co-authored-by: Abhinav Chennubhotla Pull Request: https://projects.blender.org/blender/blender/pulls/111356
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user