diff options
author | Campbell Barton <campbell@blender.org> | 2022-05-13 09:09:04 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-05-13 09:09:04 +0300 |
commit | 113b8030ced92c23e33717dac97287f8792fd1cb (patch) | |
tree | 8a4cc192d6d31f3b56d92ba71448a0428225d4e2 /source/blender/editors/util | |
parent | 470cbad51a63c56d8114ccfb3bb408b1d9cb4824 (diff) |
Fix T89909: Circle Select tool status bar doesn't match the operations
Assign get_name functions for select picking and circle select
so modifier keys show the result of holding the modifiers.
Diffstat (limited to 'source/blender/editors/util')
-rw-r--r-- | source/blender/editors/util/select_utils.c | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/source/blender/editors/util/select_utils.c b/source/blender/editors/util/select_utils.c index 53f9aca8e8d..263ef06718f 100644 --- a/source/blender/editors/util/select_utils.c +++ b/source/blender/editors/util/select_utils.c @@ -119,11 +119,11 @@ bool ED_select_similar_compare_float_tree(const KDTree_1d *tree, return false; } -eSelectOp ED_select_op_from_operator(wmOperator *op) +eSelectOp ED_select_op_from_operator(PointerRNA *ptr) { - const bool extend = RNA_boolean_get(op->ptr, "extend"); - const bool deselect = RNA_boolean_get(op->ptr, "deselect"); - const bool toggle = RNA_boolean_get(op->ptr, "toggle"); + const bool extend = RNA_boolean_get(ptr, "extend"); + const bool deselect = RNA_boolean_get(ptr, "deselect"); + const bool toggle = RNA_boolean_get(ptr, "toggle"); if (extend) { return SEL_OP_ADD; @@ -137,10 +137,56 @@ eSelectOp ED_select_op_from_operator(wmOperator *op) return SEL_OP_SET; } -void ED_select_pick_params_from_operator(wmOperator *op, struct SelectPick_Params *params) +void ED_select_pick_params_from_operator(PointerRNA *ptr, struct SelectPick_Params *params) { memset(params, 0x0, sizeof(*params)); - params->sel_op = ED_select_op_from_operator(op); - params->deselect_all = RNA_boolean_get(op->ptr, "deselect_all"); - params->select_passthrough = RNA_boolean_get(op->ptr, "select_passthrough"); + params->sel_op = ED_select_op_from_operator(ptr); + params->deselect_all = RNA_boolean_get(ptr, "deselect_all"); + params->select_passthrough = RNA_boolean_get(ptr, "select_passthrough"); } + +/* -------------------------------------------------------------------- */ +/** \name Operator Naming Callbacks + * \{ */ + +const char *ED_select_pick_get_name(wmOperatorType *UNUSED(ot), PointerRNA *ptr) +{ + struct SelectPick_Params params = {0}; + ED_select_pick_params_from_operator(ptr, ¶ms); + switch (params.sel_op) { + case SEL_OP_ADD: + return "Select (Extend)"; + case SEL_OP_SUB: + return "Select (Deselect)"; + case SEL_OP_XOR: + return "Select (Toggle)"; + case SEL_OP_AND: + BLI_assert_unreachable(); + ATTR_FALLTHROUGH; + case SEL_OP_SET: + break; + } + return "Select"; +} + +const char *ED_select_circle_get_name(wmOperatorType *UNUSED(ot), PointerRNA *ptr) +{ + /* Matches options in #WM_operator_properties_select_operation_simple */ + const eSelectOp sel_op = RNA_enum_get(ptr, "mode"); + switch (sel_op) { + case SEL_OP_ADD: + return "Circle Select (Extend)"; + case SEL_OP_SUB: + return "Circle Select (Deselect)"; + case SEL_OP_XOR: + ATTR_FALLTHROUGH; + case SEL_OP_AND: + BLI_assert_unreachable(); + ATTR_FALLTHROUGH; + case SEL_OP_SET: + break; + } + return "Circle Select"; +} + +/** \} */ |