Refactor: UI: Replace UI_block_layout with blender::ui::block_layout

This renames `UI_block_layout` API as `blender::ui::block_layout`,
following uiLayout refactors.
This function now returns a layout reference instead of pointer,
this changes applies this return type where the layout can be used
as such reference.

Changes includes the use of `blender::ui::LayoutDirection` and
`blender::ui::LayoutType` as typed enum parameters.

Part of: #117604

Pull Request: https://projects.blender.org/blender/blender/pulls/141401
This commit is contained in:
Guillermo Venegas
2025-07-03 22:00:46 +02:00
committed by Hans Goudey
parent d303ab59d8
commit b36e5b4b06
18 changed files with 428 additions and 296 deletions

View File

@@ -237,20 +237,20 @@ void ED_time_scrub_channel_search_draw(const bContext *C, ARegion *region, bDope
const float padding_y = UI_SCALE_FAC;
uiBlock *block = UI_block_begin(C, region, __func__, blender::ui::EmbossType::Emboss);
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_HEADER,
rect.xmin + padding_x,
rect.ymin + UI_UNIT_Y + padding_y,
BLI_rcti_size_x(&rect) - 2 * padding_x,
1,
0,
style);
layout->scale_y_set((UI_UNIT_Y - padding_y) / UI_UNIT_Y);
UI_block_layout_set_current(block, layout);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Header,
rect.xmin + padding_x,
rect.ymin + UI_UNIT_Y + padding_y,
BLI_rcti_size_x(&rect) - 2 * padding_x,
1,
0,
style);
layout.scale_y_set((UI_UNIT_Y - padding_y) / UI_UNIT_Y);
UI_block_layout_set_current(block, &layout);
UI_block_align_begin(block);
layout->prop(&ptr, "filter_text", UI_ITEM_NONE, "", ICON_NONE);
layout->prop(&ptr, "use_filter_invert", UI_ITEM_NONE, "", ICON_ARROW_LEFTRIGHT);
layout.prop(&ptr, "filter_text", UI_ITEM_NONE, "", ICON_NONE);
layout.prop(&ptr, "use_filter_invert", UI_ITEM_NONE, "", ICON_ARROW_LEFTRIGHT);
UI_block_align_end(block);
UI_block_layout_resolve(block, nullptr, nullptr);

View File

@@ -519,17 +519,17 @@ void region_layout(const bContext *C, ARegion *region)
const uiStyle *style = UI_style_get_dpi();
const int padding_y = main_region_padding_y();
const int padding_x = main_region_padding_x();
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
padding_x,
-padding_y,
region->winx - 2 * padding_x,
0,
0,
style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
padding_x,
-padding_y,
region->winx - 2 * padding_x,
0,
0,
style);
build_asset_view(*layout, active_shelf->settings.asset_library_reference, *active_shelf, *C);
build_asset_view(layout, active_shelf->settings.asset_library_reference, *active_shelf, *C);
int layout_height;
UI_block_layout_resolve(block, nullptr, &layout_height);

View File

@@ -705,11 +705,18 @@ static uiBlock *wm_block_insert_unicode_create(bContext *C, ARegion *region, voi
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_NO_WIN_CLIP | UI_BLOCK_NUMSELECT);
const uiStyle *style = UI_style_get_dpi();
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 200 * UI_SCALE_FAC, UI_UNIT_Y, 0, style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
200 * UI_SCALE_FAC,
UI_UNIT_Y,
0,
style);
uiItemL_ex(layout, IFACE_("Insert Unicode Character"), ICON_NONE, true, false);
layout->label(RPT_("Enter a Unicode codepoint hex value"), ICON_NONE);
uiItemL_ex(&layout, IFACE_("Insert Unicode Character"), ICON_NONE, true, false);
layout.label(RPT_("Enter a Unicode codepoint hex value"), ICON_NONE);
uiBut *text_but = uiDefBut(block,
UI_BTYPE_TEXT,
@@ -727,7 +734,7 @@ static uiBlock *wm_block_insert_unicode_create(bContext *C, ARegion *region, voi
/* Hitting Enter in the text input is treated the same as clicking the Confirm button. */
UI_but_func_set(text_but, text_insert_unicode_confirm, block, edit_string);
layout->separator();
layout.separator();
/* Buttons. */
@@ -739,7 +746,7 @@ static uiBlock *wm_block_insert_unicode_create(bContext *C, ARegion *region, voi
uiBut *confirm = nullptr;
uiBut *cancel = nullptr;
uiLayout *split = &layout->split(0.0f, true);
uiLayout *split = &layout.split(0.0f, true);
split->column(false);
if (windows_layout) {
@@ -798,7 +805,7 @@ static uiBlock *wm_block_insert_unicode_create(bContext *C, ARegion *region, voi
UI_but_flag_enable(confirm, UI_BUT_ACTIVE_DEFAULT);
int bounds_offset[2];
bounds_offset[0] = layout->width() * -0.2f;
bounds_offset[0] = layout.width() * -0.2f;
bounds_offset[1] = UI_UNIT_Y * 2.5;
UI_block_bounds_set_popup(block, 7 * UI_SCALE_FAC, bounds_offset);

View File

@@ -41,6 +41,7 @@ enum class ItemInternalFlag : uint8_t;
enum class EmbossType : uint8_t;
enum class LayoutAlign : int8_t;
enum class ButProgressType : int8_t;
enum class LayoutDirection : int8_t;
} // namespace blender::ui
struct PanelLayout {
@@ -166,6 +167,8 @@ struct uiLayout : uiItem, blender::NonCopyable, blender::NonMovable {
[[nodiscard]] bool fixed_size() const;
void fixed_size_set(bool fixed_size);
[[nodiscard]] blender::ui::LayoutDirection local_direction() const;
[[nodiscard]] wmOperatorCallContext operator_context() const;
/** Sets the default call context for new operator buttons added in any #root_ sub-layout. */
void operator_context_set(wmOperatorCallContext opcontext);
@@ -706,21 +709,21 @@ inline int uiLayout::width() const
return this->w_;
}
enum {
UI_LAYOUT_HORIZONTAL = 0,
UI_LAYOUT_VERTICAL = 1,
};
enum {
UI_LAYOUT_PANEL = 0,
UI_LAYOUT_HEADER = 1,
UI_LAYOUT_MENU = 2,
UI_LAYOUT_TOOLBAR = 3,
UI_LAYOUT_PIEMENU = 4,
UI_LAYOUT_VERT_BAR = 5,
};
namespace blender::ui {
enum class LayoutDirection : int8_t {
Horizontal = 0,
Vertical = 1,
};
enum class LayoutType : int8_t {
Panel = 0,
Header = 1,
Menu = 2,
Toolbar = 3,
PieMenu = 4,
VerticalBar = 5,
};
enum class LayoutAlign : int8_t {
Expand = 0,
Left = 1,
@@ -731,6 +734,17 @@ enum class ButProgressType : int8_t {
Bar = 0,
Ring = 1,
};
uiLayout &block_layout(uiBlock *block,
LayoutDirection direction,
LayoutType type,
int x,
int y,
int size,
int em,
int padding,
const uiStyle *style);
} // namespace blender::ui
enum eUI_Item_Flag : uint16_t {
@@ -772,15 +786,6 @@ enum eUI_Item_Flag : uint16_t {
ENUM_OPERATORS(eUI_Item_Flag, UI_ITEM_R_TEXT_BUT_FORCE_SEMI_MODAL_ACTIVE)
#define UI_ITEM_NONE eUI_Item_Flag(0)
uiLayout *UI_block_layout(uiBlock *block,
int dir,
int type,
int x,
int y,
int size,
int em,
int padding,
const uiStyle *style);
void UI_block_layout_set_current(uiBlock *block, uiLayout *layout);
void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y);
bool UI_block_layout_needs_resolving(const uiBlock *block);
@@ -824,8 +829,6 @@ void UI_menutype_draw(bContext *C, MenuType *mt, uiLayout *layout);
*/
void UI_paneltype_draw(bContext *C, PanelType *pt, uiLayout *layout);
int uiLayoutGetLocalDir(const uiLayout *layout);
int uiLayoutListItemPaddingWidth();
void uiLayoutListItemAddPadding(uiLayout *layout);

View File

@@ -189,18 +189,18 @@ static uiBlock *menu_change_shortcut(bContext *C, ARegion *region, void *arg)
UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT);
UI_block_direction_set(block, UI_DIR_CENTER_Y);
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
0,
0,
U.widget_unit * 10,
U.widget_unit * 2,
0,
style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
U.widget_unit * 10,
U.widget_unit * 2,
0,
style);
layout->label(CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"), ICON_HAND);
layout->prop(&ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
layout.label(CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Change Shortcut"), ICON_HAND);
layout.prop(&ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
const int bounds_offset[2] = {int(-100 * UI_SCALE_FAC), int(36 * UI_SCALE_FAC)};
UI_block_bounds_set_popup(block, 6 * UI_SCALE_FAC, bounds_offset);
@@ -249,18 +249,18 @@ static uiBlock *menu_add_shortcut(bContext *C, ARegion *region, void *arg)
UI_block_func_handle_set(block, but_shortcut_name_func, but);
UI_block_direction_set(block, UI_DIR_CENTER_Y);
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
0,
0,
U.widget_unit * 10,
U.widget_unit * 2,
0,
style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
U.widget_unit * 10,
U.widget_unit * 2,
0,
style);
layout->label(CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Assign Shortcut"), ICON_HAND);
layout->prop(&ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
layout.label(CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Assign Shortcut"), ICON_HAND);
layout.prop(&ptr, "type", UI_ITEM_R_FULL_EVENT | UI_ITEM_R_IMMEDIATE, "", ICON_NONE);
const int bounds_offset[2] = {int(-100 * UI_SCALE_FAC), int(36 * UI_SCALE_FAC)};
UI_block_bounds_set_popup(block, 6 * UI_SCALE_FAC, bounds_offset);

View File

@@ -77,7 +77,7 @@ using blender::StringRefNull;
struct uiLayoutRoot {
uiLayoutRoot *next, *prev;
int type;
blender::ui::LayoutType type;
wmOperatorCallContext opcontext;
int emw, emh;
@@ -260,7 +260,9 @@ static int ui_item_fit(const int item,
static int ui_layout_vary_direction(uiLayout *layout)
{
return ((ELEM(layout->root_->type, UI_LAYOUT_HEADER, UI_LAYOUT_PIEMENU) ||
return ((ELEM(layout->root_->type,
blender::ui::LayoutType::Header,
blender::ui::LayoutType::PieMenu) ||
(layout->alignment_ != blender::ui::LayoutAlign::Expand)) ?
UI_ITEM_VARY_X :
UI_ITEM_VARY_Y);
@@ -443,15 +445,15 @@ static void ui_item_move(uiItem *item, const int delta_xmin, const int delta_xma
/** \name Special RNA Items
* \{ */
int uiLayoutGetLocalDir(const uiLayout *layout)
blender::ui::LayoutDirection uiLayout::local_direction() const
{
switch (layout->type_) {
switch (type_) {
case uiItemType::LayoutRow:
case uiItemType::LayoutRoot:
case uiItemType::LayoutOverlap:
case uiItemType::LayoutPanelHeader:
case uiItemType::LayoutGridFlow:
return UI_LAYOUT_HORIZONTAL;
return blender::ui::LayoutDirection::Horizontal;
case uiItemType::LayoutColumn:
case uiItemType::LayoutColumnFlow:
case uiItemType::LayoutSplit:
@@ -459,14 +461,14 @@ int uiLayoutGetLocalDir(const uiLayout *layout)
case uiItemType::LayoutBox:
case uiItemType::LayoutPanelBody:
default:
return UI_LAYOUT_VERTICAL;
return blender::ui::LayoutDirection::Vertical;
}
}
static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, bool align)
{
uiLayout *sub;
if (uiLayoutGetLocalDir(test) == UI_LAYOUT_HORIZONTAL) {
if (test->local_direction() == blender::ui::LayoutDirection::Horizontal) {
sub = &layout->row(align);
}
else {
@@ -788,7 +790,7 @@ static void ui_item_enum_expand_elem_exec(uiLayout *layout,
UI_but_func_set(but, ui_item_enum_expand_handle, but, POINTER_FROM_INT(value));
}
if (uiLayoutGetLocalDir(layout) != UI_LAYOUT_HORIZONTAL) {
if (layout->local_direction() != blender::ui::LayoutDirection::Horizontal) {
but->drawflag |= UI_BUT_TEXT_LEFT;
}
@@ -822,7 +824,7 @@ static void ui_item_enum_expand_exec(uiLayout *layout,
BLI_assert(RNA_property_type(prop) == PROP_ENUM);
const bool radial = (layout->root_->type == UI_LAYOUT_PIEMENU);
const bool radial = (layout->root_->type == blender::ui::LayoutType::PieMenu);
bool free;
const EnumPropertyItem *item_array;
@@ -850,7 +852,7 @@ static void ui_item_enum_expand_exec(uiLayout *layout,
}
}
else if (ELEM(layout->type_, uiItemType::LayoutGridFlow, uiItemType::LayoutColumnFlow) ||
layout->root_->type == UI_LAYOUT_MENU)
layout->root_->type == blender::ui::LayoutType::Menu)
{
UI_block_layout_set_current(block, layout);
}
@@ -1252,7 +1254,7 @@ static uiBut *uiItemFullO_ptr_ex(uiLayout *layout,
}
}
if (layout->root_->type == UI_LAYOUT_MENU && !icon) {
if (layout->root_->type == blender::ui::LayoutType::Menu && !icon) {
icon = ICON_BLANK1;
}
@@ -1457,7 +1459,8 @@ void uiItemEnumO(uiLayout *layout,
BLI_INLINE bool ui_layout_is_radial(const uiLayout *layout)
{
return (layout->type_ == uiItemType::LayoutRadial) ||
((layout->type_ == uiItemType::LayoutRoot) && (layout->root_->type == UI_LAYOUT_PIEMENU));
((layout->type_ == uiItemType::LayoutRoot) &&
(layout->root_->type == blender::ui::LayoutType::PieMenu));
}
void uiItemsFullEnumO_items(uiLayout *layout,
@@ -1484,7 +1487,9 @@ void uiItemsFullEnumO_items(uiLayout *layout,
if (radial) {
target = &layout->menu_pie();
}
else if ((uiLayoutGetLocalDir(layout) == UI_LAYOUT_HORIZONTAL) && (flag & UI_ITEM_R_ICON_ONLY)) {
else if ((layout->local_direction() == blender::ui::LayoutDirection::Horizontal) &&
(flag & UI_ITEM_R_ICON_ONLY))
{
target = layout;
UI_block_layout_set_current(block, target);
@@ -2021,9 +2026,9 @@ void uiLayout::prop(PointerRNA *ptr,
}
/* Menus and pie-menus don't show checkbox without this. */
if ((root_->type == UI_LAYOUT_MENU) ||
if ((root_->type == blender::ui::LayoutType::Menu) ||
/* Use check-boxes only as a fallback in pie-menu's, when no icon is defined. */
((root_->type == UI_LAYOUT_PIEMENU) && (icon == ICON_NONE)))
((root_->type == blender::ui::LayoutType::PieMenu) && (icon == ICON_NONE)))
{
const int prop_flag = RNA_property_flag(prop);
if (type == PROP_BOOLEAN) {
@@ -2168,7 +2173,7 @@ void uiLayout::prop(PointerRNA *ptr,
/* Often expanded enum's are better arranged into a row,
* so check the existing layout. */
if (uiLayoutGetLocalDir(layout) == UI_LAYOUT_HORIZONTAL) {
if (layout->local_direction() == blender::ui::LayoutDirection::Horizontal) {
layout = &layout_split->row(true);
}
else {
@@ -2833,12 +2838,12 @@ static uiBut *ui_item_menu(uiLayout *layout,
UI_block_layout_set_current(block, layout);
ui_block_new_button_group(block, uiButtonGroupFlag(0));
if (layout->root_->type == UI_LAYOUT_MENU && !icon) {
if (layout->root_->type == blender::ui::LayoutType::Menu && !icon) {
icon = ICON_BLANK1;
}
uiTextIconPadFactor pad_factor = ui_text_pad_compact;
if (layout->root_->type == UI_LAYOUT_HEADER) { /* Ugly! */
if (layout->root_->type == blender::ui::LayoutType::Header) { /* Ugly! */
if (icon == ICON_NONE && force_menu) {
/* pass */
}
@@ -2882,9 +2887,10 @@ static uiBut *ui_item_menu(uiLayout *layout,
but->func_argN_copy_fn = func_argN_copy_fn;
}
if (ELEM(layout->root_->type, UI_LAYOUT_PANEL, UI_LAYOUT_TOOLBAR) ||
if (ELEM(
layout->root_->type, blender::ui::LayoutType::Panel, blender::ui::LayoutType::Toolbar) ||
/* We never want a drop-down in menu! */
(force_menu && layout->root_->type != UI_LAYOUT_MENU))
(force_menu && layout->root_->type != blender::ui::LayoutType::Menu))
{
UI_but_type_set_menu_from_pulldown(but);
}
@@ -2902,7 +2908,7 @@ void uiLayout::menu(MenuType *mt, const std::optional<StringRef> name_opt, int i
const StringRef name = name_opt.value_or(CTX_IFACE_(mt->translation_context, mt->label));
if (root_->type == UI_LAYOUT_MENU && !icon) {
if (root_->type == blender::ui::LayoutType::Menu && !icon) {
icon = ICON_BLANK1;
}
@@ -3025,7 +3031,7 @@ void uiLayout::popover(const bContext *C,
uiLayout *layout = this;
const StringRef name = name_opt.value_or(CTX_IFACE_(pt->translation_context, pt->label));
if (root_->type == UI_LAYOUT_MENU && !icon) {
if (root_->type == blender::ui::LayoutType::Menu && !icon) {
icon = ICON_BLANK1;
}
@@ -3104,7 +3110,7 @@ static uiBut *uiItemL_(uiLayout *layout, const StringRef name, int icon)
UI_block_layout_set_current(block, layout);
ui_block_new_button_group(block, uiButtonGroupFlag(0));
if (layout->root_->type == UI_LAYOUT_MENU && !icon) {
if (layout->root_->type == blender::ui::LayoutType::Menu && !icon) {
icon = ICON_BLANK1;
}
@@ -3429,7 +3435,7 @@ void uiItemMenuEnumFullO_ptr(uiLayout *layout,
name = operator_name.c_str();
}
if (layout->root_->type == UI_LAYOUT_MENU && !icon) {
if (layout->root_->type == blender::ui::LayoutType::Menu && !icon) {
icon = ICON_BLANK1;
}
@@ -3512,7 +3518,7 @@ void uiLayout::prop_menu_enum(PointerRNA *ptr,
const std::optional<StringRefNull> name,
int icon)
{
if (root_->type == UI_LAYOUT_MENU && !icon) {
if (root_->type == blender::ui::LayoutType::Menu && !icon) {
icon = ICON_BLANK1;
}
@@ -3990,13 +3996,13 @@ static void ui_litem_layout_root_radial(uiLayout *litem)
static void ui_litem_layout_root(uiLayout *litem)
{
if (litem->root_->type == UI_LAYOUT_HEADER) {
if (litem->root_->type == blender::ui::LayoutType::Header) {
ui_litem_layout_row(litem);
}
else if (litem->root_->type == UI_LAYOUT_PIEMENU) {
else if (litem->root_->type == blender::ui::LayoutType::PieMenu) {
ui_litem_layout_root_radial(litem);
}
else if (litem->root_->type == UI_LAYOUT_MENU) {
else if (litem->root_->type == blender::ui::LayoutType::Menu) {
ui_litem_layout_column(litem, false, true);
}
else {
@@ -4060,7 +4066,7 @@ static void ui_litem_estimate_box(uiLayout *litem)
ui_litem_estimate_column(litem, true);
int boxspace = style->boxspace;
if (litem->root_->type == UI_LAYOUT_HEADER) {
if (litem->root_->type == blender::ui::LayoutType::Header) {
boxspace = 0;
}
litem->w_ += 2 * boxspace;
@@ -4073,7 +4079,7 @@ static void ui_litem_layout_box(uiLayout *litem)
const uiStyle *style = litem->root_->style;
int boxspace = style->boxspace;
if (litem->root_->type == UI_LAYOUT_HEADER) {
if (litem->root_->type == blender::ui::LayoutType::Header) {
boxspace = 0;
}
@@ -4970,7 +4976,7 @@ static uiLayoutItemBx *ui_layout_box(uiLayout *layout, int type)
uiLayout &uiLayout::menu_pie()
{
/* radial layouts are only valid for radial menus */
if (root_->type != UI_LAYOUT_PIEMENU) {
if (root_->type != blender::ui::LayoutType::PieMenu) {
return *ui_item_local_sublayout(this, this, false);
}
@@ -5560,15 +5566,16 @@ static void ui_layout_add_padding_button(uiLayoutRoot *root)
}
}
uiLayout *UI_block_layout(uiBlock *block,
int dir,
int type,
int x,
int y,
int size,
int em,
int padding,
const uiStyle *style)
namespace blender::ui {
uiLayout &block_layout(uiBlock *block,
LayoutDirection dir,
LayoutType type,
int x,
int y,
int size,
int em,
int padding,
const uiStyle *style)
{
uiLayoutRoot *root = MEM_callocN<uiLayoutRoot>(__func__);
root->type = type;
@@ -5578,7 +5585,8 @@ uiLayout *UI_block_layout(uiBlock *block,
root->opcontext = WM_OP_INVOKE_REGION_WIN;
uiLayout *layout = MEM_new<uiLayout>(__func__);
layout->type_ = (type == UI_LAYOUT_VERT_BAR) ? uiItemType::LayoutColumn : uiItemType::LayoutRoot;
layout->type_ = (type == LayoutType::VerticalBar) ? uiItemType::LayoutColumn :
uiItemType::LayoutRoot;
/* Only used when 'uiItemInternalFlag::PropSep' is set. */
layout->flag_ = uiItemInternalFlag::PropDecorate;
@@ -5592,11 +5600,11 @@ uiLayout *UI_block_layout(uiBlock *block,
layout->context_ = nullptr;
layout->emboss_ = blender::ui::EmbossType::Undefined;
if (ELEM(type, UI_LAYOUT_MENU, UI_LAYOUT_PIEMENU)) {
if (ELEM(type, LayoutType::Menu, LayoutType::PieMenu)) {
layout->space_ = 0;
}
if (dir == UI_LAYOUT_HORIZONTAL) {
if (dir == LayoutDirection::Horizontal) {
layout->h_ = size;
layout->root_->emh = em * UI_UNIT_Y;
}
@@ -5611,9 +5619,11 @@ uiLayout *UI_block_layout(uiBlock *block,
ui_layout_add_padding_button(root);
return layout;
return *layout;
}
} // namespace blender::ui
uiBlock *uiLayout::block() const
{
return root_->block;
@@ -6180,11 +6190,18 @@ uiLayout *uiItemsAlertBox(uiBlock *block,
const float split_factor = (float(icon_size) + icon_padding) /
float(dialog_width - style->columnspace);
uiLayout *block_layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, dialog_width, 0, 0, style);
uiLayout &block_layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
dialog_width,
0,
0,
style);
/* Split layout to put alert icon on left side. */
uiLayout *split_block = &block_layout->split(split_factor, false);
uiLayout *split_block = &block_layout.split(split_factor, false);
/* Alert icon on the left. */
uiLayout *layout = &split_block->row(false);

View File

@@ -131,8 +131,15 @@ uiPieMenu *UI_pie_menu_begin(bContext *C, const char *title, int icon, const wmE
win->pie_event_type_lock = event_type;
}
pie->layout = UI_block_layout(
pie->pie_block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style);
pie->layout = &blender::ui::block_layout(pie->pie_block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::PieMenu,
0,
0,
200,
0,
0,
style);
/* NOTE: #wmEvent.xy is where we started dragging in case of #KM_CLICK_DRAG. */
pie->mx = event->xy[0];

View File

@@ -198,8 +198,15 @@ static void ui_popup_menu_create_block(bContext *C,
if (!title.is_empty()) {
pup->block->puphash = ui_popup_menu_hash(title);
}
pup->layout = UI_block_layout(
pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, UI_MENU_PADDING, style);
pup->layout = &blender::ui::block_layout(pup->block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Menu,
0,
0,
200,
0,
UI_MENU_PADDING,
style);
/* NOTE: this intentionally differs from the menu & sub-menu default because many operators
* use popups like this to select one of their options -

View File

@@ -93,8 +93,15 @@ static void ui_popover_create_block(bContext *C,
}
#endif
pup->layout = UI_block_layout(
pup->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, pup->ui_size_x, 0, 0, style);
pup->layout = &blender::ui::block_layout(pup->block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
pup->ui_size_x,
0,
0,
style);
pup->layout->operator_context_set(opcontext);

View File

@@ -73,18 +73,18 @@ static uiBlock *colorband_tools_fn(bContext *C, ARegion *region, void *cb_v)
uiBlock *block = UI_block_begin(C, region, __func__, blender::ui::EmbossType::Pulldown);
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_MENU,
0,
0,
UI_MENU_WIDTH_MIN,
0,
UI_MENU_PADDING,
style);
UI_block_layout_set_current(block, layout);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Menu,
0,
0,
UI_MENU_WIDTH_MIN,
0,
UI_MENU_PADDING,
style);
UI_block_layout_set_current(block, &layout);
{
layout->context_ptr_set("color_ramp", &coba_ptr);
layout.context_ptr_set("color_ramp", &coba_ptr);
}
/* We could move these to operators,
@@ -150,11 +150,11 @@ static uiBlock *colorband_tools_fn(bContext *C, ARegion *region, void *cb_v)
});
}
layout->separator();
layout.separator();
layout->op("UI_OT_eyedropper_colorramp", IFACE_("Eyedropper"), ICON_EYEDROPPER);
layout.op("UI_OT_eyedropper_colorramp", IFACE_("Eyedropper"), ICON_EYEDROPPER);
layout->separator();
layout.separator();
{
uiBut *but = uiDefIconTextBut(block,

View File

@@ -29,16 +29,16 @@ static uiBlock *component_menu(bContext *C, ARegion *region, void *args_v)
uiBlock *block = UI_block_begin(C, region, __func__, blender::ui::EmbossType::Emboss);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN);
uiLayout &layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
0,
0,
UI_UNIT_X * 6,
UI_UNIT_Y,
0,
UI_style_get())
->column(false);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
UI_UNIT_X * 6,
UI_UNIT_Y,
0,
UI_style_get())
.column(false);
layout.prop(&args->ptr, args->propname, UI_ITEM_R_EXPAND, "", ICON_NONE);

View File

@@ -665,16 +665,23 @@ static MenuSearch_Data *menu_items_from_ui_create(bContext *C,
}
uiBlock *block = UI_block_begin(C, region, __func__, blender::ui::EmbossType::Emboss);
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, UI_MENU_PADDING, style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Menu,
0,
0,
200,
0,
UI_MENU_PADDING,
style);
UI_block_flag_enable(block, UI_BLOCK_SHOW_SHORTCUT_ALWAYS);
if (current_menu.context.has_value()) {
layout->context_copy(&*current_menu.context);
layout.context_copy(&*current_menu.context);
}
layout->operator_context_set(WM_OP_INVOKE_REGION_WIN);
UI_menutype_draw(C, mt, layout);
layout.operator_context_set(WM_OP_INVOKE_REGION_WIN);
UI_menutype_draw(C, mt, &layout);
UI_block_end(C, block);
@@ -765,12 +772,19 @@ static MenuSearch_Data *menu_items_from_ui_create(bContext *C,
/* +1 to avoid overlap with the current 'block'. */
uiBlock *sub_block = UI_block_begin(
C, region, __func__ + 1, blender::ui::EmbossType::Emboss);
uiLayout *sub_layout = UI_block_layout(
sub_block, UI_LAYOUT_VERTICAL, UI_LAYOUT_MENU, 0, 0, 200, 0, UI_MENU_PADDING, style);
uiLayout &sub_layout = blender::ui::block_layout(sub_block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Menu,
0,
0,
200,
0,
UI_MENU_PADDING,
style);
UI_block_flag_enable(sub_block, UI_BLOCK_SHOW_SHORTCUT_ALWAYS);
sub_layout->operator_context_set(WM_OP_INVOKE_REGION_WIN);
sub_layout.operator_context_set(WM_OP_INVOKE_REGION_WIN);
/* If this is a panel, check it's poll function succeeds before drawing.
* otherwise draw(..) may be called in an unsupported context and crash, see: #130744.
@@ -786,7 +800,7 @@ static MenuSearch_Data *menu_items_from_ui_create(bContext *C,
}
if (poll_success) {
but->menu_create_func(C, sub_layout, but->poin);
but->menu_create_func(C, &sub_layout, but->poin);
}
UI_block_end(C, sub_block);

View File

@@ -2936,15 +2936,15 @@ static void ed_panel_draw(const bContext *C,
UI_panel_header_buttons_begin(panel);
if (pt->draw_header_preset && !(pt->flag & PANEL_TYPE_NO_HEADER)) {
/* for preset menu */
panel->layout = UI_block_layout(block,
UI_LAYOUT_HORIZONTAL,
UI_LAYOUT_HEADER,
0,
(UI_UNIT_Y * 1.1f) + style->panelspace,
UI_UNIT_Y,
1,
0,
style);
panel->layout = &blender::ui::block_layout(block,
blender::ui::LayoutDirection::Horizontal,
blender::ui::LayoutType::Header,
0,
(UI_UNIT_Y * 1.1f) + style->panelspace,
UI_UNIT_Y,
1,
0,
style);
panel->layout->operator_context_set(op_context);
@@ -2962,21 +2962,28 @@ static void ed_panel_draw(const bContext *C,
/* Unusual case: Use expanding layout (buttons stretch to available width). */
if (pt->flag & PANEL_TYPE_HEADER_EXPAND) {
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
labelx,
labely,
headerend - 2 * style->panelspace,
1,
0,
style);
panel->layout = &layout->row(false);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
labelx,
labely,
headerend - 2 * style->panelspace,
1,
0,
style);
panel->layout = &layout.row(false);
}
/* Regular case: Normal panel with fixed size buttons. */
else {
panel->layout = UI_block_layout(
block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, labelx, labely, UI_UNIT_Y, 1, 0, style);
panel->layout = &blender::ui::block_layout(block,
blender::ui::LayoutDirection::Horizontal,
blender::ui::LayoutType::Header,
labelx,
labely,
UI_UNIT_Y,
1,
0,
style);
}
panel->layout->operator_context_set(op_context);
@@ -2994,22 +3001,22 @@ static void ed_panel_draw(const bContext *C,
UI_panel_header_buttons_end(panel);
if (open || search_filter_active) {
short panelContext;
blender::ui::LayoutType panelContext;
/* panel context can either be toolbar region or normal panels region */
if (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) {
panelContext = UI_LAYOUT_VERT_BAR;
panelContext = blender::ui::LayoutType::VerticalBar;
}
else if (region->regiontype == RGN_TYPE_TOOLS) {
panelContext = UI_LAYOUT_TOOLBAR;
panelContext = blender::ui::LayoutType::Toolbar;
}
else {
panelContext = UI_LAYOUT_PANEL;
panelContext = blender::ui::LayoutType::Panel;
}
panel->layout = UI_block_layout(
panel->layout = &blender::ui::block_layout(
block,
UI_LAYOUT_VERTICAL,
blender::ui::LayoutDirection::Vertical,
panelContext,
(pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : style->panelspace,
0,
@@ -3457,18 +3464,39 @@ static bool panel_property_search(const bContext *C,
/* Build the layouts. Because they are only used for search,
* they don't need any of the proper style or layout information. */
if (panel->type->draw_header_preset != nullptr) {
panel->layout = UI_block_layout(
block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, 0, 0, 0, 0, 0, style);
panel->layout = &blender::ui::block_layout(block,
blender::ui::LayoutDirection::Horizontal,
blender::ui::LayoutType::Header,
0,
0,
0,
0,
0,
style);
panel_type->draw_header_preset(C, panel);
}
if (panel->type->draw_header != nullptr) {
panel->layout = UI_block_layout(
block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, 0, 0, 0, 0, 0, style);
panel->layout = &blender::ui::block_layout(block,
blender::ui::LayoutDirection::Horizontal,
blender::ui::LayoutType::Header,
0,
0,
0,
0,
0,
style);
panel_type->draw_header(C, panel);
}
if (LIKELY(panel->type->draw != nullptr)) {
panel->layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, 0, 0, 0, style);
panel->layout = &blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
0,
0,
0,
style);
panel_type->draw(C, panel);
}
@@ -3597,24 +3625,31 @@ void ED_region_header_layout(const bContext *C, ARegion *region)
}
uiBlock *block = UI_block_begin(C, region, ht->idname, blender::ui::EmbossType::Emboss);
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, xco, yco, buttony, 1, 0, style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Horizontal,
blender::ui::LayoutType::Header,
xco,
yco,
buttony,
1,
0,
style);
if (buttony_scale != 1.0f) {
layout->scale_y_set(buttony_scale);
layout.scale_y_set(buttony_scale);
}
Header header = {nullptr};
if (ht->draw) {
header.type = ht;
header.layout = layout;
header.layout = &layout;
ht->draw(C, &header);
if (ht->next) {
layout->separator();
layout.separator();
}
/* for view2d */
xco = layout->width();
xco = layout.width();
maxco = std::max(xco, maxco);
}

View File

@@ -428,23 +428,23 @@ static bool node_update_basis_buttons(const bContext &C,
dy -= NODE_DYS / 4;
uiLayout *layout = UI_block_layout(&block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
loc.x + NODE_DYS,
dy,
NODE_WIDTH(node) - NODE_DY,
0,
0,
UI_style_get_dpi());
uiLayout &layout = blender::ui::block_layout(&block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
loc.x + NODE_DYS,
dy,
NODE_WIDTH(node) - NODE_DY,
0,
0,
UI_style_get_dpi());
if (node.is_muted()) {
layout->active_set(false);
layout.active_set(false);
}
layout->context_ptr_set("node", &nodeptr);
layout.context_ptr_set("node", &nodeptr);
draw_buttons(layout, (bContext *)&C, &nodeptr);
draw_buttons(&layout, (bContext *)&C, &nodeptr);
UI_block_align_end(&block);
int buty;
@@ -511,21 +511,21 @@ static bool node_update_basis_socket(const bContext &C,
0.0f;
locy -= multi_input_socket_offset * 0.5f;
uiLayout *layout = UI_block_layout(&block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
locx + NODE_DYS,
locy,
NODE_WIDTH(node) - NODE_DY,
NODE_DY,
0,
UI_style_get_dpi());
uiLayout &layout = blender::ui::block_layout(&block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
locx + NODE_DYS,
locy,
NODE_WIDTH(node) - NODE_DY,
NODE_DY,
0,
UI_style_get_dpi());
if (node.is_muted()) {
layout->active_set(false);
layout.active_set(false);
}
uiLayout *row = &layout->row(true);
uiLayout *row = &layout.row(true);
PointerRNA nodeptr = RNA_pointer_create_discrete(&ntree.id, &RNA_Node, &node);
row->context_ptr_set("node", &nodeptr);
@@ -1145,37 +1145,37 @@ static void node_update_basis_from_declaration(
const nodes::LayoutDeclaration &decl = *item.decl;
/* Round the node origin because text contents are always pixel-aligned. */
const float2 loc = math::round(node_to_view(node.location));
uiLayout *layout = UI_block_layout(&block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
loc.x + NODE_DYS,
locy,
NODE_WIDTH(node) - NODE_DY,
0,
0,
UI_style_get_dpi());
uiLayout &layout = blender::ui::block_layout(&block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
loc.x + NODE_DYS,
locy,
NODE_WIDTH(node) - NODE_DY,
0,
0,
UI_style_get_dpi());
if (node.is_muted()) {
layout->active_set(false);
layout.active_set(false);
}
PointerRNA node_ptr = RNA_pointer_create_discrete(&ntree.id, &RNA_Node, &node);
layout->context_ptr_set("node", &node_ptr);
decl.draw(layout, const_cast<bContext *>(&C), &node_ptr);
layout.context_ptr_set("node", &node_ptr);
decl.draw(&layout, const_cast<bContext *>(&C), &node_ptr);
UI_block_align_end(&block);
int buty;
UI_block_layout_resolve(&block, nullptr, &buty);
locy = buty;
}
else if constexpr (std::is_same_v<ItemT, flat_item::Separator>) {
uiLayout *layout = UI_block_layout(&block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
locx + NODE_DYS,
locy,
NODE_WIDTH(node) - NODE_DY,
NODE_DY,
0,
UI_style_get_dpi());
layout->separator(1.0, LayoutSeparatorType::Line);
uiLayout &layout = blender::ui::block_layout(&block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
locx + NODE_DYS,
locy,
NODE_WIDTH(node) - NODE_DY,
NODE_DY,
0,
UI_style_get_dpi());
layout.separator(1.0, LayoutSeparatorType::Line);
UI_block_layout_resolve(&block, nullptr, nullptr);
}
else if constexpr (std::is_same_v<ItemT, flat_item::PanelHeader>) {
@@ -5212,11 +5212,18 @@ static void draw_tree_path(const bContext &C, ARegion &region)
const int width = BLI_rcti_size_x(rect) - 2 * padding_x;
uiBlock *block = UI_block_begin(&C, &region, __func__, blender::ui::EmbossType::None);
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, x, y, width, 1, 0, style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
x,
y,
width,
1,
0,
style);
const Vector<ui::ContextPathItem> context_path = ed::space_node::context_path_for_space_node(C);
ui::template_breadcrumbs(*layout, context_path);
ui::template_breadcrumbs(layout, context_path);
UI_block_layout_resolve(block, nullptr, nullptr);
UI_block_end(&C, block);

View File

@@ -650,18 +650,18 @@ static void spreadsheet_footer_region_draw(const bContext *C, ARegion *region)
uiBlock *block = UI_block_begin(C, region, __func__, blender::ui::EmbossType::Emboss);
const uiStyle *style = UI_style_get_dpi();
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_HORIZONTAL,
UI_LAYOUT_HEADER,
UI_HEADER_OFFSET,
region->winy - (region->winy - UI_UNIT_Y) / 2.0f,
region->winx,
1,
0,
style);
layout->separator_spacer();
layout->alignment_set(blender::ui::LayoutAlign::Right);
layout->label(stats_str, ICON_NONE);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Horizontal,
blender::ui::LayoutType::Header,
UI_HEADER_OFFSET,
region->winy - (region->winy - UI_UNIT_Y) / 2.0f,
region->winx,
1,
0,
style);
layout.separator_spacer();
layout.alignment_set(blender::ui::LayoutAlign::Right);
layout.label(stats_str, ICON_NONE);
UI_block_layout_resolve(block, nullptr, nullptr);
UI_block_align_end(block);
UI_block_end(C, block);

View File

@@ -1446,7 +1446,7 @@ static void rna_UILayout_alignment_set(PointerRNA *ptr, int value)
static int rna_UILayout_direction_get(PointerRNA *ptr)
{
return uiLayoutGetLocalDir(static_cast<uiLayout *>(ptr->data));
return int(ptr->data_as<uiLayout>()->local_direction());
}
static float rna_UILayout_scale_x_get(PointerRNA *ptr)
@@ -1653,8 +1653,8 @@ static void rna_def_ui_layout(BlenderRNA *brna)
};
static const EnumPropertyItem direction_items[] = {
{UI_LAYOUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
{UI_LAYOUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
{int(blender::ui::LayoutDirection::Horizontal), "HORIZONTAL", 0, "Horizontal", ""},
{int(blender::ui::LayoutDirection::Vertical), "VERTICAL", 0, "Vertical", ""},
{0, nullptr, 0, nullptr, nullptr},
};

View File

@@ -1432,20 +1432,27 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *region, void *arg_op)
UI_block_func_handle_set(block, wm_block_redo_cb, arg_op);
UI_popup_dummy_panel_set(region, block);
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, width, UI_UNIT_Y, 0, style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
width,
UI_UNIT_Y,
0,
style);
if (op == WM_operator_last_redo(C)) {
if (!WM_operator_check_ui_enabled(C, op->type->name)) {
layout->enabled_set(false);
layout.enabled_set(false);
}
}
uiItemL_ex(layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE, true, false);
layout->separator(0.2f, LayoutSeparatorType::Line);
layout->separator(0.5f);
uiItemL_ex(&layout, WM_operatortype_name(op->type, op->ptr), ICON_NONE, true, false);
layout.separator(0.2f, LayoutSeparatorType::Line);
layout.separator(0.5f);
uiLayout *col = &layout->column(false);
uiLayout *col = &layout.column(false);
uiTemplateOperatorPropertyButs(C, col, op, UI_BUT_LABEL_ALIGN_NONE, 0);
UI_block_bounds_set_popup(block, 7 * UI_SCALE_FAC, nullptr);
@@ -1562,8 +1569,15 @@ static uiBlock *wm_block_dialog_create(bContext *C, ARegion *region, void *user_
block, style, dialog_width + icon_size, eAlertIcon(data->icon), icon_size);
}
else {
layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, dialog_width, 0, 0, style);
layout = &blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
dialog_width,
0,
0,
style);
}
/* Title. */
@@ -1683,11 +1697,18 @@ static uiBlock *wm_operator_ui_create(bContext *C, ARegion *region, void *user_d
UI_popup_dummy_panel_set(region, block);
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, data->width, 0, 0, style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
data->width,
0,
0,
style);
/* Since UI is defined the auto-layout args are not used. */
uiTemplateOperatorPropertyButs(C, layout, op, UI_BUT_LABEL_ALIGN_COLUMN, 0);
uiTemplateOperatorPropertyButs(C, &layout, op, UI_BUT_LABEL_ALIGN_COLUMN, 0);
UI_block_func_set(block, nullptr, nullptr, nullptr);

View File

@@ -331,15 +331,15 @@ static uiBlock *wm_block_splash_create(bContext *C, ARegion *region, void * /*ar
}
const int layout_margin_x = UI_SCALE_FAC * 26;
uiLayout *layout = UI_block_layout(block,
UI_LAYOUT_VERTICAL,
UI_LAYOUT_PANEL,
layout_margin_x,
0,
splash_width - (layout_margin_x * 2),
UI_SCALE_FAC * 110,
0,
style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
layout_margin_x,
0,
splash_width - (layout_margin_x * 2),
UI_SCALE_FAC * 110,
0,
style);
MenuType *mt;
@@ -358,7 +358,7 @@ static uiBlock *wm_block_splash_create(bContext *C, ARegion *region, void * /*ar
UI_block_func_set(block, wm_block_splash_close_on_fileselect, block, nullptr);
if (mt) {
UI_menutype_draw(C, mt, layout);
UI_menutype_draw(C, mt, &layout);
}
/* Displays a warning if blender is being emulated via Rosetta (macOS) or XTA (Windows) */
@@ -370,9 +370,9 @@ static uiBlock *wm_block_splash_create(bContext *C, ARegion *region, void * /*ar
if (proc_id && strncmp(proc_id, "ARM", 3) == 0)
# endif
{
layout->separator(2.0f, LayoutSeparatorType::Line);
layout.separator(2.0f, LayoutSeparatorType::Line);
uiLayout *split = &layout->split(0.725, true);
uiLayout *split = &layout.split(0.725, true);
uiLayout *row1 = &split->row(true);
uiLayout *row2 = &split->row(true);
@@ -395,7 +395,7 @@ static uiBlock *wm_block_splash_create(bContext *C, ARegion *region, void * /*ar
"https://docs.blender.org/manual/en/latest/getting_started/installing/windows.html");
# endif
layout->separator();
layout.separator();
}
#endif
@@ -439,8 +439,15 @@ static uiBlock *wm_block_about_create(bContext *C, ARegion *region, void * /*arg
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, dialog_width, 0, 0, style);
uiLayout &layout = blender::ui::block_layout(block,
blender::ui::LayoutDirection::Vertical,
blender::ui::LayoutType::Panel,
0,
0,
dialog_width,
0,
0,
style);
/* Blender logo. */
#ifndef WITH_HEADLESS
@@ -454,21 +461,21 @@ static uiBlock *wm_block_about_create(bContext *C, ARegion *region, void * /*arg
const uchar *color = btheme->tui.wcol_menu_back.text_sel;
/* The top margin. */
uiLayout *row = &layout->row(false);
uiLayout *row = &layout.row(false);
row->separator(0.2f);
/* The logo image. */
row = &layout->row(false);
row = &layout.row(false);
row->alignment_set(blender::ui::LayoutAlign::Left);
uiDefButImage(block, ibuf, 0, U.widget_unit, ibuf->x, ibuf->y, show_color ? nullptr : color);
/* Padding below the logo. */
row = &layout->row(false);
row = &layout.row(false);
row->separator(2.7f);
}
#endif /* !WITH_HEADLESS */
uiLayout *col = &layout->column(true);
uiLayout *col = &layout.column(true);
uiItemL_ex(col, IFACE_("Blender"), ICON_NONE, true, false);