43#define PAINT_CURVE_SELECT_THRESHOLD 40.0f
44#define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = SELECT)
72#define SEL_F1 (1 << 0)
73#define SEL_F2 (1 << 1)
74#define SEL_F3 (1 << 2)
78 PaintCurve *pc,
const float pos[2],
bool ignore_pivot,
const float threshold,
char *point)
82 float closest_dist = threshold;
92 if (dist[1] < closest_dist) {
93 closest_dist = dist[1];
96 if (dist[0] < closest_dist) {
97 closest_dist = dist[0];
100 if (dist[2] < closest_dist) {
101 closest_dist = dist[2];
107 if (ignore_pivot && point_sel ==
SEL_F2) {
176 ot->name =
"Add New Paint Curve";
177 ot->description =
"Add new paint curve";
178 ot->idname =
"PAINTCURVE_OT_new";
195 const float vec[3] = {
float(loc[0]),
float(loc[1]), 0.0f};
212 if (add_index < pc->tot_points) {
213 memcpy(pcp + add_index + 1,
255 const int loc[2] = {
event->mval[0],
event->mval[1]};
277 ot->name =
"Add New Paint Curve Point";
278 ot->description =
ot->name;
279 ot->idname =
"PAINTCURVE_OT_add_point";
297 "Location of vertex in area space",
370 ot->name =
"Remove Paint Curve Point";
371 ot->description =
ot->name;
372 ot->idname =
"PAINTCURVE_OT_delete_point";
391 const float loc_fl[2] = {
float(loc[0]),
float(loc[1])};
404 bool selected =
false;
440 else if (selflag ==
SEL_F1) {
448 else if (selflag ==
SEL_F3) {
459 if (!extend && pcp) {
487 const int loc[2] = {
event->mval[0],
event->mval[1]};
518 ot->name =
"Select Paint Curve Point";
519 ot->description =
"Select a paint curve point";
520 ot->idname =
"PAINTCURVE_OT_select";
538 "Location of vertex in area space",
591 psd->
event =
event->type;
594 for (
i = 0;
i < 3;
i++) {
629 switch (event->
type) {
637 for (
i = 0;
i < 3;
i++) {
646 char opposite = (psd->
select == 0) ? 2 : 0;
664 ot->name =
"Slide Paint Curve Point";
665 ot->description =
"Select and slide paint curve point";
666 ot->idname =
"PAINTCURVE_OT_slide";
678 ot->srna,
"align",
false,
"Align Handles",
"Aligns opposite point handle during transform");
680 ot->srna,
"select",
true,
"Select",
"Attempt to select a point handle before transform");
691 name =
"PAINT_OT_image_paint";
694 name =
"PAINT_OT_weight_paint";
697 name =
"PAINT_OT_vertex_paint";
700 name =
"SCULPT_OT_brush_stroke";
703 name =
"SCULPT_CURVES_OT_brush_stroke";
706 name =
"GREASE_PENCIL_OT_brush_stroke";
719 ot->name =
"Draw Curve";
720 ot->description =
"Draw curve";
721 ot->idname =
"PAINTCURVE_OT_draw";
748 ®ion->
v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
764 ot->name =
"Place Cursor";
765 ot->description =
"Place cursor";
766 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)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)