32#define USE_LOOP_CUSTOMDATA_MERGE
62 void **blocks_l = iface->
blocks_l =
static_cast<void **
>(
64 void **blocks_v = iface->
blocks_v =
static_cast<void **
>(
66 float (*cos_2d)[2] = iface->
cos_2d =
static_cast<float (*)[2]
>(
80 mul_v2_m3v3(cos_2d[i],
static_cast<const float (*)[3]
>(axis_mat), l_iter->
v->
co);
81 blocks_l[i] =
nullptr;
86 blocks_v[i] =
nullptr;
91 }
while ((
void)i++, (l_iter = l_iter->
next) != l_first);
100 for (i = 0; i < iface->
f->
len; i++) {
106#ifdef USE_LOOP_CUSTOMDATA_MERGE
140 const bool is_flip = (l_a_inner->
next == l_a_outer);
141 BMLoop *l_a_inner_inset, *l_b_inner_inset;
159 e_a = l_a_inner->
prev->
e;
164 e_b = l_b_inner->
prev->
e;
177 if (l_a_inner_inset->
f == l_b_inner_inset->
f) {
208 const void *data_src;
223 if (is_flip ? (l_b_inner_inset->
e == l_a_inner_inset->
prev->
e) :
224 (l_a_inner_inset->
e == l_b_inner_inset->
prev->
e))
236 if (!
ELEM(l_iter, l_a_inner, l_b_inner, l_a_inner_inset, l_b_inner_inset)) {
269 const float thickness,
271 const bool use_even_offset,
272 const bool use_relative_offset,
273 const bool use_interpolate)
296 if (v_sep == v_other) {
303 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
310 BMVert *v_other = verts[i];
311 BMVert *v_other_next = verts[(i + 1) % f->
len];
325 if (use_interpolate ==
false) {
329 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
332 if (use_interpolate) {
346 const float *eno_prev = edge_nors[(i ? i : f->
len) - 1];
347 const float *eno_next = edge_nors[i];
356 if (use_even_offset) {
361 if (use_relative_offset) {
373 const float fac = depth * (use_relative_offset ? ((e_length_prev + e_length) * 0.5f) : 1.0f);
374 e_length_prev = e_length;
380 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
387 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
389 if (use_interpolate) {
407 }
while ((l_iter = l_iter->
next) != l_first);
437 if (use_interpolate) {
451 if (use_interpolate) {
459 if (use_interpolate) {
490 if (
l !=
nullptr) [[likely]] {
511 return ((tot_tag == 1) && (tot_untag >= 1)) ? l_tag :
nullptr;
555 void **vert_lengths_p)
575 } *vert_lengths =
static_cast<VertLengths *
>(*vert_lengths_p);
578 if (vert_lengths ==
nullptr) [[unlikely]] {
593 for (
int i = 0; i < 2; i++) {
597 if (vert_lengths[v_index].count == 0) {
600 vert_lengths[v_index].count = 1;
603 BLI_assert(vert_lengths[v_index].length_accum != -1.0f);
614 while (stack_index--) {
615 BMVert *
v = vert_stack[stack_index];
620 vert_lengths[v_index].length_accum /=
float(vert_lengths[v_index].count);
621 vert_lengths[v_index].count = -1;
634 if (vert_lengths[v_other_index].count >= 0) {
635 if (vert_lengths[v_other_index].count == 0) {
638 BLI_assert(vert_lengths[v_index].length_accum >= 0.0f);
639 vert_lengths[v_other_index].count += 1;
640 vert_lengths[v_other_index].length_accum += vert_lengths[v_index].length_accum;
645 MEM_delete(vert_stack);
646 *vert_lengths_p = vert_lengths;
659 void **vert_lengths_p)
683 (use_outset ==
false);
685 const bool use_even_boundary = use_even_offset;
691#ifdef USE_LOOP_CUSTOMDATA_MERGE
695 int edge_info_len = 0;
708 const bool use_vert_coords_orig = use_edge_rail;
716 if (use_interpolate) {
723 if (use_outset ==
false) {
776 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
813 if (use_interpolate) {
819 if (iface_array[j] ==
nullptr) {
823 iface_array[j] = iface;
833 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
850 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
851 for (
int j = 0; j < 2; j++) {
872 if (use_vert_coords_orig) {
873 vert_coords.
add(vout[0], vout[0]->co);
879 for (k = 0; k < vout_len; k++) {
880 BMVert *v_split = vout[k];
883 int vert_edge_tag_tot = 0;
886 if (use_vert_coords_orig) {
887 vert_coords.
add(v_split, v_split->
co);
895 if (vert_edge_tag_tot < 2) {
904 if (vert_edge_tag_tot != 0) {
907 if (vert_edge_tag_tot >= 2) {
932 if (use_edge_rail ==
false) {
935 else if (f_a != f_b) {
940 if (l_other_a->
v == l_other_b->
v) {
947 if (use_vert_coords_orig) {
951 co_other = l_other_a->
v->
co;
979 if (use_even_offset) {
996 if (use_relative_offset) {
998 (edge_info[vecpair[0]].
length + edge_info[vecpair[1]].
length) / 2.0f);
1001 else if (vert_edge_tag_tot == 1) {
1002 const float *e_no_a = edge_info[vecpair[0]].
no;
1004 if (use_even_boundary) {
1035 if (
l->
prev->
v == v_split) {
1038 else if (
l->
next->
v == v_split) {
1041 else if (
l->
v == v_split) {
1065 if (use_even_offset) {
1076 if (use_relative_offset) {
1102 if (v_glue ==
nullptr) {
1107 if (use_vert_coords_orig) {
1108 vert_coords.
remove(v_split);
1121 if (use_interpolate) {
1122 for (i = 0; i < iface_array_len; i++) {
1123 if (iface_array[i]) {
1138 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1139 BMVert *varr[4] = {
nullptr};
1144 if (varr[0] == es->
e_new->
v1) {
1156 if (varr[0] == es->
e_new->
v1) {
1237 if (use_interpolate) {
1246#ifdef USE_LOOP_CUSTOMDATA_MERGE
1247 if (has_math_ldata) {
1251 e_connect = l_a->
prev->
e;
1282 if (use_interpolate) {
1283 for (i = 0; i < iface_array_len; i++) {
1284 if (iface_array[i]) {
1290 MEM_delete(iface_array);
1297 if (depth != 0.0f) {
1298 float (*varr_co)[3];
1303 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1307 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1308 const float *no = es->
l->
f->
no;
1312 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1328 BMLoop *l_iter, *l_first;
1333 }
while ((l_iter = l_iter->
next) != l_first);
1341 void *vert_lengths_p =
nullptr;
1347 (use_relative_offset ?
1360 if (vert_lengths_p !=
nullptr) {
1369 MEM_delete(varr_co);
1372 MEM_delete(edge_info);
CustomData interface, see also DNA_customdata_types.h.
#define BLI_MEMARENA_STD_BUFSIZE
#define STACK_PUSH(stack, val)
#define STACK_DECLARE(stack)
#define STACK_SIZE(stack)
#define STACK_INIT(stack, stack_num)
#define STACK_REMOVE(stack, i)
Read Blender memory allocation and freeing.
#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_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 BMO_face_flag_enable(bm, e, oflag)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
bool add(const Key &key, const Value &value)
Value lookup_default(const Key &key, const Value &default_value) const
bool remove(const Key &key)
float length(VecOp< float, D >) RET
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
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 float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
BMFace * BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
MINLINE float shell_v3v3_normalized_to_dist(const float a[3], const float b[3])
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
bool BM_edge_in_face(const BMEdge *e, const BMFace *f)
static float bm_edge_info_average_length_with_fallback(BMVert *v, SplitEdgeInfo *edge_info, BMesh *bm, void **vert_lengths_p)
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void CustomData_data_mix_value(eCustomDataType type, const void *source, void *dest, int mixmode, float mixfactor)
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
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.
ATTR_WARN_UNUSED_RESULT const BMLoop * l
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
static void bmo_face_inset_individual(BMesh *bm, BMFace *f, MemArena *interp_arena, const float thickness, const float depth, const bool use_even_offset, const bool use_relative_offset, const bool use_interpolate)
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
bool CustomData_data_equals(eCustomDataType type, const void *data1, const void *data2)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
float BM_vert_calc_shell_factor(const BMVert *v)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void CustomData_bmesh_copy_block(CustomData &data, void *src_block, void **dst_block)
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 bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
float BM_edge_calc_length(const BMEdge *e)
void MEM_delete_void(void *vmemh)
void bmesh_kernel_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep, const bool copy_select)
Separate Edge.
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BM_edge_ordered_verts_ex(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2, const BMLoop *edge_loop)
static void bm_interp_face_store(InterpFace *iface, BMesh *bm, BMFace *f, MemArena *interp_arena)
MINLINE void mul_v3_fl(float r[3], float f)
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.
void CustomData_bmesh_free_block(CustomData *data, void **block)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, short oflag)
void CustomData_data_copy_value(eCustomDataType type, const void *source, void *dest)
void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
void BM_face_copy_shared(BMesh *bm, BMFace *f, BMLoopFilterFunc filter_fn, void *user_data)
copies face loop data from shared adjacent faces.
static float bm_edge_info_average_length(BMVert *v, SplitEdgeInfo *edge_info)
void bmesh_kernel_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, const bool copy_select)
Separate Vert.
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
MINLINE void negate_v3(float r[3])
static void bm_loop_customdata_merge(BMesh *bm, BMEdge *e_connect, BMLoop *l_a_outer, BMLoop *l_b_outer, BMLoop *l_a_inner, BMLoop *l_b_inner)
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src)
Splice Vert.
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BMVert * BM_face_loop_separate(BMesh *bm, BMLoop *l_sep)
Rip a single face from a vertex fan.
MINLINE void zero_v3(float r[3])
BMLoop * BM_edge_other_loop(BMEdge *e, BMLoop *l)
BMLoop * BM_loop_other_vert_loop(BMLoop *l, BMVert *v)
Other Loop in Face Sharing a Vert.
void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
void * BLI_memarena_alloc(MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
MINLINE float normalize_v3(float n[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
static BMLoop * bm_edge_is_mixed_face_tag(BMLoop *l)
MINLINE bool compare_v3v3(const float v1[3], const float v2[3], float limit) ATTR_WARN_UNUSED_RESULT
MINLINE float shell_v3v3_mid_normalized_to_dist(const float a[3], const float b[3])
ATTR_WARN_UNUSED_RESULT const BMVert * v2
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
void CustomData_bmesh_free_block_data(CustomData *data, void *block)
void BM_face_interp_from_face_ex(BMesh *bm, BMFace *f_dst, const BMFace *f_src, const bool do_vertex, const void **blocks_l, const void **blocks_v, float(*cos_2d)[2], float axis_mat[3][3])
Data Interpolate From Face.
void BM_elem_attrs_copy(BMesh *bm, const BMCustomDataCopyMap &map, const BMVert *src, BMVert *dst)
bool CustomData_has_math(const CustomData *data)
VecBase< float, 3 > float3
static void bm_interp_face_free(InterpFace *iface, BMesh *bm)
bool BM_face_is_normal_valid(const BMFace *f)
void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, char hflag, bool do_flush)
BMO_FLAG_BUFFER.
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
BMEdge * BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag)
Main function for creating a new edge.
bool CustomData_layer_has_math(const CustomData *data, int layer_n)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
static float bm_edge_info_average_length_fallback(BMVert *v_lookup, SplitEdgeInfo *edge_info, BMesh *bm, void **vert_lengths_p)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct BMLoop * radial_next
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]