48 BMEdge *e_a =
nullptr, *e_b =
nullptr;
53 float no_face[3], no_edge[3];
54 float tvec_a[3], tvec_b[3];
113 *r_va_other =
nullptr;
114 *r_vb_other =
nullptr;
121 if (
dot_v3v3(r_no, tvec_a) > 0.0f) {
148 const float offset_fac,
149 const float offset_fac_vg,
150 const bool use_replace,
151 const bool use_boundary,
152 const bool use_even_offset,
153 const bool use_relative_offset,
154 const bool use_crease,
155 const float crease_weight,
156 const int defgrp_index,
157 const bool defgrp_invert,
158 const short mat_offset,
163 const float ofs_orig = -(((-offset_fac + 1.0f) * 0.5f) * offset);
164 const float ofs_new = offset + ofs_orig;
165 const float ofs_mid = (ofs_orig + ofs_new) / 2.0f;
166 const float inset = offset / 2.0f;
170 const int cd_dvert_offset = (defgrp_index != -1) ?
173 const float offset_fac_vg_inv = 1.0f - offset_fac_vg;
186 BMVert **verts_boundary = use_boundary ?
190 float *verts_relfac = (use_relative_offset || (cd_dvert_offset != -1)) ?
196 int verts_loop_tot = 0;
204 float fac, fac_shell;
208 if (use_crease && cd_edge_crease_offset == -1) {
216 verts_src[i] = v_src;
235 verts_loop_tot += f_src->
len;
246 for (i = 0; i < totvert_orig; i++) {
247 v_src = verts_src[i];
252 if (use_relative_offset) {
256 verts_relfac[i] = 1.0f;
259 if (cd_dvert_offset != -1) {
265 defgrp_fac = 1.0f - defgrp_fac;
268 if (offset_fac_vg > 0.0f) {
269 defgrp_fac = (offset_fac_vg + (defgrp_fac * offset_fac_vg_inv));
272 verts_relfac[i] *= defgrp_fac;
275 fac *= verts_relfac[i];
281 if (offset == 0.0f) {
288 madd_v3_v3v3fl(verts_neg[i]->co, tvec, v_src->
no, (ofs_orig - ofs_mid) * fac);
289 madd_v3_v3v3fl(verts_pos[i]->co, tvec, v_src->
no, (ofs_new - ofs_mid) * fac);
294 verts_neg[i] =
nullptr;
295 verts_pos[i] =
nullptr;
299 if (use_relative_offset ==
false) {
304 if (use_relative_offset) {
331 if (use_even_offset) {
336 if (offset != 0.0f) {
345 for (i = 0; i < 2; i++) {
346 BMVert *v_boundary = v_pair[i];
362 fac *= verts_relfac[v_boundary_index];
366 if (use_even_offset) {
370 va_other->
co, v_boundary->
co, vb_other->
co, no_face)) *
376 if (offset != 0.0f) {
417 BMVert *v_neg1 = verts_neg[i_1];
418 BMVert *v_neg2 = verts_neg[i_2];
420 BMVert *v_pos1 = verts_pos[i_1];
421 BMVert *v_pos2 = verts_pos[i_2];
425 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
438 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
452 BMVert *v_b1 = verts_boundary[i_1];
453 BMVert *v_b2 = verts_boundary[i_2];
457 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
469 f_new->
mat_nr = std::clamp(f_new->
mat_nr + mat_offset, 0, mat_max);
514 MEM_delete(verts_boundary);
518 MEM_delete(verts_relfac);
528#define VERT_DUPE_TEST_ORIG(v) (verts_neg[BM_elem_index_get(v)] != nullptr)
529#define VERT_DUPE_TEST(v) (verts_pos[BM_elem_index_get(v)] != nullptr)
530#define VERT_DUPE_CLEAR(v) \
532 verts_pos[BM_elem_index_get(v)] = nullptr; \
550 if (mix_flag == (1 | 2)) {
553 }
while ((l_iter = l_iter->
next) != l_first);
555 if (mix_flag == (1 | 2)) {
559 }
while ((l_iter = l_iter->
next) != l_first);
564 for (i = 0; i < totvert_orig; i++) {
565 v_src = verts_src[i];
572#undef VERT_DUPE_TEST_ORIG
574#undef VERT_DUPE_CLEAR
578 for (i = 0; i < totvert_orig; i++) {
584 MEM_delete(verts_src);
585 MEM_delete(verts_neg);
586 MEM_delete(verts_pos);
587 MEM_delete(verts_loop);
CustomData interface, see also DNA_customdata_types.h.
Read Blender memory allocation and freeing.
#define BM_ELEM_CD_SET_FLOAT(ele, offset, f)
#define BM_FACE_FIRST_LOOP(p)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_index_get(ele)
#define BM_elem_flag_disable(ele, hflag)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
#define VERT_DUPE_CLEAR(v)
#define VERT_DUPE_TEST(v)
#define VERT_DUPE_TEST_ORIG(v)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
BMESH EDGE/FACE TANGENT.
MINLINE void copy_v3_v3(float r[3], const float a[3])
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
float BM_vert_calc_median_tagged_edge_length(const BMVert *v)
ATTR_WARN_UNUSED_RESULT const BMLoop * l
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void BM_vert_kill(BMesh *bm, BMVert *v)
static BMLoop * bm_edge_tag_faceloop(BMEdge *e)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
ATTR_WARN_UNUSED_RESULT const BMVert * v
static bool bm_loop_is_radial_boundary(BMLoop *l_first)
BMVert * BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, const eBMCreateFlag create_flag)
Main function for creating a new vertex.
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3])
BM_loop_calc_face_tangent.
float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
BMFace * BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4, const BMFace *f_example, const eBMCreateFlag create_flag)
Make Quad/Triangle.
float BKE_defvert_find_weight(const MDeformVert *dvert, int defgroup)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, StringRef name)
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
MINLINE void negate_v3(float r[3])
void BM_mesh_wireframe(BMesh *bm, const float offset, const float offset_fac, const float offset_fac_vg, const bool use_replace, const bool use_boundary, const bool use_even_offset, const bool use_relative_offset, const bool use_crease, const float crease_weight, const int defgrp_index, const bool defgrp_invert, const short mat_offset, const int mat_max, const bool use_tag)
float BM_loop_calc_face_angle(const BMLoop *l)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
MINLINE float normalize_v3(float n[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const StringRef name)
static void bm_vert_boundary_tangent(BMVert *v, float r_no[3], float r_no_face[3], BMVert **r_va_other, BMVert **r_vb_other)
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
MINLINE float shell_angle_to_dist(float angle)
struct BMLoop * radial_next
struct BMLoop * radial_next