UI: Removal of Five Operator Confirmations

Removal of confirmation dialogs for the following five operators. For
each of these the UI module felt that they are all either very explicit
actions and/or are easily undone.
* ARMATURE_OT_separate (Move selected bones to a separate armature)
* CURVE_OT_separate - “Move selected points to a new object”
* OBJECT_OT_vertex_parent_set (Parent selected ob to selected vertices)
* OBJECT_OT_parent_no_inverse_set (Make Parent w/o inverse correction)
* FILE_OT_directory_new - (Create New Directory)

Pull Request: https://projects.blender.org/blender/blender/pulls/120036
This commit is contained in:
Harley Acheson 2024-03-29 01:09:15 +01:00 committed by Harley Acheson
parent 01dceb6b89
commit 6dd0f6627e
6 changed files with 2 additions and 79 deletions

@ -2330,8 +2330,7 @@ def km_file_browser(params):
("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, None),
("wm.context_toggle", {"type": 'H', "value": 'PRESS'},
{"properties": [("data_path", 'space_data.params.show_hidden')]}),
("file.directory_new", {"type": 'I', "value": 'PRESS'},
{"properties": [("confirm", False)]}),
("file.directory_new", {"type": 'I', "value": 'PRESS'}, None),
("file.rename", {"type": 'F2', "value": 'PRESS'}, None),
("file.delete", {"type": 'X', "value": 'PRESS'}, None),
("file.delete", {"type": 'DEL', "value": 'PRESS'}, None),

@ -1240,8 +1240,7 @@ def km_file_browser(params):
("file.next", {"type": 'BACK_SPACE', "value": 'PRESS', "shift": True}, None),
("wm.context_toggle", {"type": 'H', "value": 'PRESS'},
{"properties": [("data_path", 'space_data.params.show_hidden')]}),
("file.directory_new", {"type": 'I', "value": 'PRESS'},
{"properties": [("confirm", False)]}),
("file.directory_new", {"type": 'I', "value": 'PRESS'}, None),
("file.rename", {"type": 'F2', "value": 'PRESS'}, None),
("file.delete", {"type": 'DEL', "value": 'PRESS'}, None),
("file.smoothscroll", {"type": 'TIMER1', "value": 'ANY', "any": True}, None),

@ -774,20 +774,6 @@ static int separate_armature_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static int separate_armature_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
if (RNA_boolean_get(op->ptr, "confirm")) {
return WM_operator_confirm_ex(C,
op,
IFACE_("Move selected bones to a separate armature?"),
nullptr,
IFACE_("Separate"),
ALERT_ICON_NONE,
false);
}
return separate_armature_exec(C, op);
}
void ARMATURE_OT_separate(wmOperatorType *ot)
{
/* identifiers */
@ -796,13 +782,11 @@ void ARMATURE_OT_separate(wmOperatorType *ot)
ot->description = "Isolate selected bones into a separate armature";
/* callbacks */
ot->invoke = separate_armature_invoke;
ot->exec = separate_armature_exec;
ot->poll = ED_operator_editarmature;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_confirm_or_exec(ot);
}
/** \} */

@ -1455,20 +1455,6 @@ static int separate_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static int separate_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
if (RNA_boolean_get(op->ptr, "confirm")) {
return WM_operator_confirm_ex(C,
op,
IFACE_("Move selected points to a new object?"),
nullptr,
IFACE_("Separate"),
ALERT_ICON_NONE,
false);
}
return separate_exec(C, op);
}
void CURVE_OT_separate(wmOperatorType *ot)
{
/* identifiers */
@ -1477,13 +1463,11 @@ void CURVE_OT_separate(wmOperatorType *ot)
ot->description = "Separate selected points from connected unselected points into a new object";
/* api callbacks */
ot->invoke = separate_invoke;
ot->exec = separate_exec;
ot->poll = ED_operator_editsurfcurve;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_confirm_or_exec(ot);
}
/** \} */

@ -288,20 +288,6 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op)
#undef INDEX_UNSET
}
static int vertex_parent_set_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
if (RNA_boolean_get(op->ptr, "confirm")) {
return WM_operator_confirm_ex(C,
op,
IFACE_("Parent selected objects to the selected vertices?"),
nullptr,
IFACE_("Parent"),
ALERT_ICON_NONE,
false);
}
return vertex_parent_set_exec(C, op);
}
void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
{
/* identifiers */
@ -310,13 +296,11 @@ void OBJECT_OT_vertex_parent_set(wmOperatorType *ot)
ot->idname = "OBJECT_OT_vertex_parent_set";
/* api callbacks */
ot->invoke = vertex_parent_set_invoke;
ot->poll = vertex_parent_set_poll;
ot->exec = vertex_parent_set_exec;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_confirm_or_exec(ot);
}
/** \} */
@ -1120,20 +1104,6 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static int parent_noinv_set_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
if (RNA_boolean_get(op->ptr, "confirm")) {
return WM_operator_confirm_ex(C,
op,
IFACE_("Make Parent without inverse correction?"),
nullptr,
IFACE_("Parent"),
ALERT_ICON_NONE,
false);
}
return parent_noinv_set_exec(C, op);
}
void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
{
/* identifiers */
@ -1142,13 +1112,11 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot)
ot->idname = "OBJECT_OT_parent_no_inverse_set";
/* api callbacks */
ot->invoke = parent_noinv_set_invoke;
ot->exec = parent_noinv_set_exec;
ot->poll = ED_operator_object_active_editable;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
WM_operator_properties_confirm_or_exec(ot);
RNA_def_boolean(ot->srna,
"keep_transform",

@ -2698,15 +2698,6 @@ static int file_directory_new_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
static int file_directory_new_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
{
if (RNA_boolean_get(op->ptr, "confirm")) {
return WM_operator_confirm_ex(
C, op, IFACE_("Create new directory?"), nullptr, IFACE_("Create"), ALERT_ICON_NONE, false);
}
return file_directory_new_exec(C, op);
}
void FILE_OT_directory_new(wmOperatorType *ot)
{
PropertyRNA *prop;
@ -2717,7 +2708,6 @@ void FILE_OT_directory_new(wmOperatorType *ot)
ot->idname = "FILE_OT_directory_new";
/* api callbacks */
ot->invoke = file_directory_new_invoke;
ot->exec = file_directory_new_exec;
/* File browsing only operator (not asset browsing). */
ot->poll = ED_operator_file_browsing_active; /* <- important, handler is on window level */
@ -2727,7 +2717,6 @@ void FILE_OT_directory_new(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
prop = RNA_def_boolean(ot->srna, "open", false, "Open", "Open new directory");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
WM_operator_properties_confirm_or_exec(ot);
}
/** \} */