Blender V5.3
bmo_dupe.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
10
11#include "MEM_guardedalloc.h"
12
13#include "BLI_array.hh"
14#include "BLI_math_matrix_c.hh"
16#include "BLI_math_vector_c.hh"
17
18#include "bmesh.hh"
19
20#include "intern/bmesh_operators_private.hh" /* own include */
21
22namespace blender {
23
24/* local flag define */
25#define DUPE_INPUT 1 /* input from operator */
26#define DUPE_NEW 2
27#define DUPE_DONE 4
28// #define DUPE_MAPPED 8 // UNUSED
29
36 BMOpSlot *slot_vertmap_out,
37 BMesh *bm_dst,
38 const std::optional<BMCustomDataCopyMap> &cd_vert_map,
39 BMVert *v_src,
41{
42 BMVert *v_dst;
43
44 /* Create a new vertex */
45 v_dst = BM_vert_create(bm_dst, v_src->co, nullptr, BM_CREATE_SKIP_CD);
46 BMO_slot_map_elem_insert(op, slot_vertmap_out, v_src, v_dst);
47 BMO_slot_map_elem_insert(op, slot_vertmap_out, v_dst, v_src);
48
49 /* Insert new vertex into the vert hash */
50 vhash.add(v_src, v_dst);
51
52 /* Copy attributes */
53 if (cd_vert_map.has_value()) {
54 BM_elem_attrs_copy(bm_dst, cd_vert_map.value(), v_src, v_dst);
55 }
56 else {
57 BM_elem_attrs_copy(bm_dst, v_src, v_dst);
58 }
59
60 /* Mark the vert for output */
61 BMO_vert_flag_enable(bm_dst, v_dst, DUPE_NEW);
62
63 return v_dst;
64}
65
72 BMOpSlot *slot_edgemap_out,
73 BMOpSlot *slot_boundarymap_out,
74 BMesh *bm_dst,
75 BMesh *bm_src,
76 const std::optional<BMCustomDataCopyMap> &cd_edge_map,
77 BMEdge *e_src,
80 const bool use_edge_flip_from_face)
81{
82 BMEdge *e_dst;
83 BMVert *e_dst_v1, *e_dst_v2;
84 uint rlen;
85
86 /* see if any of the neighboring faces are
87 * not being duplicated. in that case,
88 * add it to the new/old map. */
89 /* lookup edge */
90 rlen = 0;
91 if (e_src->l) {
92 BMLoop *l_iter_src, *l_first_src;
93 l_iter_src = l_first_src = e_src->l;
94 do {
95 if (BMO_face_flag_test(bm_src, l_iter_src->f, DUPE_INPUT)) {
96 rlen++;
97 }
98 } while ((l_iter_src = l_iter_src->radial_next) != l_first_src);
99 }
100
101 /* Lookup v1 and v2 */
102 e_dst_v1 = vhash.lookup(e_src->v1);
103 e_dst_v2 = vhash.lookup(e_src->v2);
104
105 /* Create a new edge */
106 e_dst = BM_edge_create(bm_dst, e_dst_v1, e_dst_v2, nullptr, BM_CREATE_SKIP_CD);
107 BMO_slot_map_elem_insert(op, slot_edgemap_out, e_src, e_dst);
108 BMO_slot_map_elem_insert(op, slot_edgemap_out, e_dst, e_src);
109
110 /* Add to new/old edge map if necessary. */
111 if (rlen < 2) {
112 /* not sure what non-manifold cases of greater than three
113 * radial should do. */
114 BMO_slot_map_elem_insert(op, slot_boundarymap_out, e_src, e_dst);
115 }
116
117 /* Insert new edge into the edge hash */
118 ehash.add(e_src, e_dst);
119
120 /* Copy attributes */
121 if (cd_edge_map.has_value()) {
122 BM_elem_attrs_copy(bm_dst, cd_edge_map.value(), e_src, e_dst);
123 }
124 else {
125 BM_elem_attrs_copy(bm_dst, e_src, e_dst);
126 }
127
128 /* Mark the edge for output */
129 BMO_edge_flag_enable(bm_dst, e_dst, DUPE_NEW);
130
131 if (use_edge_flip_from_face) {
132 /* Take winding from previous face (if we had one),
133 * otherwise extruding a duplicated edges gives bad normals, see: #62487. */
134 if (BM_edge_is_boundary(e_src) && (e_src->l->v == e_src->v1)) {
135 BM_edge_verts_swap(e_dst);
136 }
137 }
138
139 return e_dst;
140}
141
148 BMOpSlot *slot_facemap_out,
149 BMesh *bm_dst,
150 const std::optional<BMCustomDataCopyMap> &cd_face_map,
151 const std::optional<BMCustomDataCopyMap> &cd_loop_map,
152 BMFace *f_src,
155{
156 BMFace *f_dst;
159 BMLoop *l_iter_src, *l_iter_dst, *l_first_src;
160 int i;
161
162 l_first_src = BM_FACE_FIRST_LOOP(f_src);
163
164 /* lookup edge */
165 l_iter_src = l_first_src;
166 i = 0;
167 do {
168 vtar[i] = vhash.lookup(l_iter_src->v);
169 edar[i] = ehash.lookup(l_iter_src->e);
170 i++;
171 } while ((l_iter_src = l_iter_src->next) != l_first_src);
172
173 /* create new face */
174 f_dst = BM_face_create(bm_dst, vtar.data(), edar.data(), f_src->len, nullptr, BM_CREATE_SKIP_CD);
175 BMO_slot_map_elem_insert(op, slot_facemap_out, f_src, f_dst);
176 BMO_slot_map_elem_insert(op, slot_facemap_out, f_dst, f_src);
177
178 /* Copy attributes */
179 if (cd_face_map.has_value()) {
180 BM_elem_attrs_copy(bm_dst, cd_face_map.value(), f_src, f_dst);
181 }
182 else {
183 BM_elem_attrs_copy(bm_dst, f_src, f_dst);
184 }
185
186 /* copy per-loop custom data */
187 l_iter_src = l_first_src;
188 l_iter_dst = BM_FACE_FIRST_LOOP(f_dst);
189 do {
190 if (cd_loop_map.has_value()) {
191 BM_elem_attrs_copy(bm_dst, cd_loop_map.value(), l_iter_src, l_iter_dst);
192 }
193 else {
194 BM_elem_attrs_copy(bm_dst, l_iter_src, l_iter_dst);
195 }
196 } while ((void)(l_iter_dst = l_iter_dst->next), (l_iter_src = l_iter_src->next) != l_first_src);
197
198 /* Mark the face for output */
199 BMO_face_flag_enable(bm_dst, f_dst, DUPE_NEW);
200
201 return f_dst;
202}
203
209static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
210{
211 const bool use_select_history = BMO_slot_bool_get(op->slots_in, "use_select_history");
212 const bool use_edge_flip_from_face = BMO_slot_bool_get(op->slots_in, "use_edge_flip_from_face");
213
214 BMVert *v = nullptr, *v2;
215 BMEdge *e = nullptr;
216 BMFace *f = nullptr;
217
218 BMIter viter, eiter, fiter;
219
220 BMOpSlot *slot_boundary_map_out = BMO_slot_get(op->slots_out, "boundary_map.out");
221 BMOpSlot *slot_isovert_map_out = BMO_slot_get(op->slots_out, "isovert_map.out");
222
223 BMOpSlot *slot_vert_map_out = BMO_slot_get(op->slots_out, "vert_map.out");
224 BMOpSlot *slot_edge_map_out = BMO_slot_get(op->slots_out, "edge_map.out");
225 BMOpSlot *slot_face_map_out = BMO_slot_get(op->slots_out, "face_map.out");
226
227 /* initialize pointer hashes */
230
231 const std::optional<BMCustomDataCopyMap> cd_vert_map =
232 (bm_src == bm_dst) ? std::nullopt :
233 std::optional<BMCustomDataCopyMap>{
234 CustomData_bmesh_copy_map_calc(bm_src->vdata, bm_dst->vdata)};
235 const std::optional<BMCustomDataCopyMap> cd_edge_map =
236 (bm_src == bm_dst) ? std::nullopt :
237 std::optional<BMCustomDataCopyMap>{
238 CustomData_bmesh_copy_map_calc(bm_src->edata, bm_dst->edata)};
239 const std::optional<BMCustomDataCopyMap> cd_face_map =
240 (bm_src == bm_dst) ? std::nullopt :
241 std::optional<BMCustomDataCopyMap>{
242 CustomData_bmesh_copy_map_calc(bm_src->pdata, bm_dst->pdata)};
243 const std::optional<BMCustomDataCopyMap> cd_loop_map =
244 (bm_src == bm_dst) ? std::nullopt :
245 std::optional<BMCustomDataCopyMap>{
246 CustomData_bmesh_copy_map_calc(bm_src->ldata, bm_dst->ldata)};
247
248 /* duplicate flagged vertices */
249 BM_ITER_MESH (v, &viter, bm_src, BM_VERTS_OF_MESH) {
250 if (BMO_vert_flag_test(bm_src, v, DUPE_INPUT) &&
251 BMO_vert_flag_test(bm_src, v, DUPE_DONE) == false)
252 {
253 BMIter iter;
254 bool isolated = true;
255
256 v2 = bmo_vert_copy(op, slot_vert_map_out, bm_dst, cd_vert_map, v, vhash);
257
258 BM_ITER_ELEM (f, &iter, v, BM_FACES_OF_VERT) {
259 if (BMO_face_flag_test(bm_src, f, DUPE_INPUT)) {
260 isolated = false;
261 break;
262 }
263 }
264
265 if (isolated) {
266 BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
267 if (BMO_edge_flag_test(bm_src, e, DUPE_INPUT)) {
268 isolated = false;
269 break;
270 }
271 }
272 }
273
274 if (isolated) {
275 BMO_slot_map_elem_insert(op, slot_isovert_map_out, v, v2);
276 }
277
279 }
280 }
281
282 /* now we dupe all the edges */
283 BM_ITER_MESH (e, &eiter, bm_src, BM_EDGES_OF_MESH) {
284 if (BMO_edge_flag_test(bm_src, e, DUPE_INPUT) &&
285 BMO_edge_flag_test(bm_src, e, DUPE_DONE) == false)
286 {
287 /* make sure that verts are copied */
288 if (!BMO_vert_flag_test(bm_src, e->v1, DUPE_DONE)) {
289 bmo_vert_copy(op, slot_vert_map_out, bm_dst, cd_vert_map, e->v1, vhash);
290 BMO_vert_flag_enable(bm_src, e->v1, DUPE_DONE);
291 }
292 if (!BMO_vert_flag_test(bm_src, e->v2, DUPE_DONE)) {
293 bmo_vert_copy(op, slot_vert_map_out, bm_dst, cd_vert_map, e->v2, vhash);
294 BMO_vert_flag_enable(bm_src, e->v2, DUPE_DONE);
295 }
296 /* now copy the actual edge */
297 bmo_edge_copy(op,
298 slot_edge_map_out,
299 slot_boundary_map_out,
300 bm_dst,
301 bm_src,
302 cd_edge_map,
303 e,
304 vhash,
305 ehash,
306 use_edge_flip_from_face);
308 }
309 }
310
311 /* first we dupe all flagged faces and their elements from source */
312 BM_ITER_MESH (f, &fiter, bm_src, BM_FACES_OF_MESH) {
313 if (BMO_face_flag_test(bm_src, f, DUPE_INPUT)) {
314 /* vertex pass */
315 BM_ITER_ELEM (v, &viter, f, BM_VERTS_OF_FACE) {
316 if (!BMO_vert_flag_test(bm_src, v, DUPE_DONE)) {
317 bmo_vert_copy(op, slot_vert_map_out, bm_dst, cd_vert_map, v, vhash);
319 }
320 }
321
322 /* edge pass */
323 BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) {
324 if (!BMO_edge_flag_test(bm_src, e, DUPE_DONE)) {
325 bmo_edge_copy(op,
326 slot_edge_map_out,
327 slot_boundary_map_out,
328 bm_dst,
329 bm_src,
330 cd_edge_map,
331 e,
332 vhash,
333 ehash,
334 use_edge_flip_from_face);
336 }
337 }
338 bmo_face_copy(op, slot_face_map_out, bm_dst, cd_face_map, cd_loop_map, f, vhash, ehash);
340 }
341 }
342
343 if (use_select_history) {
344 BLI_assert(bm_src == bm_dst);
346 bm_dst, slot_vert_map_out, slot_edge_map_out, slot_face_map_out, false);
347 }
348}
349
371{
372 BMOperator *dupeop = op;
373 BMesh *bm_dst = static_cast<BMesh *>(BMO_slot_ptr_get(op->slots_in, "dest"));
374
375 if (!bm_dst) {
376 bm_dst = bm;
377 }
378
379 /* flag input */
381
382 /* use the internal copy function */
383 bmo_mesh_copy(dupeop, bm_dst, bm);
384
385 /* Output */
386 /* First copy the input buffers to output buffers - original data */
387 BMO_slot_copy(dupeop, slots_in, "geom", dupeop, slots_out, "geom_orig.out");
388
389 /* Now allocation the new output buffers. */
391 bm, dupeop, dupeop->slots_out, "geom.out", BM_ALL_NOLOOP, DUPE_NEW);
392}
393
394#if 0 /* UNUSED */
401void BMO_dupe_from_flag(BMesh *bm, int htype, const char hflag)
402{
403 BMOperator dupeop;
404
405 BMO_op_init(bm, &dupeop, "duplicate");
406 BMO_slot_buffer_from_enabled_hflag(bm, &dupeop, "geom", htype, hflag);
407
408 BMO_op_exec(bm, &dupeop);
409 BMO_op_finish(bm, &dupeop);
410}
411#endif
412
434{
435#define SPLIT_INPUT 1
436
437 BMOperator *splitop = op;
438 BMOperator dupeop;
439 const bool use_only_faces = BMO_slot_bool_get(op->slots_in, "use_only_faces");
440
441 /* initialize our sub-operator */
442 BMO_op_init(bm, &dupeop, op->flag, "duplicate");
443
444 BMO_slot_copy(splitop, slots_in, "geom", &dupeop, slots_in, "geom");
445 BMO_op_exec(bm, &dupeop);
446
447 BMFace *new_act_face = static_cast<BMFace *>(
448 BMO_slot_map_elem_get(BMO_slot_get(dupeop.slots_out, "face_map.out"), bm->act_face));
449 if (new_act_face) {
450 bm->act_face = new_act_face;
451 }
452
454
455 if (use_only_faces) {
456 BMVert *v;
457 BMEdge *e;
458 BMFace *f;
459 BMIter iter, iter2;
460
461 /* make sure to remove edges and verts we don't need */
462 BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
463 bool found = false;
464 BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
466 found = true;
467 break;
468 }
469 }
470 if (found == false) {
472 }
473 }
474
475 BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
476 bool found = false;
477 BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
479 found = true;
480 break;
481 }
482 }
483 if (found == false) {
485 }
486 }
487 }
488
489 BMO_slot_copy(&dupeop, slots_out, "geom.out", splitop, slots_out, "geom.out");
490 BMO_slot_copy(&dupeop, slots_out, "isovert_map.out", splitop, slots_out, "isovert_map.out");
491
492 /* connect outputs of dupe to delete, excluding keep geometry */
494 bm,
496 DEL_FACES,
497 /* Call before deletion so deleted geometry isn't copied. */
498 [&bm, &dupeop, &splitop]() {
499 /* Now we make our outputs by copying the dupe output. */
500
501 /* NOTE: `boundary_map.out` can't use #BMO_slot_copy because some of the "source"
502 * geometry has been removed. In this case the (source -> destination) map doesn't work.
503 * In this case there isn't an especially good option.
504 * The geometry needs to be included so the boundary is accessible.
505 * Use the "destination" as the key and the value since it avoids adding freed
506 * geometry into the map and can be easily detected by other operators.
507 * See: #142633. */
508 const char *slot_name_boundary_map = "boundary_map.out";
509 BMOpSlot *splitop_boundary_map = BMO_slot_get(splitop->slots_out, slot_name_boundary_map);
510 BMOIter siter;
511 BMElem *ele_key;
512 BMO_ITER (ele_key, &siter, dupeop.slots_out, slot_name_boundary_map, 0) {
513 BMElem *ele_val = static_cast<BMElem *>(BMO_iter_map_value_ptr(&siter));
514 if (BMO_elem_flag_test(bm, ele_key, SPLIT_INPUT)) {
515 ele_key = ele_val;
516 }
517 BMO_slot_map_elem_insert(splitop, splitop_boundary_map, ele_key, ele_val);
518 }
519 });
520
521 /* cleanup */
522 BMO_op_finish(bm, &dupeop);
523
524#undef SPLIT_INPUT
525}
526
528{
529#define DEL_INPUT 1
530
531 BMOperator *delop = op;
532
533 /* Mark Buffer */
535
537
538#undef DEL_INPUT
539}
540
548{
549 BMOperator dupop, extop;
550 float cent[3], dvec[3];
551 float axis[3];
552
553 BMO_slot_vec_get(op->slots_in, "cent", cent);
554 BMO_slot_vec_get(op->slots_in, "axis", axis);
555 normalize_v3(axis);
556 BMO_slot_vec_get(op->slots_in, "dvec", dvec);
557 const bool use_dvec = !is_zero_v3(dvec);
558 const int steps = BMO_slot_int_get(op->slots_in, "steps");
559 const float angle_total = BMO_slot_float_get(op->slots_in, "angle");
560 const bool do_dupli = BMO_slot_bool_get(op->slots_in, "use_duplicate");
561 const bool use_normal_flip = BMO_slot_bool_get(op->slots_in, "use_normal_flip");
562 /* Caller needs to perform other sanity checks (such as the spin being 360d). */
563 const bool use_merge = BMO_slot_bool_get(op->slots_in, "use_merge") &&
564 /* Don't create duplicate geometry. */
565 (steps >= 3) &&
566 /* Only the "extrude" code path supports merging. */
567 (do_dupli == false);
568
569 BMVert **vtable = nullptr;
570 float (*vtable_coords)[3] = nullptr;
571
572 /* When merging, store the original vertices to splice them back together. */
573 if (use_merge) {
575 }
576
577 /* When extruding, always restore the original location before rotating. */
578 if (do_dupli == false) {
579 vtable_coords = MEM_new_array_uninitialized<float[3]>(bm->totvert, __func__);
580 }
581
582 if (vtable || vtable_coords) {
583 int i = 0;
584 BMIter iter;
585 BMVert *v;
587 if (vtable) {
588 vtable[i] = v;
589 }
590 if (vtable_coords) {
591 copy_v3_v3(vtable_coords[i], v->co);
592 }
593 /* Evil! store original index in normal,
594 * this is duplicated into every other vertex.
595 * So we can read the original from the final.
596 *
597 * The normals must be recalculated anyway. */
598 *(reinterpret_cast<int *>(&v->no[0])) = i;
599 }
600 }
601
602 BMO_slot_copy(op, slots_in, "geom", op, slots_out, "geom_last.out");
603 for (int a = 0; a < steps; a++) {
604 /* Calculate rotation matrix for this step independently to avoid floating-point error
605 * accumulation. */
606 float rmat[3][3];
607 {
608 const float step_angle = angle_total * (float(a + 1) / float(steps));
609 axis_angle_normalized_to_mat3(rmat, axis, step_angle);
610 }
611
612 if (do_dupli) {
613 /* For duplicate mode, duplicate from original geometry
614 * and rotate by total angle for this step. */
615 BMO_op_initf(bm, &dupop, op->flag, "duplicate geom=%s", op, "geom");
616 BMO_op_exec(bm, &dupop);
618 op->flag,
619 "rotate cent=%v matrix=%m3 space=%s verts=%S",
620 cent,
621 rmat,
622 op,
623 "space",
624 &dupop,
625 "geom.out");
626 BMO_slot_copy(&dupop, slots_out, "geom.out", op, slots_out, "geom_last.out");
627 BMO_op_finish(bm, &dupop);
628 }
629 else {
631 &extop,
632 op->flag,
633 "extrude_face_region "
634 "geom=%S "
635 "use_keep_orig=%b "
636 "use_normal_flip=%b "
637 "use_normal_from_adjacent=%b "
638 "skip_input_flip=%b",
639 op,
640 "geom_last.out",
641 use_merge,
642 use_normal_flip && (a == 0),
643 (a != 0),
644 true);
645 BMO_op_exec(bm, &extop);
646 if ((use_merge && (a == steps - 1)) == false) {
647
648 /* Reset each new vert's location to its un-rotated origin so the rotate below
649 * runs as a single fresh rotation from the original position
650 * (avoids precision loss from chained rotations, see: #148890). */
651 if (a != 0) {
652 BMOpSlot *slot_geom_out = BMO_slot_get(extop.slots_out, "geom.out");
653 BMElem **elem_array = reinterpret_cast<BMElem **>(slot_geom_out->data.buf);
654 const int elem_array_len = slot_geom_out->len;
655 for (int i = 0; i < elem_array_len; i++) {
656 if (elem_array[i]->head.htype == BM_VERT) {
657 BMVert *v_src = reinterpret_cast<BMVert *>(elem_array[i]);
658 const int index = *(reinterpret_cast<const int *>(&v_src->no[0]));
659 copy_v3_v3(v_src->co, vtable_coords[index]);
660 }
661 }
662 }
663
665 op->flag,
666 "rotate cent=%v matrix=%m3 space=%s verts=%S",
667 cent,
668 rmat,
669 op,
670 "space",
671 &extop,
672 "geom.out");
673 BMO_slot_copy(&extop, slots_out, "geom.out", op, slots_out, "geom_last.out");
674 }
675 else {
676 /* Merge first/last vertices and edges (maintaining 'geom.out' state). */
677 BMOpSlot *slot_geom_out = BMO_slot_get(extop.slots_out, "geom.out");
678 BMElem **elem_array = reinterpret_cast<BMElem **>(slot_geom_out->data.buf);
679 int elem_array_len = slot_geom_out->len;
680 for (int i = 0; i < elem_array_len;) {
681 if (elem_array[i]->head.htype == BM_VERT) {
682 BMVert *v_src = reinterpret_cast<BMVert *>(elem_array[i]);
683 BMVert *v_dst = vtable[*(reinterpret_cast<const int *>(&v_src->no[0]))];
684 BM_vert_splice(bm, v_dst, v_src);
685 elem_array_len--;
686 elem_array[i] = elem_array[elem_array_len];
687 }
688 else {
689 i++;
690 }
691 }
692 for (int i = 0; i < elem_array_len;) {
693 if (elem_array[i]->head.htype == BM_EDGE) {
694 BMEdge *e_src = reinterpret_cast<BMEdge *>(elem_array[i]);
695 BMEdge *e_dst = BM_edge_find_double(e_src);
696 if (e_dst != nullptr) {
697 BM_edge_splice(bm, e_dst, e_src);
698 elem_array_len--;
699 elem_array[i] = elem_array[elem_array_len];
700 continue;
701 }
702 }
703 i++;
704 }
705 /* Full copies of faces may cause overlap. */
706 for (int i = 0; i < elem_array_len;) {
707 if (elem_array[i]->head.htype == BM_FACE) {
708 BMFace *f_src = reinterpret_cast<BMFace *>(elem_array[i]);
709 BMFace *f_dst = BM_face_find_double(f_src);
710 if (f_dst != nullptr) {
711 BM_face_kill(bm, f_src);
712 elem_array_len--;
713 elem_array[i] = elem_array[elem_array_len];
714 continue;
715 }
716 }
717 i++;
718 }
719 slot_geom_out->len = elem_array_len;
720 }
721 BMO_op_finish(bm, &extop);
722 }
723
724 if (use_dvec) {
725 float dvec_step[3];
726 mul_v3_m3v3(dvec_step, rmat, dvec);
727 mul_v3_fl(dvec_step, float(a + 1));
729 op->flag,
730 "translate vec=%v space=%s verts=%S",
731 dvec_step,
732 op,
733 "space",
734 op,
735 "geom_last.out");
736 }
737 }
738
739 if (vtable) {
740 MEM_delete(vtable);
741 }
742 if (vtable_coords) {
743 MEM_delete(vtable_coords);
744 }
745}
746
747} // namespace blender
Read Blender memory allocation and freeing.
#define BM_ALL_NOLOOP
#define BM_FACE_FIRST_LOOP(p)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, 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_face_flag_enable(bm, e, oflag)
#define BMO_slot_copy(op_src, slots_src, slot_name_src, op_dst, slots_dst, slot_name_dst)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
#define BMO_vert_flag_test(bm, e, oflag)
#define BMO_elem_flag_test(bm, ele, oflag)
#define BMO_face_flag_test(bm, e, oflag)
#define DUPE_NEW
Definition bmo_dupe.cc:26
#define DUPE_INPUT
Definition bmo_dupe.cc:25
#define SPLIT_INPUT
#define DUPE_DONE
Definition bmo_dupe.cc:27
#define DEL_INPUT
const T * data() const
Definition BLI_array.hh:323
bool add(const Key &key, const Value &value)
Definition BLI_map.hh:295
const Value & lookup(const Key &key) const
Definition BLI_map.hh:545
BMesh Iterators.
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
static BMEdge * bmo_edge_copy(BMOperator *op, BMOpSlot *slot_edgemap_out, BMOpSlot *slot_boundarymap_out, BMesh *bm_dst, BMesh *bm_src, const std::optional< BMCustomDataCopyMap > &cd_edge_map, BMEdge *e_src, Map< BMVert *, BMVert * > &vhash, Map< BMEdge *, BMEdge * > &ehash, const bool use_edge_flip_from_face)
Definition bmo_dupe.cc:71
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
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
BMCustomDataCopyMap CustomData_bmesh_copy_map_calc(const CustomData &src, const CustomData &dst, eCustomDataMask mask_exclude=0)
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.
void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type, FunctionRef< void()> prepare_fn)
void BM_edge_verts_swap(BMEdge *e)
bool BMO_op_initf(BMesh *bm, BMOperator *op, int flag, const char *fmt,...)
void BMO_mesh_selected_remap(BMesh *bm, BMOpSlot *slot_vert_map, BMOpSlot *slot_edge_map, BMOpSlot *slot_face_map, bool check_select)
void * BMO_iter_map_value_ptr(BMOIter *iter)
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.
BMFace * BM_face_create(BMesh *bm, BMVert *const *verts, BMEdge *const *edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag)
void BMO_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
MINLINE void mul_v3_fl(float r[3], float f)
static BMVert * bmo_vert_copy(BMOperator *op, BMOpSlot *slot_vertmap_out, BMesh *bm_dst, const std::optional< BMCustomDataCopyMap > &cd_vert_map, BMVert *v_src, Map< BMVert *, BMVert * > &vhash)
Definition bmo_dupe.cc:35
void * BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
@ BM_CREATE_SKIP_CD
Definition bmesh_core.hh:42
bool BM_edge_splice(BMesh *bm, BMEdge *e_dst, BMEdge *e_src)
Splice Edge.
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)
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src)
Splice Vert.
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
void bmo_delete_exec(BMesh *bm, BMOperator *op)
Definition bmo_dupe.cc:527
static BMFace * bmo_face_copy(BMOperator *op, BMOpSlot *slot_facemap_out, BMesh *bm_dst, const std::optional< BMCustomDataCopyMap > &cd_face_map, const std::optional< BMCustomDataCopyMap > &cd_loop_map, BMFace *f_src, Map< BMVert *, BMVert * > &vhash, Map< BMEdge *, BMEdge * > &ehash)
Definition bmo_dupe.cc:147
BMOpSlot * BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
BMESH OPSTACK GET SLOT.
void bmo_spin_exec(BMesh *bm, BMOperator *op)
Definition bmo_dupe.cc:547
MINLINE float normalize_v3(float n[3])
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void bmo_duplicate_exec(BMesh *bm, BMOperator *op)
Definition bmo_dupe.cc:370
ATTR_WARN_UNUSED_RESULT const BMVert * v2
void BM_face_kill(BMesh *bm, BMFace *f)
static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src)
Definition bmo_dupe.cc:209
void bmo_split_exec(BMesh *bm, BMOperator *op)
Definition bmo_dupe.cc:433
BMEdge * BM_edge_find_double(BMEdge *e)
BMFace * BM_face_find_double(BMFace *f)
void BMO_op_init(BMesh *bm, BMOperator *op, int flag, const char *opname)
BMESH OPSTACK INIT OP.
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
void BMO_op_finish(BMesh *bm, BMOperator *op)
BMESH OPSTACK FINISH OP.
BLI_INLINE void BMO_slot_map_elem_insert(BMOperator *op, BMOpSlot *slot, const void *element, void *val)
void mul_v3_m3v3(float r[3], const float M[3][3], const float a[3])
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle)
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, char hflag)
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct BMLoop * l
struct BMLoop * next
struct BMEdge * e
struct BMVert * v
struct BMLoop * radial_next
struct BMFace * f
union blender::BMOpSlot::@376352321363166111241172004263244043165250166277 data
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
CustomData pdata
CustomData vdata
CustomData edata
CustomData ldata