45#define PAINT_CURVE_SELECT_THRESHOLD 40.0f
46#define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = BEZT_FLAG_SELECT)
74#define SEL_F1 (1 << 0)
75#define SEL_F2 (1 << 1)
76#define SEL_F3 (1 << 2)
80 PaintCurve *pc,
const float pos[2],
bool ignore_pivot,
const float threshold,
char *point)
84 float closest_dist = threshold;
86 for (i = 0, pcp = pc->
points; i < pc->tot_points; i++, pcp++) {
94 if (dist[1] < closest_dist) {
95 closest_dist = dist[1];
98 if (dist[0] < closest_dist) {
99 closest_dist = dist[0];
102 if (dist[2] < closest_dist) {
103 closest_dist = dist[2];
109 if (ignore_pivot && point_sel ==
SEL_F2) {
178 ot->
name =
"Add New Paint Curve";
180 ot->
idname =
"PAINTCURVE_OT_new";
197 const float vec[3] = {
float(loc[0]),
float(loc[1]), 0.0f};
213 if (add_index < pc->tot_points) {
214 memcpy(pcp + add_index + 1,
256 const int loc[2] = {
event->mval[0],
event->mval[1]};
278 ot->
name =
"Add New Paint Curve Point";
280 ot->
idname =
"PAINTCURVE_OT_add_point";
298 "Location of vertex in area space",
323 for (i = 0, pcp = pc->
points; i < pc->tot_points; i++, pcp++) {
335 points_new = MEM_new_array<PaintCurvePoint>(new_tot,
"PaintCurvePoint");
338 for (i = 0, pcp = pc->
points; i < pc->tot_points; i++, pcp++) {
340 points_new[j] = pc->
points[i];
371 ot->
name =
"Remove Paint Curve Point";
373 ot->
idname =
"PAINTCURVE_OT_delete_point";
392 const float loc_fl[2] = {
float(loc[0]),
float(loc[1])};
405 bool selected =
false;
443 else if (selflag ==
SEL_F1) {
451 else if (selflag ==
SEL_F3) {
462 if (!extend && pcp) {
466 if ((pc->
points + i) == pcp) {
490 const int loc[2] = {
event->mval[0],
event->mval[1]};
521 ot->
name =
"Select Paint Curve Point";
523 ot->
idname =
"PAINTCURVE_OT_select";
541 "Location of vertex in area space",
594 psd->
event =
event->type;
597 for (i = 0; i < 3; i++) {
632 switch (event->
type) {
640 for (i = 0; i < 3; i++) {
649 char opposite = (psd->
select == 0) ? 2 : 0;
667 ot->
name =
"Slide Paint Curve Point";
668 ot->
description =
"Select and slide paint curve point";
669 ot->
idname =
"PAINTCURVE_OT_slide";
681 ot->
srna,
"align",
false,
"Align Handles",
"Aligns opposite point handle during transform");
683 ot->
srna,
"select",
true,
"Select",
"Attempt to select a point handle before transform");
694 name =
"PAINT_OT_image_paint";
697 name =
"PAINT_OT_weight_paint";
700 name =
"PAINT_OT_vertex_paint";
703 name =
"SCULPT_OT_brush_stroke";
706 name =
"SCULPT_CURVES_OT_brush_stroke";
718 ot->
name =
"Draw Curve";
720 ot->
idname =
"PAINTCURVE_OT_draw";
747 ®ion->
v2d, event->
mval[0], event->
mval[1], &location[0], &location[1]);
763 ot->
name =
"Place Cursor";
765 ot->
idname =
"PAINTCURVE_OT_cursor";
#define BEZT_ISSEL_ANY(bezt)
#define OB_MODE_ALL_PAINT_MESH
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
bool closest(btVector3 &v)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(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_v2v2(float r[2], const float a[2], const float b[2])
static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
MINLINE void copy_v2_v2(float r[2], const float a[2])
void ED_paintcurve_undo_push_begin(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)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
wmWindow * CTX_wm_window(const bContext *C)
static wmOperatorStatus paintcurve_delete_point_exec(bContext *C, wmOperator *op)
static wmOperatorStatus paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
bool paint_curve_poll(bContext *C)
static wmOperatorStatus paintcurve_select_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void PAINTCURVE_OT_new(wmOperatorType *ot)
void BKE_brush_tag_unsaved_changes(Brush *brush)
PaintCurve * BKE_paint_curve_add(Main *bmain, const char *name)
static char paintcurve_point_side_index(const BezTriple *bezt, const bool is_first, const char fallback)
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
MINLINE void add_v2_v2(float r[2], const float a[2])
static wmOperatorStatus paintcurve_draw_exec(bContext *C, wmOperator *)
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
static wmOperatorStatus paintcurve_add_point_exec(bContext *C, wmOperator *op)
static PaintCurve * paintcurve_for_brush_add(Main *bmain, const char *name, const Brush *brush)
void ED_view3d_cursor3d_update(bContext *C, const int mval[2], bool use_depth, enum eV3DCursorOrient orientation)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
void PAINTCURVE_OT_add_point(wmOperatorType *ot)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
static wmOperatorStatus paintcurve_new_exec(bContext *C, wmOperator *)
wmOperatorStatus WM_operator_name_call(bContext *C, const char *opstring, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve *pc, int add_index)
void PAINTCURVE_OT_cursor(wmOperatorType *ot)
static PaintCurvePoint * paintcurve_point_get_closest(PaintCurve *pc, const float pos[2], bool ignore_pivot, const float threshold, char *point)
SpaceImage * CTX_wm_space_image(const bContext *C)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
MINLINE float len_manhattan_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
void PAINTCURVE_OT_slide(wmOperatorType *ot)
void ED_paintcurve_undo_push_end(bContext *C)
Main * CTX_data_main(const bContext *C)
void PAINTCURVE_OT_draw(wmOperatorType *ot)
Paint * BKE_paint_get_active_from_context(const bContext *C)
void BKE_id_move_to_same_lib(Main &bmain, ID &id, const ID &owner_id)
Brush * BKE_paint_brush(Paint *paint)
static wmOperatorStatus paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus paintcurve_select_point_exec(bContext *C, wmOperator *op)
static wmOperatorStatus paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *event)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
static wmOperatorStatus paintcurve_cursor_invoke(bContext *C, wmOperator *, const wmEvent *event)
Object * CTX_data_active_object(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
void PAINTCURVE_OT_select(wmOperatorType *ot)
void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
static bool paintcurve_point_select(bContext *C, wmOperator *op, const int loc[2], bool toggle, bool extend)
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *)
static int paintcurve_point_co_index(char sel)
#define PAINT_CURVE_POINT_SELECT(pcp, i)
#define PAINT_CURVE_SELECT_THRESHOLD
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct PaintCurve * paint_curve
float point_initial_loc[3][2]
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct wmOperatorType * type