51 #define PAINT_CURVE_SELECT_THRESHOLD 40.0f
52 #define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = SELECT)
80 #define SEL_F1 (1 << 0)
81 #define SEL_F2 (1 << 1)
82 #define SEL_F3 (1 << 2)
86 PaintCurve *pc,
const float pos[2],
bool ignore_pivot,
const float threshold,
char *point)
90 float closest_dist = threshold;
92 for (i = 0, pcp = pc->
points; i < pc->tot_points; i++, pcp++) {
100 if (dist[1] < closest_dist) {
101 closest_dist = dist[1];
104 if (dist[0] < closest_dist) {
105 closest_dist = dist[0];
108 if (dist[2] < closest_dist) {
109 closest_dist = dist[2];
115 if (ignore_pivot && point_sel ==
SEL_F2) {
175 ot->
name =
"Add New Paint Curve";
194 const float vec[3] = {loc[0], loc[1], 0.0};
211 if (add_index < pc->tot_points) {
212 memcpy(pcp + add_index + 1,
251 const int loc[2] = {
event->mval[0],
event->mval[1]};
273 ot->
name =
"Add New Paint Curve Point";
275 ot->
idname =
"PAINTCURVE_OT_add_point";
293 "Location of vertex in area space",
318 for (i = 0, pcp = pc->
points; i < pc->tot_points; i++, pcp++) {
333 for (i = 0, pcp = pc->
points; i < pc->tot_points; i++, pcp++) {
335 points_new[j] = pc->
points[i];
365 ot->
name =
"Remove Paint Curve Point";
367 ot->
idname =
"PAINTCURVE_OT_delete_point";
386 const float loc_fl[2] = {
UNPACK2(loc)};
399 bool selected =
false;
404 if (pcp[i].bez.f1 || pcp[i].
bez.
f2 || pcp[i].
bez.
f3) {
435 else if (selflag ==
SEL_F1) {
443 else if (selflag ==
SEL_F3) {
454 if (!extend && pcp) {
458 if ((pc->
points + i) == pcp) {
511 ot->
name =
"Select Paint Curve Point";
513 ot->
idname =
"PAINTCURVE_OT_select";
531 "Location of vertex in area space",
584 psd->
event =
event->type;
587 for (i = 0; i < 3; i++) {
621 switch (event->
type) {
628 for (i = 0; i < 3; i++) {
637 char opposite = (psd->
select == 0) ? 2 : 0;
655 ot->
name =
"Slide Paint Curve Point";
669 ot->
srna,
"align",
false,
"Align Handles",
"Aligns opposite point handle during transform");
671 ot->
srna,
"select",
true,
"Select",
"Attempt to select a point handle before transform");
682 name =
"PAINT_OT_image_paint";
685 name =
"PAINT_OT_weight_paint";
688 name =
"PAINT_OT_vertex_paint";
691 name =
"SCULPT_OT_brush_stroke";
730 ®ion->
v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
746 ot->
name =
"Place Cursor";
748 ot->
idname =
"PAINTCURVE_OT_cursor";
struct Object * CTX_data_active_object(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct SpaceImage * CTX_wm_space_image(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C)
struct Paint * BKE_paint_get_active_from_context(const struct bContext *C)
void BKE_paint_curve_clamp_endpoint_add_index(struct PaintCurve *pc, const int add_index)
struct PaintCurve * BKE_paint_curve_add(struct Main *bmain, const char *name)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void add_v2_v2(float r[2], const float a[2])
MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
#define BEZT_ISSEL_ANY(bezt)
#define OB_MODE_ALL_PAINT
Object is a sort of wrapper for general info.
void ED_paintcurve_undo_push_end(struct bContext *C)
void ED_paintcurve_undo_push_begin(const char *name)
void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2], const bool use_depth, enum eV3DCursorOrient orientation)
Read Guarded memory(de)allocation.
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
bool closest(btVector3 &v)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *event)
struct PointSlideData PointSlideData
static int paintcurve_new_exec(bContext *C, wmOperator *UNUSED(op))
bool paint_curve_poll(bContext *C)
static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
static PaintCurvePoint * paintcurve_point_get_closest(PaintCurve *pc, const float pos[2], bool ignore_pivot, const float threshold, char *point)
void PAINTCURVE_OT_new(wmOperatorType *ot)
static int paintcurve_point_co_index(char sel)
static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
#define PAINT_CURVE_POINT_SELECT(pcp, i)
static int paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
void PAINTCURVE_OT_add_point(wmOperatorType *ot)
void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
static int paintcurve_delete_point_exec(bContext *C, wmOperator *op)
static int paintcurve_select_point_exec(bContext *C, wmOperator *op)
void PAINTCURVE_OT_draw(wmOperatorType *ot)
#define PAINT_CURVE_SELECT_THRESHOLD
static int paintcurve_draw_exec(bContext *C, wmOperator *UNUSED(op))
static char paintcurve_point_side_index(const BezTriple *bezt, const bool is_first, const char fallback)
static int paintcurve_select_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool paintcurve_point_select(bContext *C, wmOperator *op, const int loc[2], bool toggle, bool extend)
void PAINTCURVE_OT_cursor(wmOperatorType *ot)
void PAINTCURVE_OT_slide(wmOperatorType *ot)
static int paintcurve_add_point_exec(bContext *C, wmOperator *op)
void PAINTCURVE_OT_select(wmOperatorType *ot)
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct PaintCurve * paint_curve
float point_initial_loc[3][2]
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct wmOperatorType * type
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(region))
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
int WM_operator_name_call(bContext *C, const char *opstring, short context, PointerRNA *properties)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)