UI: Custom Text and Confirmation Button Text for Props Confirm #121287
|
@ -1744,7 +1744,8 @@ static int ed_marker_rename_invoke(bContext *C, wmOperator *op, const wmEvent *e
|
|||
RNA_string_set(op->ptr, "name", marker->name);
|
||||
}
|
||||
|
||||
return WM_operator_props_popup_confirm(C, op, event);
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Rename Selected Time Marker"), IFACE_("Rename"));
|
||||
}
|
||||
|
||||
static void MARKER_OT_rename(wmOperatorType *ot)
|
||||
|
|
|
@ -278,7 +278,7 @@ static int geometry_attribute_add_invoke(bContext *C, wmOperator *op, const wmEv
|
|||
if (!RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_string_set(op->ptr, prop, DATA_("Attribute"));
|
||||
}
|
||||
return WM_operator_props_popup_confirm(C, op, event);
|
||||
return WM_operator_props_popup_confirm_ex(C, op, event, IFACE_("Add Attribute"), IFACE_("Add"));
|
||||
}
|
||||
|
||||
void GEOMETRY_OT_attribute_add(wmOperatorType *ot)
|
||||
|
@ -398,7 +398,8 @@ static int geometry_color_attribute_add_invoke(bContext *C, wmOperator *op, cons
|
|||
if (!RNA_property_is_set(op->ptr, prop)) {
|
||||
RNA_property_string_set(op->ptr, prop, DATA_("Color"));
|
||||
}
|
||||
return WM_operator_props_popup_confirm(C, op, event);
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Add Color Attribute"), IFACE_("Add"));
|
||||
}
|
||||
|
||||
enum class ConvertAttributeMode {
|
||||
|
|
|
@ -1394,13 +1394,19 @@ static int grease_pencil_clean_loose_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int grease_pencil_clean_loose_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Remove Loose Points"), IFACE_("Delete"));
|
||||
}
|
||||
|
||||
static void GREASE_PENCIL_OT_clean_loose(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Clean Loose Points";
|
||||
ot->idname = "GREASE_PENCIL_OT_clean_loose";
|
||||
ot->description = "Remove loose points";
|
||||
|
||||
ot->invoke = WM_operator_props_popup_confirm;
|
||||
ot->invoke = grease_pencil_clean_loose_invoke;
|
||||
ot->exec = grease_pencil_clean_loose_exec;
|
||||
ot->poll = active_grease_pencil_layer_poll;
|
||||
|
||||
|
@ -1783,7 +1789,8 @@ static int grease_pencil_move_to_layer_invoke(bContext *C, wmOperator *op, const
|
|||
{
|
||||
const bool add_new_layer = RNA_boolean_get(op->ptr, "add_new_layer");
|
||||
if (add_new_layer) {
|
||||
return WM_operator_props_popup_confirm(C, op, event);
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Move to New Layer"), IFACE_("Create"));
|
||||
}
|
||||
return grease_pencil_move_to_layer_exec(C, op);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_report.hh"
|
||||
|
||||
#include "BLT_translation.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
|
||||
#include "ED_grease_pencil.hh"
|
||||
|
@ -64,6 +66,12 @@ static int grease_pencil_layer_add_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int grease_pencil_layer_add_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Add New Grease Pencil Layer"), IFACE_("Add"));
|
||||
}
|
||||
|
||||
static void GREASE_PENCIL_OT_layer_add(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
|
@ -72,7 +80,7 @@ static void GREASE_PENCIL_OT_layer_add(wmOperatorType *ot)
|
|||
ot->description = "Add a new Grease Pencil layer in the active object";
|
||||
|
||||
/* callbacks */
|
||||
ot->invoke = WM_operator_props_popup_confirm;
|
||||
ot->invoke = grease_pencil_layer_add_invoke;
|
||||
ot->exec = grease_pencil_layer_add_exec;
|
||||
ot->poll = active_grease_pencil_poll;
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "BLI_math_vector.h"
|
||||
|
||||
#include "BLT_translation.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
#include "DEG_depsgraph_build.hh"
|
||||
|
||||
|
@ -294,7 +296,8 @@ static int paint_mask_extract_exec(bContext *C, wmOperator *op)
|
|||
|
||||
static int paint_mask_extract_invoke(bContext *C, wmOperator *op, const wmEvent *e)
|
||||
{
|
||||
return WM_operator_props_popup_confirm(C, op, e);
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, e, IFACE_("Create Mesh From Paint Mask"), IFACE_("Extract"));
|
||||
}
|
||||
|
||||
static void geometry_extract_props(StructRNA *srna)
|
||||
|
|
|
@ -2857,6 +2857,12 @@ static int make_single_user_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int make_single_user_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Make Selected Objects Single-User"), IFACE_("Make Single"));
|
||||
}
|
||||
|
||||
void OBJECT_OT_make_single_user(wmOperatorType *ot)
|
||||
{
|
||||
static const EnumPropertyItem type_items[] = {
|
||||
|
@ -2874,7 +2880,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot)
|
|||
* nothing by default. */
|
||||
|
||||
/* api callbacks */
|
||||
ot->invoke = WM_operator_props_popup_confirm;
|
||||
ot->invoke = make_single_user_invoke;
|
||||
ot->exec = make_single_user_exec;
|
||||
ot->poll = ED_operator_objectmode;
|
||||
|
||||
|
|
|
@ -1079,6 +1079,12 @@ static const EnumPropertyItem mode_type_items[] = {
|
|||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static int quadriflow_remesh_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("QuadriFlow Remesh the Selected Mesh"), IFACE_("Remesh"));
|
||||
}
|
||||
|
||||
void OBJECT_OT_quadriflow_remesh(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers */
|
||||
|
@ -1092,7 +1098,7 @@ void OBJECT_OT_quadriflow_remesh(wmOperatorType *ot)
|
|||
ot->poll = object_remesh_poll;
|
||||
ot->poll_property = quadriflow_poll_property;
|
||||
ot->check = quadriflow_check;
|
||||
ot->invoke = WM_operator_props_popup_confirm;
|
||||
ot->invoke = quadriflow_remesh_invoke;
|
||||
ot->exec = quadriflow_remesh_exec;
|
||||
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
|
|
@ -1899,6 +1899,12 @@ static int sequencer_separate_images_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int sequencer_separate_images_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Separate Sequence Images"), IFACE_("Separate"));
|
||||
}
|
||||
|
||||
void SEQUENCER_OT_images_separate(wmOperatorType *ot)
|
||||
{
|
||||
/* Identifiers. */
|
||||
|
@ -1908,7 +1914,7 @@ void SEQUENCER_OT_images_separate(wmOperatorType *ot)
|
|||
|
||||
/* Api callbacks. */
|
||||
ot->exec = sequencer_separate_images_exec;
|
||||
ot->invoke = WM_operator_props_popup_confirm;
|
||||
ot->invoke = sequencer_separate_images_invoke;
|
||||
ot->poll = sequencer_edit_poll;
|
||||
|
||||
/* Flags. */
|
||||
|
|
|
@ -379,7 +379,8 @@ static int preferences_extension_repo_add_invoke(bContext *C, wmOperator *op, co
|
|||
RNA_property_string_set(op->ptr, prop_name, name_default);
|
||||
}
|
||||
|
||||
return WM_operator_props_popup_confirm(C, op, event);
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Add New Extension Repository"), IFACE_("Create"));
|
||||
}
|
||||
|
||||
static void preferences_extension_repo_add_ui(bContext * /*C*/, wmOperator *op)
|
||||
|
|
|
@ -1628,6 +1628,11 @@ static void uv_pack_islands_ui(bContext * /*C*/, wmOperator *op)
|
|||
uiItemS(layout);
|
||||
}
|
||||
|
||||
static int uv_pack_islands_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
return WM_operator_props_popup_confirm_ex(C, op, event, IFACE_("Pack Islands"), IFACE_("Pack"));
|
||||
}
|
||||
|
||||
void UV_OT_pack_islands(wmOperatorType *ot)
|
||||
{
|
||||
static const EnumPropertyItem pack_target[] = {
|
||||
|
@ -1663,7 +1668,7 @@ void UV_OT_pack_islands(wmOperatorType *ot)
|
|||
#ifdef USE_INTERACTIVE_PACK
|
||||
ot->invoke = WM_operator_props_popup_call;
|
||||
#else
|
||||
ot->invoke = WM_operator_props_popup_confirm;
|
||||
ot->invoke = uv_pack_islands_invoke;
|
||||
#endif
|
||||
ot->ui = uv_pack_islands_ui;
|
||||
ot->poll = ED_operator_uvedit;
|
||||
|
@ -2935,6 +2940,12 @@ static int smart_project_exec(bContext *C, wmOperator *op)
|
|||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static int smart_project_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
return WM_operator_props_popup_confirm_ex(
|
||||
C, op, event, IFACE_("Smart UV Project"), IFACE_("Unwrap"));
|
||||
}
|
||||
|
||||
void UV_OT_smart_project(wmOperatorType *ot)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
@ -2949,7 +2960,7 @@ void UV_OT_smart_project(wmOperatorType *ot)
|
|||
/* api callbacks */
|
||||
ot->exec = smart_project_exec;
|
||||
ot->poll = ED_operator_uvmap;
|
||||
ot->invoke = WM_operator_props_popup_confirm;
|
||||
ot->invoke = smart_project_invoke;
|
||||
|
||||
/* properties */
|
||||
prop = RNA_def_float_rotation(ot->srna,
|
||||
|
|
|
@ -733,6 +733,13 @@ bool WM_operator_winactive(bContext *C);
|
|||
* just wraps #WM_operator_props_dialog_popup.
|
||||
*/
|
||||
int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent *event);
|
||||
|
||||
int WM_operator_props_popup_confirm_ex(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *event,
|
||||
std::optional<std::string> title = std::nullopt,
|
||||
std::optional<std::string> confirm_text = std::nullopt);
|
||||
|
||||
/**
|
||||
* Same as #WM_operator_props_popup but call the operator first,
|
||||
* This way - the button values correspond to the result of the operator.
|
||||
|
|
|
@ -1725,7 +1725,9 @@ int WM_operator_ui_popup(bContext *C, wmOperator *op, int width)
|
|||
static int wm_operator_props_popup_ex(bContext *C,
|
||||
wmOperator *op,
|
||||
const bool do_call,
|
||||
const bool do_redo)
|
||||
const bool do_redo,
|
||||
std::optional<std::string> title = std::nullopt,
|
||||
std::optional<std::string> confirm_text = std::nullopt)
|
||||
{
|
||||
if ((op->type->flag & OPTYPE_REGISTER) == 0) {
|
||||
BKE_reportf(op->reports,
|
||||
|
@ -1748,7 +1750,7 @@ static int wm_operator_props_popup_ex(bContext *C,
|
|||
/* If we don't have global undo, we can't do undo push for automatic redo,
|
||||
* so we require manual OK clicking in this popup. */
|
||||
if (!do_redo || !(U.uiflag & USER_GLOBALUNDO)) {
|
||||
return WM_operator_props_dialog_popup(C, op, 300);
|
||||
return WM_operator_props_dialog_popup(C, op, 300, title, confirm_text);
|
||||
}
|
||||
|
||||
UI_popup_block_ex(C, wm_block_create_redo, nullptr, wm_block_redo_cancel_cb, op, op);
|
||||
|
@ -1760,9 +1762,18 @@ static int wm_operator_props_popup_ex(bContext *C,
|
|||
return OPERATOR_RUNNING_MODAL;
|
||||
}
|
||||
|
||||
int WM_operator_props_popup_confirm_ex(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent * /*event*/,
|
||||
std::optional<std::string> title,
|
||||
std::optional<std::string> confirm_text)
|
||||
{
|
||||
return wm_operator_props_popup_ex(C, op, false, false, title, confirm_text);
|
||||
}
|
||||
|
||||
int WM_operator_props_popup_confirm(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
{
|
||||
return wm_operator_props_popup_ex(C, op, false, false);
|
||||
return wm_operator_props_popup_ex(C, op, false, false, {}, {});
|
||||
}
|
||||
|
||||
int WM_operator_props_popup_call(bContext *C, wmOperator *op, const wmEvent * /*event*/)
|
||||
|
|
Loading…
Reference in New Issue