Blender V4.3
bmo_fill_holes.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#include "BLI_utildefines.h"
12
13#include "bmesh.hh"
14#include "bmesh_tools.hh"
15
16#include "intern/bmesh_operators_private.hh" /* own include */
17
19{
20 BMOperator op_attr;
21 const uint sides = BMO_slot_int_get(op->slots_in, "sides");
22
25
26 BM_mesh_edgenet(bm, true, true); /* TODO: sides. */
27
28 /* bad - remove faces after as a workaround */
29 if (sides != 0) {
30 BMOIter siter;
31 BMFace *f;
32
34 BMO_ITER (f, &siter, op->slots_out, "faces.out", BM_FACE) {
35 if (f->len > sides) {
36 BM_face_kill(bm, f);
37 }
38 }
39 }
40
42
43 /* --- Attribute Fill --- */
44 /* may as well since we have the faces already in a buffer */
46 &op_attr,
47 op->flag,
48 "face_attribute_fill faces=%S use_normals=%b use_data=%b",
49 op,
50 "faces.out",
51 true,
52 true);
53
54 BMO_op_exec(bm, &op_attr);
55
56 /* check if some faces couldn't be touched */
57 if (BMO_slot_buffer_len(op_attr.slots_out, "faces_fail.out")) {
58 BMOIter siter;
59 BMFace *f;
60
61 BMO_ITER (f, &siter, op_attr.slots_out, "faces_fail.out", BM_FACE) {
62 BM_face_normal_update(f); /* normals are zero'd */
63 }
64
65 BMO_op_callf(bm, op->flag, "recalc_face_normals faces=%S", &op_attr, "faces_fail.out");
66 }
67 BMO_op_finish(bm, &op_attr);
68}
unsigned int uint
@ BM_ELEM_TAG
void BM_face_kill(BMesh *bm, BMFace *f)
void BM_mesh_edgenet(BMesh *bm, const bool use_edge_tag, const bool use_new_face_tag)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
#define BM_FACE
#define BM_EDGE
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, char hflag, bool do_flush)
BMO_FLAG_BUFFER.
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)
void BMO_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
bool BMO_op_initf(BMesh *bm, BMOperator *op, int flag, const char *fmt,...)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void BMO_op_finish(BMesh *bm, BMOperator *op)
BMESH OPSTACK FINISH OP.
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,...)
void BM_face_normal_update(BMFace *f)
void bmo_holes_fill_exec(BMesh *bm, BMOperator *op)
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]