Blender V5.3
bmo_utils.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
11
12#include "MEM_guardedalloc.h"
13
14#include "DNA_mesh_types.h"
15#include "DNA_meshdata_types.h"
16
17#include "BLI_array.hh"
18#include "BLI_math_matrix_c.hh"
19#include "BLI_math_vector_c.hh"
21
22#include "BKE_attribute.h"
23#include "BKE_customdata.hh"
24
25#include "bmesh.hh"
26
27#include "intern/bmesh_operators_private.hh" /* own include */
28
29namespace blender {
30
31/* -------------------------------------------------------------------- */
34
35#define ELE_NEW 1
36
38{
39 float vec[3];
40
41 BMO_slot_vec_get(op->slots_in, "co", vec);
42
45}
46
48
49/* -------------------------------------------------------------------- */
52
54{
55 BMOIter iter;
56 BMVert *v;
57 float mat[4][4], mat_space[4][4], imat_space[4][4];
58
59 const uint shape_keys_len = BMO_slot_bool_get(op->slots_in, "use_shapekey") ?
61 0;
62 const uint cd_shape_key_offset = CustomData_get_offset(&bm->vdata, CD_SHAPEKEY);
63
64 BMO_slot_mat4_get(op->slots_in, "matrix", mat);
65 BMO_slot_mat4_get(op->slots_in, "space", mat_space);
66
67 if (!is_zero_m4(mat_space)) {
68 invert_m4_m4(imat_space, mat_space);
69 mul_m4_series(mat, imat_space, mat, mat_space);
70 }
71
72 BMO_ITER (v, &iter, op->slots_in, "verts", BM_VERT) {
73 mul_m4_v3(mat, v->co);
74
75 if (shape_keys_len != 0) {
76 float (*co_dst)[3] = static_cast<float (*)[3]>(
77 BM_ELEM_CD_GET_VOID_P(v, cd_shape_key_offset));
78 for (int i = 0; i < shape_keys_len; i++, co_dst++) {
79 mul_m4_v3(mat, *co_dst);
80 }
81 }
82 }
83}
84
86{
87 float mat[4][4], vec[3];
88
89 BMO_slot_vec_get(op->slots_in, "vec", vec);
90
91 unit_m4(mat);
92 copy_v3_v3(mat[3], vec);
93
95 op->flag,
96 "transform matrix=%m4 space=%s verts=%s use_shapekey=%s",
97 mat,
98 op,
99 "space",
100 op,
101 "verts",
102 op,
103 "use_shapekey");
104}
105
107{
108 float mat[3][3], vec[3];
109
110 BMO_slot_vec_get(op->slots_in, "vec", vec);
111
112 unit_m3(mat);
113 mat[0][0] = vec[0];
114 mat[1][1] = vec[1];
115 mat[2][2] = vec[2];
116
118 op->flag,
119 "transform matrix=%m3 space=%s verts=%s use_shapekey=%s",
120 mat,
121 op,
122 "space",
123 op,
124 "verts",
125 op,
126 "use_shapekey");
127}
128
130{
131 float center[3];
132 float mat[4][4];
133
134 BMO_slot_vec_get(op->slots_in, "cent", center);
135 BMO_slot_mat4_get(op->slots_in, "matrix", mat);
136 transform_pivot_set_m4(mat, center);
137
139 op->flag,
140 "transform matrix=%m4 space=%s verts=%s use_shapekey=%s",
141 mat,
142 op,
143 "space",
144 op,
145 "verts",
146 op,
147 "use_shapekey");
148}
149
151
152/* -------------------------------------------------------------------- */
155
157{
158 const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS);
159 const bool use_loop_mdisp_flip = BMO_slot_bool_get(op->slots_in, "flip_multires");
160 BMOIter siter;
161 BMFace *f;
162
163 BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
164 BM_face_normal_flip_ex(bm, f, cd_loop_mdisp_offset, use_loop_mdisp_flip);
165 }
166}
167
169
170/* -------------------------------------------------------------------- */
173
175{
176 BMOIter siter;
177 BMFace *f;
178 bool changed = false;
179 BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
180 if (f->len == 4) {
181 f->l_first = f->l_first->next;
182 changed = true;
183 }
184 }
185 if (changed) {
187 }
188}
189
191
192/* -------------------------------------------------------------------- */
195
196#define SEL_FLAG 1
197#define SEL_ORIG 2
198
199static void bmo_face_flag_set_flush(BMesh *bm, BMFace *f, const short oflag, const bool value)
200{
201 BMLoop *l_iter;
202 BMLoop *l_first;
203
204 BMO_face_flag_set(bm, f, oflag, value);
205 l_iter = l_first = BM_FACE_FIRST_LOOP(f);
206 do {
207 BMO_edge_flag_set(bm, l_iter->e, oflag, value);
208 BMO_vert_flag_set(bm, l_iter->v, oflag, value);
209 } while ((l_iter = l_iter->next) != l_first);
210}
211
213 BMOperator *op,
214 const bool use_faces,
215 const bool use_faces_step)
216{
217 BMOIter siter;
218
219 if (!use_faces) {
220 BMVert *v;
221
222 BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
223 bool found = false;
224
225 {
226 BMIter eiter;
227 BMEdge *e;
228
229 BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
231 found = true;
232 break;
233 }
234 }
235 }
236
237 if (found) {
238 if (!use_faces_step) {
239 BMIter eiter;
240 BMEdge *e;
241
242 BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
246 }
247 }
248 }
249 else {
250 BMIter fiter;
251 BMFace *f;
252
253 BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
256 }
257 }
258
259 /* handle wire edges (when stepping over faces) */
260 {
261 BMIter eiter;
262 BMEdge *e;
263 BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
264 if (BM_edge_is_wire(e)) {
266 {
269 }
270 }
271 }
272 }
273 }
274 }
275 }
276 }
277 else {
278 BMFace *f;
279
280 BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
281 BMIter liter;
282 BMLoop *l;
283
284 BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
285 if (!use_faces_step) {
286 BMIter fiter;
287 BMFace *f_other;
288
289 BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) {
290 if (!BMO_face_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) &&
292 {
294 }
295 }
296 }
297 else {
298 BMIter fiter;
299 BMFace *f_other;
300
301 BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) {
302 if (!BMO_face_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) &&
304 {
306 }
307 }
308 }
309 }
310 }
311 }
312}
313
315 BMOperator *op,
316 const bool use_faces,
317 const bool use_faces_step)
318{
319 BMOIter siter;
320
321 if (!use_faces) {
322 BMVert *v;
323
324 BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
325 bool found = false;
326
327 if (!use_faces_step) {
328 BMIter eiter;
329 BMEdge *e;
330
331 BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
333 found = true;
334 break;
335 }
336 }
337 }
338 else {
339 BMIter fiter;
340 BMFace *f;
341
342 BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
343 if (!BMO_face_flag_test(bm, f, SEL_ORIG)) {
344 found = true;
345 break;
346 }
347 }
348
349 /* handle wire edges (when stepping over faces) */
350 if (!found) {
351 BMIter eiter;
352 BMEdge *e;
353
354 BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
355 if (BM_edge_is_wire(e)) {
357 found = true;
358 break;
359 }
360 }
361 }
362 }
363 }
364
365 if (found) {
366 BMIter eiter;
367 BMEdge *e;
368
370
371 BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
373 }
374 }
375 }
376 }
377 else {
378 BMFace *f;
379
380 BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
381 BMIter liter;
382 BMLoop *l;
383
384 BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
385
386 if (!use_faces_step) {
387 BMIter fiter;
388 BMFace *f_other;
389
390 BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) {
391 if (!BMO_face_flag_test(bm, f_other, SEL_ORIG)) {
393 break;
394 }
395 }
396 }
397 else {
398 BMIter fiter;
399 BMFace *f_other;
400
401 BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) {
402 if (!BMO_face_flag_test(bm, f_other, SEL_ORIG)) {
404 break;
405 }
406 }
407 }
408 }
409 }
410 }
411}
412
414{
415 const bool use_faces = BMO_slot_bool_get(op->slots_in, "use_faces");
416 const bool use_face_step = BMO_slot_bool_get(op->slots_in, "use_face_step");
417 const bool constrict = BMO_slot_bool_get(op->slots_in, "use_contract");
418
420
421 if (constrict) {
422 bmo_region_extend_contract(bm, op, use_faces, use_face_step);
423 }
424 else {
425 bmo_region_extend_expand(bm, op, use_faces, use_face_step);
426 }
427
429}
430
432
433/* -------------------------------------------------------------------- */
436
438{
439 BMOIter siter;
440 BMIter iter;
441 BMVert *v;
442 BMEdge *e;
444 BMO_slot_buffer_len(op->slots_in, "verts"), __func__);
445 float *co, *co2, clip_dist = BMO_slot_float_get(op->slots_in, "clip_dist");
446 const float fac = BMO_slot_float_get(op->slots_in, "factor");
447 int i, j, clipx, clipy, clipz;
448 int xaxis, yaxis, zaxis;
449
450 clipx = BMO_slot_bool_get(op->slots_in, "mirror_clip_x");
451 clipy = BMO_slot_bool_get(op->slots_in, "mirror_clip_y");
452 clipz = BMO_slot_bool_get(op->slots_in, "mirror_clip_z");
453
454 xaxis = BMO_slot_bool_get(op->slots_in, "use_axis_x");
455 yaxis = BMO_slot_bool_get(op->slots_in, "use_axis_y");
456 zaxis = BMO_slot_bool_get(op->slots_in, "use_axis_z");
457
458 i = 0;
459 BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
460
461 co = cos[i];
462 zero_v3(co);
463
464 j = 0;
465 BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
466 co2 = BM_edge_other_vert(e, v)->co;
467 add_v3_v3v3(co, co, co2);
468 j += 1;
469 }
470
471 if (!j) {
472 copy_v3_v3(co, v->co);
473 i++;
474 continue;
475 }
476
477 mul_v3_fl(co, 1.0f / float(j));
478 interp_v3_v3v3(co, v->co, co, fac);
479
480 if (clipx && fabsf(v->co[0]) <= clip_dist) {
481 co[0] = 0.0f;
482 }
483 if (clipy && fabsf(v->co[1]) <= clip_dist) {
484 co[1] = 0.0f;
485 }
486 if (clipz && fabsf(v->co[2]) <= clip_dist) {
487 co[2] = 0.0f;
488 }
489
490 i++;
491 }
492
493 i = 0;
494 BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
495 if (xaxis) {
496 v->co[0] = cos[i][0];
497 }
498 if (yaxis) {
499 v->co[1] = cos[i][1];
500 }
501 if (zaxis) {
502 v->co[2] = cos[i][2];
503 }
504
505 i++;
506 }
507
508 MEM_delete(cos);
509}
510
512
513/* -------------------------------------------------------------------- */
516
518{
519 BMOIter fs_iter; /* selected faces iterator */
520 BMFace *fs; /* current face */
521 BMIter l_iter; /* iteration loop */
522
523 const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
524 const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_PROP_FLOAT2);
525
526 if (cd_loop_uv_offset != -1) {
527 BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
528 if (use_ccw == false) { /* same loops direction */
529 BMLoop *lf; /* current face loops */
530 float *f_luv; /* first face loop uv */
531 float p_uv[2]; /* previous uvs */
532 float t_uv[2]; /* temp uvs */
533
534 int n = 0;
535 BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
536 /* current loop uv is the previous loop uv */
537 float *luv = BM_ELEM_CD_GET_FLOAT_P(lf, cd_loop_uv_offset);
538 if (n == 0) {
539 f_luv = luv;
540 copy_v2_v2(p_uv, luv);
541 }
542 else {
543 copy_v2_v2(t_uv, luv);
544 copy_v2_v2(luv, p_uv);
545 copy_v2_v2(p_uv, t_uv);
546 }
547 n++;
548 }
549
550 copy_v2_v2(f_luv, p_uv);
551 }
552 else { /* counter loop direction */
553 BMLoop *lf; /* current face loops */
554 float *p_luv; /* previous loop uv */
555 float *luv;
556 float t_uv[2]; /* current uvs */
557
558 int n = 0;
559 BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
560 /* previous loop uv is the current loop uv */
561 luv = BM_ELEM_CD_GET_FLOAT_P(lf, cd_loop_uv_offset);
562 if (n == 0) {
563 p_luv = luv;
564 copy_v2_v2(t_uv, luv);
565 }
566 else {
567 copy_v2_v2(p_luv, luv);
568 p_luv = luv;
569 }
570 n++;
571 }
572
573 copy_v2_v2(luv, t_uv);
574 }
575 }
576 }
577}
578
580
581/* -------------------------------------------------------------------- */
584
585static void bm_face_reverse_uvs(BMFace *f, const int cd_loop_uv_offset)
586{
587 BMIter iter;
588 BMLoop *l;
589 int i;
590
592
593 BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
594 float *luv = BM_ELEM_CD_GET_FLOAT_P(l, cd_loop_uv_offset);
595 copy_v2_v2(uvs[i], luv);
596 }
597
598 /* now that we have the uvs in the array, reverse! */
599 BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
600 /* current loop uv is the previous loop uv */
601 float *luv = BM_ELEM_CD_GET_FLOAT_P(l, cd_loop_uv_offset);
602 copy_v2_v2(luv, uvs[(f->len - i - 1)]);
603 }
604}
606{
607 BMOIter iter;
608 BMFace *f;
609 const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_PROP_FLOAT2);
610
611 if (cd_loop_uv_offset != -1) {
612 BMO_ITER (f, &iter, op->slots_in, "faces", BM_FACE) {
613 bm_face_reverse_uvs(f, cd_loop_uv_offset);
614 }
615 }
616}
617
619
620/* -------------------------------------------------------------------- */
623
625 int index,
626 int *r_cd_color_offset,
627 std::optional<eCustomDataType> *r_cd_color_type)
628{
629 int color_index = 0;
632 if (color_index == index) {
633 *r_cd_color_offset = layer.offset;
634 *r_cd_color_type = eCustomDataType(layer.type);
635 return;
636 }
637 color_index++;
638 }
639 }
640 *r_cd_color_offset = -1;
641}
642
644{
645 BMOIter fs_iter; /* selected faces iterator */
646 BMFace *fs; /* current face */
647 BMIter l_iter; /* iteration loop */
648
649 const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
650
651 const int color_index = BMO_slot_int_get(op->slots_in, "color_index");
652
653 int cd_loop_color_offset;
654 std::optional<eCustomDataType> cd_loop_color_type;
655 bmo_get_loop_color_ref(bm, color_index, &cd_loop_color_offset, &cd_loop_color_type);
656
657 if (cd_loop_color_offset == -1) {
658 BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "color_index is invalid");
659 return;
660 }
661
662 const size_t size = cd_loop_color_type == CD_PROP_COLOR ? sizeof(MPropCol) : sizeof(MLoopCol);
663 void *p_col; /* previous color */
664 void *t_col = alloca(size); /* Temp color. */
665
666 BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
667 if (use_ccw == false) { /* same loops direction */
668 BMLoop *lf; /* current face loops */
669 void *f_lcol; /* first face loop color */
670
671 int n = 0;
672 BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
673 /* current loop color is the previous loop color */
674 void *lcol = BM_ELEM_CD_GET_VOID_P(lf, cd_loop_color_offset);
675
676 if (n == 0) {
677 f_lcol = lcol;
678 p_col = lcol;
679 }
680 else {
681 memcpy(t_col, lcol, size);
682 memcpy(lcol, p_col, size);
683 memcpy(p_col, t_col, size);
684 }
685 n++;
686 }
687
688 memcpy(f_lcol, p_col, size);
689 }
690 else { /* counter loop direction */
691 BMLoop *lf; /* current face loops */
692 void *lcol, *p_lcol;
693
694 int n = 0;
695 BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
696 /* previous loop color is the current loop color */
697 lcol = BM_ELEM_CD_GET_VOID_P(lf, cd_loop_color_offset);
698 if (n == 0) {
699 p_lcol = lcol;
700 memcpy(t_col, lcol, size);
701 }
702 else {
703 memcpy(p_lcol, lcol, size);
704 p_lcol = lcol;
705 }
706 n++;
707 }
708
709 memcpy(lcol, t_col, size);
710 }
711 }
712}
713
715
716/* -------------------------------------------------------------------- */
719
721 const int cd_loop_color_offset,
722 const eCustomDataType cd_loop_color_type)
723{
724 BMIter iter;
725 BMLoop *l;
726 int i;
727
728 const size_t size = cd_loop_color_type == CD_PROP_COLOR ? sizeof(MPropCol) : sizeof(MLoopCol);
729
730 char *cols = static_cast<char *>(alloca(size * f->len));
731
732 char *col = cols;
733 BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
734 void *lcol = BM_ELEM_CD_GET_VOID_P(l, cd_loop_color_offset);
735 memcpy(static_cast<void *>(col), lcol, size);
736 col += size;
737 }
738
739 /* now that we have the uvs in the array, reverse! */
740 BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
741 /* current loop uv is the previous loop color */
742 void *lcol = BM_ELEM_CD_GET_VOID_P(l, cd_loop_color_offset);
743
744 col = cols + (f->len - i - 1) * size;
745 memcpy(lcol, static_cast<void *>(col), size);
746 }
747}
748
750{
751 BMOIter iter;
752 BMFace *f;
753
754 const int color_index = BMO_slot_int_get(op->slots_in, "color_index");
755
756 int cd_loop_color_offset;
757 std::optional<eCustomDataType> cd_loop_color_type;
758 bmo_get_loop_color_ref(bm, color_index, &cd_loop_color_offset, &cd_loop_color_type);
759
760 if (cd_loop_color_offset == -1) {
761 BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "color_index is invalid");
762 return;
763 }
764
765 BMO_ITER (f, &iter, op->slots_in, "faces", BM_FACE) {
766 bm_face_reverse_colors(f, cd_loop_color_offset, *cd_loop_color_type);
767 }
768}
769
771
772} // namespace blender
Generic geometry attributes built on CustomData.
CustomData interface, see also DNA_customdata_types.h.
#define mul_m4_series(...)
Read Blender memory allocation and freeing.
#define BM_ALL_NOLOOP
#define BM_FACE_FIRST_LOOP(p)
#define BM_ELEM_CD_GET_FLOAT_P(ele, offset)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar)
#define BMO_edge_flag_test(bm, e, oflag)
#define BMO_edge_flag_enable(bm, e, oflag)
#define BMO_vert_flag_enable(bm, e, oflag)
#define BMO_vert_flag_set(bm, e, oflag, val)
#define BMO_edge_flag_set(bm, e, oflag, val)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
#define BMO_face_flag_set(bm, e, oflag, val)
#define BMO_face_flag_test(bm, e, oflag)
#define CD_MASK_COLOR_ALL
#define ELE_NEW
#define SEL_ORIG
Definition bmo_utils.cc:197
#define SEL_FLAG
Definition bmo_utils.cc:196
constexpr Span()=default
#define layer
#define cos
BMesh Iterators.
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:517
int BMO_slot_buffer_len(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
int CustomData_number_of_layers(const CustomData *data, eCustomDataType type)
void bmo_rotate_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:129
MINLINE void copy_v3_v3(float r[3], const float a[3])
unsigned int uint
Definition BKE_text.h:55
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
static void bm_face_reverse_colors(BMFace *f, const int cd_loop_color_offset, const eCustomDataType cd_loop_color_type)
Definition bmo_utils.cc:720
ATTR_WARN_UNUSED_RESULT const BMLoop * l
void bmo_transform_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:53
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
static void bmo_region_extend_expand(BMesh *bm, BMOperator *op, const bool use_faces, const bool use_faces_step)
Definition bmo_utils.cc:212
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
MINLINE void copy_v2_v2(float r[2], const float a[2])
void BMO_slot_buffer_flag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, short oflag)
BMO_FLAG_BUFFER.
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:413
ATTR_WARN_UNUSED_RESULT const BMVert * v
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:156
static void bmo_region_extend_contract(BMesh *bm, BMOperator *op, const bool use_faces, const bool use_faces_step)
Definition bmo_utils.cc:314
void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:605
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
MINLINE void mul_v3_fl(float r[3], float f)
void bmo_flip_quad_tessellation_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:174
void mul_m4_v3(const float M[4][4], float r[3])
@ BM_CREATE_NOP
Definition bmesh_core.hh:34
void bmo_scale_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:106
void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3])
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, short oflag)
static void bm_face_reverse_uvs(BMFace *f, const int cd_loop_uv_offset)
Definition bmo_utils.cc:585
void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:643
void unit_m4(float m[4][4])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
void transform_pivot_set_m4(float mat[4][4], const float pivot[3])
eCustomDataMask CD_TYPE_AS_MASK(eCustomDataType type)
void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:37
void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4])
MINLINE void zero_v3(float r[3])
bool is_zero_m4(const float mat[4][4])
static void bmo_get_loop_color_ref(BMesh *bm, int index, int *r_cd_color_offset, std::optional< eCustomDataType > *r_cd_color_type)
Definition bmo_utils.cc:624
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void unit_m3(float m[3][3])
void bmo_smooth_vert_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:437
void BM_face_normal_flip_ex(BMesh *bm, BMFace *f, const int cd_loop_mdisp_offset, const bool use_loop_mdisp_flip)
Face Flip Normal.
void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg) ATTR_NONNULL(1
static void bmo_face_flag_set_flush(BMesh *bm, BMFace *f, const short oflag, const bool value)
Definition bmo_utils.cc:199
ATTR_WARN_UNUSED_RESULT const BMFlagLayer const short oflag
@ BMO_ERROR_CANCEL
void bmo_translate_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:85
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op)
Definition bmo_utils.cc:749
#define fabsf
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct BMLoop * next
struct BMEdge * e
struct BMVert * v
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]