Refactor: UI: Replace uiItemFullO with class method uiLayout::op
This converts the public `uiItemFullO` function to an object oriented API (an `uiLayout::op` overload), matching recents changes in the API. Changes includes the removal of the paramether `IDProperty *properties` that seems unused (all places just sets `nullptr`, can be added as last argument with `nullptr` as default value though), and instead of using a return paramether the function now returns the pointer to write properties. Pull Request: https://projects.blender.org/blender/blender/pulls/138961
This commit is contained in:
committed by
Hans Goudey
parent
decf99106a
commit
44160a0524
@@ -282,6 +282,19 @@ struct uiLayout : uiItem {
|
||||
*/
|
||||
void op(blender::StringRefNull opname, std::optional<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.
|
||||
* \param context: Operator call context for #WM_operator_name_call.
|
||||
* \returns Operator pointer to write properties, might be #PointerRNA_NULL if operator does not
|
||||
* exists.
|
||||
*/
|
||||
PointerRNA op(blender::StringRefNull opname,
|
||||
std::optional<blender::StringRef> name,
|
||||
int icon,
|
||||
wmOperatorCallContext context,
|
||||
eUI_Item_Flag flag);
|
||||
/**
|
||||
* Adds a RNA property item, and exposes it into the layout.
|
||||
* \param ptr: RNA pointer to the struct owner of \a prop.
|
||||
@@ -541,14 +554,6 @@ void uiItemFullO_ptr(uiLayout *layout,
|
||||
wmOperatorCallContext context,
|
||||
eUI_Item_Flag flag,
|
||||
PointerRNA *r_opptr);
|
||||
void uiItemFullO(uiLayout *layout,
|
||||
blender::StringRefNull opname,
|
||||
std::optional<blender::StringRef> name,
|
||||
int icon,
|
||||
IDProperty *properties,
|
||||
wmOperatorCallContext context,
|
||||
eUI_Item_Flag flag,
|
||||
PointerRNA *r_opptr);
|
||||
void uiItemFullOMenuHold_ptr(uiLayout *layout,
|
||||
wmOperatorType *ot,
|
||||
std::optional<blender::StringRef> name,
|
||||
|
||||
@@ -892,14 +892,11 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
|
||||
}
|
||||
else {
|
||||
#if 0 /* Disabled for now. */
|
||||
uiItemFullO(layout,
|
||||
"UI_OT_override_type_set_button",
|
||||
"Override Type",
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
0,
|
||||
&op_ptr);
|
||||
op_ptr = layout->op("UI_OT_override_type_set_button",
|
||||
"Override Type",
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
0);
|
||||
RNA_boolean_set(&op_ptr, "all", false);
|
||||
#endif
|
||||
uiItemBooleanO(layout,
|
||||
@@ -933,14 +930,11 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
|
||||
RNA_boolean_set(&op_ptr, "all", false);
|
||||
}
|
||||
else {
|
||||
uiItemFullO(layout,
|
||||
"UI_OT_override_type_set_button",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Define Override"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = layout->op("UI_OT_override_type_set_button",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Define Override"),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_boolean_set(&op_ptr, "all", false);
|
||||
}
|
||||
}
|
||||
@@ -1314,14 +1308,12 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
|
||||
ICON_URL);
|
||||
|
||||
if (U.flag & USER_DEVELOPER_UI) {
|
||||
uiItemFullO(layout,
|
||||
"WM_OT_doc_view",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Python Reference"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr_props);
|
||||
ptr_props = layout->op(
|
||||
"WM_OT_doc_view",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Online Python Reference"),
|
||||
ICON_NONE,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_string_set(&ptr_props, "doc_id", manual_id.value().c_str());
|
||||
}
|
||||
}
|
||||
@@ -1334,14 +1326,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but, const wmEvent *ev
|
||||
/* perhaps we should move this into (G.debug & G_DEBUG) - campbell */
|
||||
if (U.flag & USER_DEVELOPER_UI) {
|
||||
if (ui_block_is_menu(but->block) == false) {
|
||||
uiItemFullO(layout,
|
||||
"UI_OT_editsource",
|
||||
std::nullopt,
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
nullptr);
|
||||
layout->op("UI_OT_editsource", std::nullopt, ICON_NONE, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1382,25 +1382,19 @@ void uiItemFullOMenuHold_ptr(uiLayout *layout,
|
||||
UI_but_func_hold_set(but, ui_item_menu_hold, BLI_strdup(menu_id));
|
||||
}
|
||||
|
||||
void uiItemFullO(uiLayout *layout,
|
||||
const blender::StringRefNull opname,
|
||||
const std::optional<StringRef> name,
|
||||
int icon,
|
||||
IDProperty *properties,
|
||||
wmOperatorCallContext context,
|
||||
const eUI_Item_Flag flag,
|
||||
PointerRNA *r_opptr)
|
||||
PointerRNA uiLayout::op(const blender::StringRefNull opname,
|
||||
const std::optional<StringRef> name,
|
||||
int icon,
|
||||
wmOperatorCallContext context,
|
||||
const eUI_Item_Flag flag)
|
||||
{
|
||||
wmOperatorType *ot = WM_operatortype_find(opname.c_str(), false); /* print error next */
|
||||
uiLayout *layout = this;
|
||||
UI_OPERATOR_ERROR_RET(ot, opname.c_str(), { return PointerRNA_NULL; });
|
||||
PointerRNA ptr;
|
||||
|
||||
UI_OPERATOR_ERROR_RET(ot, opname.c_str(), {
|
||||
if (r_opptr) {
|
||||
*r_opptr = PointerRNA_NULL;
|
||||
}
|
||||
return;
|
||||
});
|
||||
|
||||
uiItemFullO_ptr(layout, ot, name, icon, properties, context, flag, r_opptr);
|
||||
uiItemFullO_ptr(this, ot, name, icon, nullptr, context, flag, &ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static StringRef ui_menu_enumpropname(uiLayout *layout,
|
||||
@@ -1891,7 +1885,7 @@ void uiItemStringO(uiLayout *layout,
|
||||
|
||||
void uiLayout::op(const StringRefNull opname, const std::optional<StringRef> name, int icon)
|
||||
{
|
||||
uiItemFullO(this, opname, name, icon, nullptr, root_->opcontext, UI_ITEM_NONE, nullptr);
|
||||
this->op(opname, name, icon, root_->opcontext, UI_ITEM_NONE);
|
||||
}
|
||||
|
||||
/* RNA property items */
|
||||
|
||||
@@ -69,14 +69,11 @@ static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v
|
||||
|
||||
/* Move to first. */
|
||||
row = &layout->column(false);
|
||||
uiItemFullO(row,
|
||||
"CONSTRAINT_OT_move_to_index",
|
||||
IFACE_("Move to First"),
|
||||
ICON_TRIA_UP,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("CONSTRAINT_OT_move_to_index",
|
||||
IFACE_("Move to First"),
|
||||
ICON_TRIA_UP,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set(&op_ptr, "index", 0);
|
||||
if (!con->prev) {
|
||||
uiLayoutSetEnabled(row, false);
|
||||
@@ -84,14 +81,11 @@ static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v
|
||||
|
||||
/* Move to last. */
|
||||
row = &layout->column(false);
|
||||
uiItemFullO(row,
|
||||
"CONSTRAINT_OT_move_to_index",
|
||||
IFACE_("Move to Last"),
|
||||
ICON_TRIA_DOWN,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("CONSTRAINT_OT_move_to_index",
|
||||
IFACE_("Move to Last"),
|
||||
ICON_TRIA_DOWN,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
ListBase *constraint_list = blender::ed::object::constraint_list_from_constraint(
|
||||
ob, con, nullptr);
|
||||
RNA_int_set(&op_ptr, "index", BLI_listbase_count(constraint_list) - 1);
|
||||
|
||||
@@ -299,14 +299,11 @@ void uiTemplateOperatorRedoProperties(uiLayout *layout, const bContext *C)
|
||||
/* Disable for now, doesn't fit well in popover. */
|
||||
#if 0
|
||||
/* Repeat button with operator name as text. */
|
||||
uiItemFullO(layout,
|
||||
"SCREEN_OT_repeat_last",
|
||||
WM_operatortype_name(op->type, op->ptr),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
0,
|
||||
nullptr);
|
||||
layout->op("SCREEN_OT_repeat_last",
|
||||
WM_operatortype_name(op->type, op->ptr),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
0);
|
||||
#endif
|
||||
|
||||
if (WM_operator_repeat_check(C, op)) {
|
||||
|
||||
@@ -136,15 +136,12 @@ int uiTemplateRecentFiles(uiLayout *layout, int rows)
|
||||
}
|
||||
|
||||
const char *filename = BLI_path_basename(recent->filepath);
|
||||
PointerRNA ptr;
|
||||
uiItemFullO(layout,
|
||||
"WM_OT_open_mainfile",
|
||||
filename,
|
||||
BKE_blendfile_extension_check(filename) ? ICON_FILE_BLEND : ICON_FILE_BACKUP,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
PointerRNA ptr = layout->op("WM_OT_open_mainfile",
|
||||
filename,
|
||||
BKE_blendfile_extension_check(filename) ? ICON_FILE_BLEND :
|
||||
ICON_FILE_BACKUP,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_string_set(&ptr, "filepath", recent->filepath);
|
||||
RNA_boolean_set(&ptr, "display_file_selector", false);
|
||||
|
||||
|
||||
@@ -4551,27 +4551,21 @@ static wmOperatorStatus screen_area_options_invoke(bContext *C,
|
||||
|
||||
/* Vertical Split */
|
||||
PointerRNA ptr;
|
||||
uiItemFullO(layout,
|
||||
"SCREEN_OT_area_split",
|
||||
IFACE_("Vertical Split"),
|
||||
ICON_SPLIT_VERTICAL,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
ptr = layout->op("SCREEN_OT_area_split",
|
||||
IFACE_("Vertical Split"),
|
||||
ICON_SPLIT_VERTICAL,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
/* store initial mouse cursor position. */
|
||||
RNA_int_set_array(&ptr, "cursor", event->xy);
|
||||
RNA_enum_set(&ptr, "direction", SCREEN_AXIS_V);
|
||||
|
||||
/* Horizontal Split */
|
||||
uiItemFullO(layout,
|
||||
"SCREEN_OT_area_split",
|
||||
IFACE_("Horizontal Split"),
|
||||
ICON_SPLIT_HORIZONTAL,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
ptr = layout->op("SCREEN_OT_area_split",
|
||||
IFACE_("Horizontal Split"),
|
||||
ICON_SPLIT_HORIZONTAL,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
/* store initial mouse cursor position. */
|
||||
RNA_int_set_array(&ptr, "cursor", event->xy);
|
||||
RNA_enum_set(&ptr, "direction", SCREEN_AXIS_H);
|
||||
@@ -4584,26 +4578,21 @@ static wmOperatorStatus screen_area_options_invoke(bContext *C,
|
||||
if (sa1 && sa2) {
|
||||
eScreenDir dir = area_getorientation(sa1, sa2);
|
||||
if (dir != SCREEN_DIR_NONE) {
|
||||
uiItemFullO(layout,
|
||||
"SCREEN_OT_area_join",
|
||||
ELEM(dir, SCREEN_DIR_N, SCREEN_DIR_S) ? IFACE_("Join Up") : IFACE_("Join Right"),
|
||||
ELEM(dir, SCREEN_DIR_N, SCREEN_DIR_S) ? ICON_AREA_JOIN_UP : ICON_AREA_JOIN,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
ptr = layout->op("SCREEN_OT_area_join",
|
||||
ELEM(dir, SCREEN_DIR_N, SCREEN_DIR_S) ? IFACE_("Join Up") :
|
||||
IFACE_("Join Right"),
|
||||
ELEM(dir, SCREEN_DIR_N, SCREEN_DIR_S) ? ICON_AREA_JOIN_UP : ICON_AREA_JOIN,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set_array(&ptr, "source_xy", blender::int2{sa2->totrct.xmin, sa2->totrct.ymin});
|
||||
RNA_int_set_array(&ptr, "target_xy", blender::int2{sa1->totrct.xmin, sa1->totrct.ymin});
|
||||
|
||||
uiItemFullO(
|
||||
layout,
|
||||
ptr = layout->op(
|
||||
"SCREEN_OT_area_join",
|
||||
ELEM(dir, SCREEN_DIR_N, SCREEN_DIR_S) ? IFACE_("Join Down") : IFACE_("Join Left"),
|
||||
ELEM(dir, SCREEN_DIR_N, SCREEN_DIR_S) ? ICON_AREA_JOIN_DOWN : ICON_AREA_JOIN_LEFT,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set_array(&ptr, "source_xy", blender::int2{sa1->totrct.xmin, sa1->totrct.ymin});
|
||||
RNA_int_set_array(&ptr, "target_xy", blender::int2{sa2->totrct.xmin, sa2->totrct.ymin});
|
||||
|
||||
@@ -4613,14 +4602,11 @@ static wmOperatorStatus screen_area_options_invoke(bContext *C,
|
||||
|
||||
/* Swap just needs two areas. */
|
||||
if (sa1 && sa2) {
|
||||
uiItemFullO(layout,
|
||||
"SCREEN_OT_area_swap",
|
||||
IFACE_("Swap Areas"),
|
||||
ICON_AREA_SWAP,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
ptr = layout->op("SCREEN_OT_area_swap",
|
||||
IFACE_("Swap Areas"),
|
||||
ICON_AREA_SWAP,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set_array(&ptr, "cursor", event->xy);
|
||||
}
|
||||
|
||||
@@ -5175,14 +5161,11 @@ static void screen_area_menu_items(ScrArea *area, uiLayout *layout)
|
||||
|
||||
PointerRNA ptr;
|
||||
|
||||
uiItemFullO(layout,
|
||||
"SCREEN_OT_area_join",
|
||||
IFACE_("Move/Split Area"),
|
||||
ICON_AREA_DOCK,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
ptr = layout->op("SCREEN_OT_area_join",
|
||||
IFACE_("Move/Split Area"),
|
||||
ICON_AREA_DOCK,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
|
||||
layout->separator();
|
||||
|
||||
@@ -5191,14 +5174,11 @@ static void screen_area_menu_items(ScrArea *area, uiLayout *layout)
|
||||
ICON_NONE);
|
||||
|
||||
if (area->spacetype != SPACE_FILE && !area->full) {
|
||||
uiItemFullO(layout,
|
||||
"SCREEN_OT_screen_full_area",
|
||||
IFACE_("Full Screen Area"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
ptr = layout->op("SCREEN_OT_screen_full_area",
|
||||
IFACE_("Full Screen Area"),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_boolean_set(&ptr, "use_hide_panels", true);
|
||||
}
|
||||
|
||||
|
||||
@@ -296,24 +296,18 @@ void AssetCatalogTreeViewItem::build_context_menu(bContext &C, uiLayout &column)
|
||||
{
|
||||
PointerRNA props;
|
||||
|
||||
uiItemFullO(&column,
|
||||
"ASSET_OT_catalog_new",
|
||||
IFACE_("New Catalog"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&props);
|
||||
props = column.op("ASSET_OT_catalog_new",
|
||||
IFACE_("New Catalog"),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_string_set(&props, "parent_path", catalog_item_.catalog_path().c_str());
|
||||
|
||||
uiItemFullO(&column,
|
||||
"ASSET_OT_catalog_delete",
|
||||
IFACE_("Delete Catalog"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&props);
|
||||
props = column.op("ASSET_OT_catalog_delete",
|
||||
IFACE_("Delete Catalog"),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_string_set(&props, "catalog_id", catalog_item_.get_catalog_id().str().c_str());
|
||||
column.op("UI_OT_view_item_rename", IFACE_("Rename"), ICON_NONE);
|
||||
|
||||
|
||||
@@ -190,15 +190,11 @@ static void node_add_catalog_assets_draw(const bContext *C, Menu *menu)
|
||||
layout->separator();
|
||||
add_separator = false;
|
||||
}
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(layout,
|
||||
"NODE_OT_add_group_asset",
|
||||
IFACE_(asset->get_name()),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
PointerRNA op_ptr = layout->op("NODE_OT_add_group_asset",
|
||||
IFACE_(asset->get_name()),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
UI_ITEM_NONE);
|
||||
asset::operator_asset_reference_props_set(*asset, op_ptr);
|
||||
}
|
||||
|
||||
@@ -230,15 +226,11 @@ static void node_add_unassigned_assets_draw(const bContext *C, Menu *menu)
|
||||
}
|
||||
asset::AssetItemTree &tree = *snode.runtime->assets_for_menu;
|
||||
for (const asset_system::AssetRepresentation *asset : tree.unassigned_assets) {
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(menu->layout,
|
||||
"NODE_OT_add_group_asset",
|
||||
IFACE_(asset->get_name()),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
PointerRNA op_ptr = menu->layout->op("NODE_OT_add_group_asset",
|
||||
IFACE_(asset->get_name()),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_REGION_WIN,
|
||||
UI_ITEM_NONE);
|
||||
asset::operator_asset_reference_props_set(*asset, op_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1535,26 +1535,14 @@ static void view3d_panel_vgroup(const bContext *C, Panel *panel)
|
||||
|
||||
/* The weight group paste function */
|
||||
icon = (locked) ? ICON_BLANK1 : ICON_PASTEDOWN;
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_vertex_weight_paste",
|
||||
"",
|
||||
icon,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op(
|
||||
"OBJECT_OT_vertex_weight_paste", "", icon, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE);
|
||||
RNA_int_set(&op_ptr, "weight_group", i);
|
||||
|
||||
/* The weight entry delete function */
|
||||
icon = (locked) ? ICON_LOCKED : ICON_X;
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_vertex_weight_delete",
|
||||
"",
|
||||
icon,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op(
|
||||
"OBJECT_OT_vertex_weight_delete", "", icon, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE);
|
||||
RNA_int_set(&op_ptr, "weight_group", i);
|
||||
|
||||
yco -= UI_UNIT_Y;
|
||||
|
||||
@@ -337,36 +337,27 @@ static void subdivisions_panel_draw(const bContext * /*C*/, Panel *panel)
|
||||
*/
|
||||
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Subdivide"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = layout->op("OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Subdivide"),
|
||||
ICON_NONE,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_enum_set(&op_ptr, "mode", int8_t(MultiresSubdivideModeType::CatmullClark));
|
||||
RNA_string_set(&op_ptr, "modifier", ((ModifierData *)mmd)->name);
|
||||
|
||||
row = &layout->row(false);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Simple"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Simple"),
|
||||
ICON_NONE,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_enum_set(&op_ptr, "mode", int8_t(MultiresSubdivideModeType::Simple));
|
||||
RNA_string_set(&op_ptr, "modifier", ((ModifierData *)mmd)->name);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Linear"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("OBJECT_OT_multires_subdivide",
|
||||
IFACE_("Linear"),
|
||||
ICON_NONE,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_enum_set(&op_ptr, "mode", int8_t(MultiresSubdivideModeType::Linear));
|
||||
RNA_string_set(&op_ptr, "modifier", ((ModifierData *)mmd)->name);
|
||||
|
||||
|
||||
@@ -2176,15 +2176,11 @@ static void add_attribute_search_or_value_buttons(DrawGroupInputsContext &ctx,
|
||||
uiItemDecoratorR(layout, ctx.md_ptr, rna_path.c_str(), -1);
|
||||
}
|
||||
|
||||
PointerRNA props;
|
||||
uiItemFullO(prop_row,
|
||||
"object.geometry_nodes_input_attribute_toggle",
|
||||
"",
|
||||
ICON_SPREADSHEET,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&props);
|
||||
PointerRNA props = prop_row->op("object.geometry_nodes_input_attribute_toggle",
|
||||
"",
|
||||
ICON_SPREADSHEET,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_string_set(&props, "modifier_name", ctx.nmd.modifier.name);
|
||||
RNA_string_set(&props, "input_name", socket.identifier);
|
||||
}
|
||||
|
||||
@@ -620,27 +620,16 @@ static void bake_panel_draw(const bContext * /*C*/, Panel *panel)
|
||||
bool use_foam = RNA_boolean_get(ptr, "use_foam");
|
||||
|
||||
if (is_cached) {
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_ocean_bake",
|
||||
IFACE_("Delete Bake"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
PointerRNA op_ptr = layout->op("OBJECT_OT_ocean_bake",
|
||||
IFACE_("Delete Bake"),
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_boolean_set(&op_ptr, "free", true);
|
||||
}
|
||||
else {
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_ocean_bake",
|
||||
IFACE_("Bake"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
PointerRNA op_ptr = layout->op(
|
||||
"OBJECT_OT_ocean_bake", IFACE_("Bake"), ICON_NONE, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE);
|
||||
RNA_boolean_set(&op_ptr, "free", false);
|
||||
}
|
||||
|
||||
|
||||
@@ -2033,23 +2033,17 @@ static void panel_draw(const bContext * /*C*/, Panel *panel)
|
||||
row->op("MESH_OT_customdata_skin_add", std::nullopt, ICON_NONE);
|
||||
|
||||
row = &layout->row(false);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_skin_loose_mark_clear",
|
||||
IFACE_("Mark Loose"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("OBJECT_OT_skin_loose_mark_clear",
|
||||
IFACE_("Mark Loose"),
|
||||
ICON_NONE,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_enum_set(&op_ptr, "action", 0); /* SKIN_LOOSE_MARK */
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_skin_loose_mark_clear",
|
||||
IFACE_("Clear Loose"),
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("OBJECT_OT_skin_loose_mark_clear",
|
||||
IFACE_("Clear Loose"),
|
||||
ICON_NONE,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_enum_set(&op_ptr, "action", 1); /* SKIN_LOOSE_CLEAR */
|
||||
|
||||
layout->op("OBJECT_OT_skin_root_mark", IFACE_("Mark Root"), ICON_NONE);
|
||||
|
||||
@@ -226,14 +226,11 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply (Active Keyframe)"),
|
||||
ICON_CHECKMARK);
|
||||
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_modifier_apply",
|
||||
IFACE_("Apply (All Keyframes)"),
|
||||
ICON_KEYFRAME,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = layout->op("OBJECT_OT_modifier_apply",
|
||||
IFACE_("Apply (All Keyframes)"),
|
||||
ICON_KEYFRAME,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_boolean_set(&op_ptr, "all_keyframes", true);
|
||||
}
|
||||
else {
|
||||
@@ -280,25 +277,19 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
|
||||
layout->separator();
|
||||
|
||||
/* Move to first. */
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_modifier_move_to_index",
|
||||
IFACE_("Move to First"),
|
||||
ICON_TRIA_UP,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = layout->op("OBJECT_OT_modifier_move_to_index",
|
||||
IFACE_("Move to First"),
|
||||
ICON_TRIA_UP,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set(&op_ptr, "index", 0);
|
||||
|
||||
/* Move to last. */
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_modifier_move_to_index",
|
||||
IFACE_("Move to Last"),
|
||||
ICON_TRIA_DOWN,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = layout->op("OBJECT_OT_modifier_move_to_index",
|
||||
IFACE_("Move to Last"),
|
||||
ICON_TRIA_DOWN,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set(&op_ptr, "index", BLI_listbase_count(&ob->modifiers) - 1);
|
||||
|
||||
layout->separator();
|
||||
@@ -307,14 +298,11 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
|
||||
|
||||
if (md->type == eModifierType_Nodes) {
|
||||
layout->separator();
|
||||
uiItemFullO(layout,
|
||||
"OBJECT_OT_geometry_nodes_move_to_nodes",
|
||||
std::nullopt,
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = layout->op("OBJECT_OT_geometry_nodes_move_to_nodes",
|
||||
std::nullopt,
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
layout->prop(&ptr, "show_group_selector", UI_ITEM_NONE, std::nullopt, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,14 +416,11 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi
|
||||
col->label(IFACE_("Layer:"), ICON_NONE);
|
||||
row = &col->row(false);
|
||||
row->prop(&active_input_ptr, "name", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemFullO(row,
|
||||
"NODE_OT_output_file_remove_active_socket",
|
||||
"",
|
||||
ICON_X,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_R_ICON_ONLY,
|
||||
nullptr);
|
||||
row->op("NODE_OT_output_file_remove_active_socket",
|
||||
"",
|
||||
ICON_X,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_R_ICON_ONLY);
|
||||
}
|
||||
else {
|
||||
col = &layout->column(true);
|
||||
@@ -431,14 +428,11 @@ static void node_composit_buts_file_output_ex(uiLayout *layout, bContext *C, Poi
|
||||
col->label(IFACE_("File Subpath:"), ICON_NONE);
|
||||
row = &col->row(false);
|
||||
row->prop(&active_input_ptr, "path", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
|
||||
uiItemFullO(row,
|
||||
"NODE_OT_output_file_remove_active_socket",
|
||||
"",
|
||||
ICON_X,
|
||||
nullptr,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_R_ICON_ONLY,
|
||||
nullptr);
|
||||
row->op("NODE_OT_output_file_remove_active_socket",
|
||||
"",
|
||||
ICON_X,
|
||||
WM_OP_EXEC_DEFAULT,
|
||||
UI_ITEM_R_ICON_ONLY);
|
||||
|
||||
/* format details for individual files */
|
||||
imfptr = RNA_pointer_get(&active_input_ptr, "format");
|
||||
|
||||
@@ -681,15 +681,8 @@ static void node_composit_buts_viewlayers(uiLayout *layout, bContext *C, Pointer
|
||||
scn_ptr = RNA_pointer_get(ptr, "scene");
|
||||
RNA_string_get(&scn_ptr, "name", scene_name);
|
||||
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(row,
|
||||
"RENDER_OT_render",
|
||||
"",
|
||||
ICON_RENDER_STILL,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
PointerRNA op_ptr = row->op(
|
||||
"RENDER_OT_render", "", ICON_RENDER_STILL, WM_OP_INVOKE_DEFAULT, UI_ITEM_NONE);
|
||||
RNA_string_set(&op_ptr, "layer", layer_name);
|
||||
RNA_string_set(&op_ptr, "scene", scene_name);
|
||||
}
|
||||
|
||||
@@ -725,15 +725,11 @@ void draw_bake_button_row(const BakeDrawContext &ctx, uiLayout *layout, const bo
|
||||
IFACE_("Bake Packed");
|
||||
}
|
||||
|
||||
PointerRNA ptr;
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_geometry_node_bake_single",
|
||||
bake_label,
|
||||
ICON_NONE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
PointerRNA ptr = row->op("OBJECT_OT_geometry_node_bake_single",
|
||||
bake_label,
|
||||
ICON_NONE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
WM_operator_properties_id_lookup_set_from_id(&ptr, &ctx.object->id);
|
||||
RNA_string_set(&ptr, "modifier_name", ctx.nmd->modifier.name);
|
||||
RNA_int_set(&ptr, "bake_id", ctx.bake->id);
|
||||
@@ -744,29 +740,21 @@ void draw_bake_button_row(const BakeDrawContext &ctx, uiLayout *layout, const bo
|
||||
if (is_in_sidebar) {
|
||||
if (ctx.is_baked && !G.is_rendering) {
|
||||
if (ctx.bake->packed) {
|
||||
PointerRNA ptr;
|
||||
uiItemFullO(subrow,
|
||||
"OBJECT_OT_geometry_node_bake_unpack_single",
|
||||
"",
|
||||
ICON_PACKAGE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
PointerRNA ptr = subrow->op("OBJECT_OT_geometry_node_bake_unpack_single",
|
||||
"",
|
||||
ICON_PACKAGE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
WM_operator_properties_id_lookup_set_from_id(&ptr, &ctx.object->id);
|
||||
RNA_string_set(&ptr, "modifier_name", ctx.nmd->modifier.name);
|
||||
RNA_int_set(&ptr, "bake_id", ctx.bake->id);
|
||||
}
|
||||
else {
|
||||
PointerRNA ptr;
|
||||
uiItemFullO(subrow,
|
||||
"OBJECT_OT_geometry_node_bake_pack_single",
|
||||
"",
|
||||
ICON_UGLYPACKAGE,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
PointerRNA ptr = subrow->op("OBJECT_OT_geometry_node_bake_pack_single",
|
||||
"",
|
||||
ICON_UGLYPACKAGE,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
WM_operator_properties_id_lookup_set_from_id(&ptr, &ctx.object->id);
|
||||
RNA_string_set(&ptr, "modifier_name", ctx.nmd->modifier.name);
|
||||
RNA_int_set(&ptr, "bake_id", ctx.bake->id);
|
||||
@@ -776,27 +764,19 @@ void draw_bake_button_row(const BakeDrawContext &ctx, uiLayout *layout, const bo
|
||||
/* If the data is not yet baked, still show the icon based on the derived bake target. */
|
||||
const int icon = ctx.bake_target == NODES_MODIFIER_BAKE_TARGET_DISK ? ICON_UGLYPACKAGE :
|
||||
ICON_PACKAGE;
|
||||
PointerRNA ptr;
|
||||
uiItemFullO(subrow,
|
||||
"OBJECT_OT_geometry_node_bake_pack_single",
|
||||
"",
|
||||
icon,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
PointerRNA ptr = subrow->op("OBJECT_OT_geometry_node_bake_pack_single",
|
||||
"",
|
||||
icon,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
}
|
||||
}
|
||||
{
|
||||
PointerRNA ptr;
|
||||
uiItemFullO(subrow,
|
||||
"OBJECT_OT_geometry_node_bake_delete_single",
|
||||
"",
|
||||
ICON_TRASH,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&ptr);
|
||||
PointerRNA ptr = subrow->op("OBJECT_OT_geometry_node_bake_delete_single",
|
||||
"",
|
||||
ICON_TRASH,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
WM_operator_properties_id_lookup_set_from_id(&ptr, &ctx.object->id);
|
||||
RNA_string_set(&ptr, "modifier_name", ctx.nmd->modifier.name);
|
||||
RNA_int_set(&ptr, "bake_id", ctx.bake->id);
|
||||
|
||||
@@ -129,14 +129,11 @@ static void gpencil_shaderfx_ops_extra_draw(bContext *C, uiLayout *layout, void
|
||||
|
||||
/* Move to first. */
|
||||
row = &layout->column(false);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_shaderfx_move_to_index",
|
||||
IFACE_("Move to First"),
|
||||
ICON_TRIA_UP,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("OBJECT_OT_shaderfx_move_to_index",
|
||||
IFACE_("Move to First"),
|
||||
ICON_TRIA_UP,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set(&op_ptr, "index", 0);
|
||||
if (!fx->prev) {
|
||||
uiLayoutSetEnabled(row, false);
|
||||
@@ -144,14 +141,11 @@ static void gpencil_shaderfx_ops_extra_draw(bContext *C, uiLayout *layout, void
|
||||
|
||||
/* Move to last. */
|
||||
row = &layout->column(false);
|
||||
uiItemFullO(row,
|
||||
"OBJECT_OT_shaderfx_move_to_index",
|
||||
IFACE_("Move to Last"),
|
||||
ICON_TRIA_DOWN,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
op_ptr = row->op("OBJECT_OT_shaderfx_move_to_index",
|
||||
IFACE_("Move to Last"),
|
||||
ICON_TRIA_DOWN,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
RNA_int_set(&op_ptr, "index", BLI_listbase_count(&ob->shader_fx) - 1);
|
||||
if (!fx->next) {
|
||||
uiLayoutSetEnabled(row, false);
|
||||
|
||||
@@ -377,15 +377,11 @@ static uiBlock *wm_block_splash_create(bContext *C, ARegion *region, void * /*ar
|
||||
|
||||
row1->label(RPT_("Intel binary detected. Expect reduced performance."), ICON_ERROR);
|
||||
|
||||
PointerRNA op_ptr;
|
||||
uiItemFullO(row2,
|
||||
"WM_OT_url_open",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Learn More"),
|
||||
ICON_URL,
|
||||
nullptr,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE,
|
||||
&op_ptr);
|
||||
PointerRNA op_ptr = row2->op("WM_OT_url_open",
|
||||
CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Learn More"),
|
||||
ICON_URL,
|
||||
WM_OP_INVOKE_DEFAULT,
|
||||
UI_ITEM_NONE);
|
||||
# if defined(__APPLE__)
|
||||
RNA_string_set(
|
||||
&op_ptr,
|
||||
|
||||
Reference in New Issue
Block a user