Blender V5.3
bmo_beautify.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 "bmesh.hh"
15#include "bmesh_tools.hh"
17
18namespace blender {
19
20#define ELE_NEW 1
21#define FACE_MARK 2
22
24{
25 BMIter iter;
26 BMOIter siter;
27 BMFace *f;
28 BMEdge *e;
29 const bool use_restrict_tag = BMO_slot_bool_get(op->slots_in, "use_restrict_tag");
30 const short flag =
31 ((use_restrict_tag ? VERT_RESTRICT_TAG : 0) |
32 /* Enable to avoid iterative edge rotation to cause the direction of faces to flip. */
34 const short method = short(BMO_slot_int_get(op->slots_in, "method"));
35
36 BMEdge **edge_array;
37 int edge_array_len = 0;
38 BMO_ITER (f, &siter, op->slots_in, "faces", BM_FACE) {
39 if (f->len == 3) {
41 }
42 }
43
46 }
47
48 /* Will over allocate if some edges can't be rotated. */
50 size_t(BMO_slot_buffer_len(op->slots_in, "edges")), __func__);
51
52 BMO_ITER (e, &siter, op->slots_in, "edges", BM_EDGE) {
53
54 /* edge is manifold and can be rotated */
56 /* faces are tagged */
58 BMO_face_flag_test(bm, e->l->radial_next->f, FACE_MARK))
59 {
60 edge_array[edge_array_len] = e;
61 edge_array_len++;
62 }
63 }
64
66 bm, edge_array, edge_array_len, flag, method, ELE_NEW, FACE_MARK | ELE_NEW);
67
68 MEM_delete(edge_array);
69
71}
72
73} // namespace blender
Read Blender memory allocation and freeing.
#define BM_elem_flag_disable(ele, hflag)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
#define BMO_face_flag_test(bm, e, oflag)
#define ELE_NEW
#define FACE_MARK
BMesh Iterators.
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)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
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 BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
bool BM_edge_rotate_check(BMEdge *e)
Check if Rotate Edge is OK.
@ EDGE_RESTRICT_DEGENERATE
void BM_mesh_beautify_fill(BMesh *bm, BMEdge **edge_array, const int edge_array_len, const short flag, const short method, const short oflag_edge, const short oflag_face)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void bmo_beautify_fill_exec(BMesh *bm, BMOperator *op)
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]