WIP: GPv3: Select Circle operator #108815
|
@ -53,6 +53,7 @@
|
|||
#include "BKE_crazyspace.hh"
|
||||
#include "BKE_curve.h"
|
||||
#include "BKE_editmesh.h"
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_layer.h"
|
||||
#include "BKE_mball.h"
|
||||
#include "BKE_mesh.hh"
|
||||
|
@ -4028,6 +4029,32 @@ static bool do_pose_box_select(bContext *C,
|
|||
return changed_multi;
|
||||
}
|
||||
|
||||
|
||||
static bool do_grease_pencil_box_select(ViewContext *vc, const rcti *rect, const eSelectOp sel_op)
|
||||
Falk David
commented
This function should be removed. It looks like you might also need to merge with This function should be removed. It looks like you might also need to merge with `main`.
|
||||
{
|
||||
using namespace blender;
|
||||
Scene *scene = vc->scene;
|
||||
const Object *ob_eval = DEG_get_evaluated_object(vc->depsgraph,
|
||||
const_cast<Object *>(vc->obedit));
|
||||
GreasePencil &grease_pencil = *static_cast<GreasePencil *>(vc->obedit->data);
|
||||
|
||||
bool changed = false;
|
||||
grease_pencil.foreach_editable_drawing(
|
||||
scene->r.cfra, [&](int drawing_index, GreasePencilDrawing &drawing) {
|
||||
bke::crazyspace::GeometryDeformation deformation =
|
||||
bke::crazyspace::get_evaluated_grease_pencil_drawing_deformation(
|
||||
ob_eval, *vc->obedit, drawing_index);
|
||||
changed |= ed::curves::select_box(
|
||||
*vc, drawing.geometry.wrap(), deformation.positions, ATTR_DOMAIN_POINT, *rect, sel_op);
|
||||
});
|
||||
|
||||
if (changed) {
|
||||
DEG_id_tag_update(&grease_pencil.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(vc->C, NC_GEOM | ND_DATA, &grease_pencil);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
static int view3d_box_select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
using namespace blender;
|
||||
|
@ -4113,6 +4140,10 @@ static int view3d_box_select_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case OB_GREASE_PENCIL: {
|
||||
Falk David
commented
Same comment as above. Same comment as above.
|
||||
changed = do_grease_pencil_box_select(&vc, &rect, sel_op);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BLI_assert_msg(0, "box select on incorrect object type");
|
||||
break;
|
||||
|
@ -4836,7 +4867,30 @@ static bool mball_circle_select(ViewContext *vc,
|
|||
vc, do_circle_select_mball__doSelectElem, &data, V3D_PROJ_TEST_CLIP_DEFAULT);
|
||||
return data.is_changed;
|
||||
}
|
||||
/**
|
||||
* Callbacks for select circle in greasce pensil mode
|
||||
*/
|
||||
|
||||
static bool grease_pensil_circle_select(ViewContext *vc,
|
||||
Falk David
commented
This function doesn't look right. First, it should be named This function doesn't look right. First, it should be named `grease_pencil_circle_select`.
Second, the logic in the function is not right, it should be similar to the logic inside `do_grease_pencil_box_select`.
|
||||
const eSelectOp sel_op
|
||||
const int mval[2],
|
||||
float rad)
|
||||
{
|
||||
BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB));
|
||||
Scene *scene = vc->scene;
|
||||
ViewLayer *view_layer = vc->view_layer;
|
||||
View3D *v3d = vc->v3d;
|
||||
|
||||
const float radius_squared = rad * rad;
|
||||
const float mval_fl[2] = {float(mval[0]), float(mval[1])};
|
||||
|
||||
bool changed = false;
|
||||
if (SEL_OP_USE_PRE_SELECT(sel_op)) {
|
||||
changed |= grease_pensil_circle_select(scene->vc, view_layer->vc, vcv3d->vc);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
/**
|
||||
* Callbacks for circle selection in Editmode
|
||||
*/
|
||||
|
@ -4870,6 +4924,9 @@ static bool obedit_circle_select(bContext *C,
|
|||
case OB_MBALL:
|
||||
changed = mball_circle_select(vc, sel_op, mval, rad);
|
||||
break;
|
||||
ase OB_GREASE_PENSIL:
|
||||
Falk David
commented
`OB_GREASE_PENSIL` -> `OB_GREASE_PENCIL`
|
||||
changed = grease_pensil_circle_select(vc, sel_op, mval, rad);
|
||||
Falk David
commented
There should just be a call to
There should just be a call to `grease_pencil_circle_select` here.
|
||||
break;
|
||||
case OB_CURVES: {
|
||||
Curves &curves_id = *static_cast<Curves *>(vc->obedit->data);
|
||||
bke::CurvesGeometry &curves = curves_id.geometry.wrap();
|
||||
|
|
Loading…
Reference in New Issue
This looks like some copy-paste error, these added lines should be removed.