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 cc0e9eac988..81d19b13ccd 100644 --- a/source/blender/editors/asset/intern/asset_shelf_catalog_selector.cc +++ b/source/blender/editors/asset/intern/asset_shelf_catalog_selector.cc @@ -191,7 +191,7 @@ void library_selector_draw(const bContext *C, uiLayout *layout, AssetShelf &shel uiLayout *row = &layout->row(true); row->prop(&shelf_ptr, "asset_library_reference", UI_ITEM_NONE, "", ICON_NONE); if (shelf.settings.asset_library_reference.type != ASSET_LIBRARY_LOCAL) { - uiItemO(row, "", ICON_FILE_REFRESH, "ASSET_OT_library_refresh"); + row->op("ASSET_OT_library_refresh", "", ICON_FILE_REFRESH); } } diff --git a/source/blender/editors/include/UI_interface_layout.hh b/source/blender/editors/include/UI_interface_layout.hh index edb09677910..5a7a4e030fc 100644 --- a/source/blender/editors/include/UI_interface_layout.hh +++ b/source/blender/editors/include/UI_interface_layout.hh @@ -242,6 +242,13 @@ struct uiLayout : uiItem { /** Adds a label item that will display text and/or icon in the layout. */ void label(blender::StringRef name, int icon); + /** + * Adds a operator item, places a button in the layout to call the operator. + * \param opname: Operator id name. + * \param name: Text to show in the layout. + */ + void op(blender::StringRefNull opname, std::optional name, int icon); + /** * Adds a RNA property item, and exposes it into the layout. * \param ptr: RNA pointer to the struct owner of \a prop. @@ -440,10 +447,7 @@ enum class LayoutSeparatorType : int8_t { }; /* items */ -void uiItemO(uiLayout *layout, - std::optional name, - int icon, - blender::StringRefNull opname); + void uiItemEnumO_ptr(uiLayout *layout, wmOperatorType *ot, std::optional name, diff --git a/source/blender/editors/interface/interface_context_menu.cc b/source/blender/editors/interface/interface_context_menu.cc index 8bb91857eb9..a76f5c07c82 100644 --- a/source/blender/editors/interface/interface_context_menu.cc +++ b/source/blender/editors/interface/interface_context_menu.cc @@ -763,15 +763,13 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev true); } else { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Driver"), - ICON_NONE, - "ANIM_OT_copy_driver_button"); + layout->op("ANIM_OT_copy_driver_button", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Driver"), + ICON_NONE); if (ANIM_driver_can_paste()) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"), - ICON_NONE, - "ANIM_OT_paste_driver_button"); + layout->op("ANIM_OT_paste_driver_button", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"), + ICON_NONE); } uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Driver to Selected"), @@ -789,16 +787,14 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev true); } - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Edit Driver"), - ICON_DRIVER, - "ANIM_OT_driver_button_edit"); + layout->op("ANIM_OT_driver_button_edit", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Edit Driver"), + ICON_DRIVER); } - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"), - ICON_NONE, - "SCREEN_OT_drivers_editor_show"); + layout->op("SCREEN_OT_drivers_editor_show", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"), + ICON_NONE); } else if (but->flag & (UI_BUT_ANIMATED_KEY | UI_BUT_ANIMATED)) { /* pass */ @@ -806,24 +802,21 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev else if (is_anim) { uiItemS(layout); - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Driver"), - ICON_DRIVER, - "ANIM_OT_driver_button_add"); + layout->op("ANIM_OT_driver_button_add", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Add Driver"), + ICON_DRIVER); if (!is_whole_array) { if (ANIM_driver_can_paste()) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"), - ICON_NONE, - "ANIM_OT_paste_driver_button"); + layout->op("ANIM_OT_paste_driver_button", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Paste Driver"), + ICON_NONE); } } - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"), - ICON_NONE, - "SCREEN_OT_drivers_editor_show"); + layout->op("SCREEN_OT_drivers_editor_show", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Open Drivers Editor"), + ICON_NONE); } /* Keying Sets */ @@ -844,10 +837,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev "ANIM_OT_keyingset_button_add", "all", 0); - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"), - ICON_NONE, - "ANIM_OT_keyingset_button_remove"); + layout->op("ANIM_OT_keyingset_button_remove", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"), + ICON_NONE); } else { uiItemBooleanO(layout, @@ -856,10 +848,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev "ANIM_OT_keyingset_button_add", "all", 1); - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"), - ICON_NONE, - "ANIM_OT_keyingset_button_remove"); + layout->op("ANIM_OT_keyingset_button_remove", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Remove from Keying Set"), + ICON_NONE); } } @@ -986,10 +977,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev } if (is_idprop && !is_array && ELEM(type, PROP_INT, PROP_FLOAT)) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Assign Value as Default"), - ICON_NONE, - "UI_OT_assign_default_button"); + layout->op("UI_OT_assign_default_button", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Assign Value as Default"), + ICON_NONE); uiItemS(layout); } @@ -1017,10 +1007,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev true); } - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Data Path"), - ICON_NONE, - "UI_OT_copy_data_path_button"); + layout->op("UI_OT_copy_data_path_button", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Data Path"), + ICON_NONE); uiItemBooleanO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy Full Data Path"), ICON_NONE, @@ -1031,10 +1020,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev if (ptr->owner_id && !is_whole_array && ELEM(type, PROP_BOOLEAN, PROP_INT, PROP_FLOAT, PROP_ENUM)) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy as New Driver"), - ICON_NONE, - "UI_OT_copy_as_driver_button"); + layout->op("UI_OT_copy_as_driver_button", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy as New Driver"), + ICON_NONE); } uiItemS(layout); @@ -1110,16 +1098,14 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev * which isn't cheap to check. */ uiLayout *sub = &layout->column(true); uiLayoutSetEnabled(sub, !id->asset_data); - uiItemO(sub, + sub->op("ASSET_OT_mark_single", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Mark as Asset"), - ICON_ASSET_MANAGER, - "ASSET_OT_mark_single"); + ICON_ASSET_MANAGER); sub = &layout->column(true); uiLayoutSetEnabled(sub, id->asset_data); - uiItemO(sub, + sub->op("ASSET_OT_clear_single", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Clear Asset"), - ICON_NONE, - "ASSET_OT_clear_single"); + ICON_NONE); uiItemS(layout); } @@ -1140,10 +1126,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev ((uiButSearch *)but)->items_update_fn == ui_rna_collection_search_update_fn)) && ui_jump_to_target_button_poll(C)) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Jump to Target"), - ICON_NONE, - "UI_OT_jump_to_target_button"); + layout->op("UI_OT_jump_to_target_button", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Jump to Target"), + ICON_NONE); uiItemS(layout); } } @@ -1324,10 +1309,9 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev { /* Docs */ if (std::optional manual_id = UI_but_online_manual_id(but)) { PointerRNA ptr_props; - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Manual"), - ICON_URL, - "WM_OT_doc_view_manual_ui_context"); + layout->op("WM_OT_doc_view_manual_ui_context", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Manual"), + ICON_URL); if (U.flag & USER_DEVELOPER_UI) { uiItemFullO(layout, @@ -1344,7 +1328,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev } if (but->optype && U.flag & USER_DEVELOPER_UI) { - uiItemO(layout, std::nullopt, ICON_NONE, "UI_OT_copy_python_command_button"); + layout->op("UI_OT_copy_python_command_button", std::nullopt, ICON_NONE); } /* perhaps we should move this into (G.debug & G_DEBUG) - campbell */ diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index 0a416083949..f673dc1106d 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -1887,13 +1887,9 @@ void uiItemStringO(uiLayout *layout, nullptr); } -void uiItemO(uiLayout *layout, - const std::optional name, - int icon, - const StringRefNull opname) +void uiLayout::op(const StringRefNull opname, const std::optional name, int icon) { - uiItemFullO( - layout, opname, name, icon, nullptr, layout->root_->opcontext, UI_ITEM_NONE, nullptr); + uiItemFullO(this, opname, name, icon, nullptr, root_->opcontext, UI_ITEM_NONE, nullptr); } /* RNA property items */ diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc index 2b4a3bbd602..8c2d2c40a97 100644 --- a/source/blender/editors/interface/interface_ops.cc +++ b/source/blender/editors/interface/interface_ops.cc @@ -1011,9 +1011,9 @@ static bool override_idtemplate_menu_poll(const bContext *C_const, MenuType * /* static void override_idtemplate_menu_draw(const bContext * /*C*/, Menu *menu) { uiLayout *layout = menu->layout; - uiItemO(layout, IFACE_("Make"), ICON_NONE, "UI_OT_override_idtemplate_make"); - uiItemO(layout, IFACE_("Reset"), ICON_NONE, "UI_OT_override_idtemplate_reset"); - uiItemO(layout, IFACE_("Clear"), ICON_NONE, "UI_OT_override_idtemplate_clear"); + layout->op("UI_OT_override_idtemplate_make", IFACE_("Make"), ICON_NONE); + layout->op("UI_OT_override_idtemplate_reset", IFACE_("Reset"), ICON_NONE); + layout->op("UI_OT_override_idtemplate_clear", IFACE_("Clear"), ICON_NONE); } static void override_idtemplate_menu() diff --git a/source/blender/editors/interface/templates/interface_template_asset_view.cc b/source/blender/editors/interface/templates/interface_template_asset_view.cc index 6bfe2d57d43..532e8e6aa08 100644 --- a/source/blender/editors/interface/templates/interface_template_asset_view.cc +++ b/source/blender/editors/interface/templates/interface_template_asset_view.cc @@ -248,7 +248,7 @@ void uiTemplateAssetView(uiLayout *layout, row->prop( asset_library_dataptr, asset_library_prop, RNA_NO_INDEX, 0, UI_ITEM_NONE, "", ICON_NONE); if (asset_library_ref.type != ASSET_LIBRARY_LOCAL) { - uiItemO(row, "", ICON_FILE_REFRESH, "ASSET_OT_library_refresh"); + row->op("ASSET_OT_library_refresh", "", ICON_FILE_REFRESH); } } diff --git a/source/blender/editors/interface/templates/interface_template_cache_file.cc b/source/blender/editors/interface/templates/interface_template_cache_file.cc index f865f9335fa..c00d377b9f7 100644 --- a/source/blender/editors/interface/templates/interface_template_cache_file.cc +++ b/source/blender/editors/interface/templates/interface_template_cache_file.cc @@ -180,14 +180,14 @@ void uiTemplateCacheFileLayers(uiLayout *layout, const bContext *C, PointerRNA * UI_TEMPLATE_LIST_FLAG_NONE); col = &row->column(true); - uiItemO(col, "", ICON_ADD, "cachefile.layer_add"); - uiItemO(col, "", ICON_REMOVE, "cachefile.layer_remove"); + col->op("cachefile.layer_add", "", ICON_ADD); + col->op("cachefile.layer_remove", "", ICON_REMOVE); CacheFile *file = static_cast(fileptr->data); if (BLI_listbase_count(&file->layers) > 1) { uiItemS_ex(col, 1.0f); - uiItemO(col, "", ICON_TRIA_UP, "cachefile.layer_move"); - uiItemO(col, "", ICON_TRIA_DOWN, "cachefile.layer_move"); + col->op("cachefile.layer_move", "", ICON_TRIA_UP); + col->op("cachefile.layer_move", "", ICON_TRIA_DOWN); } } @@ -250,7 +250,7 @@ void uiTemplateCacheFile(uiLayout *layout, row = &layout->row(true); row->prop(&fileptr, "filepath", UI_ITEM_NONE, std::nullopt, ICON_NONE); sub = &row->row(true); - uiItemO(sub, "", ICON_FILE_REFRESH, "cachefile.reload"); + sub->op("cachefile.reload", "", ICON_FILE_REFRESH); if (sbuts->mainb == BCONTEXT_CONSTRAINT) { row = &layout->row(false); diff --git a/source/blender/editors/interface/templates/interface_template_color_ramp.cc b/source/blender/editors/interface/templates/interface_template_color_ramp.cc index 0141e3d7ff9..083bf559c81 100644 --- a/source/blender/editors/interface/templates/interface_template_color_ramp.cc +++ b/source/blender/editors/interface/templates/interface_template_color_ramp.cc @@ -152,7 +152,7 @@ static uiBlock *colorband_tools_fn(bContext *C, ARegion *region, void *cb_v) uiItemS(layout); - uiItemO(layout, IFACE_("Eyedropper"), ICON_EYEDROPPER, "UI_OT_eyedropper_colorramp"); + layout->op("UI_OT_eyedropper_colorramp", IFACE_("Eyedropper"), ICON_EYEDROPPER); uiItemS(layout); diff --git a/source/blender/editors/interface/templates/interface_template_constraint.cc b/source/blender/editors/interface/templates/interface_template_constraint.cc index ab630de5eb9..afa013ad6cd 100644 --- a/source/blender/editors/interface/templates/interface_template_constraint.cc +++ b/source/blender/editors/interface/templates/interface_template_constraint.cc @@ -52,21 +52,18 @@ static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v uiLayoutSetUnitsX(layout, 4.0f); /* Apply. */ - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), - ICON_CHECKMARK, - "CONSTRAINT_OT_apply"); + layout->op("CONSTRAINT_OT_apply", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), + ICON_CHECKMARK); /* Duplicate. */ - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), - ICON_DUPLICATE, - "CONSTRAINT_OT_copy"); + layout->op("CONSTRAINT_OT_copy", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), + ICON_DUPLICATE); - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy to Selected"), - 0, - "CONSTRAINT_OT_copy_to_selected"); + layout->op("CONSTRAINT_OT_copy_to_selected", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy to Selected"), + 0); uiItemS(layout); @@ -144,7 +141,7 @@ static void draw_constraint_header(uiLayout *layout, Object *ob, bConstraint *co sub = &row->row(false); uiLayoutSetEmboss(sub, blender::ui::EmbossType::None); uiLayoutSetOperatorContext(sub, WM_OP_INVOKE_DEFAULT); - uiItemO(sub, "", ICON_X, "CONSTRAINT_OT_delete"); + sub->op("CONSTRAINT_OT_delete", "", ICON_X); /* Some extra padding at the end, so the 'x' icon isn't too close to drag button. */ uiItemS(layout); 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 8f1c881f516..95e45047f31 100644 --- a/source/blender/editors/interface/templates/interface_template_operator_property.cc +++ b/source/blender/editors/interface/templates/interface_template_operator_property.cc @@ -325,7 +325,7 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, const bContext *C) #if 0 if (has_advanced) { - uiItemO(layout, IFACE_("More..."), ICON_NONE, "SCREEN_OT_redo_last"); + layout->op( "SCREEN_OT_redo_last", IFACE_("More..."), ICON_NONE); } #endif } @@ -448,7 +448,7 @@ void uiTemplateCollectionExporters(uiLayout *layout, bContext *C) uiItemIntO(col, "", ICON_REMOVE, "COLLECTION_OT_exporter_remove", "index", index); col = &layout->column(true); - uiItemO(col, std::nullopt, ICON_EXPORT, "COLLECTION_OT_export_all"); + col->op("COLLECTION_OT_export_all", std::nullopt, ICON_EXPORT); uiLayoutSetEnabled(col, !BLI_listbase_is_empty(exporters)); /* Draw the active exporter. */ diff --git a/source/blender/editors/interface/templates/interface_template_status.cc b/source/blender/editors/interface/templates/interface_template_status.cc index b3f3a8118e4..12ce2685f3b 100644 --- a/source/blender/editors/interface/templates/interface_template_status.cc +++ b/source/blender/editors/interface/templates/interface_template_status.cc @@ -422,7 +422,7 @@ void uiTemplateStatusInfo(uiLayout *layout, bContext *C) } uiLayoutSetEmboss(row, blender::ui::EmbossType::None); /* This operator also works fine for blocked extensions. */ - uiItemO(row, "", ICON_ERROR, "EXTENSIONS_OT_userpref_show_for_update"); + row->op("EXTENSIONS_OT_userpref_show_for_update", "", ICON_ERROR); uiBut *but = uiLayoutGetBlock(layout)->buttons.last().get(); uchar color[4]; UI_GetThemeColor4ubv(TH_TEXT, color); @@ -447,7 +447,7 @@ void uiTemplateStatusInfo(uiLayout *layout, bContext *C) } else { uiLayoutSetEmboss(row, blender::ui::EmbossType::None); - uiItemO(row, "", ICON_INTERNET_OFFLINE, "EXTENSIONS_OT_userpref_show_online"); + row->op("EXTENSIONS_OT_userpref_show_online", "", ICON_INTERNET_OFFLINE); uiBut *but = uiLayoutGetBlock(layout)->buttons.last().get(); uchar color[4]; UI_GetThemeColor4ubv(TH_TEXT, color); @@ -471,7 +471,7 @@ void uiTemplateStatusInfo(uiLayout *layout, bContext *C) uiItemS_ex(row, -0.5f); } uiLayoutSetEmboss(row, blender::ui::EmbossType::None); - uiItemO(row, "", icon, "EXTENSIONS_OT_userpref_show_for_update"); + row->op("EXTENSIONS_OT_userpref_show_for_update", "", icon); uiBut *but = uiLayoutGetBlock(layout)->buttons.last().get(); uchar color[4]; UI_GetThemeColor4ubv(TH_TEXT, color); diff --git a/source/blender/editors/object/object_relations.cc b/source/blender/editors/object/object_relations.cc index c1bfd6325af..7e5163f426a 100644 --- a/source/blender/editors/object/object_relations.cc +++ b/source/blender/editors/object/object_relations.cc @@ -1011,8 +1011,7 @@ static wmOperatorStatus parent_set_invoke_menu(bContext *C, wmOperatorType *ot) } else if (parent->type == OB_MESH) { if (can_support.attach_surface) { - uiItemO( - layout, IFACE_("Object (Attach Curves to Surface)"), ICON_NONE, "CURVES_OT_surface_set"); + layout->op("CURVES_OT_surface_set", IFACE_("Object (Attach Curves to Surface)"), ICON_NONE); } } diff --git a/source/blender/editors/screen/screen_ops.cc b/source/blender/editors/screen/screen_ops.cc index 7be8031ba4f..239ca01e969 100644 --- a/source/blender/editors/screen/screen_ops.cc +++ b/source/blender/editors/screen/screen_ops.cc @@ -5186,10 +5186,9 @@ static void screen_area_menu_items(ScrArea *area, uiLayout *layout) uiItemS(layout); - uiItemO(layout, - area->full ? IFACE_("Restore Areas") : IFACE_("Maximize Area"), - ICON_NONE, - "SCREEN_OT_screen_full_area"); + layout->op("SCREEN_OT_screen_full_area", + area->full ? IFACE_("Restore Areas") : IFACE_("Maximize Area"), + ICON_NONE); if (area->spacetype != SPACE_FILE && !area->full) { uiItemFullO(layout, @@ -5203,9 +5202,9 @@ static void screen_area_menu_items(ScrArea *area, uiLayout *layout) RNA_boolean_set(&ptr, "use_hide_panels", true); } - uiItemO(layout, std::nullopt, ICON_NONE, "SCREEN_OT_area_dupli"); + layout->op("SCREEN_OT_area_dupli", std::nullopt, ICON_NONE); uiItemS(layout); - uiItemO(layout, std::nullopt, ICON_X, "SCREEN_OT_area_close"); + layout->op("SCREEN_OT_area_close", std::nullopt, ICON_X); } void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void * /*arg*/) @@ -5227,10 +5226,9 @@ void ED_screens_header_tools_menu_create(bContext *C, uiLayout *layout, void * / &ptr, "show_region_tool_header", UI_ITEM_NONE, IFACE_("Show Tool Settings"), ICON_NONE); } - uiItemO(col, + col->op("SCREEN_OT_header_toggle_menus", IFACE_("Show Menus"), - (area->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT, - "SCREEN_OT_header_toggle_menus"); + (area->flag & HEADER_NO_PULLDOWN) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT); } if (!ELEM(area->spacetype, SPACE_TOPBAR)) { @@ -5268,7 +5266,7 @@ void ED_screens_region_flip_menu_create(bContext *C, uiLayout *layout, void * /* /* default is WM_OP_INVOKE_REGION_WIN, which we don't want here. */ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); - uiItemO(layout, but_flip_str, ICON_NONE, "SCREEN_OT_region_flip"); + layout->op("SCREEN_OT_region_flip", but_flip_str, ICON_NONE); } static void ed_screens_statusbar_menu_create(uiLayout *layout, void * /*arg*/) @@ -5318,7 +5316,7 @@ static wmOperatorStatus screen_context_menu_invoke(bContext *C, /* We need WM_OP_INVOKE_DEFAULT in case menu item is over another area. */ uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); - uiItemO(layout, IFACE_("Hide"), ICON_NONE, "SCREEN_OT_region_toggle"); + layout->op("SCREEN_OT_region_toggle", IFACE_("Hide"), ICON_NONE); ED_screens_region_flip_menu_create(C, layout, nullptr); const ScrArea *area = CTX_wm_area(C); diff --git a/source/blender/editors/screen/workspace_edit.cc b/source/blender/editors/screen/workspace_edit.cc index 1d1a73fa14d..91795988ca4 100644 --- a/source/blender/editors/screen/workspace_edit.cc +++ b/source/blender/editors/screen/workspace_edit.cc @@ -544,10 +544,9 @@ static wmOperatorStatus workspace_add_invoke(bContext *C, BLI_freelistN(&templates); uiItemS(layout); - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate Current"), - ICON_DUPLICATE, - "WORKSPACE_OT_duplicate"); + layout->op("WORKSPACE_OT_duplicate", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate Current"), + ICON_DUPLICATE); UI_popup_menu_end(C, pup); diff --git a/source/blender/editors/space_buttons/buttons_context.cc b/source/blender/editors/space_buttons/buttons_context.cc index e2c810448e6..2c876f62b7b 100644 --- a/source/blender/editors/space_buttons/buttons_context.cc +++ b/source/blender/editors/space_buttons/buttons_context.cc @@ -1259,10 +1259,8 @@ static void buttons_panel_context_draw(const bContext *C, Panel *panel) uiLayoutSetAlignment(pin_row, UI_LAYOUT_ALIGN_RIGHT); uiItemSpacer(pin_row); uiLayoutSetEmboss(pin_row, blender::ui::EmbossType::None); - uiItemO(pin_row, - "", - (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED, - "BUTTONS_OT_toggle_pin"); + pin_row->op( + "BUTTONS_OT_toggle_pin", "", (sbuts->flag & SB_PIN_CONTEXT) ? ICON_PINNED : ICON_UNPINNED); } void buttons_context_register(ARegionType *art) diff --git a/source/blender/editors/space_clip/clip_buttons.cc b/source/blender/editors/space_clip/clip_buttons.cc index 8999c8b5f7a..bbe0de30e2b 100644 --- a/source/blender/editors/space_clip/clip_buttons.cc +++ b/source/blender/editors/space_clip/clip_buttons.cc @@ -135,7 +135,7 @@ void uiTemplateMovieClip(uiLayout *layout, row = &split->row(true); row->prop(&clipptr, "filepath", UI_ITEM_NONE, "", ICON_NONE); - uiItemO(row, "", ICON_FILE_REFRESH, "clip.reload"); + row->op("clip.reload", "", ICON_FILE_REFRESH); uiLayout *col = &layout->column(false); uiTemplateColorspaceSettings(col, &clipptr, "colorspace_settings"); diff --git a/source/blender/editors/space_file/asset_catalog_tree_view.cc b/source/blender/editors/space_file/asset_catalog_tree_view.cc index 9572b1527a5..e0d78b12e62 100644 --- a/source/blender/editors/space_file/asset_catalog_tree_view.cc +++ b/source/blender/editors/space_file/asset_catalog_tree_view.cc @@ -315,7 +315,7 @@ void AssetCatalogTreeViewItem::build_context_menu(bContext &C, uiLayout &column) UI_ITEM_NONE, &props); RNA_string_set(&props, "catalog_id", catalog_item_.get_catalog_id().str().c_str()); - uiItemO(&column, IFACE_("Rename"), ICON_NONE, "UI_OT_view_item_rename"); + column.op("UI_OT_view_item_rename", IFACE_("Rename"), ICON_NONE); /* Doesn't actually exist right now, but could be defined in Python. Reason that this isn't done * in Python yet is that catalogs are not exposed in BPY, and we'd somehow pass the clicked on diff --git a/source/blender/editors/space_file/file_panels.cc b/source/blender/editors/space_file/file_panels.cc index 27b46604fec..718ab27bb89 100644 --- a/source/blender/editors/space_file/file_panels.cc +++ b/source/blender/editors/space_file/file_panels.cc @@ -112,7 +112,7 @@ static void file_panel_execution_cancel_button(uiLayout *layout) uiLayout *row = &layout->row(false); uiLayoutSetScaleX(row, 0.8f); uiLayoutSetFixedSize(row, true); - uiItemO(row, IFACE_("Cancel"), ICON_NONE, "FILE_OT_cancel"); + row->op("FILE_OT_cancel", IFACE_("Cancel"), ICON_NONE); } static void file_panel_execution_execute_button(uiLayout *layout, const char *title) @@ -122,7 +122,7 @@ static void file_panel_execution_execute_button(uiLayout *layout, const char *ti uiLayoutSetFixedSize(row, true); /* Just a display hint. */ uiLayoutSetActiveDefault(row, true); - uiItemO(row, title, ICON_NONE, "FILE_OT_execute"); + row->op("FILE_OT_execute", title, ICON_NONE); } static void file_panel_execution_buttons_draw(const bContext *C, Panel *panel) @@ -249,7 +249,7 @@ static void file_panel_asset_catalog_buttons_draw(const bContext *C, Panel *pane CTX_free(mutable_ctx); } else { - uiItemO(row, "", ICON_FILE_REFRESH, "ASSET_OT_library_refresh"); + row->op("ASSET_OT_library_refresh", "", ICON_FILE_REFRESH); } uiItemS(col); diff --git a/source/blender/editors/space_graph/graph_buttons.cc b/source/blender/editors/space_graph/graph_buttons.cc index 9f558022deb..c9958b97c9d 100644 --- a/source/blender/editors/space_graph/graph_buttons.cc +++ b/source/blender/editors/space_graph/graph_buttons.cc @@ -156,8 +156,8 @@ static void graph_panel_cursor(const bContext *C, Panel *panel) sub->prop(&spaceptr, "cursor_position_y", UI_ITEM_NONE, IFACE_("Y"), ICON_NONE); sub = &col->column(true); - uiItemO(sub, IFACE_("Cursor to Selection"), ICON_NONE, "GRAPH_OT_frame_jump"); - uiItemO(sub, IFACE_("Cursor Value to Selection"), ICON_NONE, "GRAPH_OT_snap_cursor_value"); + sub->op("GRAPH_OT_frame_jump", IFACE_("Cursor to Selection"), ICON_NONE); + sub->op("GRAPH_OT_snap_cursor_value", IFACE_("Cursor Value to Selection"), ICON_NONE); } /** \} */ @@ -1119,15 +1119,15 @@ static void graph_draw_driver_settings_panel(uiLayout *layout, if (is_popover) { /* add driver variable - add using eyedropper */ /* XXX: will this operator work like this? */ - uiItemO(row, "", ICON_EYEDROPPER, "UI_OT_eyedropper_driver"); + row->op("UI_OT_eyedropper_driver", "", ICON_EYEDROPPER); } /* copy/paste (as sub-row) */ row = &row_outer->row(true); block = uiLayoutGetBlock(row); - uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_driver_variables_copy"); - uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_driver_variables_paste"); + row->op("GRAPH_OT_driver_variables_copy", "", ICON_COPYDOWN); + row->op("GRAPH_OT_driver_variables_paste", "", ICON_PASTEDOWN); /* loop over targets, drawing them */ LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) { @@ -1371,7 +1371,7 @@ static void graph_panel_drivers_popover(const bContext *C, Panel *panel) } /* Show drivers editor is always visible */ - uiItemO(layout, IFACE_("Show in Drivers Editor"), ICON_DRIVER, "SCREEN_OT_drivers_editor_show"); + layout->op("SCREEN_OT_drivers_editor_show", IFACE_("Show in Drivers Editor"), ICON_DRIVER); } /** \} */ @@ -1429,8 +1429,8 @@ static void graph_panel_modifiers(const bContext *C, Panel *panel) /* copy/paste (as sub-row) */ row = &row->row(true); - uiItemO(row, "", ICON_COPYDOWN, "GRAPH_OT_fmodifier_copy"); - uiItemO(row, "", ICON_PASTEDOWN, "GRAPH_OT_fmodifier_paste"); + row->op("GRAPH_OT_fmodifier_copy", "", ICON_COPYDOWN); + row->op("GRAPH_OT_fmodifier_paste", "", ICON_PASTEDOWN); } ANIM_fmodifier_panels(C, ale->fcurve_owner_id, &fcu->modifiers, graph_fmodifier_panel_id); diff --git a/source/blender/editors/space_image/image_buttons.cc b/source/blender/editors/space_image/image_buttons.cc index 87137c549bd..48a3bc8bcaf 100644 --- a/source/blender/editors/space_image/image_buttons.cc +++ b/source/blender/editors/space_image/image_buttons.cc @@ -810,8 +810,8 @@ void uiTemplateImage(uiLayout *layout, const bool is_dirty = BKE_image_is_dirty(ima); if (is_dirty) { uiLayout *row = &layout->row(true); - uiItemO(row, IFACE_("Save"), ICON_NONE, "image.save"); - uiItemO(row, IFACE_("Discard"), ICON_NONE, "image.reload"); + row->op("image.save", IFACE_("Save"), ICON_NONE); + row->op("image.reload", IFACE_("Discard"), ICON_NONE); uiItemS(layout); } @@ -835,10 +835,10 @@ void uiTemplateImage(uiLayout *layout, uiLayout *row = &layout->row(true); if (is_packed) { - uiItemO(row, "", ICON_PACKAGE, "image.unpack"); + row->op("image.unpack", "", ICON_PACKAGE); } else { - uiItemO(row, "", ICON_UGLYPACKAGE, "image.pack"); + row->op("image.pack", "", ICON_UGLYPACKAGE); } row = &row->row(true); @@ -846,8 +846,8 @@ void uiTemplateImage(uiLayout *layout, prop = RNA_struct_find_property(&imaptr, "filepath"); uiDefAutoButR(block, &imaptr, prop, -1, "", ICON_NONE, 0, 0, 200, UI_UNIT_Y); - uiItemO(row, "", ICON_FILEBROWSER, "image.file_browse"); - uiItemO(row, "", ICON_FILE_REFRESH, "image.reload"); + row->op("image.file_browse", "", ICON_FILEBROWSER); + row->op("image.reload", "", ICON_FILE_REFRESH); } /* Image layers and Info */ @@ -892,7 +892,7 @@ void uiTemplateImage(uiLayout *layout, uiLayout *sub = &col->column(true); uiLayout *row = &sub->row(true); row->prop(userptr, "frame_duration", UI_ITEM_NONE, IFACE_("Frames"), ICON_NONE); - uiItemO(row, "", ICON_FILE_REFRESH, "IMAGE_OT_match_movie_length"); + row->op("IMAGE_OT_match_movie_length", "", ICON_FILE_REFRESH); sub->prop(userptr, "frame_start", UI_ITEM_NONE, IFACE_("Start"), ICON_NONE); sub->prop(userptr, "frame_offset", UI_ITEM_NONE, std::nullopt, ICON_NONE); diff --git a/source/blender/editors/space_nla/nla_buttons.cc b/source/blender/editors/space_nla/nla_buttons.cc index 785d43210ff..d98c5893eec 100644 --- a/source/blender/editors/space_nla/nla_buttons.cc +++ b/source/blender/editors/space_nla/nla_buttons.cc @@ -517,7 +517,7 @@ static void nla_panel_actclip(const bContext *C, Panel *panel) row = &layout->row(false, IFACE_("Sync Length")); row->prop(&strip_ptr, "use_sync_length", UI_ITEM_NONE, "", ICON_NONE); - uiItemO(row, IFACE_("Now"), ICON_FILE_REFRESH, "NLA_OT_action_sync_length"); + row->op("NLA_OT_action_sync_length", IFACE_("Now"), ICON_FILE_REFRESH); /* action usage */ column = &layout->column(true); @@ -641,8 +641,8 @@ static void nla_panel_modifiers(const bContext *C, Panel *panel) /* copy/paste (as sub-row) */ row = &row->row(true); - uiItemO(row, "", ICON_COPYDOWN, "NLA_OT_fmodifier_copy"); - uiItemO(row, "", ICON_PASTEDOWN, "NLA_OT_fmodifier_paste"); + row->op("NLA_OT_fmodifier_copy", "", ICON_COPYDOWN); + row->op("NLA_OT_fmodifier_paste", "", ICON_PASTEDOWN); } ANIM_fmodifier_panels(C, strip_ptr.owner_id, &strip->modifiers, nla_fmodifier_panel_id); diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 832489ffea0..8f49cec3739 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -611,8 +611,8 @@ static void node_composit_buts_cryptomatte_legacy_ex(uiLayout *layout, bContext * /*C*/, PointerRNA * /*ptr*/) { - uiItemO(layout, IFACE_("Add Crypto Layer"), ICON_ADD, "NODE_OT_cryptomatte_layer_add"); - uiItemO(layout, IFACE_("Remove Crypto Layer"), ICON_REMOVE, "NODE_OT_cryptomatte_layer_remove"); + layout->op("NODE_OT_cryptomatte_layer_add", IFACE_("Add Crypto Layer"), ICON_ADD); + layout->op("NODE_OT_cryptomatte_layer_remove", IFACE_("Remove Crypto Layer"), ICON_REMOVE); } static void node_composit_buts_cryptomatte(uiLayout *layout, bContext *C, PointerRNA *ptr) 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 074d62af0f2..833ce8eed8f 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_row_filter_ui.cc @@ -270,7 +270,7 @@ static void spreadsheet_row_filters_layout(const bContext *C, Panel *panel) uiLayoutSetActive(layout, false); } - uiItemO(layout, std::nullopt, ICON_ADD, "SPREADSHEET_OT_add_row_filter_rule"); + layout->op("SPREADSHEET_OT_add_row_filter_rule", std::nullopt, ICON_ADD); const bool panels_match = UI_panel_list_matches_data(region, row_filters, filter_panel_id_fn); diff --git a/source/blender/editors/space_topbar/space_topbar.cc b/source/blender/editors/space_topbar/space_topbar.cc index 87e5cbdffcc..f2800a53539 100644 --- a/source/blender/editors/space_topbar/space_topbar.cc +++ b/source/blender/editors/space_topbar/space_topbar.cc @@ -190,7 +190,7 @@ static void recent_files_menu_draw(const bContext * /*C*/, Menu *menu) uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_DEFAULT); if (uiTemplateRecentFiles(layout, U.recent_files) != 0) { uiItemS(layout); - uiItemO(layout, IFACE_("Clear Recent Files List..."), ICON_TRASH, "WM_OT_clear_recent_files"); + layout->op("WM_OT_clear_recent_files", IFACE_("Clear Recent Files List..."), ICON_TRASH); } else { layout->label(IFACE_("No Recent Files"), ICON_NONE); diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.cc b/source/blender/modifiers/intern/MOD_correctivesmooth.cc index da1f6661f19..c1c2de53a9d 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.cc +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.cc @@ -754,10 +754,9 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) layout->prop(ptr, "rest_source", UI_ITEM_NONE, std::nullopt, ICON_NONE); if (RNA_enum_get(ptr, "rest_source") == MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) { - uiItemO(layout, - (RNA_boolean_get(ptr, "is_bind") ? IFACE_("Unbind") : IFACE_("Bind")), - ICON_NONE, - "OBJECT_OT_correctivesmooth_bind"); + layout->op("OBJECT_OT_correctivesmooth_bind", + (RNA_boolean_get(ptr, "is_bind") ? IFACE_("Unbind") : IFACE_("Bind")), + ICON_NONE); } modifier_panel_end(layout, ptr); diff --git a/source/blender/modifiers/intern/MOD_datatransfer.cc b/source/blender/modifiers/intern/MOD_datatransfer.cc index 2dd0a84a21e..96ab7ff6f03 100644 --- a/source/blender/modifiers/intern/MOD_datatransfer.cc +++ b/source/blender/modifiers/intern/MOD_datatransfer.cc @@ -228,7 +228,7 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) modifier_vgroup_ui(layout, ptr, &ob_ptr, "vertex_group", "invert_vertex_group", std::nullopt); - uiItemO(layout, IFACE_("Generate Data Layers"), ICON_NONE, "OBJECT_OT_datalayout_transfer"); + layout->op("OBJECT_OT_datalayout_transfer", IFACE_("Generate Data Layers"), ICON_NONE); modifier_panel_end(layout, ptr); } diff --git a/source/blender/modifiers/intern/MOD_explode.cc b/source/blender/modifiers/intern/MOD_explode.cc index ae5fcedcb02..8209e02ab5d 100644 --- a/source/blender/modifiers/intern/MOD_explode.cc +++ b/source/blender/modifiers/intern/MOD_explode.cc @@ -1192,7 +1192,7 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) uiLayoutSetActive(row, has_vertex_group); row->prop(ptr, "protect", UI_ITEM_NONE, std::nullopt, ICON_NONE); - uiItemO(layout, IFACE_("Refresh"), ICON_NONE, "OBJECT_OT_explode_refresh"); + layout->op("OBJECT_OT_explode_refresh", IFACE_("Refresh"), ICON_NONE); modifier_panel_end(layout, ptr); } diff --git a/source/blender/modifiers/intern/MOD_grease_pencil_dash.cc b/source/blender/modifiers/intern/MOD_grease_pencil_dash.cc index 700df178d22..ee4efb4e6e8 100644 --- a/source/blender/modifiers/intern/MOD_grease_pencil_dash.cc +++ b/source/blender/modifiers/intern/MOD_grease_pencil_dash.cc @@ -419,8 +419,8 @@ static void panel_draw(const bContext *C, Panel *panel) uiLayout *col = &row->column(false); uiLayout *sub = &col->column(true); - uiItemO(sub, "", ICON_ADD, "OBJECT_OT_grease_pencil_dash_modifier_segment_add"); - uiItemO(sub, "", ICON_REMOVE, "OBJECT_OT_grease_pencil_dash_modifier_segment_remove"); + sub->op("OBJECT_OT_grease_pencil_dash_modifier_segment_add", "", ICON_ADD); + sub->op("OBJECT_OT_grease_pencil_dash_modifier_segment_remove", "", ICON_REMOVE); uiItemS(col); sub = &col->column(true); uiItemEnumO_string( diff --git a/source/blender/modifiers/intern/MOD_grease_pencil_time.cc b/source/blender/modifiers/intern/MOD_grease_pencil_time.cc index 7ef5673bebe..8bcee7f33c2 100644 --- a/source/blender/modifiers/intern/MOD_grease_pencil_time.cc +++ b/source/blender/modifiers/intern/MOD_grease_pencil_time.cc @@ -566,8 +566,8 @@ static void panel_draw(const bContext *C, Panel *panel) col = &row->column(false); uiLayout *sub = &col->column(true); - uiItemO(sub, "", ICON_ADD, "OBJECT_OT_grease_pencil_time_modifier_segment_add"); - uiItemO(sub, "", ICON_REMOVE, "OBJECT_OT_grease_pencil_time_modifier_segment_remove"); + sub->op("OBJECT_OT_grease_pencil_time_modifier_segment_add", "", ICON_ADD); + sub->op("OBJECT_OT_grease_pencil_time_modifier_segment_remove", "", ICON_REMOVE); uiItemS(col); sub = &col->column(true); uiItemEnumO_string( diff --git a/source/blender/modifiers/intern/MOD_hook.cc b/source/blender/modifiers/intern/MOD_hook.cc index e8d91ee4370..f4942437831 100644 --- a/source/blender/modifiers/intern/MOD_hook.cc +++ b/source/blender/modifiers/intern/MOD_hook.cc @@ -471,11 +471,11 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) if (RNA_enum_get(&ob_ptr, "mode") == OB_MODE_EDIT) { row = &layout->row(true); - uiItemO(row, IFACE_("Reset"), ICON_NONE, "OBJECT_OT_hook_reset"); - uiItemO(row, IFACE_("Recenter"), ICON_NONE, "OBJECT_OT_hook_recenter"); + row->op("OBJECT_OT_hook_reset", IFACE_("Reset"), ICON_NONE); + row->op("OBJECT_OT_hook_recenter", IFACE_("Recenter"), ICON_NONE); row = &layout->row(true); - uiItemO(row, IFACE_("Select"), ICON_NONE, "OBJECT_OT_hook_select"); - uiItemO(row, IFACE_("Assign"), ICON_NONE, "OBJECT_OT_hook_assign"); + row->op("OBJECT_OT_hook_select", IFACE_("Select"), ICON_NONE); + row->op("OBJECT_OT_hook_assign", IFACE_("Assign"), ICON_NONE); } modifier_panel_end(layout, ptr); diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.cc b/source/blender/modifiers/intern/MOD_laplaciandeform.cc index 4835689af29..215b1e4622a 100644 --- a/source/blender/modifiers/intern/MOD_laplaciandeform.cc +++ b/source/blender/modifiers/intern/MOD_laplaciandeform.cc @@ -802,10 +802,8 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) row = &layout->row(true); uiLayoutSetEnabled(row, has_vertex_group); - uiItemO(row, - is_bind ? IFACE_("Unbind") : IFACE_("Bind"), - ICON_NONE, - "OBJECT_OT_laplaciandeform_bind"); + row->op( + "OBJECT_OT_laplaciandeform_bind", is_bind ? IFACE_("Unbind") : IFACE_("Bind"), ICON_NONE); modifier_panel_end(layout, ptr); } diff --git a/source/blender/modifiers/intern/MOD_lineart.cc b/source/blender/modifiers/intern/MOD_lineart.cc index 1e5094a2b4e..4bde69904cb 100644 --- a/source/blender/modifiers/intern/MOD_lineart.cc +++ b/source/blender/modifiers/intern/MOD_lineart.cc @@ -668,12 +668,12 @@ static void bake_panel_draw(const bContext * /*C*/, Panel *panel) uiLayout *col = &layout->column(false); uiLayoutSetEnabled(col, !is_baked); - uiItemO(col, std::nullopt, ICON_NONE, "OBJECT_OT_lineart_bake_strokes"); + col->op("OBJECT_OT_lineart_bake_strokes", std::nullopt, ICON_NONE); uiItemBooleanO( col, IFACE_("Bake All"), ICON_NONE, "OBJECT_OT_lineart_bake_strokes", "bake_all", true); col = &layout->column(false); - uiItemO(col, std::nullopt, ICON_NONE, "OBJECT_OT_lineart_clear"); + col->op("OBJECT_OT_lineart_clear", std::nullopt, ICON_NONE); uiItemBooleanO( col, IFACE_("Clear All"), ICON_NONE, "OBJECT_OT_lineart_clear", "clear_all", true); } diff --git a/source/blender/modifiers/intern/MOD_meshdeform.cc b/source/blender/modifiers/intern/MOD_meshdeform.cc index 80e9239a2de..a3a7b52c10d 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.cc +++ b/source/blender/modifiers/intern/MOD_meshdeform.cc @@ -525,10 +525,7 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) col->prop(ptr, "precision", UI_ITEM_NONE, std::nullopt, ICON_NONE); col->prop(ptr, "use_dynamic_bind", UI_ITEM_NONE, std::nullopt, ICON_NONE); - uiItemO(layout, - is_bound ? IFACE_("Unbind") : IFACE_("Bind"), - ICON_NONE, - "OBJECT_OT_meshdeform_bind"); + layout->op("OBJECT_OT_meshdeform_bind", is_bound ? IFACE_("Unbind") : IFACE_("Bind"), ICON_NONE); modifier_panel_end(layout, ptr); } diff --git a/source/blender/modifiers/intern/MOD_multires.cc b/source/blender/modifiers/intern/MOD_multires.cc index 755b09d7269..4aecdcbbd11 100644 --- a/source/blender/modifiers/intern/MOD_multires.cc +++ b/source/blender/modifiers/intern/MOD_multires.cc @@ -374,8 +374,8 @@ static void subdivisions_panel_draw(const bContext * /*C*/, Panel *panel) uiItemS(layout); - uiItemO(layout, IFACE_("Unsubdivide"), ICON_NONE, "OBJECT_OT_multires_unsubdivide"); - uiItemO(layout, IFACE_("Delete Higher"), ICON_NONE, "OBJECT_OT_multires_higher_levels_delete"); + layout->op("OBJECT_OT_multires_unsubdivide", IFACE_("Unsubdivide"), ICON_NONE); + layout->op("OBJECT_OT_multires_higher_levels_delete", IFACE_("Delete Higher"), ICON_NONE); } static void shape_panel_draw(const bContext * /*C*/, Panel *panel) @@ -389,8 +389,8 @@ static void shape_panel_draw(const bContext * /*C*/, Panel *panel) uiLayoutSetEnabled(layout, RNA_enum_get(&ob_ptr, "mode") != OB_MODE_EDIT); row = &layout->row(false); - uiItemO(row, IFACE_("Reshape"), ICON_NONE, "OBJECT_OT_multires_reshape"); - uiItemO(row, IFACE_("Apply Base"), ICON_NONE, "OBJECT_OT_multires_base_apply"); + row->op("OBJECT_OT_multires_reshape", IFACE_("Reshape"), ICON_NONE); + row->op("OBJECT_OT_multires_base_apply", IFACE_("Apply Base"), ICON_NONE); } static void generate_panel_draw(const bContext * /*C*/, Panel *panel) @@ -404,20 +404,19 @@ static void generate_panel_draw(const bContext * /*C*/, Panel *panel) bool is_external = RNA_boolean_get(ptr, "is_external"); if (mmd->totlvl == 0) { - uiItemO( - layout, IFACE_("Rebuild Subdivisions"), ICON_NONE, "OBJECT_OT_multires_rebuild_subdiv"); + layout->op("OBJECT_OT_multires_rebuild_subdiv", IFACE_("Rebuild Subdivisions"), ICON_NONE); } col = &layout->column(false); row = &col->row(false); if (is_external) { - uiItemO(row, IFACE_("Pack External"), ICON_NONE, "OBJECT_OT_multires_external_pack"); + row->op("OBJECT_OT_multires_external_pack", IFACE_("Pack External"), ICON_NONE); uiLayoutSetPropSep(col, true); row = &col->row(false); row->prop(ptr, "filepath", UI_ITEM_NONE, std::nullopt, ICON_NONE); } else { - uiItemO(col, IFACE_("Save External..."), ICON_NONE, "OBJECT_OT_multires_external_save"); + col->op("OBJECT_OT_multires_external_save", IFACE_("Save External..."), ICON_NONE); } } diff --git a/source/blender/modifiers/intern/MOD_particlesystem.cc b/source/blender/modifiers/intern/MOD_particlesystem.cc index a816d3f3076..1b05ed51bb2 100644 --- a/source/blender/modifiers/intern/MOD_particlesystem.cc +++ b/source/blender/modifiers/intern/MOD_particlesystem.cc @@ -225,16 +225,14 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) if (!(ob->mode & OB_MODE_PARTICLE_EDIT)) { if (ELEM(psys->part->ren_as, PART_DRAW_GR, PART_DRAW_OB)) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Make Instances Real"), - ICON_NONE, - "OBJECT_OT_duplicates_make_real"); + layout->op("OBJECT_OT_duplicates_make_real", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Make Instances Real"), + ICON_NONE); } else if (psys->part->ren_as == PART_DRAW_PATH) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert to Mesh"), - ICON_NONE, - "OBJECT_OT_modifier_convert"); + layout->op("OBJECT_OT_modifier_convert", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Convert to Mesh"), + ICON_NONE); } } diff --git a/source/blender/modifiers/intern/MOD_skin.cc b/source/blender/modifiers/intern/MOD_skin.cc index 089c70d0016..35c394d2ad9 100644 --- a/source/blender/modifiers/intern/MOD_skin.cc +++ b/source/blender/modifiers/intern/MOD_skin.cc @@ -2031,8 +2031,8 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) layout->prop(ptr, "use_smooth_shade", UI_ITEM_NONE, std::nullopt, ICON_NONE); row = &layout->row(false); - uiItemO(row, IFACE_("Create Armature"), ICON_NONE, "OBJECT_OT_skin_armature_create"); - uiItemO(row, std::nullopt, ICON_NONE, "MESH_OT_customdata_skin_add"); + row->op("OBJECT_OT_skin_armature_create", IFACE_("Create Armature"), ICON_NONE); + row->op("MESH_OT_customdata_skin_add", std::nullopt, ICON_NONE); row = &layout->row(false); uiItemFullO(row, @@ -2054,8 +2054,8 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) &op_ptr); RNA_enum_set(&op_ptr, "action", 1); /* SKIN_LOOSE_CLEAR */ - uiItemO(layout, IFACE_("Mark Root"), ICON_NONE, "OBJECT_OT_skin_root_mark"); - uiItemO(layout, IFACE_("Equalize Radii"), ICON_NONE, "OBJECT_OT_skin_radii_equalize"); + layout->op("OBJECT_OT_skin_root_mark", IFACE_("Mark Root"), ICON_NONE); + layout->op("OBJECT_OT_skin_radii_equalize", IFACE_("Equalize Radii"), ICON_NONE); modifier_panel_end(layout, ptr); } diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.cc b/source/blender/modifiers/intern/MOD_surfacedeform.cc index ed7988fe589..a046e9c8467 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.cc +++ b/source/blender/modifiers/intern/MOD_surfacedeform.cc @@ -1606,11 +1606,11 @@ static void panel_draw(const bContext * /*C*/, Panel *panel) col = &layout->column(false); if (is_bound) { - uiItemO(col, IFACE_("Unbind"), ICON_NONE, "OBJECT_OT_surfacedeform_bind"); + col->op("OBJECT_OT_surfacedeform_bind", IFACE_("Unbind"), ICON_NONE); } else { uiLayoutSetActive(col, !RNA_pointer_is_null(&target_ptr)); - uiItemO(col, IFACE_("Bind"), ICON_NONE, "OBJECT_OT_surfacedeform_bind"); + col->op("OBJECT_OT_surfacedeform_bind", IFACE_("Bind"), ICON_NONE); } modifier_panel_end(layout, ptr); } diff --git a/source/blender/modifiers/intern/MOD_ui_common.cc b/source/blender/modifiers/intern/MOD_ui_common.cc index a017c43ed2b..fa80c33061a 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.cc +++ b/source/blender/modifiers/intern/MOD_ui_common.cc @@ -222,10 +222,9 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v) /* Apply. */ if (ob->type == OB_GREASE_PENCIL) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply (Active Keyframe)"), - ICON_CHECKMARK, - "OBJECT_OT_modifier_apply"); + layout->op("OBJECT_OT_modifier_apply", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply (Active Keyframe)"), + ICON_CHECKMARK); uiItemFullO(layout, "OBJECT_OT_modifier_apply", @@ -238,10 +237,9 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v) RNA_boolean_set(&op_ptr, "all_keyframes", true); } else { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), - ICON_CHECKMARK, - "OBJECT_OT_modifier_apply"); + layout->op("OBJECT_OT_modifier_apply", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), + ICON_CHECKMARK); } /* Apply as shapekey. */ @@ -270,16 +268,14 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v) eModifierType_Cloth, eModifierType_Fluid)) { - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), - ICON_DUPLICATE, - "OBJECT_OT_modifier_copy"); + layout->op("OBJECT_OT_modifier_copy", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), + ICON_DUPLICATE); } - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy to Selected"), - 0, - "OBJECT_OT_modifier_copy_to_selected"); + layout->op("OBJECT_OT_modifier_copy_to_selected", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Copy to Selected"), + 0); uiItemS(layout); @@ -446,7 +442,7 @@ static void modifier_panel_header(const bContext *C, Panel *panel) if (modifier_can_delete(md) && !modifier_is_simulation(md)) { sub = &row->row(false); uiLayoutSetEmboss(sub, blender::ui::EmbossType::None); - uiItemO(sub, "", ICON_X, "OBJECT_OT_modifier_remove"); + 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 6ad0195cda9..82ea8fa9aa7 100644 --- a/source/blender/nodes/NOD_socket_items_ui.hh +++ b/source/blender/nodes/NOD_socket_items_ui.hh @@ -84,8 +84,8 @@ static void draw_items_list_with_operators(const bContext *C, uiLayout *ops_col = &row->column(false); { uiLayout *add_remove_col = &ops_col->column(true); - uiItemO(add_remove_col, "", ICON_ADD, Accessor::operator_idnames::add_item); - uiItemO(add_remove_col, "", ICON_REMOVE, Accessor::operator_idnames::remove_item); + add_remove_col->op(Accessor::operator_idnames::add_item, "", ICON_ADD); + add_remove_col->op(Accessor::operator_idnames::remove_item, "", ICON_REMOVE); } { uiLayout *up_down_col = &ops_col->column(true); diff --git a/source/blender/nodes/composite/nodes/node_composite_file_output.cc b/source/blender/nodes/composite/nodes/node_composite_file_output.cc index e98f7b50f8f..c14bf894694 100644 --- a/source/blender/nodes/composite/nodes/node_composite_file_output.cc +++ b/source/blender/nodes/composite/nodes/node_composite_file_output.cc @@ -354,7 +354,7 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi uiItemS(layout); - uiItemO(layout, IFACE_("Add Input"), ICON_ADD, "NODE_OT_output_file_add_socket"); + layout->op("NODE_OT_output_file_add_socket", IFACE_("Add Input"), ICON_ADD); row = &layout->row(false); col = &row->column(true); diff --git a/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc b/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc index 784125e3792..dbf25358559 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_index_switch.cc @@ -71,7 +71,7 @@ static void node_layout_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) bNode &node = *static_cast(ptr->data); NodeIndexSwitch &storage = node_storage(node); if (uiLayout *panel = layout->panel(C, "index_switch_items", false, IFACE_("Items"))) { - uiItemO(panel, IFACE_("Add Item"), ICON_ADD, "node.index_switch_item_add"); + panel->op("node.index_switch_item_add", IFACE_("Add Item"), ICON_ADD); uiLayout *col = &panel->column(false); for (const int i : IndexRange(storage.items_num)) { uiLayout *row = &col->row(false); diff --git a/source/blender/nodes/shader/nodes/node_shader_script.cc b/source/blender/nodes/shader/nodes/node_shader_script.cc index e7297fe9ae4..097450c5231 100644 --- a/source/blender/nodes/shader/nodes/node_shader_script.cc +++ b/source/blender/nodes/shader/nodes/node_shader_script.cc @@ -31,7 +31,7 @@ static void node_shader_buts_script(uiLayout *layout, bContext * /*C*/, PointerR row->prop(ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); } - uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update"); + row->op("node.shader_script_update", "", ICON_FILE_REFRESH); } static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) diff --git a/source/blender/shader_fx/intern/FX_ui_common.cc b/source/blender/shader_fx/intern/FX_ui_common.cc index e1f4db598c1..d2d0749f22d 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.cc +++ b/source/blender/shader_fx/intern/FX_ui_common.cc @@ -121,10 +121,9 @@ static void gpencil_shaderfx_ops_extra_draw(bContext *C, uiLayout *layout, void uiLayoutSetUnitsX(layout, 4.0f); /* Duplicate. */ - uiItemO(layout, - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), - ICON_DUPLICATE, - "OBJECT_OT_shaderfx_copy"); + layout->op("OBJECT_OT_shaderfx_copy", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), + ICON_DUPLICATE); uiItemS(layout); @@ -199,7 +198,7 @@ static void shaderfx_panel_header(const bContext * /*C*/, Panel *panel) row = &row->row(false); uiLayoutSetEmboss(row, blender::ui::EmbossType::None); - uiItemO(row, "", ICON_X, "OBJECT_OT_shaderfx_remove"); + row->op("OBJECT_OT_shaderfx_remove", "", ICON_X); /* Some padding so the X isn't too close to the drag icon. */ uiItemS(layout);