Blender V4.5
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
9
10#include "DNA_brush_types.h"
11#include "DNA_scene_types.h"
12#include "DNA_space_types.h"
13
14#include "BLI_math_color.h"
15#include "BLI_math_vector.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)) {
134 }
135 else {
136 copy_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
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
230 ViewContext vc = {nullptr};
231
232 PaintOperation() = default;
234 {
235 MEM_delete(mode);
236 mode = nullptr;
237
238 if (cursor) {
240 cursor = nullptr;
241 }
242 }
243};
244
245static void gradient_draw_line(bContext * /*C*/,
246 const blender::int2 &xy,
247 const blender::float2 & /*tilt*/,
248 void *customdata)
249{
250 PaintOperation *pop = (PaintOperation *)customdata;
251
252 if (pop) {
253 GPU_line_smooth(true);
255
258
259 ARegion *region = pop->vc.region;
260
262
263 GPU_line_width(4.0);
264 immUniformColor4ub(0, 0, 0, 255);
265
269 pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
270 immEnd();
271
272 GPU_line_width(2.0);
273 immUniformColor4ub(255, 255, 255, 255);
274
278 pos, pop->startmouse[0] + region->winrct.xmin, pop->startmouse[1] + region->winrct.ymin);
279 immEnd();
280
282
284 GPU_line_smooth(false);
285 }
286}
287
288static std::unique_ptr<PaintOperation> texture_paint_init(bContext *C,
289 wmOperator *op,
290 const float mouse[2])
291{
293 Scene *scene = CTX_data_scene(C);
294 ToolSettings *settings = scene->toolsettings;
295 std::unique_ptr<PaintOperation> pop = std::make_unique<PaintOperation>();
296 Brush *brush = BKE_paint_brush(&settings->imapaint.paint);
297 int mode = RNA_enum_get(op->ptr, "mode");
299
300 copy_v2_v2(pop->prevmouse, mouse);
301 copy_v2_v2(pop->startmouse, mouse);
302
303 ViewLayer *view_layer = CTX_data_view_layer(C);
304 BKE_view_layer_synced_ensure(scene, view_layer);
306
307 /* initialize from context */
308 if (CTX_wm_region_view3d(C)) {
309 bool uvs, mat, tex, stencil;
310 if (!ED_paint_proj_mesh_data_check(*scene, *ob, &uvs, &mat, &tex, &stencil)) {
311 ED_paint_data_warning(op->reports, uvs, mat, tex, stencil);
313 return nullptr;
314 }
315 pop->mode = MEM_new<ProjectionPaintMode>("ProjectionPaintMode");
316 }
317 else {
318 pop->mode = MEM_new<ImagePaintMode>("ImagePaintMode");
319 }
320
321 pop->stroke_handle = pop->mode->paint_new_stroke(C, op, ob, mouse, mode);
322 if (!pop->stroke_handle) {
323 return nullptr;
324 }
325
327 (brush->flag & BRUSH_USE_GRADIENT))
328 {
329 pop->cursor = WM_paint_cursor_activate(
331 }
332
333 settings->imapaint.flag |= IMAGEPAINT_DRAWING;
335
336 return pop;
337}
338
340 wmOperator *op,
341 PaintStroke *stroke,
342 PointerRNA *itemptr)
343{
344 PaintOperation *pop = static_cast<PaintOperation *>(paint_stroke_mode_data(stroke));
345 Scene *scene = CTX_data_scene(C);
346 ToolSettings *toolsettings = CTX_data_tool_settings(C);
347 UnifiedPaintSettings *ups = &toolsettings->unified_paint_settings;
348 Brush *brush = BKE_paint_brush(&toolsettings->imapaint.paint);
349
350 float alphafac = (brush->flag & BRUSH_ACCUMULATE) ? ups->overlap_factor : 1.0f;
351
352 /* initial brush values. Maybe it should be considered moving these to stroke system */
353 float startalpha = BKE_brush_alpha_get(scene, brush);
354
355 float mouse[2];
356 float pressure;
357 float size;
358 float distance = paint_stroke_distance_get(stroke);
359 int eraser;
360
361 RNA_float_get_array(itemptr, "mouse", mouse);
362 pressure = RNA_float_get(itemptr, "pressure");
363 eraser = RNA_boolean_get(op->ptr, "pen_flip");
364 size = RNA_float_get(itemptr, "size");
365
366 /* stroking with fill tool only acts on stroke end */
368 copy_v2_v2(pop->prevmouse, mouse);
369 return;
370 }
371
372 if (BKE_brush_use_alpha_pressure(brush)) {
373 BKE_brush_alpha_set(scene, brush, max_ff(0.0f, startalpha * pressure * alphafac));
374 }
375 else {
376 BKE_brush_alpha_set(scene, brush, max_ff(0.0f, startalpha * alphafac));
377 }
378
379 if ((brush->flag & BRUSH_DRAG_DOT) || (brush->flag & BRUSH_ANCHORED)) {
382 }
383
384 pop->mode->paint_stroke(
385 C, pop->stroke_handle, pop->prevmouse, mouse, eraser, pressure, distance, size);
386
387 copy_v2_v2(pop->prevmouse, mouse);
388
389 /* restore brush values */
390 BKE_brush_alpha_set(scene, brush, startalpha);
391}
392
393static void paint_stroke_redraw(const bContext *C, PaintStroke *stroke, bool final)
394{
395 PaintOperation *pop = static_cast<PaintOperation *>(paint_stroke_mode_data(stroke));
396 pop->mode->paint_stroke_redraw(C, pop->stroke_handle, final);
397}
398
399static void paint_stroke_done(const bContext *C, PaintStroke *stroke)
400{
401 Scene *scene = CTX_data_scene(C);
402 ToolSettings *toolsettings = scene->toolsettings;
403 PaintOperation *pop = static_cast<PaintOperation *>(paint_stroke_mode_data(stroke));
405 Brush *brush = BKE_paint_brush(&toolsettings->imapaint.paint);
406
407 toolsettings->imapaint.flag &= ~IMAGEPAINT_DRAWING;
408
410 if (brush->flag & BRUSH_USE_GRADIENT) {
412 C, scene, paint, brush, stroke, pop->stroke_handle, pop->startmouse, pop->prevmouse);
413 }
414 else {
416 C, scene, paint, brush, stroke, pop->stroke_handle, pop->startmouse, pop->prevmouse);
417 }
418 }
420 pop->stroke_handle = nullptr;
421
423
424/* duplicate warning, see texpaint_init */
425#if 0
426 if (pop->s.warnmultifile) {
427 BKE_reportf(op->reports,
429 "Image requires 4 color channels to paint: %s",
430 pop->s.warnmultifile);
431 }
432 if (pop->s.warnpackedfile) {
433 BKE_reportf(op->reports,
435 "Packed MultiLayer files cannot be painted: %s",
436 pop->s.warnpackedfile);
437 }
438#endif
439}
440
441static bool paint_stroke_test_start(bContext *C, wmOperator *op, const float mouse[2])
442{
443 std::unique_ptr<PaintOperation> pop;
444
445 /* TODO: Should avoid putting this here. Instead, last position should be requested
446 * from stroke system. */
447
448 if (!(pop = texture_paint_init(C, op, mouse))) {
449 return false;
450 }
451
452 paint_stroke_set_mode_data(static_cast<PaintStroke *>(op->customdata), std::move(pop));
453
454 return true;
455}
456
458{
460 op,
461 nullptr,
466 event->type);
467
468 const wmOperatorStatus retval = op->type->modal(C, op, event);
469 OPERATOR_RETVAL_CHECK(retval);
470
471 if (retval == OPERATOR_FINISHED) {
472 paint_stroke_free(C, op, static_cast<PaintStroke *>(op->customdata));
473 return OPERATOR_FINISHED;
474 }
475 /* add modal handler */
477
479
481}
482
484{
485 PropertyRNA *strokeprop;
486 PointerRNA firstpoint;
487 float mouse[2];
488
489 strokeprop = RNA_struct_find_property(op->ptr, "stroke");
490
491 if (!RNA_property_collection_lookup_int(op->ptr, strokeprop, 0, &firstpoint)) {
492 return OPERATOR_CANCELLED;
493 }
494
495 RNA_float_get_array(&firstpoint, "mouse", mouse);
496
498 op,
499 nullptr,
504 0);
505 op->customdata = stroke;
506
507 /* Make sure we have proper coordinates for sampling (mask) textures -- these get stored in
508 * #UnifiedPaintSettings -- as well as support randomness and jitter. */
509 Scene &scene = *CTX_data_scene(C);
512 const Brush &brush = *BKE_paint_brush_for_read(&paint);
513 float pressure;
514 pressure = RNA_float_get(&firstpoint, "pressure");
515 float mouse_out[2];
516 bool dummy;
517 float dummy_location[3];
518
519 paint_stroke_jitter_pos(scene, *stroke, mode, brush, pressure, mouse, mouse_out);
520 paint_brush_update(C, brush, mode, stroke, mouse, mouse_out, pressure, dummy_location, &dummy);
521
522 /* frees op->customdata */
523 return paint_stroke_exec(C, op, static_cast<PaintStroke *>(op->customdata));
524}
525
527{
528 return paint_stroke_modal(C, op, event, reinterpret_cast<PaintStroke **>(&op->customdata));
529}
530
532{
533 paint_stroke_cancel(C, op, static_cast<PaintStroke *>(op->customdata));
534}
535} // namespace blender::ed::sculpt_paint::image::ops::paint
536
538{
540
541 /* identifiers */
542 ot->name = "Image Paint";
543 ot->idname = "PAINT_OT_image_paint";
544 ot->description = "Paint a stroke into the image";
545
546 /* API callbacks. */
547 ot->invoke = paint_invoke;
548 ot->modal = paint_modal;
549 ot->exec = paint_exec;
551 ot->cancel = paint_cancel;
552
553 /* flags */
554 ot->flag = OPTYPE_BLOCKING;
555
557}
bool BKE_brush_use_alpha_pressure(const Brush *brush)
Definition brush.cc:1231
int BKE_brush_size_get(const Scene *scene, const Brush *brush)
Definition brush.cc:1210
const float * BKE_brush_secondary_color_get(const Scene *scene, const Paint *paint, const Brush *brush)
Definition brush.cc:1172
void BKE_brush_alpha_set(Scene *scene, Brush *brush, float alpha)
Definition brush.cc:1256
float BKE_brush_alpha_get(const Scene *scene, const Brush *brush)
Definition brush.cc:1269
const float * BKE_brush_color_get(const Scene *scene, const Paint *paint, const Brush *brush)
Definition brush.cc:1128
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:93
const Brush * BKE_paint_brush_for_read(const Paint *paint)
Definition paint.cc:641
Paint * BKE_paint_get_active_from_context(const bContext *C)
Definition paint.cc:467
Brush * BKE_paint_brush(Paint *paint)
Definition paint.cc:636
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
Definition paint.cc:496
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert(a)
Definition BLI_assert.h:46
MINLINE float max_ff(float a, float b)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
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_CANCELLED
@ OPERATOR_FINISHED
@ 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 immVertex2f(uint attr_id, float x, float y)
void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
void immVertex2fv(uint attr_id, const float data[2])
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:166
void GPU_line_smooth(bool enable)
Definition gpu_state.cc:78
@ GPU_FETCH_FLOAT
uint GPU_vertformat_attr_add(GPUVertFormat *, blender::StringRef name, GPUVertCompType, uint comp_len, GPUVertFetchMode)
@ GPU_COMP_F32
Read Guarded memory(de)allocation.
#define C
Definition RandGen.cpp:29
@ OPTYPE_BLOCKING
Definition WM_types.hh:184
#define NC_SCENE
Definition WM_types.hh:375
#define ND_TOOLSETTINGS
Definition WM_types.hh:446
BPy_StructRNA * depsgraph
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
uint pos
float distance(VecOp< float, D >, VecOp< float, D >) RET
format
static wmOperatorStatus paint_exec(bContext *C, wmOperator *op)
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 gradient_draw_line(bContext *, const blender::int2 &xy, const blender::float2 &, void *customdata)
static wmOperatorStatus paint_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void paint_stroke_update_step(bContext *C, wmOperator *op, PaintStroke *stroke, PointerRNA *itemptr)
static void paint_stroke_done(const bContext *C, PaintStroke *stroke)
static wmOperatorStatus 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)
wmOperatorStatus 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)
wmOperatorStatus 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)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
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 ToolSettings * toolsettings
struct ImagePaintSettings imapaint
struct UnifiedPaintSettings unified_paint_settings
UndoStep * step_init
ARegion * region
Definition ED_view3d.hh:77
int ymin
int xmin
wmEventType type
Definition WM_types.hh:754
const char * name
Definition WM_types.hh:1030
wmOperatorStatus(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1078
struct ReportList * reports
struct wmOperatorType * type
struct PointerRNA * ptr
struct UndoStack * undo_stack
int xy[2]
Definition wm_draw.cc:174
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:4225
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)