Blender V5.3
paint_curve.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <climits>
10#include <cstring>
11
12#include "MEM_guardedalloc.h"
13
14#include "DNA_brush_types.h"
15#include "DNA_object_types.h"
16#include "DNA_screen_types.h"
17#include "DNA_space_types.h"
18#include "DNA_view3d_types.h"
19
20#include "BLI_math_vector_c.hh"
21
22#include "BLT_translation.hh"
23
24#include "BKE_brush.hh"
25#include "BKE_context.hh"
26#include "BKE_lib_id.hh"
27#include "BKE_paint.hh"
28#include "BKE_paint_types.hh"
29
30#include "ED_paint.hh"
31#include "ED_view3d.hh"
32
33#include "WM_api.hh"
34#include "WM_types.hh"
35
36#include "RNA_access.hh"
37#include "RNA_define.hh"
38
39#include "UI_view2d.hh"
40
41#include "paint_intern.hh"
42
43namespace blender {
44
45#define PAINT_CURVE_SELECT_THRESHOLD 40.0f
46#define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = BEZT_FLAG_SELECT)
47
49{
52 SpaceImage *sima;
53
54 if (rv3d && !(ob && ((ob->mode & (OB_MODE_ALL_PAINT_MESH | OB_MODE_SCULPT_CURVES)) != 0))) {
55 return false;
56 }
57
58 sima = CTX_wm_space_image(C);
59
60 if (sima && sima->mode != SI_MODE_PAINT) {
61 return false;
62 }
63
65 Brush *brush = (paint) ? BKE_paint_brush(paint) : nullptr;
66
67 if (brush && (brush->stroke_method == BRUSH_STROKE_CURVE)) {
68 return true;
69 }
70
71 return false;
72}
73
74#define SEL_F1 (1 << 0)
75#define SEL_F2 (1 << 1)
76#define SEL_F3 (1 << 2)
77
78/* returns 0, 1, or 2 in point according to handle 1, pivot or handle 2 */
80 PaintCurve *pc, const float pos[2], bool ignore_pivot, const float threshold, char *point)
81{
82 PaintCurvePoint *pcp, *closest = nullptr;
83 int i;
84 float closest_dist = threshold;
85
86 for (i = 0, pcp = pc->points; i < pc->tot_points; i++, pcp++) {
87 float dist[3];
88 char point_sel = 0;
89
90 dist[0] = len_manhattan_v2v2(pos, pcp->bez.vec[0]);
91 dist[1] = len_manhattan_v2v2(pos, pcp->bez.vec[1]);
92 dist[2] = len_manhattan_v2v2(pos, pcp->bez.vec[2]);
93
94 if (dist[1] < closest_dist) {
95 closest_dist = dist[1];
96 point_sel = SEL_F2;
97 }
98 if (dist[0] < closest_dist) {
99 closest_dist = dist[0];
100 point_sel = SEL_F1;
101 }
102 if (dist[2] < closest_dist) {
103 closest_dist = dist[2];
104 point_sel = SEL_F3;
105 }
106 if (point_sel) {
107 closest = pcp;
108 if (point) {
109 if (ignore_pivot && point_sel == SEL_F2) {
110 point_sel = (dist[0] < dist[2]) ? SEL_F1 : SEL_F3;
111 }
112 *point = point_sel;
113 }
114 }
115 }
116
117 return closest;
118}
119
120static int paintcurve_point_co_index(char sel)
121{
122 char i = 0;
123 while (sel != 1) {
124 sel >>= 1;
125 i++;
126 }
127 return i;
128}
129
131 const bool is_first,
132 const char fallback)
133{
134 /* when matching, guess based on endpoint side */
135 if (BEZT_ISSEL_ANY(bezt)) {
136 if ((bezt->f1 & SELECT) == (bezt->f3 & SELECT)) {
137 return is_first ? SEL_F1 : SEL_F3;
138 }
139 if (bezt->f1 & SELECT) {
140 return SEL_F1;
141 }
142 if (bezt->f3 & SELECT) {
143 return SEL_F3;
144 }
145 return fallback;
146 }
147 return 0;
148}
149
150/******************* Operators *********************************/
151
152static PaintCurve *paintcurve_for_brush_add(Main *bmain, const char *name, const Brush *brush)
153{
154 PaintCurve *curve = BKE_paint_curve_add(bmain, name);
155 BKE_id_move_to_same_lib(*bmain, curve->id, brush->id);
156 return curve;
157}
158
160{
162 Brush *brush = (paint) ? BKE_paint_brush(paint) : nullptr;
163 Main *bmain = CTX_data_main(C);
164
165 if (brush) {
166 brush->paint_curve = paintcurve_for_brush_add(bmain, DATA_("PaintCurve"), brush);
168 }
169
171
172 return OPERATOR_FINISHED;
173}
174
176{
177 /* identifiers */
178 ot->name = "Add New Paint Curve";
179 ot->description = "Add new paint curve";
180 ot->idname = "PAINTCURVE_OT_new";
181
182 /* API callbacks. */
185
186 /* flags */
188}
189
190static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
191{
194 Main *bmain = CTX_data_main(C);
195 wmWindow *window = CTX_wm_window(C);
196 ARegion *region = CTX_wm_region(C);
197 const float vec[3] = {float(loc[0]), float(loc[1]), 0.0f};
198
199 PaintCurve *pc = br->paint_curve;
200 if (!pc) {
201 br->paint_curve = pc = paintcurve_for_brush_add(bmain, DATA_("PaintCurve"), br);
202 }
203
205
206 PaintCurvePoint *pcp = MEM_new_array<PaintCurvePoint>((pc->tot_points + 1), "PaintCurvePoint");
207 int add_index = pc->add_index;
208
209 if (pc->points) {
210 if (add_index > 0) {
211 memcpy(pcp, pc->points, add_index * sizeof(PaintCurvePoint));
212 }
213 if (add_index < pc->tot_points) {
214 memcpy(pcp + add_index + 1,
215 pc->points + add_index,
216 (pc->tot_points - add_index) * sizeof(PaintCurvePoint));
217 }
218
219 MEM_delete(pc->points);
220 }
221 pc->points = pcp;
222 pc->tot_points++;
223
224 /* initialize new point */
225 pcp[add_index] = PaintCurvePoint{};
226 copy_v3_v3(pcp[add_index].bez.vec[0], vec);
227 copy_v3_v3(pcp[add_index].bez.vec[1], vec);
228 copy_v3_v3(pcp[add_index].bez.vec[2], vec);
229
230 /* last step, clear selection from all bezier handles expect the next */
231 for (int i = 0; i < pc->tot_points; i++) {
232 pcp[i].bez.f1 = pcp[i].bez.f2 = pcp[i].bez.f3 = eBezTriple_Flag{};
233 }
234
236
237 if (pc->add_index != 0) {
238 pcp[add_index].bez.f3 = BEZT_FLAG_SELECT;
239 pcp[add_index].bez.h2 = HD_ALIGN;
240 }
241 else {
242 pcp[add_index].bez.f1 = BEZT_FLAG_SELECT;
243 pcp[add_index].bez.h1 = HD_ALIGN;
244 }
245
248
249 WM_paint_cursor_tag_redraw(window, region);
250}
251
253 wmOperator *op,
254 const wmEvent *event)
255{
256 const int loc[2] = {event->mval[0], event->mval[1]};
257 paintcurve_point_add(C, op, loc);
258 RNA_int_set_array(op->ptr, "location", loc);
259 return OPERATOR_FINISHED;
260}
261
263{
264 int loc[2];
265
266 if (RNA_struct_property_is_set(op->ptr, "location")) {
267 RNA_int_get_array(op->ptr, "location", loc);
268 paintcurve_point_add(C, op, loc);
269 return OPERATOR_FINISHED;
270 }
271
272 return OPERATOR_CANCELLED;
273}
274
276{
277 /* identifiers */
278 ot->name = "Add New Paint Curve Point";
279 ot->description = ot->name;
280 ot->idname = "PAINTCURVE_OT_add_point";
281
282 /* API callbacks. */
286
287 /* flags */
289
290 /* properties */
292 "location",
293 2,
294 nullptr,
295 0,
296 SHRT_MAX,
297 "Location",
298 "Location of vertex in area space",
299 0,
300 SHRT_MAX);
301}
302
304{
307 PaintCurve *pc;
308 PaintCurvePoint *pcp;
309 wmWindow *window = CTX_wm_window(C);
310 ARegion *region = CTX_wm_region(C);
311 int i;
312 int tot_del = 0;
313 pc = br->paint_curve;
314
315 if (!pc || pc->tot_points == 0) {
316 return OPERATOR_CANCELLED;
317 }
318
320
321#define DELETE_TAG 2
322
323 for (i = 0, pcp = pc->points; i < pc->tot_points; i++, pcp++) {
324 if (BEZT_ISSEL_ANY(&pcp->bez)) {
326 tot_del++;
327 }
328 }
329
330 if (tot_del > 0) {
331 int j = 0;
332 int new_tot = pc->tot_points - tot_del;
333 PaintCurvePoint *points_new = nullptr;
334 if (new_tot > 0) {
335 points_new = MEM_new_array<PaintCurvePoint>(new_tot, "PaintCurvePoint");
336 }
337
338 for (i = 0, pcp = pc->points; i < pc->tot_points; i++, pcp++) {
339 if (!(pcp->bez.f2 & DELETE_TAG)) {
340 points_new[j] = pc->points[i];
341
342 if ((i + 1) == pc->add_index) {
344 }
345 j++;
346 }
347 else if ((i + 1) == pc->add_index) {
348 /* prefer previous point */
349 pc->add_index = j;
350 }
351 }
352 MEM_delete(pc->points);
353
354 pc->points = points_new;
355 pc->tot_points = new_tot;
356 }
357
358#undef DELETE_TAG
359
362
363 WM_paint_cursor_tag_redraw(window, region);
364
365 return OPERATOR_FINISHED;
366}
367
369{
370 /* identifiers */
371 ot->name = "Remove Paint Curve Point";
372 ot->description = ot->name;
373 ot->idname = "PAINTCURVE_OT_delete_point";
374
375 /* API callbacks. */
378
379 /* flags */
380 ot->flag = OPTYPE_UNDO;
381}
382
384 bContext *C, wmOperator *op, const int loc[2], bool toggle, bool extend)
385{
386 wmWindow *window = CTX_wm_window(C);
387 ARegion *region = CTX_wm_region(C);
390 PaintCurve *pc;
391 int i;
392 const float loc_fl[2] = {float(loc[0]), float(loc[1])};
393
394 pc = br->paint_curve;
395
396 if (!pc) {
397 return false;
398 }
399
401
402 if (toggle) {
403 PaintCurvePoint *pcp;
405 bool selected = false;
406
407 pcp = pc->points;
408
409 for (i = 0; i < pc->tot_points; i++) {
410 if ((pcp[i].bez.f1 & BEZT_FLAG_SELECT) || (pcp[i].bez.f2 & BEZT_FLAG_SELECT) ||
411 (pcp[i].bez.f3 & BEZT_FLAG_SELECT))
412 {
413 selected = true;
414 break;
415 }
416 }
417
418 if (!selected) {
420 }
421
422 for (i = 0; i < pc->tot_points; i++) {
423 pc->points[i].bez.f1 = pc->points[i].bez.f2 = pc->points[i].bez.f3 = select;
424 }
425 }
426 else {
427 PaintCurvePoint *pcp;
428 char selflag;
429
430 pcp = paintcurve_point_get_closest(pc, loc_fl, false, PAINT_CURVE_SELECT_THRESHOLD, &selflag);
431
432 if (pcp) {
434
435 if (selflag == SEL_F2) {
436 if (extend) {
437 pcp->bez.f2 ^= BEZT_FLAG_SELECT;
438 }
439 else {
440 pcp->bez.f2 |= BEZT_FLAG_SELECT;
441 }
442 }
443 else if (selflag == SEL_F1) {
444 if (extend) {
445 pcp->bez.f1 ^= BEZT_FLAG_SELECT;
446 }
447 else {
448 pcp->bez.f1 |= BEZT_FLAG_SELECT;
449 }
450 }
451 else if (selflag == SEL_F3) {
452 if (extend) {
453 pcp->bez.f3 ^= BEZT_FLAG_SELECT;
454 }
455 else {
456 pcp->bez.f3 |= BEZT_FLAG_SELECT;
457 }
458 }
459 }
460
461 /* clear selection for unselected points if not extending and if a point has been selected */
462 if (!extend && pcp) {
463 for (i = 0; i < pc->tot_points; i++) {
464 pc->points[i].bez.f1 = pc->points[i].bez.f2 = pc->points[i].bez.f3 = eBezTriple_Flag{};
465
466 if ((pc->points + i) == pcp) {
467 char index = paintcurve_point_co_index(selflag);
469 }
470 }
471 }
472
473 if (!pcp) {
475 return false;
476 }
477 }
478
480
481 WM_paint_cursor_tag_redraw(window, region);
482
483 return true;
484}
485
487 wmOperator *op,
488 const wmEvent *event)
489{
490 const int loc[2] = {event->mval[0], event->mval[1]};
491 bool toggle = RNA_boolean_get(op->ptr, "toggle");
492 bool extend = RNA_boolean_get(op->ptr, "extend");
493 if (paintcurve_point_select(C, op, loc, toggle, extend)) {
494 RNA_int_set_array(op->ptr, "location", loc);
495 return OPERATOR_FINISHED;
496 }
497 return OPERATOR_CANCELLED;
498}
499
501{
502 int loc[2];
503
504 if (RNA_struct_property_is_set(op->ptr, "location")) {
505 bool toggle = RNA_boolean_get(op->ptr, "toggle");
506 bool extend = RNA_boolean_get(op->ptr, "extend");
507 RNA_int_get_array(op->ptr, "location", loc);
508 if (paintcurve_point_select(C, op, loc, toggle, extend)) {
509 return OPERATOR_FINISHED;
510 }
511 }
512
513 return OPERATOR_CANCELLED;
514}
515
517{
518 PropertyRNA *prop;
519
520 /* identifiers */
521 ot->name = "Select Paint Curve Point";
522 ot->description = "Select a paint curve point";
523 ot->idname = "PAINTCURVE_OT_select";
524
525 /* API callbacks. */
529
530 /* flags */
532
533 /* properties */
535 "location",
536 2,
537 nullptr,
538 0,
539 SHRT_MAX,
540 "Location",
541 "Location of vertex in area space",
542 0,
543 SHRT_MAX);
544 prop = RNA_def_boolean(ot->srna, "toggle", false, "Toggle", "(De)select all");
546 prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection");
548}
549
558
560{
562 const float loc_fl[2] = {float(event->mval[0]), float(event->mval[1])};
563 char select;
564 int i;
565 bool do_select = RNA_boolean_get(op->ptr, "select");
566 bool align = RNA_boolean_get(op->ptr, "align");
568 PaintCurve *pc = br->paint_curve;
569 PaintCurvePoint *pcp;
570
571 if (!pc) {
573 }
574
575 if (do_select) {
577 }
578 else {
579 pcp = nullptr;
580 /* just find first selected point */
581 for (i = 0; i < pc->tot_points; i++) {
582 if ((select = paintcurve_point_side_index(&pc->points[i].bez, i == 0, SEL_F3))) {
583 pcp = &pc->points[i];
584 break;
585 }
586 }
587 }
588
589 if (pcp) {
590 ARegion *region = CTX_wm_region(C);
591 wmWindow *window = CTX_wm_window(C);
593 copy_v2_v2_int(psd->initial_loc, event->mval);
594 psd->event = event->type;
595 psd->pcp = pcp;
597 for (i = 0; i < 3; i++) {
598 copy_v2_v2(psd->point_initial_loc[i], pcp->bez.vec[i]);
599 }
600 psd->align = align;
601 op->customdata = psd;
602
603 /* first, clear all selection from points */
604 for (i = 0; i < pc->tot_points; i++) {
605 pc->points[i].bez.f1 = pc->points[i].bez.f3 = pc->points[i].bez.f2 = eBezTriple_Flag{};
606 }
607
608 /* only select the active point */
612
614 WM_paint_cursor_tag_redraw(window, region);
616 }
617
619}
620
622{
623 PointSlideData *psd = static_cast<PointSlideData *>(op->customdata);
624
625 if (event->type == psd->event && event->val == KM_RELEASE) {
626 MEM_delete(psd);
629 return OPERATOR_FINISHED;
630 }
631
632 switch (event->type) {
633 case MOUSEMOVE: {
634 ARegion *region = CTX_wm_region(C);
635 wmWindow *window = CTX_wm_window(C);
636 float diff[2] = {float(event->mval[0] - psd->initial_loc[0]),
637 float(event->mval[1] - psd->initial_loc[1])};
638 if (psd->select == 1) {
639 int i;
640 for (i = 0; i < 3; i++) {
641 add_v2_v2v2(psd->pcp->bez.vec[i], diff, psd->point_initial_loc[i]);
642 }
643 }
644 else {
646 copy_v2_v2(psd->pcp->bez.vec[psd->select], diff);
647
648 if (psd->align) {
649 char opposite = (psd->select == 0) ? 2 : 0;
650 sub_v2_v2v2(diff, psd->pcp->bez.vec[1], psd->pcp->bez.vec[psd->select]);
651 add_v2_v2v2(psd->pcp->bez.vec[opposite], psd->pcp->bez.vec[1], diff);
652 }
653 }
654 WM_paint_cursor_tag_redraw(window, region);
655 break;
656 }
657 default:
658 break;
659 }
660
662}
663
665{
666 /* identifiers */
667 ot->name = "Slide Paint Curve Point";
668 ot->description = "Select and slide paint curve point";
669 ot->idname = "PAINTCURVE_OT_slide";
670
671 /* API callbacks. */
675
676 /* flags */
677 ot->flag = OPTYPE_UNDO;
678
679 /* properties */
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");
684}
685
687{
689 const char *name;
690
691 switch (mode) {
694 name = "PAINT_OT_image_paint";
695 break;
697 name = "PAINT_OT_weight_paint";
698 break;
700 name = "PAINT_OT_vertex_paint";
701 break;
703 name = "SCULPT_OT_brush_stroke";
704 break;
706 name = "SCULPT_CURVES_OT_brush_stroke";
707 break;
708 default:
710 }
711
712 return WM_operator_name_call(C, name, wm::OpCallContext::InvokeDefault, nullptr, nullptr);
713}
714
716{
717 /* identifiers */
718 ot->name = "Draw Curve";
719 ot->description = "Draw curve";
720 ot->idname = "PAINTCURVE_OT_draw";
721
722 /* API callbacks. */
725
726 /* flags */
727 ot->flag = OPTYPE_UNDO;
728}
729
731 wmOperator * /*op*/,
732 const wmEvent *event)
733{
735
736 switch (mode) {
738 ARegion *region = CTX_wm_region(C);
740 float location[2];
741
742 if (!sima) {
743 return OPERATOR_CANCELLED;
744 }
745
747 &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
748 copy_v2_v2(sima->cursor, location);
750 break;
751 }
752 default:
754 break;
755 }
756
757 return OPERATOR_FINISHED;
758}
759
761{
762 /* identifiers */
763 ot->name = "Place Cursor";
764 ot->description = "Place cursor";
765 ot->idname = "PAINTCURVE_OT_cursor";
766
767 /* API callbacks. */
770
771 /* flags */
772 ot->flag = 0;
773}
774
775} // namespace blender
#define SELECT
Definition BKE_mask.hh:19
#define DATA_(msgid)
#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.
#define C
Definition RandGen.cpp:29
#define NC_PAINTCURVE
Definition WM_types.hh:409
#define NA_ADDED
Definition WM_types.hh:636
#define ND_SPACE_IMAGE
Definition WM_types.hh:565
#define NC_SPACE
Definition WM_types.hh:405
bool closest(btVector3 &v)
#define SEL_F1
Definition curve.cc:4046
#define SEL_F2
Definition curve.cc:4047
#define SEL_F3
Definition curve.cc:4048
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt)
Definition frames.inl:1166
#define SHRT_MAX
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
Definition view2d.cc:1651
BMesh Iterators.
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)
Definition brush.cc:843
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 *)
@ OB_MODE_SCULPT_CURVES
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)
@ V3D_CURSOR_ORIENT_VIEW
Definition ED_view3d.hh:102
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)
@ PROP_SKIP_SAVE
Definition RNA_types.hh:414
@ KM_RELEASE
Definition WM_types.hh:325
void BKE_id_move_to_same_lib(Main &bmain, ID &id, const ID &owner_id)
Definition lib_id.cc:953
Brush * BKE_paint_brush(Paint *paint)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
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 *)
Definition wm_draw.cc:1698
static int paintcurve_point_co_index(char sel)
#define PAINT_CURVE_POINT_SELECT(pcp, i)
#define PAINT_CURVE_SELECT_THRESHOLD
#define DELETE_TAG
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eBezTriple_Flag f2
eBezTriple_Handle h2
eBezTriple_Flag f3
eBezTriple_Flag f1
eBezTriple_Handle h1
struct PaintCurve * paint_curve
PaintCurvePoint * points
float point_initial_loc[3][2]
PaintCurvePoint * pcp
eSpaceImage_Mode mode
wmEventType type
Definition WM_types.hh:817
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1157
struct wmOperatorType * type