Cleanup: pass SelectPick_Params by reference instead of pointer
Also use a return value from ED_select_pick_params_from_operator.
This commit is contained in:
@@ -957,7 +957,7 @@ bool ED_armature_edit_deselect_all_visible_multi(bContext *C)
|
||||
* \{ */
|
||||
|
||||
bool ED_armature_edit_select_pick_bone(
|
||||
bContext *C, Base *basact, EditBone *ebone, const int selmask, const SelectPick_Params *params)
|
||||
bContext *C, Base *basact, EditBone *ebone, const int selmask, const SelectPick_Params ¶ms)
|
||||
{
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
@@ -972,13 +972,13 @@ bool ED_armature_edit_select_pick_bone(
|
||||
}
|
||||
}
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) &&
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) &&
|
||||
(ED_armature_ebone_selectflag_get(ebone) & selmask))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
Vector<Base *> bases = BKE_view_layer_array_from_bases_in_edit_mode_unique_data(
|
||||
scene, view_layer, v3d);
|
||||
@@ -998,7 +998,7 @@ bool ED_armature_edit_select_pick_bone(
|
||||
if (ebone->parent && (ebone->flag & BONE_CONNECTED)) {
|
||||
|
||||
/* Bone is in a chain. */
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
/* Select this bone. */
|
||||
ebone->flag |= BONE_TIPSEL;
|
||||
@@ -1044,7 +1044,7 @@ bool ED_armature_edit_select_pick_bone(
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
ebone->flag |= (BONE_TIPSEL | BONE_ROOTSEL);
|
||||
break;
|
||||
@@ -1075,7 +1075,7 @@ bool ED_armature_edit_select_pick_bone(
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
ebone->flag |= selmask;
|
||||
break;
|
||||
@@ -1128,7 +1128,7 @@ bool ED_armature_edit_select_pick_bone(
|
||||
return changed || found;
|
||||
}
|
||||
|
||||
bool ED_armature_edit_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params)
|
||||
bool ED_armature_edit_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms)
|
||||
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
||||
@@ -132,7 +132,7 @@ bool ED_armature_pose_select_pick_bone(const Scene *scene,
|
||||
View3D *v3d,
|
||||
Object *ob,
|
||||
Bone *bone,
|
||||
const SelectPick_Params *params)
|
||||
const SelectPick_Params ¶ms)
|
||||
{
|
||||
bool found = false;
|
||||
bool changed = false;
|
||||
@@ -143,11 +143,11 @@ bool ED_armature_pose_select_pick_bone(const Scene *scene,
|
||||
}
|
||||
}
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && (bone->flag & BONE_SELECTED)) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && (bone->flag & BONE_SELECTED)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
/* Don't use #BKE_object_pose_base_array_get_unique
|
||||
* because we may be selecting from object mode. */
|
||||
@@ -181,13 +181,13 @@ bool ED_armature_pose_select_pick_bone(const Scene *scene,
|
||||
{
|
||||
/* When we are entering into posemode via toggle-select,
|
||||
* from another active object - always select the bone. */
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
/* Re-select the bone again later in this function. */
|
||||
bone->flag &= ~BONE_SELECTED;
|
||||
}
|
||||
}
|
||||
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
bone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
|
||||
arm->act_bone = bone;
|
||||
@@ -258,7 +258,7 @@ bool ED_armature_pose_select_pick_with_buffer(const Scene *scene,
|
||||
Base *base,
|
||||
const GPUSelectResult *hit_results,
|
||||
const int hits,
|
||||
const SelectPick_Params *params,
|
||||
const SelectPick_Params ¶ms,
|
||||
bool do_nearest)
|
||||
{
|
||||
Object *ob = base->object;
|
||||
|
||||
@@ -4822,7 +4822,7 @@ void CURVE_OT_make_segment(wmOperatorType *ot)
|
||||
bool ED_curve_editnurb_select_pick(bContext *C,
|
||||
const int mval[2],
|
||||
const int dist_px,
|
||||
const SelectPick_Params *params)
|
||||
const SelectPick_Params ¶ms)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Nurb *nu;
|
||||
@@ -4840,13 +4840,13 @@ bool ED_curve_editnurb_select_pick(bContext *C,
|
||||
|
||||
bool found = ED_curve_pick_vert_ex(&vc, true, dist_px, &nu, &bezt, &bp, &hand, &basact);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) &&
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) &&
|
||||
(((bezt ? (&bezt->f1)[hand] : bp->f1) & SELECT) != 0))
|
||||
{
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
Vector<Object *> objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, vc.v3d);
|
||||
@@ -4866,7 +4866,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
|
||||
ListBase *editnurb = object_editcurve_get(obedit);
|
||||
const void *vert = BKE_curve_vert_active_get(cu);
|
||||
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
if (bezt) {
|
||||
if (hand == 1) {
|
||||
|
||||
@@ -1562,9 +1562,10 @@ static wmOperatorStatus curve_pen_modal(bContext *C, wmOperator *op, const wmEve
|
||||
BPoint *bp = nullptr;
|
||||
Nurb *nu = nullptr;
|
||||
|
||||
SelectPick_Params params{};
|
||||
params.sel_op = SEL_OP_SET;
|
||||
params.deselect_all = false;
|
||||
const SelectPick_Params params = {
|
||||
/*sel_op*/ SEL_OP_SET,
|
||||
/*deselect_all*/ false,
|
||||
};
|
||||
|
||||
wmOperatorStatus ret = OPERATOR_RUNNING_MODAL;
|
||||
|
||||
@@ -1657,7 +1658,7 @@ static wmOperatorStatus curve_pen_modal(bContext *C, wmOperator *op, const wmEve
|
||||
else if (ELEM(event->type, LEFTMOUSE)) {
|
||||
if (ELEM(event->val, KM_RELEASE, KM_DBL_CLICK)) {
|
||||
if (delete_point && !cpd->new_point && !cpd->dragging) {
|
||||
if (ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, ¶ms)) {
|
||||
if (ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, params)) {
|
||||
cpd->changed = delete_point_under_mouse(&vc, event);
|
||||
}
|
||||
}
|
||||
@@ -1718,7 +1719,7 @@ static wmOperatorStatus curve_pen_modal(bContext *C, wmOperator *op, const wmEve
|
||||
}
|
||||
}
|
||||
else if (select_point) {
|
||||
ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, ¶ms);
|
||||
ED_curve_editnurb_select_pick(C, event->mval, threshold_dist_px, params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2581,7 +2581,7 @@ bool ED_curve_editfont_select_pick(
|
||||
bContext *C,
|
||||
const int mval[2],
|
||||
/* NOTE: `params->deselect_all` is ignored as only one text-box is active at once. */
|
||||
const SelectPick_Params *params)
|
||||
const SelectPick_Params ¶ms)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
|
||||
@@ -162,11 +162,11 @@ bool ED_armature_edit_deselect_all_visible_multi(bContext *C);
|
||||
* \return True when pick finds an element or the selection changed.
|
||||
*/
|
||||
bool ED_armature_edit_select_pick_bone(
|
||||
bContext *C, Base *basact, EditBone *ebone, int selmask, const SelectPick_Params *params);
|
||||
bContext *C, Base *basact, EditBone *ebone, int selmask, const SelectPick_Params ¶ms);
|
||||
/**
|
||||
* Bone selection picking for armature edit-mode in the view3d.
|
||||
*/
|
||||
bool ED_armature_edit_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params);
|
||||
bool ED_armature_edit_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms);
|
||||
/**
|
||||
* Perform a selection operation on elements which have been 'touched',
|
||||
* use for lasso & border select but can be used elsewhere too.
|
||||
@@ -288,8 +288,7 @@ bool ED_armature_pose_select_pick_bone(const Scene *scene,
|
||||
View3D *v3d,
|
||||
Object *ob,
|
||||
Bone *bone,
|
||||
const SelectPick_Params *params)
|
||||
ATTR_NONNULL(1, 2, 3, 4, 6);
|
||||
const SelectPick_Params ¶ms) ATTR_NONNULL(1, 2, 3, 4);
|
||||
/**
|
||||
* Called for mode-less pose selection.
|
||||
* assumes the active object is still on old situation.
|
||||
@@ -302,8 +301,8 @@ bool ED_armature_pose_select_pick_with_buffer(const Scene *scene,
|
||||
Base *base,
|
||||
const GPUSelectResult *hit_results,
|
||||
int hits,
|
||||
const SelectPick_Params *params,
|
||||
bool do_nearest) ATTR_NONNULL(1, 2, 3, 4, 5, 7);
|
||||
const SelectPick_Params ¶ms,
|
||||
bool do_nearest) ATTR_NONNULL(1, 2, 3, 4, 5);
|
||||
/**
|
||||
* While in weight-paint mode, a single pose may be active as well.
|
||||
* While not common, it's possible we have multiple armatures deforming a mesh.
|
||||
|
||||
@@ -58,7 +58,7 @@ void ED_curve_editnurb_free(Object *obedit);
|
||||
bool ED_curve_editnurb_select_pick(bContext *C,
|
||||
const int mval[2],
|
||||
int dist_px,
|
||||
const SelectPick_Params *params);
|
||||
const SelectPick_Params ¶ms);
|
||||
|
||||
Nurb *ED_curve_add_nurbs_primitive(
|
||||
bContext *C, Object *obedit, float mat[4][4], int type, int newob);
|
||||
@@ -114,7 +114,7 @@ bool ED_curve_active_center(Curve *cu, float center[3]);
|
||||
*/
|
||||
bool ED_curve_editfont_select_pick(bContext *C,
|
||||
const int mval[2],
|
||||
const SelectPick_Params *params);
|
||||
const SelectPick_Params ¶ms);
|
||||
|
||||
/* `editfont_undo.cc` */
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ bool ED_lattice_flags_set(Object *obedit, int flag);
|
||||
/**
|
||||
* \return True when pick finds an element or the selection changed.
|
||||
*/
|
||||
bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params);
|
||||
bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms);
|
||||
|
||||
bool ED_lattice_deselect_all_multi(bContext *C);
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ Base *ED_mball_base_and_elem_from_select_buffer(blender::Span<Base *> bases,
|
||||
*
|
||||
* \return True when pick finds an element or the selection changed.
|
||||
*/
|
||||
bool ED_mball_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params);
|
||||
bool ED_mball_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms);
|
||||
bool ED_mball_deselect_all_multi(bContext *C);
|
||||
|
||||
/**
|
||||
|
||||
@@ -267,7 +267,7 @@ bool EDBM_unified_findnearest_from_raycast(ViewContext *vc,
|
||||
BMEdge **r_eed,
|
||||
BMFace **r_efa);
|
||||
|
||||
bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params);
|
||||
bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms);
|
||||
|
||||
/**
|
||||
* When switching select mode, makes sure selection is consistent for editing
|
||||
@@ -395,7 +395,7 @@ void paintface_flush_flags(bContext *C, Object *ob, bool flush_selection, bool f
|
||||
*/
|
||||
bool paintface_mouse_select(bContext *C,
|
||||
const int mval[2],
|
||||
const SelectPick_Params *params,
|
||||
const SelectPick_Params ¶ms,
|
||||
Object *ob);
|
||||
bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool flush_flags);
|
||||
void paintface_select_linked(bContext *C, Object *ob, const int mval[2], bool select);
|
||||
|
||||
@@ -48,7 +48,7 @@ void PE_update_object(Depsgraph *depsgraph, Scene *scene, Object *ob, int usefla
|
||||
|
||||
/* selection tools */
|
||||
|
||||
bool PE_mouse_particles(bContext *C, const int mval[2], const SelectPick_Params *params);
|
||||
bool PE_mouse_particles(bContext *C, const int mval[2], const SelectPick_Params ¶ms);
|
||||
bool PE_box_select(bContext *C, const rcti *rect, int sel_op);
|
||||
bool PE_circle_select(
|
||||
bContext *C, wmGenericUserData *wm_userdata, int sel_op, const int mval[2], float rad);
|
||||
|
||||
@@ -83,28 +83,27 @@ struct SelectPick_Params {
|
||||
* - #SEL_OP_AND (never used for picking).
|
||||
* - #SEL_OP_SET use when "extend", "deselect" and "toggle" are all disabled.
|
||||
*/
|
||||
eSelectOp sel_op;
|
||||
eSelectOp sel_op = SEL_OP_SET;
|
||||
/** Deselect all, even when there is nothing found at the cursor location. */
|
||||
bool deselect_all;
|
||||
bool deselect_all = false;
|
||||
/**
|
||||
* When selecting an element that is already selected, do nothing (passthrough).
|
||||
* don't even make it active.
|
||||
* Use to implement tweaking to move the selection without first de-selecting.
|
||||
*/
|
||||
bool select_passthrough;
|
||||
bool select_passthrough = false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Utility to get #eSelectPickMode from booleans for convenience.
|
||||
*/
|
||||
eSelectOp ED_select_op_from_operator(PointerRNA *ptr) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT;
|
||||
eSelectOp ED_select_op_from_operator(PointerRNA *ptr) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
/**
|
||||
* Initialize `params` from `op`,
|
||||
* these properties are defined by #WM_operator_properties_mouse_select.
|
||||
*/
|
||||
void ED_select_pick_params_from_operator(PointerRNA *ptr, SelectPick_Params *params)
|
||||
ATTR_NONNULL(1, 2);
|
||||
SelectPick_Params ED_select_pick_params_from_operator(PointerRNA *ptr) ATTR_NONNULL(1);
|
||||
|
||||
/**
|
||||
* Get-name callback for #wmOperatorType.get_name, this is mainly useful so the selection
|
||||
|
||||
@@ -597,7 +597,7 @@ static BPoint *findnearestLattvert(ViewContext *vc, bool select, Base **r_base)
|
||||
return data.bp;
|
||||
}
|
||||
|
||||
bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params)
|
||||
bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
BPoint *bp = nullptr;
|
||||
@@ -611,11 +611,11 @@ bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Par
|
||||
bp = findnearestLattvert(&vc, true, &basact);
|
||||
bool found = (bp != nullptr);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && (bp->f1 & SELECT)) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && (bp->f1 & SELECT)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
Vector<Object *> objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(
|
||||
vc.scene, vc.view_layer, vc.v3d);
|
||||
@@ -633,7 +633,7 @@ bool ED_lattice_select_pick(bContext *C, const int mval[2], const SelectPick_Par
|
||||
ED_view3d_viewcontext_init_object(&vc, basact->object);
|
||||
Lattice *lt = ((Lattice *)vc.obedit->data)->editlatt->latt;
|
||||
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
bp->f1 |= SELECT;
|
||||
break;
|
||||
|
||||
@@ -720,7 +720,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
|
||||
|
||||
bool paintface_mouse_select(bContext *C,
|
||||
const int mval[2],
|
||||
const SelectPick_Params *params,
|
||||
const SelectPick_Params ¶ms,
|
||||
Object *ob)
|
||||
{
|
||||
using namespace blender;
|
||||
@@ -745,11 +745,11 @@ bool paintface_mouse_select(bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && select_poly.varray[index]) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && select_poly.varray[index]) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
changed |= paintface_deselect_all_visible(C, ob, SEL_DESELECT, false);
|
||||
}
|
||||
@@ -758,7 +758,7 @@ bool paintface_mouse_select(bContext *C,
|
||||
if (found) {
|
||||
mesh->act_face = int(index);
|
||||
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_SET:
|
||||
case SEL_OP_ADD:
|
||||
select_poly.varray.set(index, true);
|
||||
|
||||
@@ -747,9 +747,10 @@ static wmOperatorStatus edbm_shortest_path_pick_invoke(bContext *C,
|
||||
/* TODO(dfelinto): right now we try to find the closest element twice.
|
||||
* The ideal is to refactor EDBM_select_pick so it doesn't
|
||||
* have to pick the nearest vert/edge/face again. */
|
||||
SelectPick_Params params{};
|
||||
params.sel_op = SEL_OP_ADD;
|
||||
EDBM_select_pick(C, event->mval, ¶ms);
|
||||
const SelectPick_Params params = {
|
||||
/*sel_op*/ SEL_OP_ADD,
|
||||
};
|
||||
EDBM_select_pick(C, event->mval, params);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
||||
@@ -2123,7 +2123,7 @@ void MESH_OT_select_interior_faces(wmOperatorType *ot)
|
||||
* Gets called via generic mouse select operator.
|
||||
* \{ */
|
||||
|
||||
bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params)
|
||||
bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms)
|
||||
{
|
||||
int base_index_active = -1;
|
||||
BMVert *eve = nullptr;
|
||||
@@ -2141,12 +2141,12 @@ bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params *p
|
||||
bool changed = false;
|
||||
bool found = unified_findnearest(&vc, bases, &base_index_active, &eve, &eed, &efa);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
BMElem *ele = efa ? (BMElem *)efa : (eed ? (BMElem *)eed : (BMElem *)eve);
|
||||
if ((found && params->select_passthrough) && BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
|
||||
if ((found && params.select_passthrough) && BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
for (Base *base_iter : bases) {
|
||||
Object *ob_iter = base_iter->object;
|
||||
@@ -2166,7 +2166,7 @@ bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params *p
|
||||
BMesh *bm = em->bm;
|
||||
|
||||
if (efa) {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
BM_mesh_active_face_set(bm, efa);
|
||||
|
||||
@@ -2211,7 +2211,7 @@ bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params *p
|
||||
}
|
||||
else if (eed) {
|
||||
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
/* Work-around: deselect first, so we can guarantee it will
|
||||
* be active even if it was already selected. */
|
||||
@@ -2251,7 +2251,7 @@ bool EDBM_select_pick(bContext *C, const int mval[2], const SelectPick_Params *p
|
||||
}
|
||||
}
|
||||
else if (eve) {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
/* Work-around: deselect first, so we can guarantee it will
|
||||
* be active even if it was already selected. */
|
||||
|
||||
@@ -8434,7 +8434,7 @@ static wmOperatorStatus edbm_point_normals_modal(bContext *C, wmOperator *op, co
|
||||
view3d_operator_needs_gpu(C);
|
||||
SelectPick_Params params{};
|
||||
params.sel_op = SEL_OP_SET;
|
||||
if (EDBM_select_pick(C, event->mval, ¶ms)) {
|
||||
if (EDBM_select_pick(C, event->mval, params)) {
|
||||
/* Point to newly selected active. */
|
||||
blender::ed::object::calc_active_center_for_editmode(obedit, false, target);
|
||||
|
||||
|
||||
@@ -850,7 +850,7 @@ static bool ed_mball_findnearest_metaelem(bContext *C,
|
||||
return found;
|
||||
}
|
||||
|
||||
bool ED_mball_select_pick(bContext *C, const int mval[2], const SelectPick_Params *params)
|
||||
bool ED_mball_select_pick(bContext *C, const int mval[2], const SelectPick_Params ¶ms)
|
||||
{
|
||||
Base *base = nullptr;
|
||||
MetaElem *ml = nullptr;
|
||||
@@ -860,11 +860,11 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], const SelectPick_Param
|
||||
|
||||
bool found = ed_mball_findnearest_metaelem(C, mval, true, &base, &ml, &selmask);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && (ml->flag & SELECT)) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && (ml->flag & SELECT)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
changed |= ED_mball_deselect_all_multi(C);
|
||||
}
|
||||
@@ -878,7 +878,7 @@ bool ED_mball_select_pick(bContext *C, const int mval[2], const SelectPick_Param
|
||||
ml->flag &= ~MB_SCALE_RAD;
|
||||
}
|
||||
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
ml->flag |= SELECT;
|
||||
break;
|
||||
|
||||
@@ -1873,7 +1873,7 @@ static bool pe_nearest_point_and_key(bContext *C,
|
||||
return found;
|
||||
}
|
||||
|
||||
bool PE_mouse_particles(bContext *C, const int mval[2], const SelectPick_Params *params)
|
||||
bool PE_mouse_particles(bContext *C, const int mval[2], const SelectPick_Params ¶ms)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@@ -1891,18 +1891,18 @@ bool PE_mouse_particles(bContext *C, const int mval[2], const SelectPick_Params
|
||||
bool changed = false;
|
||||
bool found = pe_nearest_point_and_key(C, mval, &point, &key);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && (key->flag & PEK_SELECT)) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && (key->flag & PEK_SELECT)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
changed |= PE_deselect_all_visible_ex(edit);
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
if ((key->flag & PEK_SELECT) == 0) {
|
||||
key->flag |= PEK_SELECT;
|
||||
|
||||
@@ -515,7 +515,7 @@ void node_select_single(bContext &C, bNode &node)
|
||||
static bool node_mouse_select(bContext *C,
|
||||
wmOperator *op,
|
||||
const int2 mval,
|
||||
SelectPick_Params *params)
|
||||
const SelectPick_Params ¶ms)
|
||||
{
|
||||
Main &bmain = *CTX_data_main(C);
|
||||
SpaceNode &snode = *CTX_wm_space_node(C);
|
||||
@@ -528,7 +528,7 @@ static bool node_mouse_select(bContext *C,
|
||||
bNodeSocket *sock = nullptr;
|
||||
|
||||
/* Always do socket_select when extending selection. */
|
||||
const bool socket_select = (params->sel_op == SEL_OP_XOR) ||
|
||||
const bool socket_select = (params.sel_op == SEL_OP_XOR) ||
|
||||
RNA_boolean_get(op->ptr, "socket_select");
|
||||
bool changed = false;
|
||||
bool found = false;
|
||||
@@ -541,7 +541,7 @@ static bool node_mouse_select(bContext *C,
|
||||
/* First do socket selection, these generally overlap with nodes. */
|
||||
if (socket_select) {
|
||||
/* NOTE: unlike nodes #SelectPick_Params isn't fully supported. */
|
||||
const bool extend = (params->sel_op == SEL_OP_XOR);
|
||||
const bool extend = (params.sel_op == SEL_OP_XOR);
|
||||
sock = node_find_indicated_socket(snode, region, cursor, SOCK_IN);
|
||||
if (sock) {
|
||||
node = &sock->owner_node();
|
||||
@@ -601,18 +601,18 @@ static bool node_mouse_select(bContext *C,
|
||||
found = (node != nullptr);
|
||||
node_was_selected = node && (node->flag & SELECT);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && (node->flag & SELECT)) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && (node->flag & SELECT)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
changed = node_deselect_all(node_tree);
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD:
|
||||
bke::node_set_selected(*node, true);
|
||||
break;
|
||||
@@ -653,7 +653,7 @@ static bool node_mouse_select(bContext *C,
|
||||
|
||||
bool active_texture_changed = false;
|
||||
bool viewer_node_changed = false;
|
||||
if ((node != nullptr) && (node_was_selected == false || params->select_passthrough == false)) {
|
||||
if ((node != nullptr) && (node_was_selected == false || params.select_passthrough == false)) {
|
||||
viewer_node_changed = (node->flag & NODE_DO_OUTPUT) == 0 &&
|
||||
node->type_legacy == GEO_NODE_VIEWER;
|
||||
ED_node_set_active(&bmain, &snode, snode.edittree, node, &active_texture_changed);
|
||||
@@ -681,11 +681,10 @@ static wmOperatorStatus node_select_exec(bContext *C, wmOperator *op)
|
||||
int2 mval;
|
||||
RNA_int_get_array(op->ptr, "location", mval);
|
||||
|
||||
SelectPick_Params params = {};
|
||||
ED_select_pick_params_from_operator(op->ptr, ¶ms);
|
||||
const SelectPick_Params params = ED_select_pick_params_from_operator(op->ptr);
|
||||
|
||||
/* Perform the selection. */
|
||||
const bool changed = node_mouse_select(C, op, mval, ¶ms);
|
||||
const bool changed = node_mouse_select(C, op, mval, params);
|
||||
|
||||
if (changed) {
|
||||
return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
|
||||
|
||||
@@ -1694,7 +1694,7 @@ static bool object_mouse_select_menu(bContext *C,
|
||||
const ViewContext *vc,
|
||||
const blender::Span<GPUSelectResult> hit_results,
|
||||
const int mval[2],
|
||||
const SelectPick_Params *params,
|
||||
const SelectPick_Params ¶ms,
|
||||
Base **r_basact)
|
||||
{
|
||||
|
||||
@@ -1790,9 +1790,9 @@ static bool object_mouse_select_menu(bContext *C,
|
||||
PointerRNA ptr;
|
||||
|
||||
WM_operator_properties_create_ptr(&ptr, ot);
|
||||
RNA_boolean_set(&ptr, "extend", params->sel_op == SEL_OP_ADD);
|
||||
RNA_boolean_set(&ptr, "deselect", params->sel_op == SEL_OP_SUB);
|
||||
RNA_boolean_set(&ptr, "toggle", params->sel_op == SEL_OP_XOR);
|
||||
RNA_boolean_set(&ptr, "extend", params.sel_op == SEL_OP_ADD);
|
||||
RNA_boolean_set(&ptr, "deselect", params.sel_op == SEL_OP_SUB);
|
||||
RNA_boolean_set(&ptr, "toggle", params.sel_op == SEL_OP_XOR);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, nullptr);
|
||||
WM_operator_properties_free(&ptr);
|
||||
|
||||
@@ -1823,12 +1823,11 @@ static wmOperatorStatus bone_select_menu_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (basact->object->mode & OB_MODE_EDIT) {
|
||||
EditBone *ebone = (EditBone *)object_mouse_select_menu_data[name_index].item_ptr;
|
||||
ED_armature_edit_select_pick_bone(C, basact, ebone, BONE_SELECTED, ¶ms);
|
||||
ED_armature_edit_select_pick_bone(C, basact, ebone, BONE_SELECTED, params);
|
||||
}
|
||||
else {
|
||||
bPoseChannel *pchan = (bPoseChannel *)object_mouse_select_menu_data[name_index].item_ptr;
|
||||
ED_armature_pose_select_pick_bone(
|
||||
scene, view_layer, v3d, basact->object, pchan->bone, ¶ms);
|
||||
ED_armature_pose_select_pick_bone(scene, view_layer, v3d, basact->object, pchan->bone, params);
|
||||
}
|
||||
|
||||
/* Weak but ensures we activate the menu again before using the enum. */
|
||||
@@ -1907,7 +1906,7 @@ void VIEW3D_OT_bone_select_menu(wmOperatorType *ot)
|
||||
static bool bone_mouse_select_menu(bContext *C,
|
||||
const blender::Span<GPUSelectResult> hit_results,
|
||||
const bool is_editmode,
|
||||
const SelectPick_Params *params)
|
||||
const SelectPick_Params ¶ms)
|
||||
{
|
||||
int bone_count = 0;
|
||||
|
||||
@@ -2040,9 +2039,9 @@ static bool bone_mouse_select_menu(bContext *C,
|
||||
PointerRNA ptr;
|
||||
|
||||
WM_operator_properties_create_ptr(&ptr, ot);
|
||||
RNA_boolean_set(&ptr, "extend", params->sel_op == SEL_OP_ADD);
|
||||
RNA_boolean_set(&ptr, "deselect", params->sel_op == SEL_OP_SUB);
|
||||
RNA_boolean_set(&ptr, "toggle", params->sel_op == SEL_OP_XOR);
|
||||
RNA_boolean_set(&ptr, "extend", params.sel_op == SEL_OP_ADD);
|
||||
RNA_boolean_set(&ptr, "deselect", params.sel_op == SEL_OP_SUB);
|
||||
RNA_boolean_set(&ptr, "toggle", params.sel_op == SEL_OP_XOR);
|
||||
WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &ptr, nullptr);
|
||||
WM_operator_properties_free(&ptr);
|
||||
|
||||
@@ -2501,7 +2500,7 @@ static bool ed_object_select_pick_camera_track(bContext *C,
|
||||
MovieClip *clip,
|
||||
const GPUSelectBuffer &buffer,
|
||||
const short hits,
|
||||
const SelectPick_Params *params)
|
||||
const SelectPick_Params ¶ms)
|
||||
{
|
||||
bool changed = false;
|
||||
bool found = false;
|
||||
@@ -2530,13 +2529,13 @@ static bool ed_object_select_pick_camera_track(bContext *C,
|
||||
break;
|
||||
}
|
||||
|
||||
/* Note `params->deselect_all` is ignored for tracks as in this case
|
||||
/* Note `params.deselect_all` is ignored for tracks as in this case
|
||||
* all objects will be de-selected (not tracks). */
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && TRACK_SELECTED(track)) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && TRACK_SELECTED(track)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found /* `|| params->deselect_all` */) {
|
||||
else if (found /* `|| params.deselect_all` */) {
|
||||
/* Deselect everything. */
|
||||
deselect_all_tracks(tracking);
|
||||
changed = true;
|
||||
@@ -2544,7 +2543,7 @@ static bool ed_object_select_pick_camera_track(bContext *C,
|
||||
}
|
||||
|
||||
if (found) {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
BKE_tracking_track_select(tracksbase, track, TRACK_AREA_ALL, true);
|
||||
break;
|
||||
@@ -2597,7 +2596,7 @@ static bool ed_object_select_pick_camera_track(bContext *C,
|
||||
*/
|
||||
static bool ed_object_select_pick(bContext *C,
|
||||
const int mval[2],
|
||||
const SelectPick_Params *params,
|
||||
const SelectPick_Params ¶ms,
|
||||
const bool center,
|
||||
const bool enumerate,
|
||||
const bool object_only)
|
||||
@@ -2919,14 +2918,14 @@ static bool ed_object_select_pick(bContext *C,
|
||||
* so it makes sense to disable pass-through logic in this case.
|
||||
*
|
||||
* See: #115181 for details. */
|
||||
const bool select_passthrough = params->select_passthrough && (changed_object_mode == false);
|
||||
const bool select_passthrough = params.select_passthrough && (changed_object_mode == false);
|
||||
|
||||
bool found = (basact != nullptr) && BASE_SELECTABLE(v3d, basact);
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && select_passthrough) && (basact->flag & BASE_SELECTED)) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
/* `basact` may be nullptr. */
|
||||
if (object_deselect_all_except(scene, view_layer, basact)) {
|
||||
@@ -2938,7 +2937,7 @@ static bool ed_object_select_pick(bContext *C,
|
||||
if (found) {
|
||||
use_activate_selected_base |= (oldbasact != basact) && (is_obedit == false);
|
||||
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
blender::ed::object::base_select(basact, blender::ed::object::BA_SELECT);
|
||||
break;
|
||||
@@ -3010,7 +3009,7 @@ static bool ed_object_select_pick(bContext *C,
|
||||
*/
|
||||
static bool ed_wpaint_vertex_select_pick(bContext *C,
|
||||
const int mval[2],
|
||||
const SelectPick_Params *params,
|
||||
const SelectPick_Params ¶ms,
|
||||
Object *obact)
|
||||
{
|
||||
using namespace blender;
|
||||
@@ -3027,18 +3026,18 @@ static bool ed_wpaint_vertex_select_pick(bContext *C,
|
||||
bke::AttributeWriter<bool> select_vert = attributes.lookup_or_add_for_write<bool>(
|
||||
".select_vert", bke::AttrDomain::Point);
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && select_vert.varray[index]) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && select_vert.varray[index]) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
changed |= paintface_deselect_all_visible(C, obact, SEL_DESELECT, false);
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
select_vert.varray.set(index, true);
|
||||
break;
|
||||
@@ -3490,8 +3489,7 @@ static wmOperatorStatus view3d_select_exec(bContext *C, wmOperator *op)
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
const ViewContext vc = ED_view3d_viewcontext_init(C, depsgraph);
|
||||
|
||||
SelectPick_Params params{};
|
||||
ED_select_pick_params_from_operator(op->ptr, ¶ms);
|
||||
const SelectPick_Params params = ED_select_pick_params_from_operator(op->ptr);
|
||||
|
||||
bool center = RNA_boolean_get(op->ptr, "center");
|
||||
bool enumerate = RNA_boolean_get(op->ptr, "enumerate");
|
||||
@@ -3535,7 +3533,7 @@ static wmOperatorStatus view3d_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (obedit && object_only == false) {
|
||||
if (obedit->type == OB_MESH) {
|
||||
changed = EDBM_select_pick(C, mval, ¶ms);
|
||||
changed = EDBM_select_pick(C, mval, params);
|
||||
}
|
||||
else if (obedit->type == OB_ARMATURE) {
|
||||
if (enumerate) {
|
||||
@@ -3543,23 +3541,23 @@ static wmOperatorStatus view3d_select_exec(bContext *C, wmOperator *op)
|
||||
const int hits = mixed_bones_object_selectbuffer(
|
||||
&vc, &buffer, mval, VIEW3D_SELECT_FILTER_NOP, false, true, false);
|
||||
changed = bone_mouse_select_menu(
|
||||
C, buffer.storage.as_span().take_front(hits), true, ¶ms);
|
||||
C, buffer.storage.as_span().take_front(hits), true, params);
|
||||
}
|
||||
if (!changed) {
|
||||
changed = ED_armature_edit_select_pick(C, mval, ¶ms);
|
||||
changed = ED_armature_edit_select_pick(C, mval, params);
|
||||
}
|
||||
}
|
||||
else if (obedit->type == OB_LATTICE) {
|
||||
changed = ED_lattice_select_pick(C, mval, ¶ms);
|
||||
changed = ED_lattice_select_pick(C, mval, params);
|
||||
}
|
||||
else if (ELEM(obedit->type, OB_CURVES_LEGACY, OB_SURF)) {
|
||||
changed = ED_curve_editnurb_select_pick(C, mval, ED_view3d_select_dist_px(), ¶ms);
|
||||
changed = ED_curve_editnurb_select_pick(C, mval, ED_view3d_select_dist_px(), params);
|
||||
}
|
||||
else if (obedit->type == OB_MBALL) {
|
||||
changed = ED_mball_select_pick(C, mval, ¶ms);
|
||||
changed = ED_mball_select_pick(C, mval, params);
|
||||
}
|
||||
else if (obedit->type == OB_FONT) {
|
||||
changed = ED_curve_editfont_select_pick(C, mval, ¶ms);
|
||||
changed = ED_curve_editfont_select_pick(C, mval, params);
|
||||
}
|
||||
else if (obedit->type == OB_POINTCLOUD) {
|
||||
changed = pointcloud_select_pick(*C, mval, params);
|
||||
@@ -3572,19 +3570,19 @@ static wmOperatorStatus view3d_select_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
}
|
||||
else if (obact && obact->mode & OB_MODE_PARTICLE_EDIT) {
|
||||
changed = PE_mouse_particles(C, mval, ¶ms);
|
||||
changed = PE_mouse_particles(C, mval, params);
|
||||
}
|
||||
else if (obact && BKE_paint_select_face_test(obact)) {
|
||||
changed = paintface_mouse_select(C, mval, ¶ms, obact);
|
||||
changed = paintface_mouse_select(C, mval, params, obact);
|
||||
}
|
||||
else if (BKE_paint_select_vert_test(obact)) {
|
||||
changed = ed_wpaint_vertex_select_pick(C, mval, ¶ms, obact);
|
||||
changed = ed_wpaint_vertex_select_pick(C, mval, params, obact);
|
||||
}
|
||||
else if (BKE_paint_select_grease_pencil_test(obact)) {
|
||||
changed = ed_grease_pencil_select_pick(C, mval, params);
|
||||
}
|
||||
else {
|
||||
changed = ed_object_select_pick(C, mval, ¶ms, center, enumerate, object_only);
|
||||
changed = ed_object_select_pick(C, mval, params, center, enumerate, object_only);
|
||||
}
|
||||
|
||||
/* Pass-through flag may be cleared, see #WM_operator_flag_only_pass_through_on_press. */
|
||||
|
||||
@@ -147,12 +147,13 @@ eSelectOp ED_select_op_from_operator(PointerRNA *ptr)
|
||||
return SEL_OP_SET;
|
||||
}
|
||||
|
||||
void ED_select_pick_params_from_operator(PointerRNA *ptr, SelectPick_Params *params)
|
||||
SelectPick_Params ED_select_pick_params_from_operator(PointerRNA *ptr)
|
||||
{
|
||||
memset(params, 0x0, sizeof(*params));
|
||||
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");
|
||||
SelectPick_Params params = {};
|
||||
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");
|
||||
return params;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -164,8 +165,7 @@ std::string ED_select_pick_get_name(wmOperatorType * /*ot*/, PointerRNA *ptr)
|
||||
PropertyRNA *prop = RNA_struct_find_property(ptr, "enumerate");
|
||||
const bool enumerate = (prop && RNA_property_boolean_get(ptr, prop));
|
||||
|
||||
SelectPick_Params params = {eSelectOp(0)};
|
||||
ED_select_pick_params_from_operator(ptr, ¶ms);
|
||||
const SelectPick_Params params = ED_select_pick_params_from_operator(ptr);
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD:
|
||||
if (enumerate) {
|
||||
|
||||
@@ -2559,7 +2559,7 @@ void UV_OT_select_all(wmOperatorType *ot)
|
||||
static bool uv_mouse_select_multi(bContext *C,
|
||||
const Span<Object *> objects,
|
||||
const float co[2],
|
||||
const SelectPick_Params *params)
|
||||
const SelectPick_Params ¶ms)
|
||||
{
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
const ARegion *region = CTX_wm_region(C);
|
||||
@@ -2677,11 +2677,11 @@ static bool uv_mouse_select_multi(bContext *C,
|
||||
}
|
||||
}
|
||||
|
||||
if (params->sel_op == SEL_OP_SET) {
|
||||
if ((found && params->select_passthrough) && is_selected) {
|
||||
if (params.sel_op == SEL_OP_SET) {
|
||||
if ((found && params.select_passthrough) && is_selected) {
|
||||
found = false;
|
||||
}
|
||||
else if (found || params->deselect_all) {
|
||||
else if (found || params.deselect_all) {
|
||||
/* Deselect everything. */
|
||||
uv_select_all_perform_multi(scene, objects, SEL_DESELECT);
|
||||
for (Object *obedit : objects) {
|
||||
@@ -2704,9 +2704,9 @@ static bool uv_mouse_select_multi(bContext *C,
|
||||
const BMUVOffsets offsets = BM_uv_map_offsets_get(bm);
|
||||
|
||||
if (selectmode == UV_SELECT_ISLAND) {
|
||||
const bool extend = params->sel_op == SEL_OP_ADD;
|
||||
const bool deselect = params->sel_op == SEL_OP_SUB;
|
||||
const bool toggle = params->sel_op == SEL_OP_XOR;
|
||||
const bool extend = params.sel_op == SEL_OP_ADD;
|
||||
const bool deselect = params.sel_op == SEL_OP_SUB;
|
||||
const bool toggle = params.sel_op == SEL_OP_XOR;
|
||||
/* Current behavior of 'extend'
|
||||
* is actually toggling, so pass extend flag as 'toggle' here */
|
||||
uv_select_linked_multi(scene, objects, &hit, extend, deselect, toggle, false);
|
||||
@@ -2716,7 +2716,7 @@ static bool uv_mouse_select_multi(bContext *C,
|
||||
else {
|
||||
BLI_assert(ELEM(selectmode, UV_SELECT_VERTEX, UV_SELECT_EDGE, UV_SELECT_FACE));
|
||||
bool select_value = false;
|
||||
switch (params->sel_op) {
|
||||
switch (params.sel_op) {
|
||||
case SEL_OP_ADD: {
|
||||
select_value = true;
|
||||
break;
|
||||
@@ -2778,7 +2778,7 @@ static bool uv_mouse_select_multi(bContext *C,
|
||||
}
|
||||
else {
|
||||
/* Setting the selection implies a single element, which doesn't need to be flushed. */
|
||||
if (params->sel_op != SEL_OP_SET) {
|
||||
if (params.sel_op != SEL_OP_SET) {
|
||||
ED_uvedit_selectmode_flush(scene, bm);
|
||||
}
|
||||
}
|
||||
@@ -2792,7 +2792,7 @@ static bool uv_mouse_select_multi(bContext *C,
|
||||
|
||||
return changed || found;
|
||||
}
|
||||
static bool uv_mouse_select(bContext *C, const float co[2], const SelectPick_Params *params)
|
||||
static bool uv_mouse_select(bContext *C, const float co[2], const SelectPick_Params ¶ms)
|
||||
{
|
||||
const Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
@@ -2808,10 +2808,9 @@ static wmOperatorStatus uv_select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
RNA_float_get_array(op->ptr, "location", co);
|
||||
|
||||
SelectPick_Params params{};
|
||||
ED_select_pick_params_from_operator(op->ptr, ¶ms);
|
||||
const SelectPick_Params params = ED_select_pick_params_from_operator(op->ptr);
|
||||
|
||||
const bool changed = uv_mouse_select(C, co, ¶ms);
|
||||
const bool changed = uv_mouse_select(C, co, params);
|
||||
|
||||
if (changed) {
|
||||
return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
|
||||
|
||||
Reference in New Issue
Block a user