View 3D: move picking arguments into a struct & minor refactor

- Add SelectPick_Params struct to make picking logic more
  straightforward and easier to extend.

- Use `eSelectOp` instead of booleans (extend, deselect, toggle)
  which were used to represent 4 states (which wasn't obvious).

- Handle deselect_all when pocking instead of view3d_select_exec,
  de-duplicate de-selection which was already needed in when replacing
  the selection in picking functions.

- Handle outliner update & notifiers in the picking functions
  instead of view3d_select_exec.

- Fix particle select deselect_all option which did nothing.
This commit is contained in:
2022-03-15 21:03:04 +11:00
parent 9a763d24f2
commit 5e5285baf6
20 changed files with 948 additions and 692 deletions

View File

@@ -70,6 +70,25 @@ bool ED_select_similar_compare_float_tree(const struct KDTree_1d *tree,
*/
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first);
/** Argument passed to picking functions. */
struct SelectPick_Params {
/**
* - #SEL_OP_ADD named "extend" from operators.
* - #SEL_OP_SUB named "deselect" from operators.
* - #SEL_OP_XOR named "toggle" from operators.
* - #SEL_OP_AND (never used for picking).
* - #SEL_OP_SET use when "extend", "deselect" and "toggle" are all disabled.
*/
eSelectOp sel_op;
/** Deselect all, even when there is nothing found at the cursor location. */
bool deselect_all;
};
/**
* Utility to get #eSelectPickMode from booleans for convenience.
*/
eSelectOp ED_select_op_from_booleans(bool extend, bool deselect, bool toggle);
#ifdef __cplusplus
}
#endif