72#include "RNA_prototypes.hh"
111 for (
int i = 0; i < verts_len; i++) {
115 for (
int i = 0; i < verts_len; i++) {
159#define MAX_SKIN_NODE_FRAMES 2
184 const float threshold = 0.0001f;
185 const float threshold_squared = threshold * threshold;
188 for (axis = 0; axis < 3; axis++) {
220 for (axis = 0; axis < 3; axis++) {
222 bool left =
false, right =
false;
225 for (i = 0; i < 4; i++) {
226 if (quad[i]->co[axis] < 0.0f) {
229 else if (quad[i]->co[axis] > 0.0f) {
247static bool skin_frame_find_contained_faces(
const Frame *frame, BMFace *fill_faces[2])
281 for (i = 0; i < totframe; i++) {
282 for (j = 0; j < 4; j++) {
311 for (i = 0; i < totframe; i++) {
312 Frame *frame = frames[i];
315 for (j = 0; j < 4; j++) {
316 if (frame->
verts[j] ==
v) {
327 for (i = 0; i < totframe; i++) {
328 Frame *frame = frames[i];
342 for (i = 0; i < totframe; i++) {
343 Frame *frame = frames[i];
351 if (skin_frame_find_contained_faces(frame, fill_faces)) {
396 float dist, side_a, side_b, thresh, mid[3];
399 for (i = 0; i < totframe; i++) {
403 for (j = 0; j < 4; j++) {
406 if (frames[i]->
merge[j].frame) {
410 for (k = i + 1; k < totframe; k++) {
414 thresh =
min_ff(side_a, side_b) / 2.0f;
417 for (
l = 0;
l < 4;
l++) {
418 if (frames[k]->
merge[
l].frame || frames[k]->
merge[
l].is_target) {
437 dist =
len_v3v3(frames[i]->co[j], frames[k]->co[
l]);
444 frames[k]->
merge[
l].frame = frames[i];
445 frames[k]->
merge[
l].corner = j;
446 frames[i]->
merge[j].is_target =
true;
463 int hull_frames_num, i;
465 (*tothullframe) = emap[
v].
size();
468 for (i = 0; i < emap[
v].
size(); i++) {
469 const int2 &edge = edges[emap[
v][i]];
473 hull_frames[hull_frames_num++] = &f->
frames[0];
497 for (i = 0; i < 2; i++) {
503 Frame *frame,
const float co[3],
const float radius[2],
const float mat[3][3],
float offset)
505 float rx[3], ry[3], rz[3];
524 for (i = 0; i < 4; i++) {
531 return (
v[0] +
v[1]) * 0.5f;
544 if (emap[
v].is_empty()) {
553 mat[0][2] = mat[1][0] = mat[2][1] = 1;
556 create_frame(&skin_nodes[
v].frames[0], vert_positions[
v], rad, mat, avg);
557 create_frame(&skin_nodes[
v].frames[1], vert_positions[
v], rad, mat, -avg);
566 if (emat[emap[
v][0]].origin !=
v) {
579 if (
dot_v3v3(mat[0], normal) < 0.0f) {
588 float axis[3],
angle, ine[3][3], oute[3][3];
591 e1 = &emat[emap[
v][0]];
592 e2 = &emat[emap[
v][1]];
634 e1 = &emat[emap[
v][0]];
635 e2 = &emat[emap[
v][1]];
646 create_frame(&skin_nodes[
v].frames[0], vert_positions[
v], rad, mat, avg);
653 create_frame(&skin_nodes[
v].frames[1], vert_positions[
v], rad, mat, avg);
661 create_frame(&skin_nodes[
v].frames[0], vert_positions[
v], rad, mat, 0);
674 for (
v = 0;
v < verts_num;
v++) {
675 if (emap[
v].size() <= 1) {
678 else if (emap[
v].size() == 2) {
697 const float z_up[3] = {0, 0, 1};
739 float axis[3],
angle;
740 int i,
e,
v, parent_v, parent_is_branch;
756 parent_is_branch = ((emap[parent_v].
size() > 2) || is_root[parent_v]);
762 if (parent_is_branch) {
763 calc_edge_mat(emat[
e].mat, vert_positions[parent_v], vert_positions[
v]);
767 sub_v3_v3v3(emat[
e].mat[0], vert_positions[
v], vert_positions[parent_v]);
777 for (i = 0; i < emap[
v].
size(); i++) {
780 stack_elem.
e = emap[
v][i];
791 bool *has_valid_root)
799 stack =
BLI_stack_new(
sizeof(stack_elem),
"build_edge_mats.stack");
806 for (
v = 0;
v < verts_num;
v++) {
808 if (emap[
v].size() >= 1) {
809 const int2 &edge = edges[emap[
v][0]];
816 for (i = 0; i < emap[
v].size(); i++) {
817 stack_elem.
e = emap[
v][i];
821 *has_valid_root =
true;
825 *has_valid_root =
true;
835 MEM_delete(visited_e);
859#define NUM_SUBDIVISIONS_MAX 128
862 const bool v1_branch = degree[edge[0]] > 2;
863 const bool v2_branch = degree[edge[1]] > 2;
864 int subdivisions_num;
868 if ((v1_branch && is_loose[edge[0]]) || (v2_branch && is_loose[edge[1]])) {
869 if (v1_branch && v2_branch) {
878 if (avg_radius != 0.0f) {
880 float subdivisions_num_fl;
881 const float edge_len =
len_v3v3(vert_positions[edge[0]], vert_positions[edge[1]]);
882 subdivisions_num_fl = (edge_len / avg_radius);
884 subdivisions_num = int(subdivisions_num_fl);
891 subdivisions_num = 0;
896 if (subdivisions_num < 2 && v1_branch && v2_branch) {
897 subdivisions_num = 2;
900 return subdivisions_num;
902#undef NUM_SUBDIVISIONS_MAX
918 const Span<float3> orig_vert_positions = orig->vert_positions();
920 const MDeformVert *origdvert = orig->deform_verts().data();
930 for (i = 0, subd_num = 0; i < orig_edge_num; i++) {
932 orig_vert_positions, orig_radius, orig_loose, orig_edges[i], degree);
934 subd_num += edge_subd[i];
939 orig, orig_vert_num + subd_num, orig_edge_num + subd_num, 0, 0);
948 outdvert =
result->deform_verts_for_write().data();
953 vert_interp.
copy(0, 0, orig_vert_num);
956 int result_edge_i = 0;
957 for (i = 0,
v = orig_vert_num; i < orig_edge_num; i++) {
963 VGroupData *vgroups =
nullptr, *vg;
966 const int2 &edge = orig_edges[i];
978 vg = &vgroups[vgroups_num];
994 if (isfinite(radrat)) {
995 radrat = (radrat + 1) / 2;
1003 for (j = 0; j < edge_subd[i]; j++,
v++) {
1004 float r = (j + 1) /
float(edge_subd[i] + 1);
1005 float t =
powf(r, radrat);
1009 out_vert_positions[
v], out_vert_positions[edge[0]], out_vert_positions[edge[1]], t);
1015 for (k = 0; k < vgroups_num; k++) {
1019 weight =
interpf(vg->w2, vg->w1, t);
1026 result_edges[result_edge_i][0] = u;
1027 result_edges[result_edge_i][1] =
v;
1033 MEM_delete(vgroups);
1037 result_edges[result_edge_i][0] = u;
1038 result_edges[result_edge_i][1] = edge[1];
1056 BMVert *verts[4] = {v1,
v2, v3, v4};
1075 {frame2[0], frame2[1], frame1[1], frame1[0]},
1076 {frame2[1], frame2[2], frame1[2], frame1[1]},
1077 {frame2[2], frame2[3], frame1[3], frame1[2]},
1078 {frame2[3], frame2[0], frame1[0], frame1[3]},
1089 normal_quad_v3(no, q[0][0]->co, q[0][1]->co, q[0][2]->co, q[0][3]->co);
1095 float cent_sides[4][3];
1099 for (i = 0; i < 4; i++) {
1104 for (i = 0; i < 4; i++) {
1115 for (i = 0; i < 4; i++) {
1117 add_poly(so, q[i][3], q[i][2], q[i][1], q[i][0]);
1120 add_poly(so, q[i][0], q[i][1], q[i][2], q[i][3]);
1131 for (i = 0; i < sn->
totframe; i++) {
1133 for (j = 0; j < 4; j++) {
1134 if (!f->
merge[j].frame) {
1149#define PRINT_HOLE_INFO 0
1162 const float ray_dir[3],
1166 BMVert *
v, *v_first =
nullptr, *v_prev =
nullptr;
1175 else if (v_prev != v_first) {
1180 ray_start, ray_dir, v_first->
co, v_prev->co,
v->
co, &dist,
nullptr);
1181 if (curhit && dist < best_dist) {
1190 *r_lambda = best_dist;
1201 int orig_len = f->
len;
1210 while (f->
len > n) {
1213 BMVert *v_safe, *v_merge;
1227 v_safe = shortest_edge->
v1;
1228 v_merge = shortest_edge->
v2;
1237 bool wrong_face =
false;
1239 for (i = 0; i < orig_len; i++) {
1240 if (orig_verts[i] == v_merge) {
1241 orig_verts[i] =
nullptr;
1265 BMFace *f, *isect_target_face, *center_target_face;
1267 float frame_center[3];
1268 float frame_normal[3];
1269 float best_isect_dist =
FLT_MAX;
1270 float best_center_dist =
FLT_MAX;
1281 isect_target_face = center_target_face =
nullptr;
1283 float dist, poly_center[3];
1288 if (hit && dist < best_isect_dist) {
1289 isect_target_face = f;
1290 best_isect_dist = dist;
1295 dist =
len_v3v3(frame_center, poly_center);
1296 if (dist < best_center_dist) {
1297 center_target_face = f;
1298 best_center_dist = dist;
1302 f = isect_target_face;
1303 if (!f || best_center_dist < best_isect_dist / 2) {
1304 f = center_target_face;
1311 printf(
"no good face found\n");
1326 for (i = 0; i < 4; i++) {
1327 for (j = 0; j < 4; j++) {
1328 orders[i][j] = (j + i) % 4;
1329 orders[i + 4][j] = 3 - ((j + i) % 4);
1334 for (i = 0; i < 8; i++) {
1338 for (j = 0; j < 4; j++) {
1342 if (
len < shortest_len) {
1344 memcpy(best_order, orders[i],
sizeof(
int[4]));
1355 int i, best_order[4];
1366 "extrude_discrete_faces faces=%hf",
1372 split_face =
nullptr;
1382 if (split_face->
len == 3) {
1394 "subdivide_edges edges=%he cuts=%i quad_corner_type=%i",
1399 else if (split_face->
len > 4) {
1408 reinterpret_cast<void **
>(vert_buf.
data()),
1420 if (split_face->
len != 4) {
1426 reinterpret_cast<void **
>(vert_buf.
data()),
1442 for (i = 0; i < 4; i++) {
1456 int i, attached[4], totattached = 0;
1459 for (i = 0; i < 4; i++) {
1461 attached[totattached++] = i;
1466 for (i = 0; i < totattached; i++) {
1489 for (i = 0; i < 3; i++) {
1490 if (!
ELEM(tri[1][i], tri[0][0], tri[0][1], tri[0][2])) {
1497 for (i = 0, j = 0; i < 3; i++, j++) {
1501 if (
ELEM(tri[0][i],
e->v1,
e->v2) &&
1502 (tri[0][(i + 1) % 3] ==
e->v1 || tri[0][(i + 1) % 3] ==
e->v2))
1516 add_poly(so, quad[0], quad[1], quad[2], quad[3]);
1538 if (adj[0]->
len == 3 && adj[1]->
len == 3) {
1604 Frame **hull_frames;
1605 int v, tothullframe;
1607 for (
v = 0;
v < verts_num;
v++) {
1609 if (!skin_nodes[
v].totframe) {
1612 MEM_delete(hull_frames);
1621 for (
v = 0;
v < verts_num;
v++) {
1625 for (i = 0; i < sn->
totframe; i++) {
1628 for (j = 0; j < 4; j++) {
1629 if (f->
merge[j].frame) {
1644 for (
v = 0;
v < verts_num;
v++) {
1648 for (j = 0; j < sn->
totframe; j++) {
1669 for (
v = 0;
v < verts_num;
v++) {
1677 for (i = 0; i < 4; i++) {
1716 a = &skin_nodes[edges[
e][0]];
1717 b = &skin_nodes[edges[
e][1]];
1733 for (i = 0; i < 4; i++) {
1734 v_order[i] = fr[1]->
verts[order[i]];
1760 for (i = 0; i < verts_num; i++) {
1761 for (j = 0; j < skin_nodes[i].
totframe; j++) {
1764 for (k = 0; k < 4; k++) {
1797 static_cast<float *
>(
1827 for (
v = 0;
v < verts_num;
v++) {
1832 Frame **hull_frames;
1836 if (!
build_hull(so, hull_frames, tothullframe)) {
1840 MEM_delete(hull_frames);
1884 for (
v = 0;
v < verts_num;
v++) {
1885 if (skin_nodes[
v].totframe) {
1927 int *orig =
static_cast<int *
>(
1944 bool has_valid_root =
false;
1952 const Span<float3> vert_positions = origmesh->vert_positions();
1954 const MDeformVert *dvert = origmesh->deform_verts().data();
1955 const int verts_num = origmesh->
verts_num;
1960 edges, verts_num, vert_to_edge_offsets, vert_to_edge_indices);
1962 emat =
build_edge_mats(is_root, vert_positions, verts_num, edges, vert_to_edge, &has_valid_root);
1963 skin_nodes =
build_frames(vert_positions, verts_num, radius, vert_to_edge, emat);
1967 bm =
build_skin(skin_nodes, verts_num, vert_to_edge, edges, dvert, smd, r_error);
1969 MEM_delete(skin_nodes);
1971 if (!has_valid_root) {
1992 if (!
mesh->attributes().contains(
"skin_modifier_radius")) {
2028 "No valid root vertex found (you need one per mesh island you want to skin)");
2059 layout.
prop(ptr,
"branch_smoothing",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
2062 row->
prop(ptr,
"use_x_symmetry", toggles_flag, std::nullopt, ICON_NONE);
2063 row->
prop(ptr,
"use_y_symmetry", toggles_flag, std::nullopt, ICON_NONE);
2064 row->
prop(ptr,
"use_z_symmetry", toggles_flag, std::nullopt, ICON_NONE);
2066 layout.
prop(ptr,
"use_smooth_shade",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
2068 row = &layout.
row(
false);
2069 row->
op(
"OBJECT_OT_skin_armature_create",
IFACE_(
"Create Armature"), ICON_NONE);
2070 row->
op(
"MESH_OT_customdata_skin_add", std::nullopt, ICON_NONE);
2072 row = &layout.
row(
false);
2073 op_ptr = row->
op(
"OBJECT_OT_skin_loose_mark_clear",
2079 op_ptr = row->
op(
"OBJECT_OT_skin_loose_mark_clear",
2086 layout.
op(
"OBJECT_OT_skin_root_mark",
IFACE_(
"Mark Root"), ICON_NONE);
2087 layout.
op(
"OBJECT_OT_skin_radii_equalize",
IFACE_(
"Equalize Radii"), ICON_NONE);
#define BLI_BITMAP_NEW(_num, _alloc_string)
#define BLI_BITMAP_TEST(_bitmap, _index)
#define BLI_BITMAP_ENABLE(_bitmap, _index)
A min-heap / priority queue ADT.
Read Blender memory allocation and freeing.
#define NUM_SUBDIVISIONS_MAX
#define MAX_SKIN_NODE_FRAMES
#define UNPACK4_EX(pre, a, post)
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
#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 BMO_ITER(ele, iter, slot_args, slot_name, restrict_flag)
#define BMO_FLAG_DEFAULTS
#define CD_MASK_MDEFORMVERT
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Span< NewT > constexpr cast() const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
void reinitialize(const int64_t new_size)
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
void copy(int src_index, int dst_index, int count) const
GSpanAttributeWriter convert_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
float dot(VecOp< float, D >, VecOp< float, D >) RET
OrientationBounds merge(const OrientationBounds &cone_a, const OrientationBounds &cone_b)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
ENUM_OPERATORS(Layer::Flags)
void count_indices(Span< int > indices, MutableSpan< int > counts)
int edge_other_vert(const int2 edge, const int vert)
GroupedSpan< int > build_vert_to_edge_map(Span< int2 > edges, int verts_num, Array< int > &r_offsets, Array< int > &r_indices)
@ ITEM_R_FORCE_BLANK_DECORATE
MINLINE float min_ff(float a, float b)
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool BMO_error_occurred_at_level(BMesh *bm, eBMOpErrorLevel level)
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)
ModifierTypeInfo modifierType_Skin
static Frame ** collect_hull_frames(int v, SkinNode *frames, GroupedSpan< int > emap, const Span< int2 > edges, int *tothullframe)
void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
float angle_normalized_v3v3(const float v1[3], const float v2[3]) ATTR_WARN_UNUSED_RESULT
static void skin_update_merged_vertices(SkinNode *skin_nodes, int verts_num)
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
static void skin_choose_quad_bridge_order(BMVert *a[4], BMVert *b[4], int best_order[4])
void * CustomData_bmesh_get(const CustomData *data, void *block, eCustomDataType type)
void BM_mesh_elem_toolflags_ensure(BMesh *bm)
void BKE_modifier_set_error(const Object *ob, ModifierData *md, const char *format,...) ATTR_PRINTF_FORMAT(3
void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float axis[3], float angle)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
int CustomData_number_of_layers(const CustomData *data, eCustomDataType type)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
void mid_v3_v3v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
MINLINE void copy_v3_v3(float r[3], const float a[3])
void BM_face_as_array_vert_quad(BMFace *f, BMVert *r_verts[4])
void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMLoop * l
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
static void vert_face_normal_mark_update(BMVert *v)
static void skin_set_orig_indices(Mesh *mesh)
void BLI_stack_pop(BLI_Stack *stack, void *dst) ATTR_NONNULL()
static void vert_array_face_normal_update(BMVert **verts, int verts_len)
static void skin_fix_hull_topology(BMesh *bm, SkinNode *skin_nodes, int verts_num)
static void init_data(ModifierData *md)
static bool quad_crosses_symmetry_plane(BMVert *quad[4], const SkinModifierData *smd)
bool BMO_op_initf(BMesh *bm, BMOperator *op, int flag, const char *fmt,...)
static Mesh * subdivide_base(const Mesh *orig)
BMLoop * BM_face_find_shortest_loop(BMFace *f)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
static BMesh * build_skin(SkinNode *skin_nodes, int verts_num, GroupedSpan< int > emap, const Span< int2 > edges, const MDeformVert *input_dvert, SkinModifierData *smd, eSkinErrorFlag *r_error)
ATTR_WARN_UNUSED_RESULT const BMVert * v
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.
static void vert_face_normal_mark_set(BMVert *v)
void BMO_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
BLI_INLINE BMVert * BM_edge_other_vert(BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static Mesh * base_skin(Mesh *origmesh, SkinModifierData *smd, eSkinErrorFlag *r_error)
BMLoop * BM_face_find_longest_loop(BMFace *f)
MINLINE void mul_v3_fl(float r[3], float f)
static void required_data_mask(ModifierData *, CustomData_MeshMasks *r_cddata_masks)
void BMO_push(BMesh *bm, BMOperator *op)
BMESH OPSTACK PUSH.
static float half_v2(const float v[2])
static BMFace * skin_hole_target_face(BMesh *bm, Frame *frame)
static int calc_edge_subdivisions(const Span< float3 > vert_positions, const VArray< float2 > &radius, const VArray< bool > &is_loose, const int2 &edge, const Span< int > degree)
@ SUBD_CORNER_STRAIGHT_CUT
bool BM_face_share_face_check(BMFace *f_a, BMFace *f_b)
void modifier_error_message_draw(ui::Layout &layout, PointerRNA *ptr)
void * BLI_heapsimple_pop_min(HeapSimple *heap) ATTR_NONNULL(1)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
float BM_face_calc_area(const BMFace *f)
static int connection_node_mat(float mat[3][3], int v, GroupedSpan< int > emap, EMat *emat)
static void create_frame(Frame *frame, const float co[3], const float radius[2], const float mat[3][3], float offset)
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
void BM_face_normal_update(BMFace *f)
static void skin_smooth_hulls(BMesh *bm, SkinNode *skin_nodes, int verts_num, const SkinModifierData *smd)
static void calc_frame_center(float center[3], const Frame *frame)
@ MOD_SKIN_SMOOTH_SHADING
float normal_quad_v3(float n[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_face)
static void panel_register(ARegionType *region_type)
@ SKIN_ERROR_NO_VALID_ROOT
static bool build_hull(SkinOutput *so, Frame **frames, int totframe)
bool BM_vert_in_face(BMVert *v, BMFace *f)
static EMat * build_edge_mats(const VArray< bool > &is_root, const Span< float3 > vert_positions, const int verts_num, const Span< int2 > edges, GroupedSpan< int > emap, bool *has_valid_root)
MINLINE void negate_v3(float r[3])
static float frame_len(const Frame *frame)
const BMAllocTemplate bm_mesh_allocsize_default
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
void BLI_heapsimple_free(HeapSimple *heap, HeapSimpleFreeFP ptrfreefp) ATTR_NONNULL(1)
static bool is_quad_symmetric(BMVert *quad[4], const SkinModifierData *smd)
bool BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
static void add_quad_from_tris(SkinOutput *so, BMEdge *e, BMFace *adj[2])
static Mesh * modify_mesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
bool isect_ray_tri_v3(const float ray_origin[3], const float ray_direction[3], const float v0[3], const float v1[3], const float v2[3], float *r_lambda, float r_uv[2])
void BKE_id_free(Main *bmain, void *idv)
@ eModifierTypeFlag_SupportsEditmode
@ eModifierTypeFlag_AcceptsMesh
static void skin_output_end_nodes(SkinOutput *so, SkinNode *skin_nodes, int verts_num)
static Mesh * final_skin(SkinModifierData *smd, Mesh *mesh, eSkinErrorFlag *r_error)
HeapSimple * BLI_heapsimple_new() ATTR_WARN_UNUSED_RESULT
BMOpSlot * BMO_slot_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *identifier)
BMESH OPSTACK GET SLOT.
static void output_frames(BMesh *bm, SkinNode *sn, const MDeformVert *input_dvert)
static BMFace * collapse_face_corners(BMesh *bm, BMFace *f, int n, BMVert **orig_verts)
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
BMEdge * BM_edge_exists(BMVert *v_a, BMVert *v_b)
MINLINE float normalize_v3(float n[3])
void BM_face_as_array_vert_tri(BMFace *f, BMVert *r_verts[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 mid_v3_v3v3(float r[3], const float a[3], const float b[3])
void BLI_heapsimple_insert(HeapSimple *heap, float value, void *ptr) ATTR_NONNULL(1)
static void connect_frames(SkinOutput *so, BMVert *frame1[4], BMVert *frame2[4])
static int isect_ray_poly(const float ray_start[3], const float ray_dir[3], BMFace *f, float *r_lambda)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
static void node_frames_init(SkinNode *nf, int totframe)
static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
void BM_face_kill(BMesh *bm, BMFace *f)
static void calc_edge_mat(float mat[3][3], const float a[3], const float b[3])
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t)
Mesh * BKE_mesh_from_bmesh_for_eval_nomain(BMesh *bm, const CustomData_MeshMasks *cd_mask_extra, const Mesh *me_settings)
bool is_quad_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3])
static void build_emats_stack(BLI_Stack *stack, BLI_bitmap *visited_e, EMat *emat, GroupedSpan< int > emap, const Span< int2 > edges, const VArray< bool > &is_root, const Span< float3 > vert_positions)
void BKE_defvert_add_index_notest(MDeformVert *dv, int defgroup, float weight)
bool BLI_heapsimple_is_empty(const HeapSimple *heap) ATTR_NONNULL(1)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
void BKE_defvert_copy(MDeformVert *dvert_dst, const MDeformVert *dvert_src)
void bmesh_edit_begin(BMesh *, BMOpTypeFlag)
BMesh Begin Edit.
Mesh * BKE_mesh_new_nomain_from_template(const Mesh *me_src, int verts_num, int edges_num, int faces_num, int corners_num)
static void panel_draw(const bContext *, Panel *panel)
MINLINE float interpf(float target, float origin, float t)
void BLI_stack_push(BLI_Stack *stack, const void *src) ATTR_NONNULL()
void zero_m3(float m[3][3])
static bool skin_output_branch_hulls(SkinOutput *so, SkinNode *skin_nodes, int verts_num, GroupedSpan< int > emap, const Span< int2 > edges)
void BMO_op_init(BMesh *bm, BMOperator *op, int flag, const char *opname)
BMESH OPSTACK INIT OP.
static void skin_hole_detach_partially_attached_frame(BMesh *bm, Frame *frame)
static void merge_frame_corners(Frame **frames, int totframe)
void BMO_op_finish(BMesh *bm, BMOperator *op)
BMESH OPSTACK FINISH OP.
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
bool BM_face_is_normal_valid(const BMFace *f)
void bmesh_edit_end(BMesh *bm, BMOpTypeFlag type_flag)
BMesh End Edit.
BLI_INLINE void BMO_slot_map_elem_insert(BMOperator *op, BMOpSlot *slot, const void *element, void *val)
static void add_poly(SkinOutput *so, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4)
BLI_Stack * BLI_stack_new(size_t elem_size, const char *description) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BMO_pop(BMesh *bm)
BMESH OPSTACK POP.
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
static void end_node_frames(int v, SkinNode *skin_nodes, const Span< float3 > vert_positions, const VArray< float2 > &radius, GroupedSpan< int > emap, EMat *emat)
int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len)
Iterator as Array.
static void skin_merge_close_frame_verts(SkinNode *skin_nodes, int verts_num, GroupedSpan< int > emap, const Span< int2 > edges)
static void quad_from_tris(BMEdge *e, BMFace *adj[2], BMVert *ndx[4])
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void BM_mesh_delete_hflag_tagged(BMesh *bm, const char hflag, const char htype)
static SkinNode * build_frames(const Span< float3 > vert_positions, int verts_num, const VArray< float2 > &radius, GroupedSpan< int > emap, EMat *emat)
static void skin_output_connections(SkinOutput *so, SkinNode *skin_nodes, const Span< int2 > edges)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
static void connection_node_frames(int v, SkinNode *skin_nodes, const Span< float3 > vert_positions, const VArray< float2 > &radius, GroupedSpan< int > emap, EMat *emat)
void * CustomData_bmesh_get_n(const CustomData *data, void *block, eCustomDataType type, int n)
void BKE_modifier_copydata_generic(const ModifierData *md, ModifierData *md_dst, int flag)
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct blender::Frame::@371212255071010251171227334026130127022052335373 merge[4]
SkinModifierSymmetryAxis symmetry_axes
Frame frames[MAX_SKIN_NODE_FRAMES]
MutableVArraySpan< T > span
void use_property_split_set(bool is_sep)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)