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";
176 ot->description =
"Add new paint curve";
177 ot->idname =
"PAINTCURVE_OT_new";
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,
254 const int loc[2] = {
event->mval[0],
event->mval[1]};
276 ot->name =
"Add New Paint Curve Point";
277 ot->description =
ot->name;
278 ot->idname =
"PAINTCURVE_OT_add_point";
296 "Location of vertex in area space",
369 ot->name =
"Remove Paint Curve Point";
370 ot->description =
ot->name;
371 ot->idname =
"PAINTCURVE_OT_delete_point";
390 const float loc_fl[2] = {float(loc[0]), float(loc[1])};
403 bool selected =
false;
439 else if (selflag ==
SEL_F1) {
447 else if (selflag ==
SEL_F3) {
458 if (!extend && pcp) {
486 const int loc[2] = {
event->mval[0],
event->mval[1]};
517 ot->name =
"Select Paint Curve Point";
518 ot->description =
"Select a paint curve point";
519 ot->idname =
"PAINTCURVE_OT_select";
537 "Location of vertex in area space",
558 const float loc_fl[2] = {float(event->
mval[0]), float(event->
mval[1])};
590 psd->
event =
event->type;
593 for (
i = 0;
i < 3;
i++) {
628 switch (event->
type) {
636 for (
i = 0;
i < 3;
i++) {
645 char opposite = (psd->
select == 0) ? 2 : 0;
663 ot->name =
"Slide Paint Curve Point";
664 ot->description =
"Select and slide paint curve point";
665 ot->idname =
"PAINTCURVE_OT_slide";
677 ot->srna,
"align",
false,
"Align Handles",
"Aligns opposite point handle during transform");
679 ot->srna,
"select",
true,
"Select",
"Attempt to select a point handle before transform");
690 name =
"PAINT_OT_image_paint";
693 name =
"PAINT_OT_weight_paint";
696 name =
"PAINT_OT_vertex_paint";
699 name =
"SCULPT_OT_brush_stroke";
702 name =
"SCULPT_CURVES_OT_brush_stroke";
705 name =
"GREASE_PENCIL_OT_brush_stroke";
717 ot->name =
"Draw Curve";
718 ot->description =
"Draw curve";
719 ot->idname =
"PAINTCURVE_OT_draw";
746 ®ion->
v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
762 ot->name =
"Place Cursor";
763 ot->description =
"Place cursor";
764 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)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
void * MEM_mallocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
static wmOperatorStatus paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus paintcurve_cursor_invoke(bContext *C, wmOperator *, const wmEvent *event)
bool paint_curve_poll(bContext *C)
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])
static wmOperatorStatus paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
#define PAINT_CURVE_POINT_SELECT(pcp, i)
static wmOperatorStatus paintcurve_select_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void PAINTCURVE_OT_add_point(wmOperatorType *ot)
void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
static wmOperatorStatus paintcurve_new_exec(bContext *C, wmOperator *)
static wmOperatorStatus paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void PAINTCURVE_OT_draw(wmOperatorType *ot)
#define PAINT_CURVE_SELECT_THRESHOLD
static wmOperatorStatus paintcurve_add_point_exec(bContext *C, wmOperator *op)
static char paintcurve_point_side_index(const BezTriple *bezt, const bool is_first, const char fallback)
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)
void PAINTCURVE_OT_cursor(wmOperatorType *ot)
void PAINTCURVE_OT_slide(wmOperatorType *ot)
static wmOperatorStatus paintcurve_draw_exec(bContext *C, wmOperator *)
static wmOperatorStatus paintcurve_select_point_exec(bContext *C, wmOperator *op)
static wmOperatorStatus paintcurve_delete_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]
struct wmOperatorType * type
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)