Blender  V3.3
paint_curve.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #include <limits.h>
8 #include <string.h>
9 
10 #include "MEM_guardedalloc.h"
11 
12 #include "DNA_brush_types.h"
13 #include "DNA_object_types.h"
14 #include "DNA_screen_types.h"
15 #include "DNA_space_types.h"
16 #include "DNA_view3d_types.h"
17 
18 #include "BLI_math_vector.h"
19 
20 #include "BKE_context.h"
21 #include "BKE_main.h"
22 #include "BKE_paint.h"
23 
24 #include "ED_paint.h"
25 #include "ED_view3d.h"
26 
27 #include "WM_api.h"
28 #include "WM_types.h"
29 
30 #include "RNA_access.h"
31 #include "RNA_define.h"
32 
33 #include "UI_view2d.h"
34 
35 #include "paint_intern.h"
36 
37 #define PAINT_CURVE_SELECT_THRESHOLD 40.0f
38 #define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = SELECT)
39 
41 {
43  Paint *p;
45  SpaceImage *sima;
46 
47  if (rv3d && !(ob && ((ob->mode & (OB_MODE_ALL_PAINT | OB_MODE_SCULPT_CURVES)) != 0))) {
48  return false;
49  }
50 
51  sima = CTX_wm_space_image(C);
52 
53  if (sima && sima->mode != SI_MODE_PAINT) {
54  return false;
55  }
56 
58 
59  if (p && p->brush && (p->brush->flag & BRUSH_CURVE)) {
60  return true;
61  }
62 
63  return false;
64 }
65 
66 #define SEL_F1 (1 << 0)
67 #define SEL_F2 (1 << 1)
68 #define SEL_F3 (1 << 2)
69 
70 /* returns 0, 1, or 2 in point according to handle 1, pivot or handle 2 */
72  PaintCurve *pc, const float pos[2], bool ignore_pivot, const float threshold, char *point)
73 {
74  PaintCurvePoint *pcp, *closest = NULL;
75  int i;
76  float closest_dist = threshold;
77 
78  for (i = 0, pcp = pc->points; i < pc->tot_points; i++, pcp++) {
79  float dist[3];
80  char point_sel = 0;
81 
82  dist[0] = len_manhattan_v2v2(pos, pcp->bez.vec[0]);
83  dist[1] = len_manhattan_v2v2(pos, pcp->bez.vec[1]);
84  dist[2] = len_manhattan_v2v2(pos, pcp->bez.vec[2]);
85 
86  if (dist[1] < closest_dist) {
87  closest_dist = dist[1];
88  point_sel = SEL_F2;
89  }
90  if (dist[0] < closest_dist) {
91  closest_dist = dist[0];
92  point_sel = SEL_F1;
93  }
94  if (dist[2] < closest_dist) {
95  closest_dist = dist[2];
96  point_sel = SEL_F3;
97  }
98  if (point_sel) {
99  closest = pcp;
100  if (point) {
101  if (ignore_pivot && point_sel == SEL_F2) {
102  point_sel = (dist[0] < dist[2]) ? SEL_F1 : SEL_F3;
103  }
104  *point = point_sel;
105  }
106  }
107  }
108 
109  return closest;
110 }
111 
112 static int paintcurve_point_co_index(char sel)
113 {
114  char i = 0;
115  while (sel != 1) {
116  sel >>= 1;
117  i++;
118  }
119  return i;
120 }
121 
122 static char paintcurve_point_side_index(const BezTriple *bezt,
123  const bool is_first,
124  const char fallback)
125 {
126  /* when matching, guess based on endpoint side */
127  if (BEZT_ISSEL_ANY(bezt)) {
128  if ((bezt->f1 & SELECT) == (bezt->f3 & SELECT)) {
129  return is_first ? SEL_F1 : SEL_F3;
130  }
131  if (bezt->f1 & SELECT) {
132  return SEL_F1;
133  }
134  if (bezt->f3 & SELECT) {
135  return SEL_F3;
136  }
137  return fallback;
138  }
139  return 0;
140 }
141 
142 /******************* Operators *********************************/
143 
145 {
147  Main *bmain = CTX_data_main(C);
148 
149  if (p && p->brush) {
150  p->brush->paint_curve = BKE_paint_curve_add(bmain, "PaintCurve");
151  }
152 
154 
155  return OPERATOR_FINISHED;
156 }
157 
159 {
160  /* identifiers */
161  ot->name = "Add New Paint Curve";
162  ot->description = "Add new paint curve";
163  ot->idname = "PAINTCURVE_OT_new";
164 
165  /* api callbacks */
168 
169  /* flags */
171 }
172 
173 static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
174 {
176  Brush *br = p->brush;
177  Main *bmain = CTX_data_main(C);
178  wmWindow *window = CTX_wm_window(C);
179  ARegion *region = CTX_wm_region(C);
180  const float vec[3] = {loc[0], loc[1], 0.0};
181 
182  PaintCurve *pc = br->paint_curve;
183  if (!pc) {
184  br->paint_curve = pc = BKE_paint_curve_add(bmain, "PaintCurve");
185  }
186 
188 
189  PaintCurvePoint *pcp = MEM_mallocN((pc->tot_points + 1) * sizeof(PaintCurvePoint),
190  "PaintCurvePoint");
191  int add_index = pc->add_index;
192 
193  if (pc->points) {
194  if (add_index > 0) {
195  memcpy(pcp, pc->points, add_index * sizeof(PaintCurvePoint));
196  }
197  if (add_index < pc->tot_points) {
198  memcpy(pcp + add_index + 1,
199  pc->points + add_index,
200  (pc->tot_points - add_index) * sizeof(PaintCurvePoint));
201  }
202 
203  MEM_freeN(pc->points);
204  }
205  pc->points = pcp;
206  pc->tot_points++;
207 
208  /* initialize new point */
209  memset(&pcp[add_index], 0, sizeof(PaintCurvePoint));
210  copy_v3_v3(pcp[add_index].bez.vec[0], vec);
211  copy_v3_v3(pcp[add_index].bez.vec[1], vec);
212  copy_v3_v3(pcp[add_index].bez.vec[2], vec);
213 
214  /* last step, clear selection from all bezier handles expect the next */
215  for (int i = 0; i < pc->tot_points; i++) {
216  pcp[i].bez.f1 = pcp[i].bez.f2 = pcp[i].bez.f3 = 0;
217  }
218 
220 
221  if (pc->add_index != 0) {
222  pcp[add_index].bez.f3 = SELECT;
223  pcp[add_index].bez.h2 = HD_ALIGN;
224  }
225  else {
226  pcp[add_index].bez.f1 = SELECT;
227  pcp[add_index].bez.h1 = HD_ALIGN;
228  }
229 
231 
232  WM_paint_cursor_tag_redraw(window, region);
233 }
234 
235 static int paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
236 {
237  const int loc[2] = {event->mval[0], event->mval[1]};
238  paintcurve_point_add(C, op, loc);
239  RNA_int_set_array(op->ptr, "location", loc);
240  return OPERATOR_FINISHED;
241 }
242 
244 {
245  int loc[2];
246 
247  if (RNA_struct_property_is_set(op->ptr, "location")) {
248  RNA_int_get_array(op->ptr, "location", loc);
249  paintcurve_point_add(C, op, loc);
250  return OPERATOR_FINISHED;
251  }
252 
253  return OPERATOR_CANCELLED;
254 }
255 
257 {
258  /* identifiers */
259  ot->name = "Add New Paint Curve Point";
260  ot->description = ot->name;
261  ot->idname = "PAINTCURVE_OT_add_point";
262 
263  /* api callbacks */
267 
268  /* flags */
270 
271  /* properties */
273  "location",
274  2,
275  NULL,
276  0,
277  SHRT_MAX,
278  "Location",
279  "Location of vertex in area space",
280  0,
281  SHRT_MAX);
282 }
283 
285 {
287  Brush *br = p->brush;
288  PaintCurve *pc;
289  PaintCurvePoint *pcp;
290  wmWindow *window = CTX_wm_window(C);
291  ARegion *region = CTX_wm_region(C);
292  int i;
293  int tot_del = 0;
294  pc = br->paint_curve;
295 
296  if (!pc || pc->tot_points == 0) {
297  return OPERATOR_CANCELLED;
298  }
299 
301 
302 #define DELETE_TAG 2
303 
304  for (i = 0, pcp = pc->points; i < pc->tot_points; i++, pcp++) {
305  if (BEZT_ISSEL_ANY(&pcp->bez)) {
306  pcp->bez.f2 |= DELETE_TAG;
307  tot_del++;
308  }
309  }
310 
311  if (tot_del > 0) {
312  int j = 0;
313  int new_tot = pc->tot_points - tot_del;
314  PaintCurvePoint *points_new = NULL;
315  if (new_tot > 0) {
316  points_new = MEM_mallocN(new_tot * sizeof(PaintCurvePoint), "PaintCurvePoint");
317  }
318 
319  for (i = 0, pcp = pc->points; i < pc->tot_points; i++, pcp++) {
320  if (!(pcp->bez.f2 & DELETE_TAG)) {
321  points_new[j] = pc->points[i];
322 
323  if ((i + 1) == pc->add_index) {
325  }
326  j++;
327  }
328  else if ((i + 1) == pc->add_index) {
329  /* prefer previous point */
330  pc->add_index = j;
331  }
332  }
333  MEM_freeN(pc->points);
334 
335  pc->points = points_new;
336  pc->tot_points = new_tot;
337  }
338 
339 #undef DELETE_TAG
340 
342 
343  WM_paint_cursor_tag_redraw(window, region);
344 
345  return OPERATOR_FINISHED;
346 }
347 
349 {
350  /* identifiers */
351  ot->name = "Remove Paint Curve Point";
352  ot->description = ot->name;
353  ot->idname = "PAINTCURVE_OT_delete_point";
354 
355  /* api callbacks */
358 
359  /* flags */
360  ot->flag = OPTYPE_UNDO;
361 }
362 
364  bContext *C, wmOperator *op, const int loc[2], bool toggle, bool extend)
365 {
366  wmWindow *window = CTX_wm_window(C);
367  ARegion *region = CTX_wm_region(C);
369  Brush *br = p->brush;
370  PaintCurve *pc;
371  int i;
372  const float loc_fl[2] = {UNPACK2(loc)};
373 
374  pc = br->paint_curve;
375 
376  if (!pc) {
377  return false;
378  }
379 
381 
382  if (toggle) {
383  PaintCurvePoint *pcp;
384  char select = 0;
385  bool selected = false;
386 
387  pcp = pc->points;
388 
389  for (i = 0; i < pc->tot_points; i++) {
390  if (pcp[i].bez.f1 || pcp[i].bez.f2 || pcp[i].bez.f3) {
391  selected = true;
392  break;
393  }
394  }
395 
396  if (!selected) {
397  select = SELECT;
398  }
399 
400  for (i = 0; i < pc->tot_points; i++) {
401  pc->points[i].bez.f1 = pc->points[i].bez.f2 = pc->points[i].bez.f3 = select;
402  }
403  }
404  else {
405  PaintCurvePoint *pcp;
406  char selflag;
407 
408  pcp = paintcurve_point_get_closest(pc, loc_fl, false, PAINT_CURVE_SELECT_THRESHOLD, &selflag);
409 
410  if (pcp) {
412 
413  if (selflag == SEL_F2) {
414  if (extend) {
415  pcp->bez.f2 ^= SELECT;
416  }
417  else {
418  pcp->bez.f2 |= SELECT;
419  }
420  }
421  else if (selflag == SEL_F1) {
422  if (extend) {
423  pcp->bez.f1 ^= SELECT;
424  }
425  else {
426  pcp->bez.f1 |= SELECT;
427  }
428  }
429  else if (selflag == SEL_F3) {
430  if (extend) {
431  pcp->bez.f3 ^= SELECT;
432  }
433  else {
434  pcp->bez.f3 |= SELECT;
435  }
436  }
437  }
438 
439  /* clear selection for unselected points if not extending and if a point has been selected */
440  if (!extend && pcp) {
441  for (i = 0; i < pc->tot_points; i++) {
442  pc->points[i].bez.f1 = pc->points[i].bez.f2 = pc->points[i].bez.f3 = 0;
443 
444  if ((pc->points + i) == pcp) {
445  char index = paintcurve_point_co_index(selflag);
446  PAINT_CURVE_POINT_SELECT(pcp, index);
447  }
448  }
449  }
450 
451  if (!pcp) {
453  return false;
454  }
455  }
456 
458 
459  WM_paint_cursor_tag_redraw(window, region);
460 
461  return true;
462 }
463 
465 {
466  const int loc[2] = {UNPACK2(event->mval)};
467  bool toggle = RNA_boolean_get(op->ptr, "toggle");
468  bool extend = RNA_boolean_get(op->ptr, "extend");
469  if (paintcurve_point_select(C, op, loc, toggle, extend)) {
470  RNA_int_set_array(op->ptr, "location", loc);
471  return OPERATOR_FINISHED;
472  }
473  return OPERATOR_CANCELLED;
474 }
475 
477 {
478  int loc[2];
479 
480  if (RNA_struct_property_is_set(op->ptr, "location")) {
481  bool toggle = RNA_boolean_get(op->ptr, "toggle");
482  bool extend = RNA_boolean_get(op->ptr, "extend");
483  RNA_int_get_array(op->ptr, "location", loc);
484  if (paintcurve_point_select(C, op, loc, toggle, extend)) {
485  return OPERATOR_FINISHED;
486  }
487  }
488 
489  return OPERATOR_CANCELLED;
490 }
491 
493 {
494  PropertyRNA *prop;
495 
496  /* identifiers */
497  ot->name = "Select Paint Curve Point";
498  ot->description = "Select a paint curve point";
499  ot->idname = "PAINTCURVE_OT_select";
500 
501  /* api callbacks */
505 
506  /* flags */
508 
509  /* properties */
511  "location",
512  2,
513  NULL,
514  0,
515  SHRT_MAX,
516  "Location",
517  "Location of vertex in area space",
518  0,
519  SHRT_MAX);
520  prop = RNA_def_boolean(ot->srna, "toggle", false, "Toggle", "(De)select all");
522  prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend selection");
524 }
525 
526 typedef struct PointSlideData {
528  char select;
529  int initial_loc[2];
530  float point_initial_loc[3][2];
531  int event;
532  bool align;
534 
535 static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *event)
536 {
538  const float loc_fl[2] = {UNPACK2(event->mval)};
539  char select;
540  int i;
541  bool do_select = RNA_boolean_get(op->ptr, "select");
542  bool align = RNA_boolean_get(op->ptr, "align");
543  Brush *br = p->brush;
544  PaintCurve *pc = br->paint_curve;
545  PaintCurvePoint *pcp;
546 
547  if (!pc) {
548  return OPERATOR_PASS_THROUGH;
549  }
550 
551  if (do_select) {
553  }
554  else {
555  pcp = NULL;
556  /* just find first selected point */
557  for (i = 0; i < pc->tot_points; i++) {
558  if ((select = paintcurve_point_side_index(&pc->points[i].bez, i == 0, SEL_F3))) {
559  pcp = &pc->points[i];
560  break;
561  }
562  }
563  }
564 
565  if (pcp) {
566  ARegion *region = CTX_wm_region(C);
567  wmWindow *window = CTX_wm_window(C);
568  PointSlideData *psd = MEM_mallocN(sizeof(PointSlideData), "PointSlideData");
569  copy_v2_v2_int(psd->initial_loc, event->mval);
570  psd->event = event->type;
571  psd->pcp = pcp;
573  for (i = 0; i < 3; i++) {
574  copy_v2_v2(psd->point_initial_loc[i], pcp->bez.vec[i]);
575  }
576  psd->align = align;
577  op->customdata = psd;
578 
579  /* first, clear all selection from points */
580  for (i = 0; i < pc->tot_points; i++) {
581  pc->points[i].bez.f1 = pc->points[i].bez.f3 = pc->points[i].bez.f2 = 0;
582  }
583 
584  /* only select the active point */
585  PAINT_CURVE_POINT_SELECT(pcp, psd->select);
587 
589  WM_paint_cursor_tag_redraw(window, region);
590  return OPERATOR_RUNNING_MODAL;
591  }
592 
593  return OPERATOR_PASS_THROUGH;
594 }
595 
596 static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
597 {
598  PointSlideData *psd = op->customdata;
599 
600  if (event->type == psd->event && event->val == KM_RELEASE) {
601  MEM_freeN(psd);
604  return OPERATOR_FINISHED;
605  }
606 
607  switch (event->type) {
608  case MOUSEMOVE: {
609  ARegion *region = CTX_wm_region(C);
610  wmWindow *window = CTX_wm_window(C);
611  float diff[2] = {event->mval[0] - psd->initial_loc[0], event->mval[1] - psd->initial_loc[1]};
612  if (psd->select == 1) {
613  int i;
614  for (i = 0; i < 3; i++) {
615  add_v2_v2v2(psd->pcp->bez.vec[i], diff, psd->point_initial_loc[i]);
616  }
617  }
618  else {
619  add_v2_v2(diff, psd->point_initial_loc[psd->select]);
620  copy_v2_v2(psd->pcp->bez.vec[psd->select], diff);
621 
622  if (psd->align) {
623  char opposite = (psd->select == 0) ? 2 : 0;
624  sub_v2_v2v2(diff, psd->pcp->bez.vec[1], psd->pcp->bez.vec[psd->select]);
625  add_v2_v2v2(psd->pcp->bez.vec[opposite], psd->pcp->bez.vec[1], diff);
626  }
627  }
628  WM_paint_cursor_tag_redraw(window, region);
629  break;
630  }
631  default:
632  break;
633  }
634 
635  return OPERATOR_RUNNING_MODAL;
636 }
637 
639 {
640  /* identifiers */
641  ot->name = "Slide Paint Curve Point";
642  ot->description = "Select and slide paint curve point";
643  ot->idname = "PAINTCURVE_OT_slide";
644 
645  /* api callbacks */
649 
650  /* flags */
651  ot->flag = OPTYPE_UNDO;
652 
653  /* properties */
655  ot->srna, "align", false, "Align Handles", "Aligns opposite point handle during transform");
657  ot->srna, "select", true, "Select", "Attempt to select a point handle before transform");
658 }
659 
661 {
663  const char *name;
664 
665  switch (mode) {
668  name = "PAINT_OT_image_paint";
669  break;
670  case PAINT_MODE_WEIGHT:
671  name = "PAINT_OT_weight_paint";
672  break;
673  case PAINT_MODE_VERTEX:
674  name = "PAINT_OT_vertex_paint";
675  break;
676  case PAINT_MODE_SCULPT:
677  name = "SCULPT_OT_brush_stroke";
678  break;
680  name = "SCULPT_CURVES_OT_brush_stroke";
681  break;
682  default:
683  return OPERATOR_PASS_THROUGH;
684  }
685 
687 }
688 
690 {
691  /* identifiers */
692  ot->name = "Draw Curve";
693  ot->description = "Draw curve";
694  ot->idname = "PAINTCURVE_OT_draw";
695 
696  /* api callbacks */
699 
700  /* flags */
701  ot->flag = OPTYPE_UNDO;
702 }
703 
704 static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
705 {
707 
708  switch (mode) {
709  case PAINT_MODE_TEXTURE_2D: {
710  ARegion *region = CTX_wm_region(C);
712  float location[2];
713 
714  if (!sima) {
715  return OPERATOR_CANCELLED;
716  }
717 
719  &region->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
720  copy_v2_v2(sima->cursor, location);
722  break;
723  }
724  default:
726  break;
727  }
728 
729  return OPERATOR_FINISHED;
730 }
731 
733 {
734  /* identifiers */
735  ot->name = "Place Cursor";
736  ot->description = "Place cursor";
737  ot->idname = "PAINTCURVE_OT_cursor";
738 
739  /* api callbacks */
742 
743  /* flags */
744  ot->flag = 0;
745 }
struct Object * CTX_data_active_object(const bContext *C)
Definition: context.c:1353
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:749
struct SpaceImage * CTX_wm_space_image(const bContext *C)
Definition: context.c:824
struct Main * CTX_data_main(const bContext *C)
Definition: context.c:1074
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
Definition: context.c:793
struct wmWindow * CTX_wm_window(const bContext *C)
Definition: context.c:723
ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C)
void BKE_paint_curve_clamp_endpoint_add_index(struct PaintCurve *pc, int add_index)
Definition: paint.c:737
struct Paint * BKE_paint_get_active_from_context(const struct bContext *C)
struct PaintCurve * BKE_paint_curve_add(struct Main *bmain, const char *name)
Definition: paint.c:705
ePaintMode
Definition: BKE_paint.h:67
@ PAINT_MODE_SCULPT_CURVES
Definition: BKE_paint.h:83
@ PAINT_MODE_TEXTURE_3D
Definition: BKE_paint.h:73
@ PAINT_MODE_SCULPT
Definition: BKE_paint.h:68
@ PAINT_MODE_WEIGHT
Definition: BKE_paint.h:71
@ PAINT_MODE_TEXTURE_2D
Definition: BKE_paint.h:75
@ PAINT_MODE_VERTEX
Definition: BKE_paint.h:70
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 UNPACK2(a)
#define UNUSED(x)
@ BRUSH_CURVE
#define BEZT_ISSEL_ANY(bezt)
@ HD_ALIGN
#define OB_MODE_ALL_PAINT
@ OB_MODE_SCULPT_CURVES
Object is a sort of wrapper for general info.
@ SI_MODE_PAINT
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
void ED_paintcurve_undo_push_end(struct bContext *C)
void ED_paintcurve_undo_push_begin(const char *name)
void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2], bool use_depth, enum eV3DCursorOrient orientation)
Definition: view3d_edit.c:984
@ V3D_CURSOR_ORIENT_VIEW
Definition: ED_view3d.h:87
Read Guarded memory(de)allocation.
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
@ PROP_SKIP_SAVE
Definition: RNA_types.h:218
#define C
Definition: RandGen.cpp:25
void UI_view2d_region_to_view(const struct View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
@ KM_RELEASE
Definition: WM_types.h:268
@ OPTYPE_UNDO
Definition: WM_types.h:148
@ OPTYPE_REGISTER
Definition: WM_types.h:146
#define NC_PAINTCURVE
Definition: WM_types.h:346
#define NA_ADDED
Definition: WM_types.h:525
#define ND_SPACE_IMAGE
Definition: WM_types.h:465
@ WM_OP_INVOKE_DEFAULT
Definition: WM_types.h:201
#define NC_SPACE
Definition: WM_types.h:342
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
bool closest(btVector3 &v)
#define SELECT
uint pos
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
static int paintcurve_slide_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: paint_curve.c:535
struct PointSlideData PointSlideData
static int paintcurve_new_exec(bContext *C, wmOperator *UNUSED(op))
Definition: paint_curve.c:144
bool paint_curve_poll(bContext *C)
Definition: paint_curve.c:40
static int paintcurve_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition: paint_curve.c:596
static PaintCurvePoint * paintcurve_point_get_closest(PaintCurve *pc, const float pos[2], bool ignore_pivot, const float threshold, char *point)
Definition: paint_curve.c:71
void PAINTCURVE_OT_new(wmOperatorType *ot)
Definition: paint_curve.c:158
static int paintcurve_point_co_index(char sel)
Definition: paint_curve.c:112
static void paintcurve_point_add(bContext *C, wmOperator *op, const int loc[2])
Definition: paint_curve.c:173
#define PAINT_CURVE_POINT_SELECT(pcp, i)
Definition: paint_curve.c:38
static int paintcurve_add_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: paint_curve.c:235
static int paintcurve_cursor_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
Definition: paint_curve.c:704
void PAINTCURVE_OT_add_point(wmOperatorType *ot)
Definition: paint_curve.c:256
void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
Definition: paint_curve.c:348
static int paintcurve_delete_point_exec(bContext *C, wmOperator *op)
Definition: paint_curve.c:284
static int paintcurve_select_point_exec(bContext *C, wmOperator *op)
Definition: paint_curve.c:476
void PAINTCURVE_OT_draw(wmOperatorType *ot)
Definition: paint_curve.c:689
#define PAINT_CURVE_SELECT_THRESHOLD
Definition: paint_curve.c:37
#define SEL_F1
Definition: paint_curve.c:66
#define SEL_F2
Definition: paint_curve.c:67
static int paintcurve_draw_exec(bContext *C, wmOperator *UNUSED(op))
Definition: paint_curve.c:660
static char paintcurve_point_side_index(const BezTriple *bezt, const bool is_first, const char fallback)
Definition: paint_curve.c:122
static int paintcurve_select_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition: paint_curve.c:464
static bool paintcurve_point_select(bContext *C, wmOperator *op, const int loc[2], bool toggle, bool extend)
Definition: paint_curve.c:363
#define SEL_F3
Definition: paint_curve.c:68
void PAINTCURVE_OT_cursor(wmOperatorType *ot)
Definition: paint_curve.c:732
void PAINTCURVE_OT_slide(wmOperatorType *ot)
Definition: paint_curve.c:638
#define DELETE_TAG
static int paintcurve_add_point_exec(bContext *C, wmOperator *op)
Definition: paint_curve.c:243
void PAINTCURVE_OT_select(wmOperatorType *ot)
Definition: paint_curve.c:492
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
Definition: rna_access.c:4945
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
Definition: rna_access.c:4933
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
Definition: rna_access.c:5301
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:4863
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3493
PropertyRNA * RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
Definition: rna_define.c:3623
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1490
uint8_t h1
uint8_t f3
float vec[3][3]
uint8_t f1
uint8_t f2
uint8_t h2
struct PaintCurve * paint_curve
Definition: BKE_main.h:121
PaintCurvePoint * points
struct Brush * brush
float point_initial_loc[3][2]
Definition: paint_curve.c:530
PaintCurvePoint * pcp
Definition: paint_curve.c:527
int initial_loc[2]
Definition: paint_curve.c:529
float cursor[2]
short val
Definition: WM_types.h:680
int mval[2]
Definition: WM_types.h:684
short type
Definition: WM_types.h:678
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:919
const char * name
Definition: WM_types.h:888
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:935
const char * idname
Definition: WM_types.h:890
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:943
struct StructRNA * srna
Definition: WM_types.h:969
const char * description
Definition: WM_types.h:893
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:903
struct wmOperatorType * type
struct PointerRNA * ptr
void WM_paint_cursor_tag_redraw(wmWindow *win, ARegion *UNUSED(region))
Definition: wm_draw.c:1294
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)
@ MOUSEMOVE
wmOperatorType * ot
Definition: wm_files.c:3479