Blender V4.3
paint_image_ops_paint.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10#include "DNA_brush_types.h"
11#include "DNA_color_types.h"
12#include "DNA_scene_types.h"
13#include "DNA_space_types.h"
14
15#include "BLI_math_color.h"
16
17#include "BKE_brush.hh"
18#include "BKE_context.hh"
19#include "BKE_layer.hh"
20#include "BKE_paint.hh"
21#include "BKE_undo_system.hh"
22
23#include "ED_paint.hh"
24#include "ED_view3d.hh"
25
26#include "GPU_immediate.hh"
27#include "GPU_state.hh"
28
29#include "MEM_guardedalloc.h"
30
31#include "RNA_access.hh"
32
33#include "WM_api.hh"
34#include "WM_types.hh"
35
36#include "ED_image.hh"
37
38#include "paint_intern.hh"
39
41
47 public:
48 virtual ~AbstractPaintMode() = default;
49 virtual void *paint_new_stroke(
50 bContext *C, wmOperator *op, Object *ob, const float mouse[2], int mode) = 0;
51 virtual void paint_stroke(bContext *C,
52 void *stroke_handle,
53 float prev_mouse[2],
54 float mouse[2],
55 int eraser,
56 float pressure,
57 float distance,
58 float size) = 0;
59
60 virtual void paint_stroke_redraw(const bContext *C, void *stroke_handle, bool final) = 0;
61 virtual void paint_stroke_done(void *stroke_handle) = 0;
62 virtual void paint_gradient_fill(const bContext *C,
63 const Scene *scene,
64 const Paint *paint,
65 Brush *brush,
66 PaintStroke *stroke,
67 void *stroke_handle,
68 float mouse_start[2],
69 float mouse_end[2]) = 0;
70 virtual void paint_bucket_fill(const bContext *C,
71 const Scene *scene,
72 const Paint *paint,
73 Brush *brush,
74 PaintStroke *stroke,
75 void *stroke_handle,
76 float mouse_start[2],
77 float mouse_end[2]) = 0;
78};
79
81 public:
83 bContext *C, wmOperator *op, Object * /*ob*/, const float /*mouse*/[2], int mode) override
84 {
85 return paint_2d_new_stroke(C, op, mode);
86 }
87
88 void paint_stroke(bContext * /*C*/,
89 void *stroke_handle,
90 float prev_mouse[2],
91 float mouse[2],
92 int eraser,
93 float pressure,
94 float distance,
95 float size) override
96 {
97 paint_2d_stroke(stroke_handle, prev_mouse, mouse, eraser, pressure, distance, size);
98 }
99
100 void paint_stroke_redraw(const bContext *C, void *stroke_handle, bool final) override
101 {
102 paint_2d_redraw(C, stroke_handle, final);
103 }
104
105 void paint_stroke_done(void *stroke_handle) override
106 {
107 paint_2d_stroke_done(stroke_handle);
108 }
109
111 const Scene * /*scene*/,
112 const Paint * /*paint*/,
113 Brush *brush,
114 PaintStroke * /*stroke*/,
115 void *stroke_handle,
116 float mouse_start[2],
117 float mouse_end[2]) override
118 {
119 paint_2d_gradient_fill(C, brush, mouse_start, mouse_end, stroke_handle);
120 }
121
123 const Scene *scene,
124 const Paint *paint,
125 Brush *brush,
126 PaintStroke *stroke,
127 void *stroke_handle,
128 float mouse_start[2],
129 float mouse_end[2]) override
130 {
131 float color[3];
132 if (paint_stroke_inverted(stroke)) {
133 srgb_to_linearrgb_v3_v3(color, BKE_brush_secondary_color_get(scene, paint, brush));
134 }
135 else {
136 srgb_to_linearrgb_v3_v3(color, BKE_brush_color_get(scene, paint, brush));
137 }
138 paint_2d_bucket_fill(C, color, brush, mouse_start, mouse_end, stroke_handle);
139 }
140};
141
143 public:
145 bContext *C, wmOperator * /*op*/, Object *ob, const float mouse[2], int mode) override
146 {
147 return paint_proj_new_stroke(C, ob, mouse, mode);
148 }
149
151 void *stroke_handle,
152 float prev_mouse[2],
153 float mouse[2],
154 int eraser,
155 float pressure,
156 float distance,
157 float size) override
158 {
159 paint_proj_stroke(C, stroke_handle, prev_mouse, mouse, eraser, pressure, distance, size);
160 };
161
162 void paint_stroke_redraw(const bContext *C, void *stroke_handle, bool final) override
163 {
164 paint_proj_redraw(C, stroke_handle, final);
165 }
166
167 void paint_stroke_done(void *stroke_handle) override
168 {
169 paint_proj_stroke_done(stroke_handle);
170 }
171
173 const Scene *scene,
174 const Paint *paint,
175 Brush *brush,
176 PaintStroke *stroke,
177 void *stroke_handle,
178 float mouse_start[2],
179 float mouse_end[2]) override
180 {
181 paint_fill(C, scene, paint, brush, stroke, stroke_handle, mouse_start, mouse_end);
182 }
183
185 const Scene *scene,
186 const Paint *paint,
187 Brush *brush,
188 PaintStroke *stroke,
189 void *stroke_handle,
190 float mouse_start[2],
191 float mouse_end[2]) override
192 {
193 paint_fill(C, scene, paint, brush, stroke, stroke_handle, mouse_start, mouse_end);
194 }
195
196 private:
197 void paint_fill(const bContext *C,
198 const Scene *scene,
199 const Paint * /*paint*/,
200 Brush *brush,
201 PaintStroke *stroke,
202 void *stroke_handle,
203 float mouse_start[2],
204 float mouse_end[2])
205 {
207 stroke_handle,
208 mouse_start,
209 mouse_end,
210 paint_stroke_flipped(stroke),
211 1.0,
212 0.0,
213 BKE_brush_size_get(scene, brush));
214 /* two redraws, one for GPU update, one for notification */
215 paint_proj_redraw(C, stroke_handle, false);
216 paint_proj_redraw(C, stroke_handle, true);
217 }
218};
219
221 AbstractPaintMode *mode = nullptr;
222
223 void *stroke_handle = nullptr;
224
225 float prevmouse[2] = {0.0f, 0.0f};
226 float startmouse[2] = {0.0f, 0.0f};
227 double starttime = 0.0;
228
229 wmPaintCursor *cursor = nullptr;
230 ViewContext vc = {nullptr};
231
232 PaintOperation() = default;
234 {
235 MEM_delete(mode);
236 mode = nullptr;
237
238 if (cursor) {
239 WM_paint_cursor_end(cursor);
240 cursor = nullptr;
241 }
242 }
243};
244
245static void gradient_draw_line(bContext * /*C*/, int x, int y, void *customdata)
246{
247 PaintOperation *pop = (PaintOperation *)customdata;
248
249 if (pop) {
250 GPU_line_smooth(true);
252
255
256 ARegion *region = pop->vc.region;
257
259
260 GPU_line_width(4.0);
261 immUniformColor4ub(0, 0, 0, 255);
262
264 immVertex2i(pos, x, y);
266 pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
267 immEnd();
268
269 GPU_line_width(2.0);
270 immUniformColor4ub(255, 255, 255, 255);
271
273 immVertex2i(pos, x, y);
275 pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
276 immEnd();
277
279
281 GPU_line_smooth(false);
282 }
283}
284
285static std::unique_ptr<PaintOperation> texture_paint_init(bContext *C,
286 wmOperator *op,
287 const float mouse[2])
288{
290 Scene *scene = CTX_data_scene(C);
291 ToolSettings *settings = scene->toolsettings;
292 std::unique_ptr<PaintOperation> pop = std::make_unique<PaintOperation>();
293 Brush *brush = BKE_paint_brush(&settings->imapaint.paint);
294 int mode = RNA_enum_get(op->ptr, "mode");
296
297 copy_v2_v2(pop->prevmouse, mouse);
298 copy_v2_v2(pop->startmouse, mouse);
299
300 ViewLayer *view_layer = CTX_data_view_layer(C);
301 BKE_view_layer_synced_ensure(scene, view_layer);
303
304 /* initialize from context */
305 if (CTX_wm_region_view3d(C)) {
306 bool uvs, mat, tex, stencil;
307 if (!ED_paint_proj_mesh_data_check(*scene, *ob, &uvs, &mat, &tex, &stencil)) {
308 ED_paint_data_warning(op->reports, uvs, mat, tex, stencil);
310 return nullptr;
311 }
312 pop->mode = MEM_new<ProjectionPaintMode>("ProjectionPaintMode");
313 }
314 else {
315 pop->mode = MEM_new<ImagePaintMode>("ImagePaintMode");
316 }
317
318 pop->stroke_handle = pop->mode->paint_new_stroke(C, op, ob, mouse, mode);
319 if (!pop->stroke_handle) {
320 return nullptr;
321 }
322
324 (brush->flag & BRUSH_USE_GRADIENT))
325 {
326 pop->cursor = WM_paint_cursor_activate(
328 }
329
330 settings->imapaint.flag |= IMAGEPAINT_DRAWING;
332
333 return pop;
334}
335
337 wmOperator * /*op*/,
338 PaintStroke *stroke,
339 PointerRNA *itemptr)
340{
341 PaintOperation *pop = static_cast<PaintOperation *>(paint_stroke_mode_data(stroke));
342 Scene *scene = CTX_data_scene(C);
343 ToolSettings *toolsettings = CTX_data_tool_settings(C);
344 UnifiedPaintSettings *ups = &toolsettings->unified_paint_settings;
345 Brush *brush = BKE_paint_brush(&toolsettings->imapaint.paint);
346
347 float alphafac = (brush->flag & BRUSH_ACCUMULATE) ? ups->overlap_factor : 1.0f;
348
349 /* initial brush values. Maybe it should be considered moving these to stroke system */
350 float startalpha = BKE_brush_alpha_get(scene, brush);
351
352 float mouse[2];
353 float pressure;
354 float size;
355 float distance = paint_stroke_distance_get(stroke);
356 int eraser;
357
358 RNA_float_get_array(itemptr, "mouse", mouse);
359 pressure = RNA_float_get(itemptr, "pressure");
360 eraser = RNA_boolean_get(itemptr, "pen_flip");
361 size = RNA_float_get(itemptr, "size");
362
363 /* stroking with fill tool only acts on stroke end */
365 copy_v2_v2(pop->prevmouse, mouse);
366 return;
367 }
368
369 if (BKE_brush_use_alpha_pressure(brush)) {
370 BKE_brush_alpha_set(scene, brush, max_ff(0.0f, startalpha * pressure * alphafac));
371 }
372 else {
373 BKE_brush_alpha_set(scene, brush, max_ff(0.0f, startalpha * alphafac));
374 }
375
376 if ((brush->flag & BRUSH_DRAG_DOT) || (brush->flag & BRUSH_ANCHORED)) {
377 UndoStack *ustack = CTX_wm_manager(C)->undo_stack;
379 }
380
381 pop->mode->paint_stroke(
382 C, pop->stroke_handle, pop->prevmouse, mouse, eraser, pressure, distance, size);
383
384 copy_v2_v2(pop->prevmouse, mouse);
385
386 /* restore brush values */
387 BKE_brush_alpha_set(scene, brush, startalpha);
388}
389
390static void paint_stroke_redraw(const bContext *C, PaintStroke *stroke, bool final)
391{
392 PaintOperation *pop = static_cast<PaintOperation *>(paint_stroke_mode_data(stroke));
393 pop->mode->paint_stroke_redraw(C, pop->stroke_handle, final);
394}
395
396static void paint_stroke_done(const bContext *C, PaintStroke *stroke)
397{
398 Scene *scene = CTX_data_scene(C);
399 ToolSettings *toolsettings = scene->toolsettings;
400 PaintOperation *pop = static_cast<PaintOperation *>(paint_stroke_mode_data(stroke));
402 Brush *brush = BKE_paint_brush(&toolsettings->imapaint.paint);
403
404 toolsettings->imapaint.flag &= ~IMAGEPAINT_DRAWING;
405
407 if (brush->flag & BRUSH_USE_GRADIENT) {
409 C, scene, paint, brush, stroke, pop->stroke_handle, pop->startmouse, pop->prevmouse);
410 }
411 else {
413 C, scene, paint, brush, stroke, pop->stroke_handle, pop->startmouse, pop->prevmouse);
414 }
415 }
417 pop->stroke_handle = nullptr;
418
420
421/* duplicate warning, see texpaint_init */
422#if 0
423 if (pop->s.warnmultifile) {
424 BKE_reportf(op->reports,
426 "Image requires 4 color channels to paint: %s",
427 pop->s.warnmultifile);
428 }
429 if (pop->s.warnpackedfile) {
430 BKE_reportf(op->reports,
432 "Packed MultiLayer files cannot be painted: %s",
433 pop->s.warnpackedfile);
434 }
435#endif
436}
437
438static bool paint_stroke_test_start(bContext *C, wmOperator *op, const float mouse[2])
439{
440 std::unique_ptr<PaintOperation> pop;
441
442 /* TODO: Should avoid putting this here. Instead, last position should be requested
443 * from stroke system. */
444
445 if (!(pop = texture_paint_init(C, op, mouse))) {
446 return false;
447 }
448
449 paint_stroke_set_mode_data(static_cast<PaintStroke *>(op->customdata), std::move(pop));
450
451 return true;
452}
453
454static int paint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
455{
456 int retval;
457
459 op,
460 nullptr,
465 event->type);
466
467 if ((retval = op->type->modal(C, op, event)) == OPERATOR_FINISHED) {
468 paint_stroke_free(C, op, static_cast<PaintStroke *>(op->customdata));
469 return OPERATOR_FINISHED;
470 }
471 /* add modal handler */
473
474 OPERATOR_RETVAL_CHECK(retval);
476
478}
479
480static int paint_exec(bContext *C, wmOperator *op)
481{
482 PropertyRNA *strokeprop;
483 PointerRNA firstpoint;
484 float mouse[2];
485
486 strokeprop = RNA_struct_find_property(op->ptr, "stroke");
487
488 if (!RNA_property_collection_lookup_int(op->ptr, strokeprop, 0, &firstpoint)) {
489 return OPERATOR_CANCELLED;
490 }
491
492 RNA_float_get_array(&firstpoint, "mouse", mouse);
493
494 PaintStroke *stroke = paint_stroke_new(C,
495 op,
496 nullptr,
501 0);
502 op->customdata = stroke;
503
504 /* Make sure we have proper coordinates for sampling (mask) textures -- these get stored in
505 * #UnifiedPaintSettings -- as well as support randomness and jitter. */
506 Scene &scene = *CTX_data_scene(C);
509 const Brush &brush = *BKE_paint_brush_for_read(&paint);
510 float pressure;
511 pressure = RNA_float_get(&firstpoint, "pressure");
512 float mouse_out[2];
513 bool dummy;
514 float dummy_location[3];
515
516 paint_stroke_jitter_pos(scene, *stroke, mode, brush, pressure, mouse, mouse_out);
517 paint_brush_update(C, brush, mode, stroke, mouse, mouse_out, pressure, dummy_location, &dummy);
518
519 /* frees op->customdata */
520 return paint_stroke_exec(C, op, static_cast<PaintStroke *>(op->customdata));
521}
522
523static int paint_modal(bContext *C, wmOperator *op, const wmEvent *event)
524{
525 return paint_stroke_modal(C, op, event, reinterpret_cast<PaintStroke **>(&op->customdata));
526}
527
528static void paint_cancel(bContext *C, wmOperator *op)
529{
530 paint_stroke_cancel(C, op, static_cast<PaintStroke *>(op->customdata));
531}
532} // namespace blender::ed::sculpt_paint::image::ops::paint
533
535{
537
538 /* identifiers */
539 ot->name = "Image Paint";
540 ot->idname = "PAINT_OT_image_paint";
541 ot->description = "Paint a stroke into the image";
542
543 /* api callbacks */
544 ot->invoke = paint_invoke;
545 ot->modal = paint_modal;
546 ot->exec = paint_exec;
548 ot->cancel = paint_cancel;
549
550 /* flags */
552
554}
bool BKE_brush_use_alpha_pressure(const Brush *brush)
Definition brush.cc:1096
int BKE_brush_size_get(const Scene *scene, const Brush *brush)
Definition brush.cc:1075
const float * BKE_brush_secondary_color_get(const Scene *scene, const Paint *paint, const Brush *brush)
Definition brush.cc:1037
void BKE_brush_alpha_set(Scene *scene, Brush *brush, float alpha)
Definition brush.cc:1140
float BKE_brush_alpha_get(const Scene *scene, const Brush *brush)
Definition brush.cc:1153
const float * BKE_brush_color_get(const Scene *scene, const Paint *paint, const Brush *brush)
Definition brush.cc:1029
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ToolSettings * CTX_data_tool_settings(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void BKE_view_layer_synced_ensure(const Scene *scene, ViewLayer *view_layer)
Object * BKE_view_layer_active_object_get(const ViewLayer *view_layer)
PaintMode
Definition BKE_paint.hh:99
const Brush * BKE_paint_brush_for_read(const Paint *paint)
Definition paint.cc:654
Paint * BKE_paint_get_active_from_context(const bContext *C)
Definition paint.cc:477
Brush * BKE_paint_brush(Paint *paint)
Definition paint.cc:649
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
Definition paint.cc:506
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert(a)
Definition BLI_assert.h:50
MINLINE float max_ff(float a, float b)
void srgb_to_linearrgb_v3_v3(float linear[3], const float srgb[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
unsigned int uint
@ BRUSH_DRAG_DOT
@ BRUSH_ACCUMULATE
@ BRUSH_ANCHORED
@ BRUSH_USE_GRADIENT
@ IMAGE_PAINT_BRUSH_TYPE_FILL
@ IMAGEPAINT_DRAWING
#define RGN_TYPE_ANY
#define SPACE_TYPE_ANY
@ OPERATOR_RUNNING_MODAL
#define OPERATOR_RETVAL_CHECK(ret)
bool ED_image_tools_paint_poll(bContext *C)
void ED_image_undo_push_begin(const char *name, PaintMode paint_mode)
void ED_image_undo_push_end()
void ED_paint_data_warning(ReportList *reports, bool has_uvs, bool has_mat, bool has_tex, bool has_stencil)
void ED_image_undo_restore(UndoStep *us)
bool ED_paint_proj_mesh_data_check(Scene &scene, Object &ob, bool *r_has_uvs, bool *r_has_mat, bool *r_has_tex, bool *r_has_stencil)
ViewContext ED_view3d_viewcontext_init(bContext *C, Depsgraph *depsgraph)
void immEnd()
void immUnbindProgram()
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immVertex2i(uint attr_id, int x, int y)
void immUniformColor4ub(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
GPUVertFormat * immVertexFormat()
void immBegin(GPUPrimType, uint vertex_len)
@ GPU_PRIM_LINES
@ GPU_SHADER_3D_UNIFORM_COLOR
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
void GPU_blend(eGPUBlend blend)
Definition gpu_state.cc:42
void GPU_line_width(float width)
Definition gpu_state.cc:161
void GPU_line_smooth(bool enable)
Definition gpu_state.cc:78
@ GPU_FETCH_INT_TO_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, const char *name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_I32
Read Guarded memory(de)allocation.
@ OPTYPE_BLOCKING
Definition WM_types.hh:164
#define NC_SCENE
Definition WM_types.hh:345
#define ND_TOOLSETTINGS
Definition WM_types.hh:416
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
virtual void paint_stroke_redraw(const bContext *C, void *stroke_handle, bool final)=0
virtual void paint_gradient_fill(const bContext *C, const Scene *scene, const Paint *paint, Brush *brush, PaintStroke *stroke, void *stroke_handle, float mouse_start[2], float mouse_end[2])=0
virtual void paint_bucket_fill(const bContext *C, const Scene *scene, const Paint *paint, Brush *brush, PaintStroke *stroke, void *stroke_handle, float mouse_start[2], float mouse_end[2])=0
virtual void paint_stroke(bContext *C, void *stroke_handle, float prev_mouse[2], float mouse[2], int eraser, float pressure, float distance, float size)=0
virtual void * paint_new_stroke(bContext *C, wmOperator *op, Object *ob, const float mouse[2], int mode)=0
void paint_stroke(bContext *, void *stroke_handle, float prev_mouse[2], float mouse[2], int eraser, float pressure, float distance, float size) override
void paint_bucket_fill(const bContext *C, const Scene *scene, const Paint *paint, Brush *brush, PaintStroke *stroke, void *stroke_handle, float mouse_start[2], float mouse_end[2]) override
void paint_gradient_fill(const bContext *C, const Scene *, const Paint *, Brush *brush, PaintStroke *, void *stroke_handle, float mouse_start[2], float mouse_end[2]) override
void * paint_new_stroke(bContext *C, wmOperator *op, Object *, const float[2], int mode) override
void paint_stroke_redraw(const bContext *C, void *stroke_handle, bool final) override
void * paint_new_stroke(bContext *C, wmOperator *, Object *ob, const float mouse[2], int mode) override
void paint_gradient_fill(const bContext *C, const Scene *scene, const Paint *paint, Brush *brush, PaintStroke *stroke, void *stroke_handle, float mouse_start[2], float mouse_end[2]) override
void paint_stroke_redraw(const bContext *C, void *stroke_handle, bool final) override
void paint_bucket_fill(const bContext *C, const Scene *scene, const Paint *paint, Brush *brush, PaintStroke *stroke, void *stroke_handle, float mouse_start[2], float mouse_end[2]) override
void paint_stroke(bContext *C, void *stroke_handle, float prev_mouse[2], float mouse[2], int eraser, float pressure, float distance, float size) override
const Depsgraph * depsgraph
format
static void gradient_draw_line(bContext *, int x, int y, void *customdata)
static void paint_stroke_update_step(bContext *C, wmOperator *, PaintStroke *stroke, PointerRNA *itemptr)
static bool paint_stroke_test_start(bContext *C, wmOperator *op, const float mouse[2])
static std::unique_ptr< PaintOperation > texture_paint_init(bContext *C, wmOperator *op, const float mouse[2])
static void paint_stroke_done(const bContext *C, PaintStroke *stroke)
static int paint_exec(bContext *C, wmOperator *op)
static int paint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void paint_stroke_redraw(const bContext *C, PaintStroke *stroke, bool final)
static void paint_cancel(bContext *C, wmOperator *op)
static int paint_modal(bContext *C, wmOperator *op, const wmEvent *event)
int paint_stroke_exec(bContext *C, wmOperator *op, PaintStroke *stroke)
void paint_stroke_jitter_pos(Scene &scene, const PaintStroke &stroke, const PaintMode mode, const Brush &brush, const float pressure, const float mval[2], float r_mouse_out[2])
void paint_stroke_cancel(bContext *C, wmOperator *op, PaintStroke *stroke)
bool paint_stroke_flipped(PaintStroke *stroke)
int paint_stroke_modal(bContext *C, wmOperator *op, const wmEvent *event, PaintStroke **stroke_p)
bool paint_brush_update(bContext *C, const Brush &brush, PaintMode mode, PaintStroke *stroke, const float mouse_init[2], float mouse[2], float pressure, float r_location[3], bool *r_location_is_set)
void * paint_stroke_mode_data(PaintStroke *stroke)
float paint_stroke_distance_get(PaintStroke *stroke)
void paint_stroke_free(bContext *C, wmOperator *op, PaintStroke *stroke)
PaintStroke * paint_stroke_new(bContext *C, wmOperator *op, StrokeGetLocation get_location, StrokeTestStart test_start, StrokeUpdateStep update_step, StrokeRedraw redraw, StrokeDone done, int event_type)
bool paint_stroke_inverted(PaintStroke *stroke)
void paint_stroke_set_mode_data(PaintStroke *stroke, std::unique_ptr< PaintModeData > mode_data)
void * paint_2d_new_stroke(bContext *C, wmOperator *op, int mode)
void paint_2d_bucket_fill(const bContext *C, const float color[3], Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps)
void paint_2d_gradient_fill(const bContext *C, Brush *br, const float mouse_init[2], const float mouse_final[2], void *ps)
void paint_2d_stroke_done(void *ps)
void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], const bool eraser, float pressure, float distance, float base_size)
void paint_2d_redraw(const bContext *C, void *ps, bool final)
void PAINT_OT_image_paint(wmOperatorType *ot)
void * paint_proj_new_stroke(bContext *C, Object *ob, const float mouse[2], int mode)
void paint_proj_stroke(const bContext *C, void *ps_handle_p, const float prev_pos[2], const float pos[2], const bool eraser, float pressure, float distance, float size)
void paint_proj_redraw(const bContext *C, void *ps_handle_p, bool final)
void paint_proj_stroke_done(void *ps_handle_p)
void paint_stroke_operator_properties(wmOperatorType *ot)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
char image_brush_type
struct ImagePaintSettings imapaint
struct UnifiedPaintSettings unified_paint_settings
UndoStep * step_init
ARegion * region
Definition ED_view3d.hh:73
short type
Definition WM_types.hh:722
const char * name
Definition WM_types.hh:990
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1042
const char * idname
Definition WM_types.hh:992
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1036
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1022
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
void(* cancel)(bContext *C, wmOperator *op)
Definition WM_types.hh:1028
struct ReportList * reports
struct wmOperatorType * type
struct PointerRNA * ptr
struct UndoStack * undo_stack
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorType * ot
Definition wm_files.cc:4125
bool WM_paint_cursor_end(wmPaintCursor *handle)
wmPaintCursor * WM_paint_cursor_activate(short space_type, short region_type, bool(*poll)(bContext *C), wmPaintCursorDraw draw, void *customdata)