Blender V4.3
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
11#include "BLI_utildefines.h"
12
14#include "bmesh.hh"
15#include "bmesh_tools.hh"
16
17#include "BKE_customdata.hh"
18
19#include "intern/bmesh_operators_private.hh" /* own include */
20
22{
23 const float offset = BMO_slot_float_get(op->slots_in, "offset");
24 const int offset_type = BMO_slot_int_get(op->slots_in, "offset_type");
25 const int profile_type = BMO_slot_int_get(op->slots_in, "profile_type");
26 const int seg = BMO_slot_int_get(op->slots_in, "segments");
27 const int affect_type = BMO_slot_int_get(op->slots_in, "affect");
28 const float profile = BMO_slot_float_get(op->slots_in, "profile");
29 const bool clamp_overlap = BMO_slot_bool_get(op->slots_in, "clamp_overlap");
30 const int material = BMO_slot_int_get(op->slots_in, "material");
31 const bool loop_slide = BMO_slot_bool_get(op->slots_in, "loop_slide");
32 const bool mark_seam = BMO_slot_bool_get(op->slots_in, "mark_seam");
33 const bool mark_sharp = BMO_slot_bool_get(op->slots_in, "mark_sharp");
34 const bool harden_normals = BMO_slot_bool_get(op->slots_in, "harden_normals");
35 const int face_strength_mode = BMO_slot_int_get(op->slots_in, "face_strength_mode");
36 const int miter_outer = BMO_slot_int_get(op->slots_in, "miter_outer");
37 const int miter_inner = BMO_slot_int_get(op->slots_in, "miter_inner");
38 const float spread = BMO_slot_float_get(op->slots_in, "spread");
39 const CurveProfile *custom_profile = static_cast<const CurveProfile *>(
40 BMO_slot_ptr_get(op->slots_in, "custom_profile"));
41 const int vmesh_method = BMO_slot_int_get(op->slots_in, "vmesh_method");
42
43 if (offset > 0) {
44 BMOIter siter;
45 BMEdge *e;
46 BMVert *v;
47
48 /* first flush 'geom' into flags, this makes it possible to check connected data,
49 * BM_FACE is cleared so we can put newly created faces into a bmesh slot. */
51
52 BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
54 }
55
56 BMO_ITER (e, &siter, op->slots_in, "geom", BM_EDGE) {
59 /* in case verts were not also included in the geom */
62 }
63 }
64
66 offset,
67 offset_type,
68 profile_type,
69 seg,
70 profile,
71 affect_type,
72 false,
73 clamp_overlap,
74 nullptr,
75 -1,
76 material,
77 loop_slide,
78 mark_seam,
79 mark_sharp,
80 harden_normals,
81 face_strength_mode,
82 miter_outer,
83 miter_inner,
84 spread,
85 custom_profile,
86 vmesh_method,
87 CustomData_get_offset_named(&bm->vdata, CD_PROP_FLOAT, "bevel_weight_vert"),
88 CustomData_get_offset_named(&bm->edata, CD_PROP_FLOAT, "bevel_weight_edge"));
89
93 }
94}
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)
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
#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:21
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
CustomData vdata
CustomData edata