Blender V5.0
interface_layout.cc File Reference
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "DNA_screen_types.h"
#include "DNA_userdef_types.h"
#include "BLI_array.hh"
#include "BLI_dynstr.h"
#include "BLI_listbase.h"
#include "BLI_math_base.h"
#include "BLI_path_utils.hh"
#include "BLI_rect.h"
#include "BLI_string_ref.hh"
#include "BLI_string_utf8.h"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_idprop.hh"
#include "BKE_lib_id.hh"
#include "BKE_path_templates.hh"
#include "BKE_screen.hh"
#include "RNA_access.hh"
#include "RNA_prototypes.hh"
#include "UI_interface_layout.hh"
#include "ED_id_management.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "fmt/format.h"
#include "interface_intern.hh"

Go to the source code of this file.

Classes

struct  uiLayoutRoot
struct  blender::ui::ItemInternal
struct  blender::ui::LayoutInternal
struct  uiButtonItem
struct  LayoutRow
struct  LayoutColumn
struct  LayoutRootPieMenu
struct  LayoutOverlap
struct  LayoutRadial
struct  LayoutAbsolute
struct  uiLayoutItemFlow
struct  uiLayoutItemGridFlow
struct  uiLayoutItemBx
struct  uiLayoutItemPanelHeader
struct  uiLayoutItemPanelBody
struct  uiLayoutItemSplit
struct  uiTextIconPadFactor
struct  MenuItemLevel
struct  UILayoutGridFlowInput
struct  UILayoutGridFlowOutput
struct  ItemInternal
struct  LayoutInternal

Namespaces

namespace  blender
namespace  blender::ui

Macros

#define UI_PROP_DECORATE
#define UI_PROP_SEP_ICON_WIDTH_EXCEPTION
#define CASE_ITEM(type, name)

Enumerations

enum class  blender::ui::ItemType : int8_t {
  blender::ui::Button , blender::ui::LayoutRow , blender::ui::LayoutPanelHeader , blender::ui::LayoutPanelBody ,
  blender::ui::LayoutColumn , blender::ui::LayoutColumnFlow , blender::ui::LayoutRowFlow , blender::ui::LayoutGridFlow ,
  blender::ui::LayoutBox , blender::ui::LayoutAbsolute , blender::ui::LayoutSplit , blender::ui::LayoutOverlap ,
  blender::ui::LayoutRadial , blender::ui::LayoutRoot
}
enum class  blender::ui::ItemInternalFlag : uint8_t {
  blender::ui::AutoFixedSize = 1 << 0 , blender::ui::FixedSize = 1 << 1 , blender::ui::BoxItem = 1 << 2 , blender::ui::PropSep = 1 << 3 ,
  blender::ui::InsidePropSep = 1 << 4 , blender::ui::PropDecorate = 1 << 5 , blender::ui::PropDecorateNoPad = 1 << 6
}

Functions

uiLayoutblender::ui::block_layout (uiBlock *block, LayoutDirection direction, LayoutType type, int x, int y, int size, int em, int padding, const uiStyle *style)
void blender::ui::block_layout_set_current (uiBlock *block, uiLayout *layout)
void blender::ui::block_layout_free (uiBlock *block)
int2 blender::ui::block_layout_resolve (uiBlock *block)
bool blender::ui::block_layout_needs_resolving (const uiBlock *block)
Special RNA Items
static uiLayoutui_item_local_sublayout (uiLayout *test, uiLayout *layout, bool align)
static void ui_layer_but_cb (bContext *C, void *arg_but, void *arg_index)
static void ui_item_array (uiLayout *layout, uiBlock *block, const StringRef name, int icon, PointerRNA *ptr, PropertyRNA *prop, const int len, int x, const int y, int w, const int, const bool expand, const bool slider, const int toggle, const bool icon_only, const bool compact, const bool show_text)
static void ui_item_enum_expand_handle (bContext *C, void *arg1, void *arg2)
static void ui_item_enum_expand_elem_exec (uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, const std::optional< StringRef > uiname, const int h, const ButType but_type, const bool icon_only, const EnumPropertyItem *item, const bool is_first)
static void ui_item_enum_expand_exec (uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, const std::optional< StringRef > uiname, const int h, const ButType but_type, const bool icon_only)
static void ui_item_enum_expand (uiLayout *layout, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, const std::optional< StringRef > uiname, const int h, const bool icon_only)
static void ui_item_enum_expand_tabs (uiLayout *layout, bContext *C, uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_highlight, PropertyRNA *prop_highlight, const std::optional< StringRef > uiname, const int h, const bool icon_only)
static void ui_keymap_but_cb (bContext *, void *but_v, void *)
static uiButui_item_with_label (uiLayout *layout, uiBlock *block, const StringRef name, const int icon, PointerRNA *ptr, PropertyRNA *prop, const int index, const int x, const int y, const int w_hint, const int h, const int flag)
void UI_context_active_but_prop_get_filebrowser (const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, bool *r_is_undo, bool *r_is_userdef)
Button Items
static void ui_but_tip_from_enum_item (uiBut *but, const EnumPropertyItem *item)
static void ui_item_disabled (uiLayout *layout, const char *name)
static uiButuiItemFullO_ptr_ex (uiLayout *layout, wmOperatorType *ot, std::optional< StringRef > name, int icon, const blender::wm::OpCallContext context, const eUI_Item_Flag flag, PointerRNA *r_opptr)
static void ui_item_menu_hold (bContext *C, ARegion *butregion, uiBut *but)
BLI_INLINE bool ui_layout_is_radial (const uiLayout *layout)
static void ui_item_rna_size (uiLayout *layout, StringRef name, int icon, PointerRNA *ptr, PropertyRNA *prop, int index, bool icon_only, bool compact, int *r_w, int *r_h)
static bool ui_item_rna_is_expand (PropertyRNA *prop, int index, const eUI_Item_Flag item_flag)
static uiLayoutui_layout_heading_find (uiLayout *cur_layout)
static void ui_layout_heading_label_add (uiLayout *layout, uiLayout *heading_layout, bool right_align, bool respect_prop_split)
static void search_id_collection (StructRNA *ptype, PointerRNA *r_ptr, PropertyRNA **r_prop)
static void ui_rna_collection_search_arg_free_fn (void *ptr)
uiButui_but_add_search (uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop, PropertyRNA *item_searchprop, const bool results_are_suggestions)
void ui_item_menutype_func (bContext *C, uiLayout *layout, void *arg_mt)
void ui_item_paneltype_func (bContext *C, uiLayout *layout, void *arg_pt)
static uiButui_item_menu (uiLayout *layout, const StringRef name, int icon, uiMenuCreateFunc func, void *arg, void *argN, const std::optional< StringRef > tip, bool force_menu, uiButArgNFree func_argN_free_fn=MEM_freeN, uiButArgNCopy func_argN_copy_fn=MEM_dupallocN)
static uiButuiItem_simple (uiLayout *layout, const StringRef name, int icon, std::optional< blender::StringRef > tooltip=std::nullopt, const ButType but_type=ButType::Label)
uiButuiItemL_ex (uiLayout *layout, const StringRef name, int icon, const bool highlight, const bool redalert)
uiPropertySplitWrapper uiItemPropertySplitWrapperCreate (uiLayout *parent_layout)
uiLayoutuiItemL_respect_property_split (uiLayout *layout, StringRef text, int icon)
void uiItemLDrag (uiLayout *layout, PointerRNA *ptr, StringRef name, int icon)
static int menu_item_enum_opname_menu_active (bContext *C, uiBut *but, MenuItemLevel *lvl)
static void menu_item_enum_opname_menu (bContext *C, uiLayout *layout, void *arg)
static void menu_item_enum_rna_menu (bContext *, uiLayout *layout, void *arg)
Layout Items
static int ui_litem_min_width (int itemw)
static int spaces_after_column_item (const uiLayout *litem, const uiItem *item, const uiItem *next_item, const bool is_box)
static RadialDirection ui_get_radialbut_vec (float vec[2], short itemnum)
static bool ui_item_is_radial_displayable (uiItem *item)
static bool ui_item_is_radial_drawable (uiButtonItem *bitem)
static void ui_litem_grid_flow_compute (blender::Span< uiItem * > items, const UILayoutGridFlowInput *parameters, UILayoutGridFlowOutput *results)
bool uiLayoutEndsWithPanelHeader (const uiLayout &layout)
static uiLayoutItemBxui_layout_box (uiLayout *layout, ButType type)
void ui_layout_list_set_labels_active (uiLayout *layout)
int uiLayoutListItemPaddingWidth ()
void uiLayoutListItemAddPadding (uiLayout *layout)
Block Layout Search Filtering
static bool block_search_panel_label_matches (const uiBlock *block, const char *search_string)
static bool button_matches_search_filter (uiBut *but, const char *search_filter)
static bool button_group_has_search_match (const uiButtonGroup &group, const char *search_filter)
static bool block_search_filter_tag_buttons (uiBlock *block, const char *search_filter)
bool UI_block_apply_search_filter (uiBlock *block, const char *search_filter)
Layout
static void ui_item_scale (uiLayout *litem, const float scale[2])
static void ui_item_align (uiLayout *litem, short nr)
static void ui_item_flag (uiLayout *litem, int flag)
static blender::int2 ui_layout_end (uiBlock *block, uiLayout *layout)
static void ui_layout_free (uiLayout *layout)
static void ui_layout_add_padding_button (uiLayoutRoot *root)
void ui_layout_add_but (uiLayout *layout, uiBut *but)
void ui_layout_remove_but (uiLayout *layout, const uiBut *but)
bool ui_layout_replace_but_ptr (uiLayout *layout, const void *old_but_ptr, uiBut *new_but)
void uiLayoutSetFunc (uiLayout *layout, uiMenuHandleFunc handlefunc, void *argv)
void uiLayoutSetTooltipFunc (uiLayout *layout, uiButToolTipFunc func, void *arg, uiCopyArgFunc copy_arg, uiFreeArgFunc free_arg)
void uiLayoutSetTooltipCustomFunc (uiLayout *layout, uiButToolTipCustomFunc func, void *arg, uiCopyArgFunc copy_arg, uiFreeArgFunc free_arg)
wmOperatorTypeUI_but_operatortype_get_from_enum_menu (uiBut *but, PropertyRNA **r_prop)
MenuTypeUI_but_menutype_get (const uiBut *but)
PanelTypeUI_but_paneltype_get (const uiBut *but)
std::optional< blender::StringRefNullUI_but_asset_shelf_type_idname_get (const uiBut *but)
void UI_menutype_draw (bContext *C, MenuType *mt, uiLayout *layout)
static bool ui_layout_has_panel_label (const uiLayout *layout, const PanelType *pt)
static void ui_paneltype_draw_impl (bContext *C, PanelType *pt, uiLayout *layout, bool show_header)
void UI_paneltype_draw (bContext *C, PanelType *pt, uiLayout *layout)
Layout (Debugging/Introspection)

Serialize the layout as a Python compatible dictionary,

Note
Proper string escaping isn't used, triple quotes are used to prevent single quotes from interfering with Python syntax. If we want this to be fool-proof, we would need full Python compatible string escape support. As we don't use triple quotes in the UI it's good-enough in practice.
static void ui_layout_introspect_button (DynStr *ds, const uiButtonItem *bitem)
static void ui_layout_introspect_items (DynStr *ds, blender::Span< const uiItem * > items)
const char * UI_layout_introspect (uiLayout *layout)
Alert Box with Big Icon
uiLayoutuiItemsAlertBox (uiBlock *block, const uiStyle *style, const int dialog_width, const eAlertIcon icon, const int icon_size)
uiLayoutuiItemsAlertBox (uiBlock *block, const int size, const eAlertIcon icon)

Structs and Defines

#define UI_OPERATOR_ERROR_RET(_ot, _opname)
#define UI_ITEM_PROP_SEP_DIVIDE   0.4f
using uiItemType = blender::ui::ItemType
using uiItemInternalFlag = blender::ui::ItemInternalFlag

Item

#define UI_ITEM_VARY_X   1
#define UI_ITEM_VARY_Y   2
constexpr uiTextIconPadFactor ui_text_pad_default = {1.50f, 0.25f, 0.0f}
constexpr uiTextIconPadFactor ui_text_pad_compact = {1.25f, 0.35f, 0.0f}
constexpr uiTextIconPadFactor ui_text_pad_none = {0.25f, 1.50f, 0.0f}
static StringRef ui_item_name_add_colon (StringRef name, char namestr[UI_MAX_NAME_STR])
static StringRefNull ui_item_name_add_colon (StringRefNull name, char namestr[UI_MAX_NAME_STR])
static int ui_item_fit (const int item, const int pos, const int all, const int available, const bool is_last, const blender::ui::LayoutAlign alignment, float *extra_pixel)
static int ui_layout_vary_direction (uiLayout *layout)
static bool ui_layout_variable_size (uiLayout *layout)
static int ui_text_icon_width_ex (uiLayout *layout, const StringRef name, int icon, const uiTextIconPadFactor &pad_factor, const uiFontStyle *fstyle)
static int ui_text_icon_width (uiLayout *layout, const StringRef name, const int icon, const bool compact)
static void ui_item_size (const uiItem *item, int *r_w, int *r_h)
static void ui_item_offset (const uiItem *item, int *r_x, int *r_y)
static void ui_item_position (uiItem *item, const int x, const int y, const int w, const int h)
static void ui_item_move (uiItem *item, const int delta_xmin, const int delta_xmax)

Macro Definition Documentation

◆ CASE_ITEM

#define CASE_ITEM ( type,
name )
Value:
case type: { \
BLI_dynstr_append(ds, "'type': '"); \
BLI_dynstr_append(ds, name); \
BLI_dynstr_append(ds, "', "); \
break; \
} \
((void)0)
const char * name

Referenced by ui_layout_introspect_items().

◆ UI_ITEM_PROP_SEP_DIVIDE

#define UI_ITEM_PROP_SEP_DIVIDE   0.4f

Definition at line 74 of file interface_layout.cc.

Referenced by uiLayout::prop(), and uiItemPropertySplitWrapperCreate().

◆ UI_ITEM_VARY_X

#define UI_ITEM_VARY_X   1

Definition at line 379 of file interface_layout.cc.

Referenced by ui_layout_variable_size(), and ui_layout_vary_direction().

◆ UI_ITEM_VARY_Y

#define UI_ITEM_VARY_Y   2

Definition at line 380 of file interface_layout.cc.

Referenced by ui_layout_vary_direction().

◆ UI_OPERATOR_ERROR_RET

#define UI_OPERATOR_ERROR_RET ( _ot,
_opname )
Value:
if (ot == nullptr) { \
ui_item_disabled(this, _opname); \
RNA_warning("'%s' unknown operator", _opname); \
return PointerRNA_NULL; \
} \
(void)0
const PointerRNA PointerRNA_NULL
wmOperatorType * ot
Definition wm_files.cc:4237

Definition at line 66 of file interface_layout.cc.

Referenced by uiLayout::op(), and uiLayout::op_menu_enum().

◆ UI_PROP_DECORATE

#define UI_PROP_DECORATE

Definition at line 57 of file interface_layout.cc.

Referenced by ui_item_with_label().

◆ UI_PROP_SEP_ICON_WIDTH_EXCEPTION

#define UI_PROP_SEP_ICON_WIDTH_EXCEPTION

Definition at line 60 of file interface_layout.cc.

Typedef Documentation

◆ uiItemInternalFlag

◆ uiItemType

Definition at line 196 of file interface_layout.cc.

Function Documentation

◆ block_search_filter_tag_buttons()

bool block_search_filter_tag_buttons ( uiBlock * block,
const char * search_filter )
static

Apply the search filter, tagging all buttons with whether they match or not. Tag every button in the group as a result if any button in the group matches.

Note
It would be great to return early here if we found a match, but because the results may be visible we have to continue searching the entire block.
Returns
True if the block has any search results.

Definition at line 5225 of file interface_layout.cc.

References button_group_has_search_match(), uiBlock::button_groups, uiButtonGroup::buttons, uiBut::flag, and UI_SEARCH_FILTER_NO_MATCH.

Referenced by UI_block_apply_search_filter().

◆ block_search_panel_label_matches()

bool block_search_panel_label_matches ( const uiBlock * block,
const char * search_string )
static

◆ button_group_has_search_match()

bool button_group_has_search_match ( const uiButtonGroup & group,
const char * search_filter )
static

Test for a search result within a specific button group.

Definition at line 5205 of file interface_layout.cc.

References button_matches_search_filter(), and uiButtonGroup::buttons.

Referenced by block_search_filter_tag_buttons().

◆ button_matches_search_filter()

bool button_matches_search_filter ( uiBut * but,
const char * search_filter )
static

Returns true if a button or the data / operator it represents matches the search filter.

Definition at line 5142 of file interface_layout.cc.

References BLI_strcasestr(), free(), i, MEM_freeN(), Menu, name, wmOperatorType::name, uiBut::optype, ptr, RNA_property_description(), RNA_property_enum_items_gettexted(), RNA_property_ui_name(), uiBut::rnapoin, uiBut::rnaprop, uiBut::str, and uiBut::type.

Referenced by button_group_has_search_match().

◆ menu_item_enum_opname_menu()

◆ menu_item_enum_opname_menu_active()

◆ menu_item_enum_rna_menu()

void menu_item_enum_rna_menu ( bContext * ,
uiLayout * layout,
void * arg )
static

◆ search_id_collection()

void search_id_collection ( StructRNA * ptype,
PointerRNA * r_ptr,
PropertyRNA ** r_prop )
static

◆ spaces_after_column_item()

int spaces_after_column_item ( const uiLayout * litem,
const uiItem * item,
const uiItem * next_item,
const bool is_box )
static

◆ UI_block_apply_search_filter()

bool UI_block_apply_search_filter ( uiBlock * block,
const char * search_filter )

Apply property search behavior, setting panel flags and deactivating buttons that don't match.

Note
Must not be run after #UI_block_layout_resolve.

Definition at line 5241 of file interface_layout.cc.

References block_search_filter_tag_buttons(), block_search_panel_label_matches(), PanelType::flag, uiBlock::panel, PANEL_TYPE_NO_SEARCH, Panel::type, and ui_panel_tag_search_filter_match().

Referenced by ed_panel_draw(), and panel_property_search().

◆ ui_but_add_search()

◆ UI_but_asset_shelf_type_idname_get()

std::optional< blender::StringRefNull > UI_but_asset_shelf_type_idname_get ( const uiBut * but)

This is a bit of a hack but best keep it in one place at least.

Definition at line 5860 of file interface_layout.cc.

References UI_asset_shelf_idname_from_button_context().

Referenced by shortcut_get_operator_property().

◆ UI_but_menutype_get()

◆ UI_but_operatortype_get_from_enum_menu()

◆ UI_but_paneltype_get()

◆ ui_but_tip_from_enum_item()

void ui_but_tip_from_enum_item ( uiBut * but,
const EnumPropertyItem * item )
static

Update a buttons tip with an enum's description if possible.

Definition at line 1325 of file interface_layout.cc.

References EnumPropertyItem::description, wmOperatorType::get_description, uiBut::optype, and uiBut::tip.

Referenced by uiLayout::op_enum_items(), and uiLayout::props_enum().

◆ UI_context_active_but_prop_get_filebrowser()

void UI_context_active_but_prop_get_filebrowser ( const bContext * C,
PointerRNA * r_ptr,
PropertyRNA ** r_prop,
bool * r_is_undo,
bool * r_is_userdef )

◆ ui_get_radialbut_vec()

RadialDirection ui_get_radialbut_vec ( float vec[2],
short itemnum )
static

Definition at line 3880 of file interface_layout.cc.

References PIE_MAX_ITEMS, printf, ui_but_pie_dir(), and ui_radial_dir_order.

Referenced by LayoutRadial::resolve_impl().

◆ ui_item_align()

void ui_item_align ( uiLayout * litem,
short nr )
static

◆ ui_item_array()

◆ ui_item_disabled()

◆ ui_item_enum_expand()

void ui_item_enum_expand ( uiLayout * layout,
uiBlock * block,
PointerRNA * ptr,
PropertyRNA * prop,
const std::optional< StringRef > uiname,
const int h,
const bool icon_only )
static

Definition at line 1023 of file interface_layout.cc.

References ptr, Row, and ui_item_enum_expand_exec().

Referenced by uiLayout::prop().

◆ ui_item_enum_expand_elem_exec()

◆ ui_item_enum_expand_exec()

◆ ui_item_enum_expand_handle()

void ui_item_enum_expand_handle ( bContext * C,
void * arg1,
void * arg2 )
static

◆ ui_item_enum_expand_tabs()

◆ ui_item_fit()

int ui_item_fit ( const int item,
const int pos,
const int all,
const int available,
const bool is_last,
const blender::ui::LayoutAlign alignment,
float * extra_pixel )
static

Definition at line 341 of file interface_layout.cc.

References all(), ELEM, blender::ui::Expand, and pos.

Referenced by LayoutRow::resolve_impl().

◆ ui_item_flag()

void ui_item_flag ( uiLayout * litem,
int flag )
static

◆ ui_item_is_radial_displayable()

bool ui_item_is_radial_displayable ( uiItem * item)
static

Definition at line 3894 of file interface_layout.cc.

References Label, and uiItem::type().

Referenced by LayoutRadial::resolve_impl().

◆ ui_item_is_radial_drawable()

bool ui_item_is_radial_drawable ( uiButtonItem * bitem)
static

Definition at line 3906 of file interface_layout.cc.

References uiButtonItem::but, ELEM, Sepr, SeprLine, SeprSpacer, and uiBut::type.

Referenced by LayoutRadial::resolve_impl().

◆ ui_item_local_sublayout()

uiLayout * ui_item_local_sublayout ( uiLayout * test,
uiLayout * layout,
bool align )
static

◆ ui_item_menu()

◆ ui_item_menu_hold()

◆ ui_item_menutype_func()

void ui_item_menutype_func ( bContext * C,
uiLayout * layout,
void * arg_mt )

◆ ui_item_move()

void ui_item_move ( uiItem * item,
const int delta_xmin,
const int delta_xmax )
static

◆ ui_item_name_add_colon() [1/2]

StringRef ui_item_name_add_colon ( StringRef name,
char namestr[UI_MAX_NAME_STR] )
static

◆ ui_item_name_add_colon() [2/2]

StringRefNull ui_item_name_add_colon ( StringRefNull name,
char namestr[UI_MAX_NAME_STR] )
static

Definition at line 327 of file interface_layout.cc.

References len, name, and UI_MAX_NAME_STR.

◆ ui_item_offset()

void ui_item_offset ( const uiItem * item,
int * r_x,
int * r_y )
static

◆ ui_item_paneltype_func()

void ui_item_paneltype_func ( bContext * C,
uiLayout * layout,
void * arg_pt )

◆ ui_item_position()

◆ ui_item_rna_is_expand()

bool ui_item_rna_is_expand ( PropertyRNA * prop,
int index,
const eUI_Item_Flag item_flag )
static

◆ ui_item_rna_size()

◆ ui_item_scale()

void ui_item_scale ( uiLayout * litem,
const float scale[2] )
static

◆ ui_item_size()

◆ ui_item_with_label()

uiBut * ui_item_with_label ( uiLayout * layout,
uiBlock * block,
const StringRef name,
const int icon,
PointerRNA * ptr,
PropertyRNA * prop,
const int index,
const int x,
const int y,
const int w_hint,
const int h,
const int flag )
static

◆ ui_keymap_but_cb()

void ui_keymap_but_cb ( bContext * ,
void * but_v,
void *  )
static

◆ ui_layer_but_cb()

◆ ui_layout_add_but()

void ui_layout_add_but ( uiLayout * layout,
uiBut * but )

Definition at line 5568 of file interface_layout.cc.

References blender::ui::LayoutInternal::layout_add_but().

Referenced by ui_def_but().

◆ ui_layout_add_padding_button()

void ui_layout_add_padding_button ( uiLayoutRoot * root)
static

◆ ui_layout_box()

◆ ui_layout_end()

◆ ui_layout_free()

void ui_layout_free ( uiLayout * layout)
static

◆ ui_layout_has_panel_label()

◆ ui_layout_heading_find()

uiLayout * ui_layout_heading_find ( uiLayout * cur_layout)
static

Find first layout ancestor (or self) with a heading set.

Returns
the layout to add the heading to as a fallback (i.e. if it can't be placed in a split layout). Its uiLayout.heading member can be cleared to mark the heading as added (so it's not added multiple times). Returns a pointer to the heading

Definition at line 1874 of file interface_layout.cc.

References uiLayout::parent().

Referenced by uiLayout::prop(), and ui_item_menu().

◆ ui_layout_heading_label_add()

void ui_layout_heading_label_add ( uiLayout * layout,
uiLayout * heading_layout,
bool right_align,
bool respect_prop_split )
static

◆ UI_layout_introspect()

const char * UI_layout_introspect ( uiLayout * layout)

Evaluate layout items as a Python dictionary.

Definition at line 6102 of file interface_layout.cc.

References BLI_dynstr_free(), BLI_dynstr_get_cstring(), BLI_dynstr_new(), result, and ui_layout_introspect_items().

Referenced by bpy_rna_uilayout_introspect().

◆ ui_layout_introspect_button()

◆ ui_layout_introspect_items()

void ui_layout_introspect_items ( DynStr * ds,
blender::Span< const uiItem * > items )
static

◆ ui_layout_is_radial()

BLI_INLINE bool ui_layout_is_radial ( const uiLayout * layout)

◆ ui_layout_list_set_labels_active()

void ui_layout_list_set_labels_active ( uiLayout * layout)

Check all buttons defined in this layout, and set any button flagged as UI_BUT_LIST_ITEM as active/selected. Needed to handle correctly text colors of active (selected) list item.

Definition at line 4990 of file interface_layout.cc.

References uiButtonItem::but, uiBut::flag, uiLayout::items(), UI_but_flag_enable(), UI_BUT_LIST_ITEM, ui_layout_list_set_labels_active(), and UI_SELECT.

Referenced by blender::ui::TreeViewLayoutBuilder::build_row(), ui_layout_list_set_labels_active(), and ui_template_list_layout_draw().

◆ ui_layout_remove_but()

void ui_layout_remove_but ( uiLayout * layout,
const uiBut * but )

◆ ui_layout_replace_but_ptr()

bool ui_layout_replace_but_ptr ( uiLayout * layout,
const void * old_but_ptr,
uiBut * new_but )
Returns
true if the button was successfully replaced.

Definition at line 5621 of file interface_layout.cc.

References uiButtonItem::but, and blender::ui::LayoutInternal::ui_layout_find_button_item().

Referenced by ui_but_change_type().

◆ ui_layout_variable_size()

bool ui_layout_variable_size ( uiLayout * layout)
static

◆ ui_layout_vary_direction()

◆ ui_litem_grid_flow_compute()

◆ ui_litem_min_width()

int ui_litem_min_width ( int itemw)
static

Definition at line 3620 of file interface_layout.cc.

References UI_UNIT_X.

Referenced by LayoutRow::resolve_impl().

◆ UI_menutype_draw()

◆ UI_paneltype_draw()

void UI_paneltype_draw ( bContext * C,
PanelType * pt,
uiLayout * layout )

Used for popup panels only.

Definition at line 5981 of file interface_layout.cc.

References C, uiLayout::context(), CTX_store_set(), and ui_paneltype_draw_impl().

Referenced by ui_item_paneltype_func(), and UI_popover_panel_invoke().

◆ ui_paneltype_draw_impl()

◆ ui_rna_collection_search_arg_free_fn()

void ui_rna_collection_search_arg_free_fn ( void * ptr)
static

◆ ui_text_icon_width()

int ui_text_icon_width ( uiLayout * layout,
const StringRef name,
const int icon,
const bool compact )
static

◆ ui_text_icon_width_ex()

◆ uiItem_simple()

◆ uiItemFullO_ptr_ex()

◆ uiItemL_ex()

◆ uiItemL_respect_property_split()

uiLayout * uiItemL_respect_property_split ( uiLayout * layout,
blender::StringRef text,
int icon )

Helper to add a label using a property split layout if needed. After calling this the active layout will be the one to place the labeled items in. An additional layout may be returned to place decorator buttons in.

Returns
the layout to place decorators in, if #UI_ITEM_PROP_SEP is enabled. Otherwise null.

Definition at line 3211 of file interface_layout.cc.

References uiLayout::block(), blender::ui::block_layout_set_current(), uiPropertySplitWrapper::decorate_column, uiPropertySplitWrapper::label_column, uiPropertySplitWrapper::property_row, ui_item_name_add_colon(), UI_MAX_NAME_STR, uiItem_simple(), uiItemPropertySplitWrapperCreate(), and uiLayout::use_property_split().

Referenced by draw_matrix_template(), graph_panel_key_properties(), template_ID(), template_search_buttons(), ui_item_with_label(), and ui_layout_heading_label_add().

◆ uiItemLDrag()

void uiItemLDrag ( uiLayout * layout,
PointerRNA * ptr,
blender::StringRef name,
int icon )

Label icon for dragging.

Definition at line 3231 of file interface_layout.cc.

References name, ptr, RNA_struct_is_ID(), UI_but_drag_set_id(), and uiItem_simple().

Referenced by buttons_panel_context_draw().

◆ uiItemPropertySplitWrapperCreate()

uiPropertySplitWrapper uiItemPropertySplitWrapperCreate ( uiLayout * parent_layout)

Normally, we handle the split layout in uiLayout::prop(), but there are other cases where the logic is needed. Ideally, uiLayout::prop() could just call this, but it currently has too many special needs.

The returned #uiPropertySplitWrapper.decorator_column may be null when decorators are disabled (#uiLayoutGetPropDecorate() returns false).

Definition at line 3193 of file interface_layout.cc.

References uiLayout::alignment_set(), uiLayout::column(), uiPropertySplitWrapper::decorate_column, uiPropertySplitWrapper::label_column, uiPropertySplitWrapper::property_row, blender::ui::Right, uiLayout::row(), uiLayout::split(), UI_ITEM_PROP_SEP_DIVIDE, blender::ui::LayoutInternal::ui_item_prop_split_layout_hack(), and uiLayout::use_property_decorate().

Referenced by blender::ed::space_node::ui_node_draw_input(), and uiItemL_respect_property_split().

◆ uiItemsAlertBox() [1/2]

uiLayout * uiItemsAlertBox ( uiBlock * block,
const int size,
const eAlertIcon icon )

◆ uiItemsAlertBox() [2/2]

uiLayout * uiItemsAlertBox ( uiBlock * block,
const uiStyle * style,
const int dialog_width,
const eAlertIcon icon,
const int icon_size )

◆ uiLayoutEndsWithPanelHeader()

bool uiLayoutEndsWithPanelHeader ( const uiLayout & layout)

Definition at line 4882 of file interface_layout.cc.

References uiLayout::items(), and uiItem::type().

Referenced by ed_panel_draw().

◆ uiLayoutListItemAddPadding()

◆ uiLayoutListItemPaddingWidth()

int uiLayoutListItemPaddingWidth ( )

Definition at line 5102 of file interface_layout.cc.

References UI_SCALE_FAC.

Referenced by uiLayoutListItemAddPadding().

◆ uiLayoutSetFunc()

void uiLayoutSetFunc ( uiLayout * layout,
uiMenuHandleFunc handlefunc,
void * argv )

◆ uiLayoutSetTooltipCustomFunc()

void uiLayoutSetTooltipCustomFunc ( uiLayout * layout,
uiButToolTipCustomFunc func,
void * arg,
uiCopyArgFunc copy_arg,
uiFreeArgFunc free_arg )

Same as above but should be used when building a fully custom tooltip instead of just generating a description.

Definition at line 5779 of file interface_layout.cc.

References uiButtonItem::but, Decorator, uiLayout::items(), uiBut::type, UI_but_func_tooltip_custom_set(), and uiLayoutSetTooltipCustomFunc().

Referenced by blender::ed::space_node::node_socket_add_tooltip(), blender::ed::space_node::node_socket_add_tooltip_in_node_editor(), and uiLayoutSetTooltipCustomFunc().

◆ uiLayoutSetTooltipFunc()

void uiLayoutSetTooltipFunc ( uiLayout * layout,
uiButToolTipFunc func,
void * arg,
uiCopyArgFunc copy_arg,
uiFreeArgFunc free_arg )

Set tooltip function for all buttons in the layout. func, arg and free_arg are passed on to UI_but_func_tooltip_set, so their meaning is the same.

Parameters
funcThe callback function that gets called to get tooltip content
argAn optional opaque pointer that gets passed to func
free_argAn optional callback for freeing arg (can be set to e.g. MEM_freeN)
copy_argAn optional callback for duplicating arg in case UI_but_func_tooltip_set is being called on multiple buttons (can be set to e.g. MEM_dupallocN). If set to NULL, arg will be passed as-is to all buttons.

Definition at line 5744 of file interface_layout.cc.

References uiButtonItem::but, Decorator, uiLayout::items(), uiBut::type, UI_but_func_tooltip_set(), and uiLayoutSetTooltipFunc().

Referenced by blender::nodes::draw_interface_panel_as_panel(), and uiLayoutSetTooltipFunc().

Variable Documentation

◆ ui_text_pad_compact

uiTextIconPadFactor ui_text_pad_compact = {1.25f, 0.35f, 0.0f}
constexpr

ui_text_pad_default scaled down.

Definition at line 421 of file interface_layout.cc.

Referenced by ui_item_menu(), and ui_text_icon_width().

◆ ui_text_pad_default

uiTextIconPadFactor ui_text_pad_default = {1.50f, 0.25f, 0.0f}
constexpr

This adds over an icons width of padding even when no icon is used, this is done because most buttons need additional space (drop-down chevron for example). menus and labels use much smaller text values compared to this default.

Note
It may seem odd that the icon only adds 0.25, but taking margins into account it's fine, except for ui_text_pad_compact where a bit more margin is required.

Definition at line 418 of file interface_layout.cc.

Referenced by ui_text_icon_width().

◆ ui_text_pad_none

uiTextIconPadFactor ui_text_pad_none = {0.25f, 1.50f, 0.0f}
constexpr

Least amount of padding not to clip the text or icon.

Definition at line 424 of file interface_layout.cc.

Referenced by ui_item_with_label(), and uiItem_simple().