Blender  V2.93
bmo_bevel.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
23 #include "BLI_utildefines.h"
24 
25 #include "BKE_curveprofile.h"
26 #include "DNA_curveprofile_types.h"
27 #include "bmesh.h"
28 #include "bmesh_tools.h"
29 
30 #include "intern/bmesh_operators_private.h" /* own include */
31 
33 {
34  const float offset = BMO_slot_float_get(op->slots_in, "offset");
35  const int offset_type = BMO_slot_int_get(op->slots_in, "offset_type");
36  const int profile_type = BMO_slot_int_get(op->slots_in, "profile_type");
37  const int seg = BMO_slot_int_get(op->slots_in, "segments");
38  const int affect_type = BMO_slot_int_get(op->slots_in, "affect");
39  const float profile = BMO_slot_float_get(op->slots_in, "profile");
40  const bool clamp_overlap = BMO_slot_bool_get(op->slots_in, "clamp_overlap");
41  const int material = BMO_slot_int_get(op->slots_in, "material");
42  const bool loop_slide = BMO_slot_bool_get(op->slots_in, "loop_slide");
43  const bool mark_seam = BMO_slot_bool_get(op->slots_in, "mark_seam");
44  const bool mark_sharp = BMO_slot_bool_get(op->slots_in, "mark_sharp");
45  const bool harden_normals = BMO_slot_bool_get(op->slots_in, "harden_normals");
46  const int face_strength_mode = BMO_slot_int_get(op->slots_in, "face_strength_mode");
47  const int miter_outer = BMO_slot_int_get(op->slots_in, "miter_outer");
48  const int miter_inner = BMO_slot_int_get(op->slots_in, "miter_inner");
49  const float spread = BMO_slot_float_get(op->slots_in, "spread");
50  const float smoothresh = BMO_slot_float_get(op->slots_in, "smoothresh");
51  const CurveProfile *custom_profile = BMO_slot_ptr_get(op->slots_in, "custom_profile");
52  const int vmesh_method = BMO_slot_int_get(op->slots_in, "vmesh_method");
53 
54  if (offset > 0) {
55  BMOIter siter;
56  BMEdge *e;
57  BMVert *v;
58 
59  /* first flush 'geom' into flags, this makes it possible to check connected data,
60  * BM_FACE is cleared so we can put newly created faces into a bmesh slot. */
62 
63  BMO_ITER (v, &siter, op->slots_in, "geom", BM_VERT) {
65  }
66 
67  BMO_ITER (e, &siter, op->slots_in, "geom", BM_EDGE) {
68  if (BM_edge_is_manifold(e)) {
70  /* in case verts were not also included in the geom */
73  }
74  }
75 
77  offset,
78  offset_type,
79  profile_type,
80  seg,
81  profile,
82  affect_type,
83  false,
84  clamp_overlap,
85  NULL,
86  -1,
87  material,
88  loop_slide,
89  mark_seam,
90  mark_sharp,
91  harden_normals,
92  face_strength_mode,
93  miter_outer,
94  miter_inner,
95  spread,
96  smoothresh,
97  custom_profile,
98  vmesh_method);
99 
103  }
104 }
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 struct 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 float smoothresh, const struct CurveProfile *custom_profile, const int vmesh_method)
Definition: bmesh_bevel.c:7454
@ BM_FACE
Definition: bmesh_class.h:386
@ BM_VERT
Definition: bmesh_class.h:383
@ BM_EDGE
Definition: bmesh_class.h:384
@ BM_ELEM_TAG
Definition: bmesh_class.h:484
#define BM_elem_flag_enable(ele, hflag)
Definition: bmesh_inline.h:28
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char htype, const char hflag)
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
#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)
void * BMO_slot_ptr_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.c:32
Material material
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]