Blender  V3.3
bmo_utils.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
10 #include "MEM_guardedalloc.h"
11 
12 #include "DNA_mesh_types.h"
13 #include "DNA_meshdata_types.h"
14 #include "DNA_object_types.h"
15 
16 #include "BLI_alloca.h"
17 #include "BLI_math.h"
18 
19 #include "BKE_attribute.h"
20 #include "BKE_customdata.h"
21 #include "BKE_object.h"
22 
23 #include "bmesh.h"
24 
25 #include "intern/bmesh_operators_private.h" /* own include */
26 
27 #define ELE_NEW 1
28 
30 {
31  float vec[3];
32 
33  BMO_slot_vec_get(op->slots_in, "co", vec);
34 
37 }
38 
40 {
41  BMOIter iter;
42  BMVert *v;
43  float mat[4][4], mat_space[4][4], imat_space[4][4];
44 
45  const uint shape_keys_len = BMO_slot_bool_get(op->slots_in, "use_shapekey") ?
47  0;
48  const uint cd_shape_key_offset = CustomData_get_offset(&bm->vdata, CD_SHAPEKEY);
49 
50  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
51  BMO_slot_mat4_get(op->slots_in, "space", mat_space);
52 
53  if (!is_zero_m4(mat_space)) {
54  invert_m4_m4(imat_space, mat_space);
55  mul_m4_series(mat, imat_space, mat, mat_space);
56  }
57 
58  BMO_ITER (v, &iter, op->slots_in, "verts", BM_VERT) {
59  mul_m4_v3(mat, v->co);
60 
61  if (shape_keys_len != 0) {
62  float(*co_dst)[3] = BM_ELEM_CD_GET_VOID_P(v, cd_shape_key_offset);
63  for (int i = 0; i < shape_keys_len; i++, co_dst++) {
64  mul_m4_v3(mat, *co_dst);
65  }
66  }
67  }
68 }
69 
71 {
72  float mat[4][4], vec[3];
73 
74  BMO_slot_vec_get(op->slots_in, "vec", vec);
75 
76  unit_m4(mat);
77  copy_v3_v3(mat[3], vec);
78 
80  op->flag,
81  "transform matrix=%m4 space=%s verts=%s use_shapekey=%s",
82  mat,
83  op,
84  "space",
85  op,
86  "verts",
87  op,
88  "use_shapekey");
89 }
90 
92 {
93  float mat[3][3], vec[3];
94 
95  BMO_slot_vec_get(op->slots_in, "vec", vec);
96 
97  unit_m3(mat);
98  mat[0][0] = vec[0];
99  mat[1][1] = vec[1];
100  mat[2][2] = vec[2];
101 
103  op->flag,
104  "transform matrix=%m3 space=%s verts=%s use_shapekey=%s",
105  mat,
106  op,
107  "space",
108  op,
109  "verts",
110  op,
111  "use_shapekey");
112 }
113 
115 {
116  float center[3];
117  float mat[4][4];
118 
119  BMO_slot_vec_get(op->slots_in, "cent", center);
120  BMO_slot_mat4_get(op->slots_in, "matrix", mat);
122 
124  op->flag,
125  "transform matrix=%m4 space=%s verts=%s use_shapekey=%s",
126  mat,
127  op,
128  "space",
129  op,
130  "verts",
131  op,
132  "use_shapekey");
133 }
134 
136 {
137  const int cd_loop_mdisp_offset = CustomData_get_offset(&bm->ldata, CD_MDISPS);
138  const bool use_loop_mdisp_flip = BMO_slot_bool_get(op->slots_in, "flip_multires");
139  BMOIter siter;
140  BMFace *f;
141 
142  BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
143  BM_face_normal_flip_ex(bm, f, cd_loop_mdisp_offset, use_loop_mdisp_flip);
144  }
145 }
146 
147 #define SEL_FLAG 1
148 #define SEL_ORIG 2
149 
150 static void bmo_face_flag_set_flush(BMesh *bm, BMFace *f, const short oflag, const bool value)
151 {
152  BMLoop *l_iter;
153  BMLoop *l_first;
154 
155  BMO_face_flag_set(bm, f, oflag, value);
156  l_iter = l_first = BM_FACE_FIRST_LOOP(f);
157  do {
158  BMO_edge_flag_set(bm, l_iter->e, oflag, value);
159  BMO_vert_flag_set(bm, l_iter->v, oflag, value);
160  } while ((l_iter = l_iter->next) != l_first);
161 }
162 
164  BMOperator *op,
165  const bool use_faces,
166  const bool use_faces_step)
167 {
168  BMOIter siter;
169 
170  if (!use_faces) {
171  BMVert *v;
172 
173  BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
174  bool found = false;
175 
176  {
177  BMIter eiter;
178  BMEdge *e;
179 
180  BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
182  found = true;
183  break;
184  }
185  }
186  }
187 
188  if (found) {
189  if (!use_faces_step) {
190  BMIter eiter;
191  BMEdge *e;
192 
193  BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
197  }
198  }
199  }
200  else {
201  BMIter fiter;
202  BMFace *f;
203 
204  BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
207  }
208  }
209 
210  /* handle wire edges (when stepping over faces) */
211  {
212  BMIter eiter;
213  BMEdge *e;
214  BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
215  if (BM_edge_is_wire(e)) {
216  if (!BMO_edge_flag_test(bm, e, SEL_FLAG) &&
220  }
221  }
222  }
223  }
224  }
225  }
226  }
227  }
228  else {
229  BMFace *f;
230 
231  BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
232  BMIter liter;
233  BMLoop *l;
234 
235  BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
236  if (!use_faces_step) {
237  BMIter fiter;
238  BMFace *f_other;
239 
240  BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) {
241  if (!BMO_face_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) &&
242  !BM_elem_flag_test(f_other, BM_ELEM_HIDDEN)) {
243  BMO_face_flag_enable(bm, f_other, SEL_FLAG);
244  }
245  }
246  }
247  else {
248  BMIter fiter;
249  BMFace *f_other;
250 
251  BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) {
252  if (!BMO_face_flag_test(bm, f_other, SEL_ORIG | SEL_FLAG) &&
253  !BM_elem_flag_test(f_other, BM_ELEM_HIDDEN)) {
254  BMO_face_flag_enable(bm, f_other, SEL_FLAG);
255  }
256  }
257  }
258  }
259  }
260  }
261 }
262 
264  BMOperator *op,
265  const bool use_faces,
266  const bool use_faces_step)
267 {
268  BMOIter siter;
269 
270  if (!use_faces) {
271  BMVert *v;
272 
273  BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
274  bool found = false;
275 
276  if (!use_faces_step) {
277  BMIter eiter;
278  BMEdge *e;
279 
280  BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
281  if (!BMO_edge_flag_test(bm, e, SEL_ORIG)) {
282  found = true;
283  break;
284  }
285  }
286  }
287  else {
288  BMIter fiter;
289  BMFace *f;
290 
291  BM_ITER_ELEM (f, &fiter, v, BM_FACES_OF_VERT) {
292  if (!BMO_face_flag_test(bm, f, SEL_ORIG)) {
293  found = true;
294  break;
295  }
296  }
297 
298  /* handle wire edges (when stepping over faces) */
299  if (!found) {
300  BMIter eiter;
301  BMEdge *e;
302 
303  BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
304  if (BM_edge_is_wire(e)) {
305  if (!BMO_edge_flag_test(bm, e, SEL_ORIG)) {
306  found = true;
307  break;
308  }
309  }
310  }
311  }
312  }
313 
314  if (found) {
315  BMIter eiter;
316  BMEdge *e;
317 
319 
320  BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
322  }
323  }
324  }
325  }
326  else {
327  BMFace *f;
328 
329  BMO_ITER (f, &siter, op->slots_in, "geom", BM_FACE) {
330  BMIter liter;
331  BMLoop *l;
332 
333  BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
334 
335  if (!use_faces_step) {
336  BMIter fiter;
337  BMFace *f_other;
338 
339  BM_ITER_ELEM (f_other, &fiter, l->e, BM_FACES_OF_EDGE) {
340  if (!BMO_face_flag_test(bm, f_other, SEL_ORIG)) {
342  break;
343  }
344  }
345  }
346  else {
347  BMIter fiter;
348  BMFace *f_other;
349 
350  BM_ITER_ELEM (f_other, &fiter, l->v, BM_FACES_OF_VERT) {
351  if (!BMO_face_flag_test(bm, f_other, SEL_ORIG)) {
353  break;
354  }
355  }
356  }
357  }
358  }
359  }
360 }
361 
363 {
364  const bool use_faces = BMO_slot_bool_get(op->slots_in, "use_faces");
365  const bool use_face_step = BMO_slot_bool_get(op->slots_in, "use_face_step");
366  const bool constrict = BMO_slot_bool_get(op->slots_in, "use_contract");
367 
369 
370  if (constrict) {
371  bmo_region_extend_contract(bm, op, use_faces, use_face_step);
372  }
373  else {
374  bmo_region_extend_expand(bm, op, use_faces, use_face_step);
375  }
376 
378 }
379 
381 {
382  BMOIter siter;
383  BMIter iter;
384  BMVert *v;
385  BMEdge *e;
386  float(*cos)[3] = MEM_mallocN(sizeof(*cos) * BMO_slot_buffer_len(op->slots_in, "verts"),
387  __func__);
388  float *co, *co2, clip_dist = BMO_slot_float_get(op->slots_in, "clip_dist");
389  const float fac = BMO_slot_float_get(op->slots_in, "factor");
390  int i, j, clipx, clipy, clipz;
391  int xaxis, yaxis, zaxis;
392 
393  clipx = BMO_slot_bool_get(op->slots_in, "mirror_clip_x");
394  clipy = BMO_slot_bool_get(op->slots_in, "mirror_clip_y");
395  clipz = BMO_slot_bool_get(op->slots_in, "mirror_clip_z");
396 
397  xaxis = BMO_slot_bool_get(op->slots_in, "use_axis_x");
398  yaxis = BMO_slot_bool_get(op->slots_in, "use_axis_y");
399  zaxis = BMO_slot_bool_get(op->slots_in, "use_axis_z");
400 
401  i = 0;
402  BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
403 
404  co = cos[i];
405  zero_v3(co);
406 
407  j = 0;
408  BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
409  co2 = BM_edge_other_vert(e, v)->co;
410  add_v3_v3v3(co, co, co2);
411  j += 1;
412  }
413 
414  if (!j) {
415  copy_v3_v3(co, v->co);
416  i++;
417  continue;
418  }
419 
420  mul_v3_fl(co, 1.0f / (float)j);
421  interp_v3_v3v3(co, v->co, co, fac);
422 
423  if (clipx && fabsf(v->co[0]) <= clip_dist) {
424  co[0] = 0.0f;
425  }
426  if (clipy && fabsf(v->co[1]) <= clip_dist) {
427  co[1] = 0.0f;
428  }
429  if (clipz && fabsf(v->co[2]) <= clip_dist) {
430  co[2] = 0.0f;
431  }
432 
433  i++;
434  }
435 
436  i = 0;
437  BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) {
438  if (xaxis) {
439  v->co[0] = cos[i][0];
440  }
441  if (yaxis) {
442  v->co[1] = cos[i][1];
443  }
444  if (zaxis) {
445  v->co[2] = cos[i][2];
446  }
447 
448  i++;
449  }
450 
451  MEM_freeN(cos);
452 }
453 
454 /**************************************************************************** *
455  * Cycle UVs for a face
456  **************************************************************************** */
457 
459 {
460  BMOIter fs_iter; /* selected faces iterator */
461  BMFace *fs; /* current face */
462  BMIter l_iter; /* iteration loop */
463 
464  const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
465  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
466 
467  if (cd_loop_uv_offset != -1) {
468  BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
469  if (use_ccw == false) { /* same loops direction */
470  BMLoop *lf; /* current face loops */
471  MLoopUV *f_luv; /* first face loop uv */
472  float p_uv[2]; /* previous uvs */
473  float t_uv[2]; /* tmp uvs */
474 
475  int n = 0;
476  BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
477  /* current loop uv is the previous loop uv */
478  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(lf, cd_loop_uv_offset);
479  if (n == 0) {
480  f_luv = luv;
481  copy_v2_v2(p_uv, luv->uv);
482  }
483  else {
484  copy_v2_v2(t_uv, luv->uv);
485  copy_v2_v2(luv->uv, p_uv);
486  copy_v2_v2(p_uv, t_uv);
487  }
488  n++;
489  }
490 
491  copy_v2_v2(f_luv->uv, p_uv);
492  }
493  else { /* counter loop direction */
494  BMLoop *lf; /* current face loops */
495  MLoopUV *p_luv; /* previous loop uv */
496  MLoopUV *luv;
497  float t_uv[2]; /* current uvs */
498 
499  int n = 0;
500  BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
501  /* previous loop uv is the current loop uv */
502  luv = BM_ELEM_CD_GET_VOID_P(lf, cd_loop_uv_offset);
503  if (n == 0) {
504  p_luv = luv;
505  copy_v2_v2(t_uv, luv->uv);
506  }
507  else {
508  copy_v2_v2(p_luv->uv, luv->uv);
509  p_luv = luv;
510  }
511  n++;
512  }
513 
514  copy_v2_v2(luv->uv, t_uv);
515  }
516  }
517  }
518 }
519 
520 /**************************************************************************** *
521  * Reverse UVs for a face
522  **************************************************************************** */
523 
524 static void bm_face_reverse_uvs(BMFace *f, const int cd_loop_uv_offset)
525 {
526  BMIter iter;
527  BMLoop *l;
528  int i;
529 
530  float(*uvs)[2] = BLI_array_alloca(uvs, f->len);
531 
532  BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
533  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
534  copy_v2_v2(uvs[i], luv->uv);
535  }
536 
537  /* now that we have the uvs in the array, reverse! */
538  BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
539  /* current loop uv is the previous loop uv */
540  MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
541  copy_v2_v2(luv->uv, uvs[(f->len - i - 1)]);
542  }
543 }
545 {
546  BMOIter iter;
547  BMFace *f;
548  const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV);
549 
550  if (cd_loop_uv_offset != -1) {
551  BMO_ITER (f, &iter, op->slots_in, "faces", BM_FACE) {
552  bm_face_reverse_uvs(f, cd_loop_uv_offset);
553  }
554  }
555 }
556 
557 /**************************************************************************** *
558  * Cycle colors for a face
559  **************************************************************************** */
561  int index,
562  int *r_cd_color_offset,
563  int *r_cd_color_type)
564 {
565  Mesh me_query;
566 
568  ID_ME, &bm->vdata, NULL, &bm->ldata, NULL, NULL, &me_query.id);
569 
571  &me_query.id, index, ATTR_DOMAIN_MASK_COLOR, CD_MASK_COLOR_ALL);
572 
573  if (!layer || BKE_id_attribute_domain(&me_query.id, layer) != ATTR_DOMAIN_CORNER) {
574  *r_cd_color_offset = -1;
575  return;
576  }
577 
578  int layer_i = CustomData_get_layer_index(&bm->ldata, layer->type);
579 
580  *r_cd_color_offset = bm->ldata.layers[layer_i].offset;
581  *r_cd_color_type = layer->type;
582 }
583 
585 {
586  BMOIter fs_iter; /* selected faces iterator */
587  BMFace *fs; /* current face */
588  BMIter l_iter; /* iteration loop */
589 
590  const bool use_ccw = BMO_slot_bool_get(op->slots_in, "use_ccw");
591 
592  const int color_index = BMO_slot_int_get(op->slots_in, "color_index");
593 
594  int cd_loop_color_offset;
595  int cd_loop_color_type;
596 
597  bmo_get_loop_color_ref(bm, color_index, &cd_loop_color_offset, &cd_loop_color_type);
598 
599  if (cd_loop_color_offset == -1) {
600  BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "color_index is invalid");
601  return;
602  }
603 
604  const size_t size = cd_loop_color_type == CD_PROP_COLOR ? sizeof(MPropCol) : sizeof(MLoopCol);
605  void *p_col; /* previous color */
606  void *t_col = alloca(size); /* tmp color */
607 
608  BMO_ITER (fs, &fs_iter, op->slots_in, "faces", BM_FACE) {
609  if (use_ccw == false) { /* same loops direction */
610  BMLoop *lf; /* current face loops */
611  void *f_lcol; /* first face loop color */
612 
613  int n = 0;
614  BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
615  /* current loop color is the previous loop color */
616  void *lcol = BM_ELEM_CD_GET_VOID_P(lf, cd_loop_color_offset);
617 
618  if (n == 0) {
619  f_lcol = lcol;
620  p_col = lcol;
621  }
622  else {
623  memcpy(t_col, lcol, size);
624  memcpy(lcol, p_col, size);
625  memcpy(p_col, t_col, size);
626  }
627  n++;
628  }
629 
630  memcpy(f_lcol, p_col, size);
631  }
632  else { /* counter loop direction */
633  BMLoop *lf; /* current face loops */
634  void *lcol, *p_lcol;
635 
636  int n = 0;
637  BM_ITER_ELEM (lf, &l_iter, fs, BM_LOOPS_OF_FACE) {
638  /* previous loop color is the current loop color */
639  lcol = BM_ELEM_CD_GET_VOID_P(lf, cd_loop_color_offset);
640  if (n == 0) {
641  p_lcol = lcol;
642  memcpy(t_col, lcol, size);
643  }
644  else {
645  memcpy(p_lcol, lcol, size);
646  p_lcol = lcol;
647  }
648  n++;
649  }
650 
651  memcpy(lcol, t_col, size);
652  }
653  }
654 }
655 
656 /*************************************************************************** *
657  * Reverse colors for a face
658  *************************************************************************** */
660  const int cd_loop_color_offset,
661  const int cd_loop_color_type)
662 {
663  BMIter iter;
664  BMLoop *l;
665  int i;
666 
667  const size_t size = cd_loop_color_type == CD_PROP_COLOR ? sizeof(MPropCol) : sizeof(MLoopCol);
668 
669  char *cols = alloca(size * f->len);
670 
671  char *col = cols;
672  BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
673  void *lcol = BM_ELEM_CD_GET_VOID_P(l, cd_loop_color_offset);
674  memcpy((void *)col, lcol, size);
675  col += size;
676  }
677 
678  /* now that we have the uvs in the array, reverse! */
679  BM_ITER_ELEM_INDEX (l, &iter, f, BM_LOOPS_OF_FACE, i) {
680  /* current loop uv is the previous loop color */
681  void *lcol = BM_ELEM_CD_GET_VOID_P(l, cd_loop_color_offset);
682 
683  col = cols + (f->len - i - 1) * size;
684  memcpy(lcol, (void *)col, size);
685  }
686 }
687 
689 {
690  BMOIter iter;
691  BMFace *f;
692 
693  const int color_index = BMO_slot_int_get(op->slots_in, "color_index");
694 
695  int cd_loop_color_offset;
696  int cd_loop_color_type;
697 
698  bmo_get_loop_color_ref(bm, color_index, &cd_loop_color_offset, &cd_loop_color_type);
699 
700  if (cd_loop_color_offset == -1) {
701  BMO_error_raise(bm, op, BMO_ERROR_CANCEL, "color_index is invalid");
702  return;
703  }
704 
705  BMO_ITER (f, &iter, op->slots_in, "faces", BM_FACE) {
706  bm_face_reverse_colors(f, cd_loop_color_offset, cd_loop_color_type);
707  }
708 }
typedef float(TangentPoint)[2]
Generic geometry attributes built on CustomData.
@ ATTR_DOMAIN_CORNER
Definition: BKE_attribute.h:30
CustomDataLayer * BKE_id_attribute_from_index(struct ID *id, int lookup_index, eAttrDomainMask domain_mask, eCustomDataMask layer_mask)
Definition: attribute.cc:551
eAttrDomain BKE_id_attribute_domain(const struct ID *id, const struct CustomDataLayer *layer)
#define ATTR_DOMAIN_MASK_COLOR
Definition: BKE_attribute.h:48
void BKE_id_attribute_copy_domains_temp(short id_type, const struct CustomData *vdata, const struct CustomData *edata, const struct CustomData *ldata, const struct CustomData *pdata, const struct CustomData *cdata, struct ID *r_id)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_number_of_layers(const struct CustomData *data, int type)
int CustomData_get_layer_index(const struct CustomData *data, int type)
int CustomData_get_offset(const struct CustomData *data, int type)
General operations, lookup, etc. for blender objects.
#define BLI_array_alloca(arr, realsize)
Definition: BLI_alloca.h:22
void unit_m3(float m[3][3])
Definition: math_matrix.c:40
void unit_m4(float m[4][4])
Definition: rct.c:1090
bool invert_m4_m4(float R[4][4], const float A[4][4])
Definition: math_matrix.c:1287
void transform_pivot_set_m4(float mat[4][4], const float pivot[3])
Definition: math_matrix.c:2369
void mul_m4_v3(const float M[4][4], float r[3])
Definition: math_matrix.c:729
#define mul_m4_series(...)
bool is_zero_m4(const float mat[4][4])
Definition: math_matrix.c:2520
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
Definition: math_vector.c:29
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void zero_v3(float r[3])
unsigned int uint
Definition: BLI_sys_types.h:67
#define UNUSED(x)
@ ID_ME
Definition: DNA_ID_enums.h:48
#define CD_MASK_COLOR_ALL
@ CD_PROP_COLOR
@ CD_SHAPEKEY
@ CD_MLOOPUV
struct MPropCol MPropCol
Object is a sort of wrapper for general info.
NSNotificationCenter * center
Read Guarded memory(de)allocation.
#define BM_ALL_NOLOOP
Definition: bmesh_class.h:411
#define BM_FACE_FIRST_LOOP(p)
Definition: bmesh_class.h:622
@ BM_FACE
Definition: bmesh_class.h:386
@ BM_VERT
Definition: bmesh_class.h:383
@ BM_ELEM_HIDDEN
Definition: bmesh_class.h:472
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
Definition: bmesh_class.h:541
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.
Definition: bmesh_core.c:41
@ BM_CREATE_NOP
Definition: bmesh_core.h:12
@ BMO_ERROR_CANCEL
Definition: bmesh_error.h:21
void BMO_error_raise(BMesh *bm, BMOperator *owner, eBMOpErrorLevel level, const char *msg) ATTR_NONNULL(1
#define BM_elem_flag_test(ele, hflag)
Definition: bmesh_inline.h:12
#define BM_ITER_ELEM(ele, iter, data, itype)
@ BM_FACES_OF_EDGE
@ BM_FACES_OF_VERT
@ BM_EDGES_OF_VERT
@ BM_LOOPS_OF_FACE
#define BM_ITER_ELEM_INDEX(ele, iter, data, itype, indexvar)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_mat[4][4])
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.
#define BMO_edge_flag_test(bm, e, oflag)
void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float r_vec[3])
#define BMO_edge_flag_enable(bm, e, oflag)
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
#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)
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)
#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)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
int BMO_slot_buffer_len(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
#define BMO_face_flag_test(bm, e, oflag)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
ATTR_WARN_UNUSED_RESULT const BMFlagLayer const short oflag
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.
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
void bmo_rotate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:114
void bmo_region_extend_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:362
void bmo_reverse_uvs_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:544
#define SEL_ORIG
Definition: bmo_utils.c:148
#define ELE_NEW
Definition: bmo_utils.c:27
static void bmo_region_extend_expand(BMesh *bm, BMOperator *op, const bool use_faces, const bool use_faces_step)
Definition: bmo_utils.c:163
void bmo_transform_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:39
static void bmo_face_flag_set_flush(BMesh *bm, BMFace *f, const short oflag, const bool value)
Definition: bmo_utils.c:150
void bmo_reverse_colors_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:688
void bmo_rotate_colors_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:584
static void bm_face_reverse_uvs(BMFace *f, const int cd_loop_uv_offset)
Definition: bmo_utils.c:524
void bmo_rotate_uvs_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:458
static void bm_face_reverse_colors(BMFace *f, const int cd_loop_color_offset, const int cd_loop_color_type)
Definition: bmo_utils.c:659
#define SEL_FLAG
Definition: bmo_utils.c:147
void bmo_translate_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:70
void bmo_create_vert_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:29
void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op)
Definition: bmo_utils.c:380
static void bmo_get_loop_color_ref(BMesh *bm, int index, int *r_cd_color_offset, int *r_cd_color_type)
Definition: bmo_utils.c:560
void bmo_scale_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:91
static void bmo_region_extend_contract(BMesh *bm, BMOperator *op, const bool use_faces, const bool use_faces_step)
Definition: bmo_utils.c:263
void bmo_reverse_faces_exec(BMesh *bm, BMOperator *op)
Definition: bmo_utils.c:135
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
uint col
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:33
#define fabsf(x)
Definition: metal/compat.h:219
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:319
int len
Definition: bmesh_class.h:267
struct BMVert * v
Definition: bmesh_class.h:153
struct BMEdge * e
Definition: bmesh_class.h:164
struct BMLoop * next
Definition: bmesh_class.h:233
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
float co[3]
Definition: bmesh_class.h:87
CustomData vdata
Definition: bmesh_class.h:337
CustomData ldata
Definition: bmesh_class.h:337
CustomDataLayer * layers