diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d.py | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 28 |
2 files changed, 28 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index b3ca6f1c3fe..3a5efc30f50 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -6153,7 +6153,7 @@ class VIEW3D_PT_overlay_motion_tracking(Panel): def draw_header(self, context): view = context.space_data - self.layout.prop(view, "show_reconstruction", text="") + self.layout.prop(view, "show_reconstruction", text=self.bl_label) def draw(self, context): layout = self.layout diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index f027a62cbfd..b707aaa0ee9 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -5540,6 +5540,26 @@ void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout) } } +static bool ui_layout_has_panel_label(const uiLayout *layout, const PanelType *pt) +{ + LISTBASE_FOREACH (uiItem *, subitem, &layout->items) { + if (subitem->type == ITEM_BUTTON) { + uiButtonItem *bitem = (uiButtonItem *)subitem; + if (!(bitem->but->flag & UI_HIDDEN) && STREQ(bitem->but->str, pt->label)) { + return true; + } + } + else { + uiLayout *litem = (uiLayout *)subitem; + if (ui_layout_has_panel_label(litem, pt)) { + return true; + } + } + } + + return false; +} + static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout, bool show_header) { Panel *panel = MEM_callocN(sizeof(Panel), "popover panel"); @@ -5556,7 +5576,13 @@ static void ui_paneltype_draw_impl(bContext *C, PanelType *pt, uiLayout *layout, pt->draw_header(C, panel); panel->layout = NULL; } - uiItemL(row, CTX_IFACE_(pt->translation_context, pt->label), ICON_NONE); + + /* draw_header() is often used to add a checkbox to the header. If we add the label like below + * the label is disconnected from the checkbox, adding a weird looking gap. As workaround, let + * the checkbox add the label instead. */ + if (!ui_layout_has_panel_label(row, pt)) { + uiItemL(row, CTX_IFACE_(pt->translation_context, pt->label), ICON_NONE); + } } panel->layout = layout; |