24 #define USE_LOOP_CUSTOMDATA_MERGE
83 }
while ((
void)i++, (l_iter = l_iter->
next) != l_first);
92 for (i = 0; i < iface->
f->
len; i++) {
98 #ifdef USE_LOOP_CUSTOMDATA_MERGE
132 const bool is_flip = (l_a_inner->
next == l_a_outer);
133 BMLoop *l_a_inner_inset, *l_b_inner_inset;
151 e_a = l_a_inner->
prev->
e;
156 e_b = l_b_inner->
prev->
e;
164 if (l_a_inner_inset->
f == l_b_inner_inset->
f) {
194 const void *data_src;
209 if (is_flip ? (l_b_inner_inset->
e == l_a_inner_inset->
prev->
e) :
210 (l_a_inner_inset->
e == l_b_inner_inset->
prev->
e)) {
221 if (!
ELEM(l_iter, l_a_inner, l_b_inner, l_a_inner_inset, l_b_inner_inset)) {
251 const float thickness,
253 const bool use_even_offset,
254 const bool use_relative_offset,
255 const bool use_interpolate)
278 if (v_sep == v_other) {
285 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
307 if (use_interpolate ==
false) {
311 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
314 if (use_interpolate) {
328 const float *eno_prev = edge_nors[(i ? i : f->
len) - 1];
329 const float *eno_next = edge_nors[i];
338 if (use_even_offset) {
343 if (use_relative_offset) {
355 const float fac = depth * (use_relative_offset ? ((e_length_prev + e_length) * 0.5f) : 1.0f);
356 e_length_prev = e_length;
362 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
369 }
while ((
void)i++, ((l_iter = l_iter->
next) != l_first));
371 if (use_interpolate) {
389 }
while ((l_iter = l_iter->
next) != l_first);
419 if (use_interpolate) {
433 if (use_interpolate) {
441 if (use_interpolate) {
493 return ((tot_tag == 1) && (tot_untag >= 1)) ? l_tag :
NULL;
537 void **vert_lengths_p)
557 } *vert_lengths = *vert_lengths_p;
575 for (
int i = 0; i < 2; i++) {
579 if (vert_lengths[v_index].
count == 0) {
582 vert_lengths[v_index].count = 1;
585 BLI_assert(vert_lengths[v_index].length_accum != -1.0f);
596 while (stack_index--) {
597 BMVert *
v = vert_stack[stack_index];
602 vert_lengths[v_index].length_accum /= (
float)vert_lengths[v_index].
count;
603 vert_lengths[v_index].count = -1;
616 if (vert_lengths[v_other_index].
count >= 0) {
617 if (vert_lengths[v_other_index].
count == 0) {
620 BLI_assert(vert_lengths[v_index].length_accum >= 0.0f);
621 vert_lengths[v_other_index].count += 1;
622 vert_lengths[v_other_index].length_accum += vert_lengths[v_index].length_accum;
628 *vert_lengths_p = vert_lengths;
641 void **vert_lengths_p)
665 (use_outset ==
false);
667 const bool use_even_boundary = use_even_offset;
673 #ifdef USE_LOOP_CUSTOMDATA_MERGE
677 int edge_info_len = 0;
690 const bool use_vert_coords_orig = use_edge_rail;
699 if (use_interpolate) {
706 if (use_outset ==
false) {
758 if (use_vert_coords_orig) {
764 #define VERT_ORIG_STORE(_v) \
766 float *_co = BLI_memarena_alloc(vert_coords_orig, sizeof(float[3])); \
767 copy_v3_v3(_co, (_v)->co); \
768 BLI_ghash_insert(vert_coords, _v, _co); \
771 #define VERT_ORIG_GET(_v) (const float *)BLI_ghash_lookup_default(vert_coords, (_v), (_v)->co)
774 #define VERT_ORIG_REMOVE(_v) BLI_ghash_remove(vert_coords, (_v), NULL, NULL)
776 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
813 if (use_interpolate) {
819 if (iface_array[j] ==
NULL) {
822 iface_array[j] = iface;
832 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
849 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
850 for (
int j = 0; j < 2; j++) {
870 if (r_vout_len == 1) {
871 if (use_vert_coords_orig) {
878 for (k = 0; k < r_vout_len; k++) {
879 BMVert *v_split = vout[k];
882 int vert_edge_tag_tot = 0;
885 if (use_vert_coords_orig) {
893 if (vert_edge_tag_tot < 2) {
902 if (vert_edge_tag_tot != 0) {
905 if (vert_edge_tag_tot >= 2) {
930 if (use_edge_rail ==
false) {
933 else if (f_a != f_b) {
938 if (l_other_a->
v == l_other_b->
v) {
941 const float *co_other;
945 if (use_vert_coords_orig) {
949 co_other = l_other_a->
v->
co;
977 if (use_even_offset) {
994 if (use_relative_offset) {
996 (edge_info[vecpair[0]].
length + edge_info[vecpair[1]].
length) / 2.0f);
999 else if (vert_edge_tag_tot == 1) {
1000 const float *e_no_a = edge_info[vecpair[0]].
no;
1002 if (use_even_boundary) {
1033 if (
l->
prev->
v == v_split) {
1036 else if (
l->
next->
v == v_split) {
1039 else if (
l->
v == v_split) {
1063 if (use_even_offset) {
1074 if (use_relative_offset) {
1089 if (r_vout_len > 2) {
1100 if (v_glue ==
NULL) {
1105 if (use_vert_coords_orig) {
1119 if (use_vert_coords_orig) {
1124 if (use_interpolate) {
1125 for (i = 0; i < iface_array_len; i++) {
1126 if (iface_array[i]) {
1141 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1147 if (varr[0] == es->
e_new->
v1) {
1159 if (varr[0] == es->
e_new->
v1) {
1240 if (use_interpolate) {
1249 #ifdef USE_LOOP_CUSTOMDATA_MERGE
1250 if (has_math_ldata) {
1254 e_connect = l_a->
prev->
e;
1285 if (use_interpolate) {
1286 for (i = 0; i < iface_array_len; i++) {
1287 if (iface_array[i]) {
1300 if (depth != 0.0f) {
1306 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1310 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1311 const float *no = es->
l->
f->
no;
1315 for (i = 0, es = edge_info; i < edge_info_len; i++, es++) {
1331 BMLoop *l_iter, *l_first;
1336 }
while ((l_iter = l_iter->
next) != l_first);
1344 void *vert_lengths_p =
NULL;
1350 (use_relative_offset ?
1363 if (vert_lengths_p !=
NULL) {
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
bool CustomData_has_math(const struct CustomData *data)
bool CustomData_data_equals(int type, const void *data1, const void *data2)
void CustomData_data_copy_value(int type, const void *source, void *dest)
void CustomData_bmesh_copy_data(const struct CustomData *source, struct CustomData *dest, void *src_block, void **dest_block)
void CustomData_bmesh_free_block_data(struct CustomData *data, void *block)
bool CustomData_layer_has_math(const struct CustomData *data, int layer_n)
void CustomData_data_mix_value(int type, const void *source, void *dest, int mixmode, float mixfactor)
void CustomData_bmesh_free_block(struct CustomData *data, void **block)
#define BLI_array_alloca(arr, realsize)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
GHash * BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
MINLINE float shell_v3v3_normalized_to_dist(const float a[3], const float b[3])
MINLINE float shell_v3v3_mid_normalized_to_dist(const float a[3], const float b[3])
void axis_dominant_v3_to_m3(float r_mat[3][3], const float normal[3])
Normal to x,y matrix.
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
MINLINE bool compare_v3v3(const float a[3], const float b[3], float limit) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v3(float r[3])
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
struct MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
#define BLI_MEMARENA_STD_BUFSIZE
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
#define STACK_PUSH(stack, val)
#define STACK_DECLARE(stack)
#define STACK_SIZE(stack)
#define STACK_INIT(stack, stack_num)
#define STACK_REMOVE(stack, i)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
Read Guarded memory(de)allocation.
#define BM_FACE_FIRST_LOOP(p)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
void BM_face_copy_shared(BMesh *bm, BMFace *f, BMLoopFilterFunc filter_fn, void *user_data)
copies face loop data from shared adjacent faces.
void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src, void *ele_dst)
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.
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.
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)
void bmesh_kernel_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep, const bool copy_select)
Separate Edge.
bool BM_vert_splice(BMesh *bm, BMVert *v_dst, BMVert *v_src)
Splice Vert.
void bmesh_kernel_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, const bool copy_select)
Separate Vert.
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.
#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)
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.
#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)
ATTR_WARN_UNUSED_RESULT BMesh * bm
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BMVert * BM_face_loop_separate(BMesh *bm, BMLoop *l_sep)
Rip a single face from a vertex fan.
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.
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.
float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
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)
#define BMO_face_flag_enable(bm, e, oflag)
#define BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name)
void BM_edge_ordered_verts_ex(const BMEdge *edge, BMVert **r_v1, BMVert **r_v2, const BMLoop *edge_loop)
bool BM_edge_in_face(const BMEdge *e, const BMFace *f)
float BM_vert_calc_shell_factor(const BMVert *v)
bool BM_face_is_normal_valid(const BMFace *f)
BMLoop * BM_loop_other_vert_loop(BMLoop *l, BMVert *v)
Other Loop in Face Sharing a Vert.
float BM_edge_calc_length(const BMEdge *e)
BMLoop * BM_edge_other_loop(BMEdge *e, BMLoop *l)
void BM_edge_calc_face_tangent(const BMEdge *e, const BMLoop *e_loop, float r_tangent[3])
BMESH EDGE/FACE TANGENT.
BLI_INLINE bool BM_edge_is_manifold(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMLoop * l
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMLoop * l_b
ATTR_WARN_UNUSED_RESULT const BMVert * v
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)
void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
static void bm_interp_face_store(InterpFace *iface, BMesh *bm, BMFace *f, MemArena *interp_arena)
struct InterpFace InterpFace
#define VERT_ORIG_REMOVE(_v)
static void bm_interp_face_free(InterpFace *iface, BMesh *bm)
static float bm_edge_info_average_length_with_fallback(BMVert *v, SplitEdgeInfo *edge_info, BMesh *bm, void **vert_lengths_p)
void bmo_inset_individual_exec(BMesh *bm, BMOperator *op)
static BMLoop * bm_edge_is_mixed_face_tag(BMLoop *l)
static float bm_edge_info_average_length_fallback(BMVert *v_lookup, SplitEdgeInfo *edge_info, BMesh *bm, void **vert_lengths_p)
static float bm_edge_info_average_length(BMVert *v, SplitEdgeInfo *edge_info)
#define VERT_ORIG_GET(_v)
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)
struct SplitEdgeInfo SplitEdgeInfo
#define VERT_ORIG_STORE(_v)
SyclQueue void void size_t num_bytes void
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
T length(const vec_base< T, Size > &a)
struct BMLoop * radial_next
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]