101 if (do_select ==
true) {
136 for (
int i = 0;
i < spline->tot_point;
i++) {
160 for (
int i = 0;
i < spline->tot_point;
i++) {
169 for (j = 0; j < cur_point->
tot_uw; j++) {
220 ot->name =
"(De)select All";
221 ot->description =
"Change selection of all curve points";
222 ot->idname =
"MASK_OT_select_all";
253 const float threshold = 19;
261 C,
mask, co, threshold, &mask_layer, &spline, &which_handle,
nullptr);
263 if (extend ==
false && deselect ==
false && toggle ==
false) {
329 C,
mask, co, threshold, &mask_layer, &spline, &point, &uw,
nullptr))
397 ot->description =
"Select spline points";
398 ot->idname =
"MASK_OT_select";
419 "Location of vertex in normalized space",
441 bool changed =
false;
459 mask_layer_orig !=
nullptr;
460 mask_layer_orig = mask_layer_orig->
next, mask_layer_eval = mask_layer_eval->
next)
466 *spline_eval =
static_cast<MaskSpline *
>(mask_layer_eval->splines.first);
467 spline_orig !=
nullptr;
468 spline_orig = spline_orig->
next, spline_eval = spline_eval->
next)
473 for (
int i = 0;
i < spline_orig->tot_point;
i++) {
503 ot->name =
"Box Select";
504 ot->description =
"Select curve points using box selection";
505 ot->idname =
"MASK_OT_select_box";
537 bool changed =
false;
551 mask_layer_orig !=
nullptr;
552 mask_layer_orig = mask_layer_orig->
next, mask_layer_eval = mask_layer_eval->
next)
558 *spline_eval =
static_cast<MaskSpline *
>(mask_layer_eval->splines.first);
559 spline_orig !=
nullptr;
560 spline_orig = spline_orig->
next, spline_eval = spline_eval->
next)
565 for (
int i = 0;
i < spline_orig->tot_point;
i++) {
623 ot->name =
"Lasso Select";
624 ot->description =
"Select curve points using lasso selection";
625 ot->idname =
"MASK_OT_select_lasso";
649 const float offset[2],
650 const float ellipse[2])
655 x = (bezt->
vec[1][0] - offset[0]) * ellipse[0];
656 y = (bezt->
vec[1][1] - offset[1]) * ellipse[1];
658 return x *
x +
y *
y < 1.0f;
670 float zoomx, zoomy, offset[2], ellipse[2];
672 bool changed =
false;
682 width = height =
max_ii(width, height);
684 ellipse[0] = width * zoomx / radius;
685 ellipse[1] = height * zoomy / radius;
701 mask_layer_orig !=
nullptr;
702 mask_layer_orig = mask_layer_orig->
next, mask_layer_eval = mask_layer_eval->
next)
708 *spline_eval =
static_cast<MaskSpline *
>(mask_layer_eval->splines.first);
709 spline_orig !=
nullptr;
710 spline_orig = spline_orig->
next, spline_eval = spline_eval->
next)
715 for (
int i = 0;
i < spline_orig->tot_point;
i++) {
744 ot->name =
"Circle Select";
745 ot->description =
"Select curve points using circle selection";
746 ot->idname =
"MASK_OT_select_circle";
782 const float threshold = 19;
783 bool changed =
false;
788 C,
mask, co, threshold, &mask_layer, &spline,
nullptr,
nullptr);
813 ot->name =
"Select Linked";
814 ot->idname =
"MASK_OT_select_linked_pick";
815 ot->description =
"(De)select all points linked to the curve under the mouse cursor";
837 bool changed =
false;
868 ot->name =
"Select Linked All";
869 ot->idname =
"MASK_OT_select_linked";
870 ot->description =
"Select all curve points linked to already selected ones";
897 bool start_sel, end_sel, prev_sel, cur_sel;
900 for (
int i = 0;
i < spline->tot_point;
i++) {
905 if (spline->tot_point < 2) {
918 for (
int i = 0;
i < spline->tot_point;
i++) {
919 if (
i == 0 && !cyclic) {
926 if (cur_sel != more) {
927 if (prev_sel == more) {
934 for (
int i = spline->tot_point - 1;
i >= 0;
i--) {
935 if (
i == spline->tot_point - 1 && !cyclic) {
943 if (cur_sel != more) {
944 if (prev_sel == more) {
967 ot->name =
"Select More";
968 ot->idname =
"MASK_OT_select_more";
969 ot->description =
"Select more spline points connected to initial selection";
987 ot->name =
"Select Less";
988 ot->idname =
"MASK_OT_select_less";
989 ot->description =
"Deselect spline points at the boundary of each selection region";
Mask * CTX_data_edit_mask(const bContext *C)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
#define MASKPOINT_ISSEL_ANY(p)
void BKE_mask_point_select_set(struct MaskSplinePoint *point, bool do_select)
#define MASKPOINT_ISSEL_KNOT(p)
#define MASKPOINT_ISSEL_HANDLE(point, which_handle)
void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, eMaskWhichHandle which_handle, bool do_select)
struct MaskSplinePoint * BKE_mask_spline_point_array(struct MaskSpline *spline)
bool BLI_lasso_is_point_inside(blender::Span< blender::int2 > mcoords, int sx, int sy, int error_value)
void BLI_lasso_boundbox(rcti *rect, blender::Span< blender::int2 > mcoords)
#define LISTBASE_FOREACH(type, var, list)
MINLINE int max_ii(int a, int b)
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2])
bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y)
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void ED_mask_mouse_pos(ScrArea *area, ARegion *region, const int mval[2], float r_co[2])
void ED_mask_point_pos(ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y)
void ED_mask_zoom(ScrArea *area, ARegion *region, float *r_zoomx, float *r_zoomy)
void ED_mask_get_size(ScrArea *area, int *r_width, int *r_height)
void ED_mask_point_pos__reverse(ScrArea *area, ARegion *region, float x, float y, float *r_x, float *r_y)
bool ED_maskedit_mask_visible_splines_poll(bContext *C)
eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first)
#define SEL_OP_USE_PRE_DESELECT(sel_op)
std::string ED_select_circle_get_name(wmOperatorType *ot, PointerRNA *ptr)
std::string ED_select_pick_get_name(wmOperatorType *ot, PointerRNA *ptr)
@ OPTYPE_DEPENDS_ON_CURSOR
BPy_StructRNA * depsgraph
void ED_mask_view_lock_state_restore_no_jump(const bContext *C, const MaskViewLockState *state)
void ED_mask_view_lock_state_store(const bContext *C, MaskViewLockState *state)
MaskSplinePoint * ED_mask_point_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], float threshold, MaskLayer **r_mask_layer, MaskSpline **r_spline, eMaskWhichHandle *r_which_handle, float *r_score)
bool ED_mask_feather_find_nearest(const bContext *C, Mask *mask_orig, const float normal_co[2], float threshold, MaskLayer **r_mask_layer, MaskSpline **r_spline, MaskSplinePoint **r_point, MaskSplinePointUW **r_uw, float *r_score)
void MASK_OT_select_circle(wmOperatorType *ot)
static wmOperatorStatus box_select_exec(bContext *C, wmOperator *op)
bool ED_mask_spline_select_check(const MaskSpline *spline)
static wmOperatorStatus mask_select_linked_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus mask_select_less_exec(bContext *C, wmOperator *)
void MASK_OT_select_more(wmOperatorType *ot)
void MASK_OT_select(wmOperatorType *ot)
bool ED_mask_select_check(const Mask *mask)
static int mask_spline_point_inside_ellipse(BezTriple *bezt, const float offset[2], const float ellipse[2])
static wmOperatorStatus select_exec(bContext *C, wmOperator *op)
static wmOperatorStatus select_all_exec(bContext *C, wmOperator *op)
void ED_mask_layer_select_set(MaskLayer *mask_layer, const bool do_select)
static bool do_lasso_select_mask(bContext *C, const Span< int2 > mcoords, const eSelectOp sel_op)
void MASK_OT_select_less(wmOperatorType *ot)
void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select)
void MASK_OT_select_linked(wmOperatorType *ot)
bool ED_mask_layer_select_check(const MaskLayer *mask_layer)
static wmOperatorStatus circle_select_exec(bContext *C, wmOperator *op)
void MASK_OT_select_box(wmOperatorType *ot)
static wmOperatorStatus clip_lasso_select_exec(bContext *C, wmOperator *op)
static wmOperatorStatus mask_select_more_less(bContext *C, bool more)
void ED_mask_select_flush_all(Mask *mask)
static wmOperatorStatus select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void MASK_OT_select_all(wmOperatorType *ot)
static wmOperatorStatus mask_select_more_exec(bContext *C, wmOperator *)
void MASK_OT_select_lasso(wmOperatorType *ot)
void ED_mask_select_toggle_all(Mask *mask, int action)
void ED_mask_deselect_all(const bContext *C)
static wmOperatorStatus mask_select_linked_exec(bContext *C, wmOperator *)
void MASK_OT_select_linked_pick(wmOperatorType *ot)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
VecBase< int32_t, 2 > int2
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
struct MaskSplinePoint * act_point
struct MaskSpline * act_spline
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
bool WM_gesture_is_modal_first(const wmGesture *gesture)
wmOperatorStatus WM_gesture_circle_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Array< int2 > WM_gesture_lasso_path_to_array(bContext *, wmOperator *op)
wmOperatorStatus WM_gesture_lasso_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_box_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gesture_lasso_cancel(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_circle_modal(bContext *C, wmOperator *op, const wmEvent *event)
wmOperatorStatus WM_gesture_lasso_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_operator_properties_border_to_rcti(wmOperator *op, rcti *r_rect)
void WM_operator_properties_gesture_box(wmOperatorType *ot)
void WM_operator_properties_select_operation_simple(wmOperatorType *ot)
void WM_operator_properties_gesture_lasso(wmOperatorType *ot)
void WM_operator_properties_gesture_circle(wmOperatorType *ot)
void WM_operator_properties_select_all(wmOperatorType *ot)
void WM_operator_properties_mouse_select(wmOperatorType *ot)
wmOperatorStatus WM_operator_flag_only_pass_through_on_press(wmOperatorStatus retval, const wmEvent *event)