Blender V5.0
bmo_bevel.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
12#include "bmesh.hh"
13#include "bmesh_tools.hh"
14
15#include "BKE_customdata.hh"
16
17#include "intern/bmesh_operators_private.hh" /* own include */
18
20{
21 const float offset = BMO_slot_float_get(op->slots_in, "offset");
22 const int offset_type = BMO_slot_int_get(op->slots_in, "offset_type");
23 const int profile_type = BMO_slot_int_get(op->slots_in, "profile_type");
24 const int seg = BMO_slot_int_get(op->slots_in, "segments");
25 const int affect_type = BMO_slot_int_get(op->slots_in, "affect");
26 const float profile = BMO_slot_float_get(op->slots_in, "profile");
27 const bool clamp_overlap = BMO_slot_bool_get(op->slots_in, "clamp_overlap");
28 const int material = BMO_slot_int_get(op->slots_in, "material");
29 const bool loop_slide = BMO_slot_bool_get(op->slots_in, "loop_slide");
30 const bool mark_seam = BMO_slot_bool_get(op->slots_in, "mark_seam");
31 const bool mark_sharp = BMO_slot_bool_get(op->slots_in, "mark_sharp");
32 const bool harden_normals = BMO_slot_bool_get(op->slots_in, "harden_normals");
33 const int face_strength_mode = BMO_slot_int_get(op->slots_in, "face_strength_mode");
34 const int miter_outer = BMO_slot_int_get(op->slots_in, "miter_outer");
35 const int miter_inner = BMO_slot_int_get(op->slots_in, "miter_inner");
36 const float spread = BMO_slot_float_get(op->slots_in, "spread");
37 const CurveProfile *custom_profile = static_cast<const CurveProfile *>(
38 BMO_slot_ptr_get(op->slots_in, "custom_profile"));
39 const int vmesh_method = BMO_slot_int_get(op->slots_in, "vmesh_method");
40
41 if (offset > 0) {
42 BMOIter siter;
43 BMEdge *e;
44 BMVert *v;
45
46 /* first flush 'geom' into flags, this makes it possible to check connected data,
47 * BM_FACE is cleared so we can put newly created faces into a bmesh slot. */
49
50 BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
52 }
53
54 BMO_ITER (e, &siter, op->slots_in, "geom", BM_EDGE) {
57 /* in case verts were not also included in the geom */
60 }
61 }
62
64 offset,
65 offset_type,
66 profile_type,
67 seg,
68 profile,
69 affect_type,
70 false,
71 clamp_overlap,
72 nullptr,
73 -1,
74 material,
75 loop_slide,
76 mark_seam,
77 mark_sharp,
78 harden_normals,
79 face_strength_mode,
80 miter_outer,
81 miter_inner,
82 spread,
83 custom_profile,
84 vmesh_method,
85 CustomData_get_offset_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert"),
86 CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge"));
87
91 }
92}
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
@ CD_PROP_FLOAT
void BM_mesh_bevel(BMesh *bm, const float offset, const int offset_type, const int profile_type, const int segments, const float profile, const bool affect_type, const bool use_weights, const bool limit_offset, const MDeformVert *dvert, const int vertex_group, const int mat, const bool loop_slide, const bool mark_seam, const bool mark_sharp, const bool harden_normals, const int face_strength_mode, const int miter_outer, const int miter_inner, const float spread, const CurveProfile *custom_profile, const int vmesh_method, const int bweight_offset_vert, const int bweight_offset_edge)
@ BM_ELEM_TAG
#define BM_elem_flag_enable(ele, hflag)
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
#define BM_VERT
void * BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
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)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
void bmo_bevel_exec(BMesh *bm, BMOperator *op)
Definition bmo_bevel.cc:19
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]