diff --git a/source/blender/editors/animation/fmodifier_ui.cc b/source/blender/editors/animation/fmodifier_ui.cc index b2ccd9eff9b..263b39312da 100644 --- a/source/blender/editors/animation/fmodifier_ui.cc +++ b/source/blender/editors/animation/fmodifier_ui.cc @@ -319,7 +319,7 @@ static void fmodifier_panel_header(const bContext *C, Panel *panel) /* Right align. */ sub = &layout->row(true); uiLayoutSetAlignment(sub, UI_LAYOUT_ALIGN_RIGHT); - uiLayoutSetEmboss(sub, blender::ui::EmbossType::None); + sub->emboss_set(blender::ui::EmbossType::None); /* 'Mute' button. */ sub->prop(ptr, "mute", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); diff --git a/source/blender/editors/asset/intern/asset_shelf_catalog_selector.cc b/source/blender/editors/asset/intern/asset_shelf_catalog_selector.cc index 81d19b13ccd..365c1f9cd85 100644 --- a/source/blender/editors/asset/intern/asset_shelf_catalog_selector.cc +++ b/source/blender/editors/asset/intern/asset_shelf_catalog_selector.cc @@ -139,7 +139,7 @@ class AssetCatalogSelectorTree : public ui::AbstractTreeView { AssetCatalogSelectorTree &tree = dynamic_cast(get_tree_view()); uiBlock *block = uiLayoutGetBlock(&row); - uiLayoutSetEmboss(&row, blender::ui::EmbossType::Emboss); + row.emboss_set(blender::ui::EmbossType::Emboss); uiLayout *subrow = &row.row(false); uiLayoutSetActive(subrow, catalog_path_enabled_); diff --git a/source/blender/editors/include/UI_interface_layout.hh b/source/blender/editors/include/UI_interface_layout.hh index a567c1aa06e..4a4dce762b1 100644 --- a/source/blender/editors/include/UI_interface_layout.hh +++ b/source/blender/editors/include/UI_interface_layout.hh @@ -104,6 +104,11 @@ struct uiLayout : uiItem { float search_weight_; public: + blender::ui::EmbossType emboss() const; + void emboss_set(blender::ui::EmbossType emboss); + + /** Sub-layout items. */ + uiLayout &absolute(bool align); uiBlock *absolute_block(); @@ -478,7 +483,6 @@ void uiLayoutSetScaleX(uiLayout *layout, float scale); void uiLayoutSetScaleY(uiLayout *layout, float scale); void uiLayoutSetUnitsX(uiLayout *layout, float unit); void uiLayoutSetUnitsY(uiLayout *layout, float unit); -void uiLayoutSetEmboss(uiLayout *layout, blender::ui::EmbossType emboss); void uiLayoutSetPropSep(uiLayout *layout, bool is_sep); void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep); int uiLayoutGetLocalDir(const uiLayout *layout); @@ -498,7 +502,6 @@ float uiLayoutGetScaleX(uiLayout *layout); float uiLayoutGetScaleY(uiLayout *layout); float uiLayoutGetUnitsX(uiLayout *layout); float uiLayoutGetUnitsY(uiLayout *layout); -blender::ui::EmbossType uiLayoutGetEmboss(uiLayout *layout); bool uiLayoutGetPropSep(uiLayout *layout); bool uiLayoutGetPropDecorate(uiLayout *layout); Panel *uiLayoutGetRootPanel(uiLayout *layout); diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index 67049a395b4..c1ee4cae462 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -5156,9 +5156,9 @@ void uiLayoutSetUnitsY(uiLayout *layout, float unit) layout->units_[1] = unit; } -void uiLayoutSetEmboss(uiLayout *layout, blender::ui::EmbossType emboss) +void uiLayout::emboss_set(blender::ui::EmbossType emboss) { - layout->emboss_ = emboss; + emboss_ = emboss; } bool uiLayoutGetPropSep(uiLayout *layout) @@ -5256,12 +5256,12 @@ float uiLayoutGetUnitsY(uiLayout *layout) return layout->units_[1]; } -blender::ui::EmbossType uiLayoutGetEmboss(uiLayout *layout) +blender::ui::EmbossType uiLayout::emboss() const { - if (layout->emboss_ == blender::ui::EmbossType::Undefined) { - return layout->root_->block->emboss; + if (emboss_ == blender::ui::EmbossType::Undefined) { + return root_->block->emboss; } - return layout->emboss_; + return emboss_; } int uiLayoutListItemPaddingWidth() diff --git a/source/blender/editors/interface/templates/interface_template_constraint.cc b/source/blender/editors/interface/templates/interface_template_constraint.cc index 5a45f8bc230..9a0a193fac2 100644 --- a/source/blender/editors/interface/templates/interface_template_constraint.cc +++ b/source/blender/editors/interface/templates/interface_template_constraint.cc @@ -115,7 +115,7 @@ static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *co /* Constraint type icon. */ uiLayout *sub = &layout->row(false); - uiLayoutSetEmboss(sub, blender::ui::EmbossType::Emboss); + sub->emboss_set(blender::ui::EmbossType::Emboss); uiLayoutSetRedAlert(sub, (con->flag & CONSTRAINT_DISABLE)); sub->label("", RNA_struct_ui_icon(ptr.type)); @@ -133,7 +133,7 @@ static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *co /* Close 'button' - emboss calls here disable drawing of 'button' behind X */ sub = &row->row(false); - uiLayoutSetEmboss(sub, blender::ui::EmbossType::None); + sub->emboss_set(blender::ui::EmbossType::None); uiLayoutSetOperatorContext(sub, WM_OP_INVOKE_DEFAULT); sub->op("CONSTRAINT_OT_delete", "", ICON_X); diff --git a/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc b/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc index 91b2f1c5b57..fa49d365613 100644 --- a/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc +++ b/source/blender/editors/interface/templates/interface_template_node_tree_interface.cc @@ -109,7 +109,7 @@ class NodeSocketViewItem : public BasicTreeViewItem { uiLayout *input_socket_layout = &row.row(true); if (socket_.flag & NODE_INTERFACE_SOCKET_INPUT) { /* XXX Socket template only draws in embossed layouts (Julian). */ - uiLayoutSetEmboss(input_socket_layout, blender::ui::EmbossType::Emboss); + input_socket_layout->emboss_set(blender::ui::EmbossType::Emboss); /* Context is not used by the template function. */ uiTemplateNodeSocket(input_socket_layout, /*C*/ nullptr, socket_.socket_color()); } @@ -123,7 +123,7 @@ class NodeSocketViewItem : public BasicTreeViewItem { uiLayout *output_socket_layout = &row.row(true); if (socket_.flag & NODE_INTERFACE_SOCKET_OUTPUT) { /* XXX Socket template only draws in embossed layouts (Julian). */ - uiLayoutSetEmboss(output_socket_layout, blender::ui::EmbossType::Emboss); + output_socket_layout->emboss_set(blender::ui::EmbossType::Emboss); /* Context is not used by the template function. */ uiTemplateNodeSocket(output_socket_layout, /*C*/ nullptr, socket_.socket_color()); } @@ -197,7 +197,7 @@ class NodePanelViewItem : public BasicTreeViewItem { if (toggle_ != nullptr) { uiLayout *toggle_layout = &row.row(true); /* XXX Socket template only draws in embossed layouts (Julian). */ - uiLayoutSetEmboss(toggle_layout, blender::ui::EmbossType::Emboss); + toggle_layout->emboss_set(blender::ui::EmbossType::Emboss); /* Context is not used by the template function. */ uiTemplateNodeSocket(toggle_layout, /*C*/ nullptr, toggle_->socket_color()); } diff --git a/source/blender/editors/interface/templates/interface_template_operator_property.cc b/source/blender/editors/interface/templates/interface_template_operator_property.cc index f72d78abcc4..90f84b7e52a 100644 --- a/source/blender/editors/interface/templates/interface_template_operator_property.cc +++ b/source/blender/editors/interface/templates/interface_template_operator_property.cc @@ -350,7 +350,7 @@ static void draw_export_controls( layout->label(label, ICON_NONE); if (valid) { uiLayout *row = &layout->row(false); - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); uiItemPopoverPanel(row, C, "WM_PT_operator_presets", "", ICON_PRESET); PointerRNA op_ptr = row->op("COLLECTION_OT_exporter_export", "", ICON_EXPORT); RNA_int_set(&op_ptr, "index", index); @@ -403,7 +403,7 @@ static void draw_exporter_item(uiList * /*ui_list*/, int /*flt_flag*/) { uiLayout *row = &layout->row(false); - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); row->prop(itemptr, "name", UI_ITEM_NONE, "", ICON_NONE); } diff --git a/source/blender/editors/interface/templates/interface_template_status.cc b/source/blender/editors/interface/templates/interface_template_status.cc index 94605a37f94..423c3e14976 100644 --- a/source/blender/editors/interface/templates/interface_template_status.cc +++ b/source/blender/editors/interface/templates/interface_template_status.cc @@ -420,7 +420,7 @@ void uiTemplateStatusInfo(uiLayout *layout, bContext *C) row->label("|", ICON_NONE); row->separator(-0.5f); } - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); /* This operator also works fine for blocked extensions. */ row->op("EXTENSIONS_OT_userpref_show_for_update", "", ICON_ERROR); uiBut *but = uiLayoutGetBlock(layout)->buttons.last().get(); @@ -446,7 +446,7 @@ void uiTemplateStatusInfo(uiLayout *layout, bContext *C) row->label("", ICON_INTERNET_OFFLINE); } else { - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); row->op("EXTENSIONS_OT_userpref_show_online", "", ICON_INTERNET_OFFLINE); uiBut *but = uiLayoutGetBlock(layout)->buttons.last().get(); uchar color[4]; @@ -470,7 +470,7 @@ void uiTemplateStatusInfo(uiLayout *layout, bContext *C) row->label("|", ICON_NONE); row->separator(-0.5f); } - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); row->op("EXTENSIONS_OT_userpref_show_for_update", "", icon); uiBut *but = uiLayoutGetBlock(layout)->buttons.last().get(); uchar color[4]; diff --git a/source/blender/editors/interface/views/tree_view.cc b/source/blender/editors/interface/views/tree_view.cc index a6a5193e8c5..4aeaa29a919 100644 --- a/source/blender/editors/interface/views/tree_view.cc +++ b/source/blender/editors/interface/views/tree_view.cc @@ -908,7 +908,7 @@ void TreeViewLayoutBuilder::build_row(AbstractTreeViewItem &item) const uiLayout *row = &overlap->row(false); /* Enable emboss for mouse hover highlight. */ - uiLayoutSetEmboss(row, blender::ui::EmbossType::Emboss); + row->emboss_set(blender::ui::EmbossType::Emboss); /* Every item gets one! Other buttons can be overlapped on top. */ item.add_treerow_button(block_); diff --git a/source/blender/editors/space_buttons/buttons_context.cc b/source/blender/editors/space_buttons/buttons_context.cc index 2c876f62b7b..e6b8f8b1470 100644 --- a/source/blender/editors/space_buttons/buttons_context.cc +++ b/source/blender/editors/space_buttons/buttons_context.cc @@ -1258,7 +1258,7 @@ static void buttons_panel_context_draw(const bContext *C, Panel *panel) uiLayout *pin_row = &row->row(false); uiLayoutSetAlignment(pin_row, UI_LAYOUT_ALIGN_RIGHT); uiItemSpacer(pin_row); - uiLayoutSetEmboss(pin_row, blender::ui::EmbossType::None); + pin_row->emboss_set(blender::ui::EmbossType::None); pin_row->op( "BUTTONS_OT_toggle_pin", "", (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED); } diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index f8960d49856..162d43ba50c 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -1118,7 +1118,7 @@ static void draw_node_socket_name_editable(uiLayout *layout, { if (sock->runtime->declaration) { if (sock->runtime->declaration->socket_name_rna) { - uiLayoutSetEmboss(layout, blender::ui::EmbossType::None); + layout->emboss_set(blender::ui::EmbossType::None); layout->prop((&sock->runtime->declaration->socket_name_rna->owner), sock->runtime->declaration->socket_name_rna->property_name, UI_ITEM_NONE, diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc index 0d0050eac3a..816baa0a9c7 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc @@ -1054,7 +1054,7 @@ static void draw_context_panel(const bContext &C, uiLayout &layout) SpaceSpreadsheet &sspreadsheet = *CTX_wm_space_spreadsheet(&C); PanelLayout context_panel = layout.panel(&C, "context", false); - uiLayoutSetEmboss(context_panel.header, ui::EmbossType::None); + context_panel.header->emboss_set(ui::EmbossType::None); if (ID *root_id = get_current_id(&sspreadsheet)) { std::string label = BKE_id_name(*root_id); if (!context_panel.body) { diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc index f80decb97d6..36d47445877 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc @@ -149,7 +149,7 @@ static void spreadsheet_filter_panel_draw_header(const bContext *C, Panel *panel } uiLayout *row = &layout->row(true); - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); row->prop(filter_ptr, "enabled", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); if (column_name.is_empty()) { @@ -170,7 +170,7 @@ static void spreadsheet_filter_panel_draw_header(const bContext *C, Panel *panel } row = &layout->row(true); - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); const int current_index = BLI_findindex(&sspreadsheet->row_filters, filter); PointerRNA op_ptr = row->op("SPREADSHEET_OT_remove_row_filter_rule", "", ICON_X); RNA_int_set(&op_ptr, "index", current_index); diff --git a/source/blender/editors/space_view3d/view3d_buttons.cc b/source/blender/editors/space_view3d/view3d_buttons.cc index bcc4f2f9bbc..46526b74da0 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.cc +++ b/source/blender/editors/space_view3d/view3d_buttons.cc @@ -1604,7 +1604,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) colsub = &split->column(true); colsub->prop(ptr, "location", UI_ITEM_NONE, std::nullopt, ICON_NONE); colsub = &split->column(true); - uiLayoutSetEmboss(colsub, blender::ui::EmbossType::NoneOrStatus); + colsub->emboss_set(blender::ui::EmbossType::NoneOrStatus); colsub->label("", ICON_NONE); colsub->prop( ptr, "lock_location", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_DECORATE_UNLOCKED); @@ -1616,7 +1616,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) colsub = &split->column(true); colsub->prop(ptr, "rotation_quaternion", UI_ITEM_NONE, IFACE_("Rotation"), ICON_NONE); colsub = &split->column(true); - uiLayoutSetEmboss(colsub, blender::ui::EmbossType::NoneOrStatus); + colsub->emboss_set(blender::ui::EmbossType::NoneOrStatus); colsub->prop(ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE); if (RNA_boolean_get(ptr, "lock_rotations_4d")) { colsub->prop(ptr, @@ -1638,7 +1638,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) colsub = &split->column(true); colsub->prop(ptr, "rotation_axis_angle", UI_ITEM_NONE, IFACE_("Rotation"), ICON_NONE); colsub = &split->column(true); - uiLayoutSetEmboss(colsub, blender::ui::EmbossType::NoneOrStatus); + colsub->emboss_set(blender::ui::EmbossType::NoneOrStatus); colsub->prop(ptr, "lock_rotations_4d", UI_ITEM_R_TOGGLE, IFACE_("4L"), ICON_NONE); if (RNA_boolean_get(ptr, "lock_rotations_4d")) { colsub->prop(ptr, @@ -1660,7 +1660,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) colsub = &split->column(true); colsub->prop(ptr, "rotation_euler", UI_ITEM_NONE, IFACE_("Rotation"), ICON_NONE); colsub = &split->column(true); - uiLayoutSetEmboss(colsub, blender::ui::EmbossType::NoneOrStatus); + colsub->emboss_set(blender::ui::EmbossType::NoneOrStatus); colsub->label("", ICON_NONE); colsub->prop(ptr, "lock_rotation", @@ -1675,7 +1675,7 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr) colsub = &split->column(true); colsub->prop(ptr, "scale", UI_ITEM_NONE, std::nullopt, ICON_NONE); colsub = &split->column(true); - uiLayoutSetEmboss(colsub, blender::ui::EmbossType::NoneOrStatus); + colsub->emboss_set(blender::ui::EmbossType::NoneOrStatus); colsub->label("", ICON_NONE); colsub->prop( ptr, "lock_scale", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_DECORATE_UNLOCKED); diff --git a/source/blender/makesrna/intern/rna_ui.cc b/source/blender/makesrna/intern/rna_ui.cc index ae442e13131..ddb8c5598b4 100644 --- a/source/blender/makesrna/intern/rna_ui.cc +++ b/source/blender/makesrna/intern/rna_ui.cc @@ -1500,12 +1500,12 @@ static void rna_UILayout_units_y_set(PointerRNA *ptr, float value) static int rna_UILayout_emboss_get(PointerRNA *ptr) { - return int(uiLayoutGetEmboss(static_cast(ptr->data))); + return int(static_cast(ptr->data)->emboss()); } static void rna_UILayout_emboss_set(PointerRNA *ptr, int value) { - uiLayoutSetEmboss(static_cast(ptr->data), blender::ui::EmbossType(value)); + static_cast(ptr->data)->emboss_set(blender::ui::EmbossType(value)); } static bool rna_UILayout_property_split_get(PointerRNA *ptr) diff --git a/source/blender/modifiers/intern/MOD_ui_common.cc b/source/blender/modifiers/intern/MOD_ui_common.cc index 613c07a7fd4..8937b7615c7 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.cc +++ b/source/blender/modifiers/intern/MOD_ui_common.cc @@ -322,7 +322,7 @@ static void modifier_panel_header(const bContext *C, Panel *panel) /* Modifier Icon. */ sub = &layout->row(true); - uiLayoutSetEmboss(sub, blender::ui::EmbossType::None); + sub->emboss_set(blender::ui::EmbossType::None); if (mti->is_disabled && mti->is_disabled(scene, md, false)) { uiLayoutSetRedAlert(sub, true); } @@ -422,7 +422,7 @@ static void modifier_panel_header(const bContext *C, Panel *panel) /* Delete button. */ if (modifier_can_delete(md) && !modifier_is_simulation(md)) { sub = &row->row(false); - uiLayoutSetEmboss(sub, blender::ui::EmbossType::None); + sub->emboss_set(blender::ui::EmbossType::None); sub->op("OBJECT_OT_modifier_remove", "", ICON_X); buttons_number++; } diff --git a/source/blender/nodes/NOD_socket_items_ui.hh b/source/blender/nodes/NOD_socket_items_ui.hh index 31eb0753da5..6ce0c708ca3 100644 --- a/source/blender/nodes/NOD_socket_items_ui.hh +++ b/source/blender/nodes/NOD_socket_items_ui.hh @@ -39,7 +39,7 @@ static void draw_item_in_list(uiList * /*ui_list*/, RNA_float_get_array(itemptr, "color", color); uiTemplateNodeSocket(row, const_cast(C), color); } - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); row->prop(itemptr, "name", UI_ITEM_NONE, "", ICON_NONE); } diff --git a/source/blender/shader_fx/intern/FX_ui_common.cc b/source/blender/shader_fx/intern/FX_ui_common.cc index e8af11c3ccb..2273deb8ac1 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.cc +++ b/source/blender/shader_fx/intern/FX_ui_common.cc @@ -191,7 +191,7 @@ static void shaderfx_panel_header(const bContext * /*C*/, Panel *panel) row->menu_fn("", ICON_DOWNARROW_HLT, gpencil_shaderfx_ops_extra_draw, fx); row = &row->row(false); - uiLayoutSetEmboss(row, blender::ui::EmbossType::None); + row->emboss_set(blender::ui::EmbossType::None); row->op("OBJECT_OT_shaderfx_remove", "", ICON_X); /* Some padding so the X isn't too close to the drag icon. */