Blender V5.3
paint_ops.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 <algorithm>
10#include <cstdlib>
11#include <cstring>
12
13#include "MEM_guardedalloc.h"
14
15#include "BLI_ghash.hh"
16#include "BLI_listbase.hh"
17#include "BLI_math_color_c.hh"
18#include "BLI_math_vector_c.hh"
19#include "BLI_utildefines.hh"
20
21#include "IMB_interp.hh"
22
23#include "DNA_brush_types.h"
24#include "DNA_scene_types.h"
25
26#include "BKE_brush.hh"
27#include "BKE_context.hh"
28#include "BKE_image.hh"
29#include "BKE_lib_id.hh"
30#include "BKE_library.hh"
31#include "BKE_main.hh"
32#include "BKE_paint.hh"
33#include "BKE_paint_types.hh"
34#include "BKE_report.hh"
35
36#include "ED_image.hh"
37#include "ED_paint.hh"
38#include "ED_screen.hh"
39
40#include "WM_api.hh"
41#include "WM_types.hh"
42
43#include "RNA_access.hh"
44#include "RNA_define.hh"
45
47
48#include "paint_intern.hh"
49
51#include "mesh/paint_hide.hh"
52#include "mesh/paint_mask.hh"
53#include "mesh/sculpt_intern.hh"
54
55namespace blender {
56
58{
61 float scalar = RNA_float_get(op->ptr, "scalar");
62
63 if (brush) {
64 /* Pixel diameter. */
65 {
66 const int old_size = BKE_brush_size_get(paint, brush);
67 int size = int(scalar * old_size);
68
69 if (abs(old_size - size) < U.pixelsize) {
70 if (scalar > 1) {
71 size += U.pixelsize;
72 }
73 else if (scalar < 1) {
74 size -= U.pixelsize;
75 }
76 }
77
79 }
80
81 /* Unprojected diameter. */
82 {
83 float unprojected_size = scalar * BKE_brush_unprojected_size_get(paint, brush);
84
85 unprojected_size = std::max(unprojected_size, 0.001f);
86
87 BKE_brush_unprojected_size_set(paint, brush, unprojected_size);
88 }
89
91 }
92
93 return OPERATOR_FINISHED;
94}
95
97{
98 /* identifiers */
99 ot->name = "Scale Sculpt/Paint Brush Size";
100 ot->description = "Change brush size by a scalar";
101 ot->idname = "BRUSH_OT_scale_size";
102
103 /* API callbacks. */
105
106 /* flags */
107 ot->flag = 0;
108
109 RNA_def_float(ot->srna, "scalar", 1, 0, 2, "Scalar", "Factor to scale brush size by", 0, 2);
110}
111
112/***** Stencil Control *****/
113
119
124
130
132 float init_mouse[2] = {0};
133 float init_spos[2] = {0};
134 float init_sdim[2] = {0};
135 float init_rot = 0.0f;
136 float init_angle = 0.0f;
137 float lenorig = 0.0f;
138 float area_size[2] = {0};
142 int mask = 0;
143 Brush *br = nullptr;
144 float *dim_target = nullptr;
145 float *rot_target = nullptr;
146 float *pos_target = nullptr;
147 short launch_event = 0;
148};
149
151{
152 Brush *br = scd->br;
153 float mdiff[2];
154 if (scd->mask) {
157 scd->init_rot = br->mask_mtex.rot;
158
160 scd->rot_target = &br->mask_mtex.rot;
161 scd->pos_target = br->mask_stencil_pos;
162
163 sub_v2_v2v2(mdiff, scd->init_mouse, br->mask_stencil_pos);
164 }
165 else {
168 scd->init_rot = br->mtex.rot;
169
170 scd->dim_target = br->stencil_dimension;
171 scd->rot_target = &br->mtex.rot;
172 scd->pos_target = br->stencil_pos;
173
174 sub_v2_v2v2(mdiff, scd->init_mouse, br->stencil_pos);
175 }
176
177 scd->lenorig = len_v2(mdiff);
178
179 scd->init_angle = atan2f(mdiff[1], mdiff[0]);
180}
181
183{
186 const float mvalf[2] = {float(event->mval[0]), float(event->mval[1])};
187 ARegion *region = CTX_wm_region(C);
189 int mask = RNA_enum_get(op->ptr, "texmode");
190
191 if (mask) {
193 return OPERATOR_CANCELLED;
194 }
195 }
196 else {
198 return OPERATOR_CANCELLED;
199 }
200 }
201
202 scd = MEM_new<StencilControlData>(__func__);
203 scd->mask = mask;
204 scd->br = br;
205
206 copy_v2_v2(scd->init_mouse, mvalf);
207
209
210 scd->mode = StencilControlMode(RNA_enum_get(op->ptr, "mode"));
212 scd->area_size[0] = region->winx;
213 scd->area_size[1] = region->winy;
214
215 op->customdata = scd;
217
219}
220
222{
223 copy_v2_v2(scd->dim_target, scd->init_sdim);
224 copy_v2_v2(scd->pos_target, scd->init_spos);
225 *scd->rot_target = scd->init_rot;
226}
227
229{
230 StencilControlData *scd = static_cast<StencilControlData *>(op->customdata);
231 stencil_restore(scd);
232 MEM_delete(scd);
233}
234
235static void stencil_control_calculate(StencilControlData *scd, const int mval[2])
236{
237#define PIXEL_MARGIN 5
238
239 float mdiff[2];
240 const float mvalf[2] = {float(mval[0]), float(mval[1])};
241 switch (scd->mode) {
243 sub_v2_v2v2(mdiff, mvalf, scd->init_mouse);
244 add_v2_v2v2(scd->pos_target, scd->init_spos, mdiff);
245 CLAMP(scd->pos_target[0],
246 -scd->dim_target[0] + PIXEL_MARGIN,
247 scd->area_size[0] + scd->dim_target[0] - PIXEL_MARGIN);
248
249 CLAMP(scd->pos_target[1],
250 -scd->dim_target[1] + PIXEL_MARGIN,
251 scd->area_size[1] + scd->dim_target[1] - PIXEL_MARGIN);
253
254 break;
255 case STENCIL_SCALE: {
256 float len, factor;
257 sub_v2_v2v2(mdiff, mvalf, scd->pos_target);
258 len = len_v2(mdiff);
259 factor = len / scd->lenorig;
260 copy_v2_v2(mdiff, scd->init_sdim);
262 mdiff[0] = factor * scd->init_sdim[0];
263 }
265 mdiff[1] = factor * scd->init_sdim[1];
266 }
267 clamp_v2(mdiff, 5.0f, 10000.0f);
268 copy_v2_v2(scd->dim_target, mdiff);
270 break;
271 }
272 case STENCIL_ROTATE: {
273 float angle;
274 sub_v2_v2v2(mdiff, mvalf, scd->pos_target);
275 angle = atan2f(mdiff[1], mdiff[0]);
276 angle = scd->init_rot + angle - scd->init_angle;
277 if (angle < 0.0f) {
278 angle += float(2 * M_PI);
279 }
280 if (angle > float(2 * M_PI)) {
281 angle -= float(2 * M_PI);
282 }
283 *scd->rot_target = angle;
285 break;
286 }
287 }
288#undef PIXEL_MARGIN
289}
290
292{
293 StencilControlData *scd = static_cast<StencilControlData *>(op->customdata);
294
295 if (event->type == scd->launch_event && event->val == KM_RELEASE) {
296 MEM_delete(scd);
298 return OPERATOR_FINISHED;
299 }
300
301 switch (event->type) {
302 case MOUSEMOVE:
303 stencil_control_calculate(scd, event->mval);
304 break;
305 case EVT_ESCKEY:
306 if (event->val == KM_PRESS) {
309 return OPERATOR_CANCELLED;
310 }
311 break;
312 case EVT_XKEY:
313 if (event->val == KM_PRESS) {
314
317 }
318 else {
320 }
321
322 stencil_control_calculate(scd, event->mval);
323 }
324 break;
325 case EVT_YKEY:
326 if (event->val == KM_PRESS) {
329 }
330 else {
332 }
333
334 stencil_control_calculate(scd, event->mval);
335 }
336 break;
337 default:
338 break;
339 }
340
342
344}
345
347{
349
350 Paint *paint;
351 Brush *br;
352
354 return false;
355 }
356
359 return (br && (br->mtex.brush_map_mode == MTEX_MAP_MODE_STENCIL ||
361}
362
364{
365 static const EnumPropertyItem stencil_control_items[] = {
366 {STENCIL_TRANSLATE, "TRANSLATION", 0, "Translation", ""},
367 {STENCIL_SCALE, "SCALE", 0, "Scale", ""},
368 {STENCIL_ROTATE, "ROTATION", 0, "Rotation", ""},
369 {0, nullptr, 0, nullptr, nullptr},
370 };
371
372 static const EnumPropertyItem stencil_texture_items[] = {
373 {STENCIL_PRIMARY, "PRIMARY", 0, "Primary", ""},
374 {STENCIL_SECONDARY, "SECONDARY", 0, "Secondary", ""},
375 {0, nullptr, 0, nullptr, nullptr},
376 };
377 /* identifiers */
378 ot->name = "Stencil Brush Control";
379 ot->description = "Control the stencil brush";
380 ot->idname = "BRUSH_OT_stencil_control";
381
382 /* API callbacks. */
387
388 /* flags */
389 ot->flag = 0;
390
391 PropertyRNA *prop;
392 prop = RNA_def_enum(ot->srna, "mode", stencil_control_items, STENCIL_TRANSLATE, "Tool", "");
394 prop = RNA_def_enum(ot->srna, "texmode", stencil_texture_items, STENCIL_PRIMARY, "Tool", "");
396}
397
399{
402 bool use_scale = RNA_boolean_get(op->ptr, "use_scale");
403 bool use_repeat = RNA_boolean_get(op->ptr, "use_repeat");
404 bool do_mask = RNA_boolean_get(op->ptr, "mask");
405 Tex *tex = nullptr;
406 MTex *mtex = nullptr;
407 if (br) {
408 mtex = do_mask ? &br->mask_mtex : &br->mtex;
409 tex = mtex->tex;
410 }
411
412 if (tex && tex->type == TEX_IMAGE && tex->ima) {
413 float aspx, aspy;
414 Image *ima = tex->ima;
415 float orig_area, stencil_area, factor;
416 ED_image_get_uv_aspect(ima, nullptr, &aspx, &aspy);
417
418 if (use_scale) {
419 aspx *= mtex->size[0];
420 aspy *= mtex->size[1];
421 }
422
423 if (use_repeat && tex->extend == TEX_REPEAT) {
424 aspx *= tex->xrepeat;
425 aspy *= tex->yrepeat;
426 }
427
428 orig_area = fabsf(aspx * aspy);
429
430 if (do_mask) {
431 stencil_area = fabsf(br->mask_stencil_dimension[0] * br->mask_stencil_dimension[1]);
432 }
433 else {
434 stencil_area = fabsf(br->stencil_dimension[0] * br->stencil_dimension[1]);
435 }
436
437 factor = sqrtf(stencil_area / orig_area);
438
439 if (do_mask) {
440 br->mask_stencil_dimension[0] = fabsf(factor * aspx);
441 br->mask_stencil_dimension[1] = fabsf(factor * aspy);
442 }
443 else {
444 br->stencil_dimension[0] = fabsf(factor * aspx);
445 br->stencil_dimension[1] = fabsf(factor * aspy);
446 }
448 }
449
451
452 return OPERATOR_FINISHED;
453}
454
456{
457 /* identifiers */
458 ot->name = "Image Aspect";
459 ot->description =
460 "When using an image texture, adjust the stencil size to fit the image aspect ratio";
461 ot->idname = "BRUSH_OT_stencil_fit_image_aspect";
462
463 /* API callbacks. */
466
467 /* flags */
469
470 RNA_def_boolean(ot->srna, "use_repeat", true, "Use Repeat", "Use repeat mapping values");
471 RNA_def_boolean(ot->srna, "use_scale", true, "Use Scale", "Use texture scale values");
473 ot->srna, "mask", false, "Modify Mask Stencil", "Modify either the primary or mask stencil");
474}
475
477{
480 bool do_mask = RNA_boolean_get(op->ptr, "mask");
481
482 if (!br) {
483 return OPERATOR_CANCELLED;
484 }
485
486 if (do_mask) {
487 br->mask_stencil_pos[0] = 256;
488 br->mask_stencil_pos[1] = 256;
489
490 br->mask_stencil_dimension[0] = 256;
491 br->mask_stencil_dimension[1] = 256;
492
493 br->mask_mtex.rot = 0;
494 }
495 else {
496 br->stencil_pos[0] = 256;
497 br->stencil_pos[1] = 256;
498
499 br->stencil_dimension[0] = 256;
500 br->stencil_dimension[1] = 256;
501
502 br->mtex.rot = 0;
503 }
504
507
508 return OPERATOR_FINISHED;
509}
510
512{
513 /* identifiers */
514 ot->name = "Reset Transform";
515 ot->description = "Reset the stencil transformation to the default";
516 ot->idname = "BRUSH_OT_stencil_reset_transform";
517
518 /* API callbacks. */
521
522 /* flags */
524
526 ot->srna, "mask", false, "Modify Mask Stencil", "Modify either the primary or mask stencil");
527}
528
529/**************************** registration **********************************/
530
532{
533 wmOperatorType *ot;
534 wmOperatorTypeMacro *otmacro;
535
536 ot = WM_operatortype_append_macro("PAINTCURVE_OT_add_point_slide",
537 "Add Curve Point and Slide",
538 "Add new curve point and slide it",
540 ot->description = "Add new curve point and slide it";
541 WM_operatortype_macro_define(ot, "PAINTCURVE_OT_add_point");
542 otmacro = WM_operatortype_macro_define(ot, "PAINTCURVE_OT_slide");
543 RNA_boolean_set(otmacro->ptr, "align", true);
544 RNA_boolean_set(otmacro->ptr, "select", false);
545}
546
548{
549 /* palette */
550 using namespace blender::ed::sculpt_paint;
554
559
560 /* paint curve */
568
569 /* brush */
581
582 /* image */
592
593 /* weight */
601
602 /* uv */
606
607 /* vertex selection */
616
617 /* vertex */
622
628
629 /* face-select */
637
639
640 /* partial visibility */
649
650 /* paint masking */
656}
657
659{
660 static const EnumPropertyItem modal_items[] = {
661 {PAINT_STROKE_MODAL_CANCEL, "CANCEL", 0, "Cancel", "Cancel and undo a stroke in progress"},
662 {0}};
663
664 static const char *name = "Paint Stroke Modal";
665
666 wmKeyMap *keymap = WM_modalkeymap_find(keyconf, name);
667
668 /* This function is called for each space-type, only needs to add map once. */
669 if (!keymap) {
670 keymap = WM_modalkeymap_ensure(keyconf, name, modal_items);
671 }
672
673 return keymap;
674}
675
677{
678 using namespace blender::ed::sculpt_paint;
679 wmKeyMap *keymap;
680
681 keymap = WM_keymap_ensure(keyconf, "Paint Curve", SPACE_EMPTY, RGN_TYPE_WINDOW);
682 keymap->poll = paint_curve_poll;
683
684 /* Sculpt mode */
685 keymap = WM_keymap_ensure(keyconf, "Sculpt", SPACE_EMPTY, RGN_TYPE_WINDOW);
686 keymap->poll = sculpt_mode_poll;
687
688 /* Vertex Paint mode */
689 keymap = WM_keymap_ensure(keyconf, "Vertex Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
691
692 /* Weight Paint mode */
693 keymap = WM_keymap_ensure(keyconf, "Weight Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
695
696 /* Weight paint's Vertex Selection Mode. */
697 keymap = WM_keymap_ensure(
698 keyconf, "Paint Vertex Selection (Weight, Vertex)", SPACE_EMPTY, RGN_TYPE_WINDOW);
699 keymap->poll = vert_paint_poll;
700
701 /* Image/Texture Paint mode */
702 keymap = WM_keymap_ensure(keyconf, "Image Paint", SPACE_EMPTY, RGN_TYPE_WINDOW);
704
705 /* face-mask mode */
706 keymap = WM_keymap_ensure(
707 keyconf, "Paint Face Mask (Weight, Vertex, Texture)", SPACE_EMPTY, RGN_TYPE_WINDOW);
708 keymap->poll = facemask_paint_poll;
709
710 /* paint stroke */
711 keymap = paint_stroke_modal_keymap(keyconf);
712 WM_modalkeymap_assign(keymap, "SCULPT_OT_brush_stroke");
713 WM_modalkeymap_assign(keymap, "PAINT_OT_vertex_paint");
714 WM_modalkeymap_assign(keymap, "PAINT_OT_weight_paint");
715 WM_modalkeymap_assign(keymap, "PAINT_OT_image_paint");
716
717 /* Curves Sculpt mode. */
718 keymap = WM_keymap_ensure(keyconf, "Sculpt Curves", SPACE_EMPTY, RGN_TYPE_WINDOW);
719 keymap->poll = curves_sculpt_poll;
720
721 /* sculpt expand. */
722 expand::modal_keymap(keyconf);
723}
724
725} // namespace blender
#define M_PI
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define NC_WINDOW
Definition WM_types.hh:388
#define NC_BRUSH
Definition WM_types.hh:398
#define NA_EDITED
Definition WM_types.hh:634
#define CLAMP(a, b, c)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition btVector3.h:356
#define abs
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
void modal_keymap(wmKeyConfig *keyconf)
void PAINT_OT_hide_show_polyline_gesture(wmOperatorType *ot)
void PAINT_OT_hide_show_masked(wmOperatorType *ot)
void PAINT_OT_hide_show_line_gesture(wmOperatorType *ot)
void PAINT_OT_visibility_invert(wmOperatorType *ot)
void PAINT_OT_hide_show_lasso_gesture(wmOperatorType *ot)
void PAINT_OT_visibility_filter(wmOperatorType *ot)
void PAINT_OT_hide_show_all(wmOperatorType *ot)
void PAINT_OT_hide_show(wmOperatorType *ot)
void PAINT_OT_mask_polyline_gesture(wmOperatorType *ot)
void PAINT_OT_mask_line_gesture(wmOperatorType *ot)
void PAINT_OT_mask_box_gesture(wmOperatorType *ot)
void PAINT_OT_mask_lasso_gesture(wmOperatorType *ot)
void PAINT_OT_mask_flood_fill(wmOperatorType *ot)
bool curves_sculpt_poll(bContext *C)
void BRUSH_OT_asset_save(wmOperatorType *ot)
void PAINT_OT_sample_color(wmOperatorType *ot)
bool paint_supports_texture(PaintMode mode)
void BRUSH_OT_asset_delete(wmOperatorType *ot)
void BRUSH_OT_asset_edit_metadata(wmOperatorType *ot)
bool sculpt_mode_poll(bContext *C)
Definition sculpt.cc:3800
void BRUSH_OT_asset_load_preview(wmOperatorType *ot)
void BRUSH_OT_asset_revert(wmOperatorType *ot)
void BRUSH_OT_asset_save_as(wmOperatorType *ot)
void BRUSH_OT_asset_activate(wmOperatorType *ot)
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
StencilConstraint
Definition paint_ops.cc:125
@ STENCIL_CONSTRAINT_Y
Definition paint_ops.cc:128
@ STENCIL_CONSTRAINT_X
Definition paint_ops.cc:127
@ STENCIL_CONSTRAINT_NONE
Definition paint_ops.cc:126
UserDef U
Definition blender.cc:58
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void PAINT_OT_face_select_linked(wmOperatorType *ot)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void PAINT_OT_image_paint(wmOperatorType *ot)
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
Definition wm_keymap.cc:999
MINLINE void add_v2_v2v2(float r[2], const float a[2], const float b[2])
static void BRUSH_OT_scale_size(wmOperatorType *ot)
Definition paint_ops.cc:96
void PAINT_OT_vert_select_ungrouped(wmOperatorType *ot)
void PAINT_OT_project_image(wmOperatorType *ot)
void PAINT_OT_texture_paint_toggle(wmOperatorType *ot)
void PAINT_OT_vertex_color_set(wmOperatorType *ot)
bool image_texture_paint_poll(bContext *C)
MINLINE void copy_v2_v2(float r[2], const float a[2])
void PAINT_OT_weight_sample_group(wmOperatorType *ot)
static wmOperatorStatus stencil_reset_transform_exec(bContext *C, wmOperator *op)
Definition paint_ops.cc:476
void PAINT_OT_add_texture_paint_slot(wmOperatorType *ot)
void PALETTE_OT_new(wmOperatorType *ot)
Definition palette.cc:229
void PAINT_OT_face_vert_reveal(wmOperatorType *ot)
StencilControlMode
Definition paint_ops.cc:114
@ STENCIL_ROTATE
Definition paint_ops.cc:117
@ STENCIL_TRANSLATE
Definition paint_ops.cc:115
@ STENCIL_SCALE
Definition paint_ops.cc:116
void SCULPT_OT_uv_sculpt_relax(wmOperatorType *ot)
Definition sculpt_uv.cc:999
void PAINT_OT_vertex_paint(wmOperatorType *ot)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void PAINT_OT_vert_select_linked(wmOperatorType *ot)
wmOperatorTypeMacro * WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
static void BRUSH_OT_stencil_reset_transform(wmOperatorType *ot)
Definition paint_ops.cc:511
void PAINT_OT_face_select_linked_pick(wmOperatorType *ot)
void PAINT_OT_weight_paint(wmOperatorType *ot)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:681
static wmOperatorStatus brush_scale_size_exec(bContext *C, wmOperator *op)
Definition paint_ops.cc:57
static wmOperatorStatus stencil_control_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Definition paint_ops.cc:182
static bool stencil_control_poll(bContext *C)
Definition paint_ops.cc:346
static wmOperatorStatus stencil_fit_image_aspect_exec(bContext *C, wmOperator *op)
Definition paint_ops.cc:398
bool paint_curve_poll(bContext *C)
void PAINT_OT_vert_select_more(wmOperatorType *ot)
void PAINTCURVE_OT_new(wmOperatorType *ot)
static void stencil_control_cancel(bContext *, wmOperator *op)
Definition paint_ops.cc:228
void PALETTE_OT_extract_from_image(wmOperatorType *ot)
Definition palette.cc:388
void BKE_brush_tag_unsaved_changes(Brush *brush)
Definition brush.cc:843
void BKE_brush_unprojected_size_set(Paint *paint, Brush *brush, float unprojected_size)
Definition brush.cc:1390
static void stencil_restore(StencilControlData *scd)
Definition paint_ops.cc:221
bool vert_paint_poll(bContext *C)
static void stencil_set_target(StencilControlData *scd)
Definition paint_ops.cc:150
void PAINT_OT_grab_clone(wmOperatorType *ot)
static wmKeyMap * paint_stroke_modal_keymap(wmKeyConfig *keyconf)
Definition paint_ops.cc:658
void PAINT_OT_vertex_color_hsv(wmOperatorType *ot)
void PAINT_OT_face_select_loop(wmOperatorType *ot)
void ED_image_get_uv_aspect(Image *ima, ImageUser *iuser, float *r_aspx, float *r_aspy)
void PAINT_OT_vertex_color_from_weight(wmOperatorType *ot)
void PAINT_OT_vertex_color_levels(wmOperatorType *ot)
void SCULPT_OT_uv_sculpt_pinch(wmOperatorType *ot)
void ED_operatormacros_paint()
Definition paint_ops.cc:531
void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot)
void SCULPT_OT_uv_sculpt_grab(wmOperatorType *ot)
Definition sculpt_uv.cc:984
void PAINT_OT_vert_select_loop(wmOperatorType *ot)
wmKeyMap * WM_keymap_ensure(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
Definition wm_keymap.cc:935
int BKE_brush_size_get(const Paint *paint, const Brush *brush)
Definition brush.cc:1356
void PAINTCURVE_OT_add_point(wmOperatorType *ot)
void PAINT_OT_weight_paint_toggle(wmOperatorType *ot)
void PAINT_OT_vertex_color_invert(wmOperatorType *ot)
void PAINT_OT_image_from_view(wmOperatorType *ot)
void PAINT_OT_face_select_all(wmOperatorType *ot)
void PAINT_OT_weight_sample(wmOperatorType *ot)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void BKE_brush_size_set(Paint *paint, Brush *brush, int size)
Definition brush.cc:1340
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void PAINTCURVE_OT_cursor(wmOperatorType *ot)
void PAINT_OT_vertex_color_smooth(wmOperatorType *ot)
void PAINT_OT_face_select_less(wmOperatorType *ot)
void ED_keymap_paint(wmKeyConfig *keyconf)
Definition paint_ops.cc:676
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
wmOperatorType * WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag)
void PAINTCURVE_OT_slide(wmOperatorType *ot)
static wmOperatorStatus stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *event)
Definition paint_ops.cc:291
void PALETTE_OT_sort(wmOperatorType *ot)
Definition palette.cc:480
static void stencil_control_calculate(StencilControlData *scd, const int mval[2])
Definition paint_ops.cc:235
void PAINT_OT_brush_colors_flip(wmOperatorType *ot)
void PAINT_OT_weight_set(wmOperatorType *ot)
bool vertex_paint_mode_poll(bContext *C)
void PAINTCURVE_OT_draw(wmOperatorType *ot)
void PALETTE_OT_color_add(wmOperatorType *ot)
Definition palette.cc:288
Paint * BKE_paint_get_active_from_context(const bContext *C)
MINLINE void clamp_v2(float vec[2], float min, float max)
void PALETTE_OT_color_move(wmOperatorType *ot)
Definition palette.cc:528
void PAINT_OT_weight_from_bones(wmOperatorType *ot)
void PAINT_OT_vert_select_all(wmOperatorType *ot)
@ PROP_SKIP_SAVE
Definition RNA_types.hh:414
@ PROP_HIDDEN
Definition RNA_types.hh:408
void PAINT_OT_weight_gradient(wmOperatorType *ot)
float BKE_brush_unprojected_size_get(const Paint *paint, const Brush *brush)
Definition brush.cc:1403
@ KM_RELEASE
Definition WM_types.hh:325
void PAINT_OT_face_select_more(wmOperatorType *ot)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
Brush * BKE_paint_brush(Paint *paint)
void PAINT_OT_vert_select_hide(wmOperatorType *ot)
void PALETTE_OT_join(wmOperatorType *ot)
Definition palette.cc:598
void PAINT_OT_add_simple_uvs(wmOperatorType *ot)
bool facemask_paint_poll(bContext *C)
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
Definition wm_keymap.cc:972
void PAINT_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
void PAINT_OT_vert_select_less(wmOperatorType *ot)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
void ED_operatortypes_paint()
Definition paint_ops.cc:547
void PAINT_OT_face_select_hide(wmOperatorType *ot)
StencilTextureMode
Definition paint_ops.cc:120
@ STENCIL_SECONDARY
Definition paint_ops.cc:122
@ STENCIL_PRIMARY
Definition paint_ops.cc:121
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
static void BRUSH_OT_stencil_control(wmOperatorType *ot)
Definition paint_ops.cc:363
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void PALETTE_OT_color_delete(wmOperatorType *ot)
Definition palette.cc:316
int WM_userdef_event_type_from_keymap_type(int kmitype)
static void BRUSH_OT_stencil_fit_image_aspect(wmOperatorType *ot)
Definition paint_ops.cc:455
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
ARegion * CTX_wm_region(const bContext *C)
PaintMode BKE_paintmode_get_active_from_context(const bContext *C)
bool weight_paint_mode_poll(bContext *C)
void PAINTCURVE_OT_select(wmOperatorType *ot)
void PAINTCURVE_OT_delete_point(wmOperatorType *ot)
float RNA_float_get(PointerRNA *ptr, const char *name)
void PAINT_OT_vert_select_linked_pick(wmOperatorType *ot)
#define PAINT_STROKE_MODAL_CANCEL
#define PIXEL_MARGIN
#define fabsf
#define sqrtf
#define atan2f
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
float mask_stencil_dimension[2]
struct MTex mask_mtex
float stencil_dimension[2]
float mask_stencil_pos[2]
eMTex_BrushMapMode brush_map_mode
StencilControlMode mode
Definition paint_ops.cc:139
StencilConstraint constrain_mode
Definition paint_ops.cc:140
struct Image * ima
eTex_Extend extend
wmEventType type
Definition WM_types.hh:817
bool(*) poll(struct bContext *)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
void(*) cancel(bContext *C, wmOperator *op)
Definition WM_types.hh:1149
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