Refactor: UI: Replace uiItemO with class method uiLayout::op
This converts the public `uiItemO` function to an object oriented API (`uiLayout::op`). Also this rearranges `idname` paramether, since this the only one required, and to make format similar to `uiItemFullO` Note: One of the benefits of moving from a public function to class method is to reduce API usage difference between C++ and Python. In Python this method is called `UILayout::operator`, however `operator` is a reserved keyword in C++. Part of: #117604 Pull Request: https://projects.blender.org/blender/blender/pulls/138776
This commit is contained in:
committed by
Hans Goudey
parent
93be6baa9c
commit
a017a6cc54
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<blender::StringRef> 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<blender::StringRef> name,
|
||||
int icon,
|
||||
blender::StringRefNull opname);
|
||||
|
||||
void uiItemEnumO_ptr(uiLayout *layout,
|
||||
wmOperatorType *ot,
|
||||
std::optional<blender::StringRef> name,
|
||||
|
||||
@@ -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<std::string> 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 */
|
||||
|
||||
@@ -1887,13 +1887,9 @@ void uiItemStringO(uiLayout *layout,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void uiItemO(uiLayout *layout,
|
||||
const std::optional<StringRef> name,
|
||||
int icon,
|
||||
const StringRefNull opname)
|
||||
void uiLayout::op(const StringRefNull opname, const std::optional<StringRef> 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 */
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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<CacheFile *>(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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -71,7 +71,7 @@ static void node_layout_ex(uiLayout *layout, bContext *C, PointerRNA *ptr)
|
||||
bNode &node = *static_cast<bNode *>(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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user