42#define PAINT_CURVE_SELECT_THRESHOLD 40.0f
43#define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = SELECT)
71#define SEL_F1 (1 << 0)
72#define SEL_F2 (1 << 1)
73#define SEL_F3 (1 << 2)
77 PaintCurve *pc,
const float pos[2],
bool ignore_pivot,
const float threshold,
char *point)
81 float closest_dist = threshold;
91 if (dist[1] < closest_dist) {
92 closest_dist = dist[1];
95 if (dist[0] < closest_dist) {
96 closest_dist = dist[0];
99 if (dist[2] < closest_dist) {
100 closest_dist = dist[2];
106 if (ignore_pivot && point_sel ==
SEL_F2) {
175 ot->
name =
"Add New Paint Curve";
194 const float vec[3] = {
float(loc[0]),
float(loc[1]), 0.0f};
211 if (add_index < pc->tot_points) {
212 memcpy(pcp + add_index + 1,
252 const int loc[2] = {
event->mval[0],
event->mval[1]};
274 ot->
name =
"Add New Paint Curve Point";
276 ot->
idname =
"PAINTCURVE_OT_add_point";
294 "Location of vertex in area space",
337 points_new[j] = pc->
points[i];
368 ot->
name =
"Remove Paint Curve Point";
370 ot->
idname =
"PAINTCURVE_OT_delete_point";
389 const float loc_fl[2] = {
float(loc[0]),
float(loc[1])};
402 bool selected =
false;
407 if (pcp[i].bez.f1 || pcp[i].
bez.
f2 || pcp[i].
bez.
f3) {
438 else if (selflag ==
SEL_F1) {
446 else if (selflag ==
SEL_F3) {
457 if (!extend && pcp) {
461 if ((pc->
points + i) == pcp) {
483 const int loc[2] = {
event->mval[0],
event->mval[1]};
514 ot->
name =
"Select Paint Curve Point";
516 ot->
idname =
"PAINTCURVE_OT_select";
534 "Location of vertex in area space",
588 psd->
event =
event->type;
591 for (i = 0; i < 3; i++) {
626 switch (event->
type) {
634 for (i = 0; i < 3; i++) {
643 char opposite = (psd->
select == 0) ? 2 : 0;
661 ot->
name =
"Slide Paint Curve Point";
675 ot->
srna,
"align",
false,
"Align Handles",
"Aligns opposite point handle during transform");
677 ot->
srna,
"select",
true,
"Select",
"Attempt to select a point handle before transform");
688 name =
"PAINT_OT_image_paint";
691 name =
"PAINT_OT_weight_paint";
694 name =
"PAINT_OT_vertex_paint";
697 name =
"SCULPT_OT_brush_stroke";
700 name =
"SCULPT_CURVES_OT_brush_stroke";
703 name =
"GREASE_PENCIL_OT_brush_stroke";
706 name =
"GREASE_PENCIL_OT_sculpt_paint";
745 ®ion->v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
761 ot->
name =
"Place Cursor";
763 ot->
idname =
"PAINTCURVE_OT_cursor";
void BKE_brush_tag_unsaved_changes(Brush *brush)
SpaceImage * CTX_wm_space_image(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
void BKE_id_move_to_same_lib(Main &bmain, ID &id, const ID &owner_id)
PaintCurve * BKE_paint_curve_add(Main *bmain, const char *name)
void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve *pc, int add_index)
Paint * BKE_paint_get_active_from_context(const bContext *C)
Brush * BKE_paint_brush(Paint *paint)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
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_begin(const char *name)
void ED_paintcurve_undo_push_end(bContext *C)
void ED_view3d_cursor3d_update(bContext *C, const int mval[2], bool use_depth, enum eV3DCursorOrient orientation)
Read Guarded memory(de)allocation.
void UI_view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
bool closest(btVector3 &v)
draw_view in_light_buf[] float
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
ccl_device_inline float4 select(const int4 mask, const float4 a, const float4 b)
static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool paint_curve_poll(bContext *C)
static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
static PaintCurve * paintcurve_for_brush_add(Main *bmain, const char *name, const Brush *brush)
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)
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)
static int paintcurve_new_exec(bContext *C, wmOperator *)
void PAINTCURVE_OT_draw(wmOperatorType *ot)
#define PAINT_CURVE_SELECT_THRESHOLD
static int paintcurve_draw_exec(bContext *C, wmOperator *)
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)
static PaintCurvePoint * paintcurve_point_get_closest(PaintCurve *pc, const float pos[2], bool ignore_pivot, const float threshold, char *point)
static int paintcurve_cursor_invoke(bContext *C, wmOperator *, const wmEvent *event)
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_int_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const int *default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct PaintCurve * paint_curve
float point_initial_loc[3][2]
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
struct wmOperatorType * type
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)