11#define DNA_DEPRECATED_ALLOW
80 ed->is_loose = is_loose;
81 ed->is_draw = is_draw;
89 if (x1->
v1 > x2->
v1) {
92 if (x1->
v1 < x2->
v1) {
95 if (x1->
v2 > x2->
v2) {
98 if (x1->
v2 < x2->
v2) {
108 const MFace *allface,
110 const MPoly *allpoly,
123 uint totedge_final = 0;
128 for (a = totface, mface = allface; a > 0; a--, mface++) {
132 else if (mface->
v3) {
148 for (a = totface, mface = allface; a > 0; a--, mface++) {
155 else if (mface->
v3) {
164 for (a = totedge,
ed = edsort; a > 1; a--,
ed++) {
166 if (
ed->v1 != (
ed + 1)->v1 ||
ed->v2 != (
ed + 1)->v2) {
174 for (a = totedge, edge = edges,
ed = edsort; a > 1; a--,
ed++) {
176 if (
ed->v1 != (
ed + 1)->v1 ||
ed->v2 != (
ed + 1)->v2) {
182 if (
ed->v1 + 1 !=
ed->v2) {
183 std::swap(edge->v1, edge->v2);
189 (
ed + 1)->is_draw |=
ed->is_draw;
200 hash.reserve(totedge_final);
201 for (edge_index = 0, edge = edges; edge_index < totedge_final; edge_index++, edge++) {
202 hash.add({edge->v1, edge->v2}, edge_index);
206 for (a = 0; a < faces_num; a++, mpoly++) {
208 int i = mpoly->totloop;
210 ml_next = allloop + mpoly->loopstart;
211 ml = &ml_next[i - 1];
214 ml->e =
hash.lookup({ml->v, ml_next->v});
222 *r_totedge = totedge_final;
236 static_cast<MLoop *
>(
240 mesh->totface_legacy,
252 edges =
static_cast<MEdge *
>(
const_cast<void *
>(
254 mesh->edges_num = totedge;
256 mesh->tag_topology_changed();
267 for (a =
b = 0, f = mfaces; a <
mesh->totface_legacy; a++, f++) {
270 memcpy(&mfaces[
b], f,
sizeof(mfaces[
b]));
278 mesh->totface_legacy =
b;
290 if (
mesh->cd_flag) [[unlikely]] {
301 for (
const MVert &vert : verts) {
302 if (vert.bweight_legacy != 0) {
303 mesh->cd_flag |= ME_CDFLAG_VERT_BWEIGHT;
308 for (
const MEdge &edge : edges) {
309 if (edge.bweight_legacy != 0) {
310 mesh->cd_flag |= ME_CDFLAG_EDGE_BWEIGHT;
311 if (
mesh->cd_flag & ME_CDFLAG_EDGE_CREASE) {
315 if (edge.crease_legacy != 0) {
316 mesh->cd_flag |= ME_CDFLAG_EDGE_CREASE;
317 if (
mesh->cd_flag & ME_CDFLAG_EDGE_BWEIGHT) {
330#define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol) \
332 MLoopCol *mloopcol__tmp = _mloopcol; \
333 const MCol *mcol__tmp = _mcol; \
334 mloopcol__tmp->r = mcol__tmp->b; \
335 mloopcol__tmp->g = mcol__tmp->g; \
336 mloopcol__tmp->b = mcol__tmp->r; \
337 mloopcol__tmp->a = mcol__tmp->a; \
352 MFace *mf = mface + findex;
354 for (
int i = 0; i < numTex; i++) {
373 for (
int i = 0; i < numCol; i++) {
376 const MCol *mcol =
static_cast<const MCol *
>(
392 float (*loop_normals)[3] =
static_cast<float (*)[3]
>(
394 const short (*tessloop_normals)[3] =
static_cast<short (*)[3]
>(
396 const int max = mf->
v4 ? 4 : 3;
398 for (
int i = 0; i <
max; i++, loop_normals++, tessloop_normals++) {
409 int tot = mf->
v4 ? 4 : 3;
427 const int side = int(
sqrtf(
float(fd->
totdisp / corners)));
428 const int side_sq = side * side;
430 for (
int i = 0; i < tot; i++, disps += side_sq, ld++) {
434 MEM_delete(ld->
disps);
438 "converted loop mdisps");
440 memcpy(ld->
disps, disps,
size_t(side_sq) *
sizeof(
float[3]));
443 memset(ld->
disps, 0,
size_t(side_sq) *
sizeof(
float[3]));
452 for (
int i = 0; i < fdata_legacy->
totlayer; i++) {
489 int i, j, totloop, faces_num, *polyindex;
495 faces_num = totface_i;
497 int *material_indices =
static_cast<int *
>(
499 if (material_indices ==
nullptr) {
503 bool *sharp_faces =
static_cast<bool *
>(
506 sharp_faces =
static_cast<bool *
>(
515 for (i = 0; i < totface_i; i++, mf++) {
516 totloop += mf->
v4 ? 4 : 3;
533 for (i = 0; i < totedge_i; i++) {
537 polyindex =
static_cast<int *
>(
544 for (i = 0; i < totface_i; i++, mf++, poly++) {
547 poly->totloop = mf->
v4 ? 4 : 3;
549 material_indices[i] = mf->
mat_nr;
550 sharp_faces[i] = (mf->
flag & ME_SMOOTH) == 0;
555 ml->e = eh.lookup({mf->v1, mf->v2}); \
574 id, fdata_legacy, totface_i, ldata, mface, totloop, i, poly->loopstart, numTex, numCol);
585 *r_faces_num = faces_num;
586 *r_totloop = totloop;
607 if (
mesh.active_color_attribute !=
nullptr) {
615 if (
mesh.default_color_attribute !=
nullptr) {
636 int a_num = 0, b_num = 0;
637# define LAYER_CMP(l_a, t_a, l_b, t_b) \
638 ((a_num += CustomData_number_of_layers(l_a, t_a)) == \
639 (b_num += CustomData_number_of_layers(l_b, t_b)))
658 return a_num ?
true : fallback;
686 for (
int i = 0; i < ldata->
totlayer; i++) {
702 if ((
mesh->totface_legacy != 0) && (
mesh->faces_num == 0)) [[unlikely]] {
709 const int tottex_original =
mesh->uv_map_names().size();
715 if (tottex_tessface != tottex_original || totcol_tessface != totcol_original) {
727 "%s: warning! Tessellation uvs or vcol data got out of sync, "
728 "had to reset!\n CD_MTFACE: %d != CD_PROP_FLOAT2: %d || CD_MCOL: %d != "
729 "CD_PROP_BYTE_COLOR: "
748 mesh->totface_legacy,
751 mesh->edges_for_write().data(),
752 static_cast<MFace *
>(
const_cast<void *
>(
758 mesh->attribute_storage.wrap().remove(
".corner_vert");
759 mesh->attribute_storage.wrap().remove(
".corner_edge");
804 mesh->totface_legacy,
807 mesh->edges_for_write().data(),
808 static_cast<MFace *
>(
const_cast<void *
>(
829#define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol) \
831 const MLoopCol *mloopcol__tmp = _mloopcol; \
832 MCol *mcol__tmp = _mcol; \
833 mcol__tmp->b = mloopcol__tmp->r; \
834 mcol__tmp->g = mloopcol__tmp->g; \
835 mcol__tmp->r = mloopcol__tmp->b; \
836 mcol__tmp->a = mloopcol__tmp->a; \
853 uint (*loopindices)[4],
862 const int numUV = uv_names.
size();
863 const int numCol = mloopcol_names.
size();
871 for (i = 0; i < numUV; i++) {
876 for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, texface++) {
877 for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
883 for (i = 0; i < numCol; i++) {
884 MCol(*mcol)[4] =
static_cast<MCol(*)[4]
>(
890 for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, mcol++) {
891 for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
903 for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, of++) {
904 for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
911 short (*face_normals)[4][3] =
static_cast<short (*)[4][3]
>(
913 const float (*loop_normals)[3] =
static_cast<const float (*)[3]
>(
916 for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, face_normals++) {
917 for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) {
927 if ((mface->
v3 || nr == 4) && mface->
v3 == mface->
v4) {
931 if ((mface->
v2 || mface->
v4) && mface->
v2 == mface->
v3) {
932 mface->
v3 = mface->
v4;
936 if (mface->
v1 == mface->
v2) {
937 mface->
v2 = mface->
v3;
938 mface->
v3 = mface->
v4;
948 mface->
v1 == mface->
v2 || mface->
v2 == mface->
v3 || mface->
v3 == mface->
v1)
956 mface->
v1 == mface->
v2 || mface->
v2 == mface->
v3 || mface->
v3 == mface->
v4 ||
957 mface->
v4 == mface->
v1 ||
959 mface->
v1 == mface->
v3 || mface->
v2 == mface->
v4)
967 if (mface->
v3 == 0) {
968 static int corner_indices[4] = {1, 2, 0, 3};
970 std::swap(mface->
v1, mface->
v2);
971 std::swap(mface->
v2, mface->
v3);
979 if (mface->
v3 == 0 || mface->
v4 == 0) {
980 static int corner_indices[4] = {2, 3, 0, 1};
982 std::swap(mface->
v1, mface->
v3);
983 std::swap(mface->
v2, mface->
v4);
998 const int totloop =
mesh.corners_num;
999 const int faces_num =
mesh.faces_num;
1001#define USE_TESSFACE_SPEEDUP
1002#define USE_TESSFACE_QUADS
1005#define TESSFACE_IS_QUAD 1
1011 int *mface_to_poly_map;
1013 int poly_index, mface_index;
1032 for (poly_index = 0; poly_index < faces_num; poly_index++) {
1033 const uint mp_loopstart =
uint(faces[poly_index].start());
1034 const uint mp_totloop =
uint(faces[poly_index].size());
1035 uint l1, l2, l3, l4;
1037 if (mp_totloop < 3) {
1041#ifdef USE_TESSFACE_SPEEDUP
1043# define ML_TO_MF(i1, i2, i3) \
1044 mface_to_poly_map[mface_index] = poly_index; \
1045 mf = &mface[mface_index]; \
1046 lidx = lindices[mface_index]; \
1048 l1 = mp_loopstart + i1; \
1049 l2 = mp_loopstart + i2; \
1050 l3 = mp_loopstart + i3; \
1051 mf->v1 = corner_verts[l1]; \
1052 mf->v2 = corner_verts[l2]; \
1053 mf->v3 = corner_verts[l3]; \
1059 mf->mat_nr = material_indices[poly_index]; \
1060 mf->flag = sharp_faces[poly_index] ? 0 : ME_SMOOTH; \
1061 mf->edcode = eMFace_EdgeCode{}; \
1065# define ML_TO_MF_QUAD() \
1066 mface_to_poly_map[mface_index] = poly_index; \
1067 mf = &mface[mface_index]; \
1068 lidx = lindices[mface_index]; \
1070 l1 = mp_loopstart + 0; \
1071 l2 = mp_loopstart + 1; \
1072 l3 = mp_loopstart + 2; \
1073 l4 = mp_loopstart + 3; \
1074 mf->v1 = corner_verts[l1]; \
1075 mf->v2 = corner_verts[l2]; \
1076 mf->v3 = corner_verts[l3]; \
1077 mf->v4 = corner_verts[l4]; \
1082 mf->mat_nr = material_indices[poly_index]; \
1083 mf->flag = sharp_faces[poly_index] ? 0 : ME_SMOOTH; \
1084 mf->edcode = eMFace_EdgeCode(TESSFACE_IS_QUAD); \
1087 else if (mp_totloop == 3) {
1091 else if (mp_totloop == 4) {
1092# ifdef USE_TESSFACE_QUADS
1104 const float *co_curr, *co_prev;
1108 float axis_mat[3][3];
1109 float (*projverts)[2];
1112 const uint totfilltri = mp_totloop - 2;
1114 if (arena ==
nullptr) [[unlikely]] {
1118 tris =
static_cast<uint(*)[3]
>(
1120 projverts =
static_cast<float (*)[2]
>(
1126 co_prev = positions[corner_verts[mp_loopstart + mp_totloop - 1]];
1127 for (j = 0; j < mp_totloop; j++) {
1128 const int vert = corner_verts[mp_loopstart + j];
1129 co_curr = positions[vert];
1140 for (j = 0; j < mp_totloop; j++) {
1141 const int vert = corner_verts[mp_loopstart + j];
1142 mul_v2_m3v3(projverts[j], axis_mat, positions[vert]);
1148 for (j = 0; j < totfilltri; j++) {
1149 uint *tri = tris[j];
1150 lidx = lindices[mface_index];
1152 mface_to_poly_map[mface_index] = poly_index;
1153 mf = &mface[mface_index];
1156 l1 = mp_loopstart + tri[0];
1157 l2 = mp_loopstart + tri[1];
1158 l3 = mp_loopstart + tri[2];
1160 mf->
v1 = corner_verts[l1];
1161 mf->
v2 = corner_verts[l2];
1162 mf->
v3 = corner_verts[l3];
1170 mf->
mat_nr = material_indices ? material_indices[poly_index] : 0;
1186 const int totface = mface_index;
1191 if (corner_tris_num != totface) [[likely]] {
1192 mface =
static_cast<MFace *
>(
1195 mface_to_poly_map,
sizeof(*mface_to_poly_map) *
size_t(totface)));
1218#ifdef USE_TESSFACE_QUADS
1220 for (mface_index = 0; mface_index < totface; mface_index++, mf++) {
1228 MEM_delete(lindices);
1230 mesh.totface_legacy = totface;
1232#undef USE_TESSFACE_SPEEDUP
1233#undef USE_TESSFACE_QUADS
1248 if (
mesh->faces_num &&
mesh->totface_legacy == 0) {
1261 using namespace bke;
1269 if (std::any_of(polys.
begin(),
1271 [](
const MPoly &poly) { return !(poly.flag_legacy & ME_SMOOTH); }))
1274 "sharp_face", AttrDomain::Face);
1276 for (const int i : range) {
1277 sharp_faces.span[i] = !(polys[i].flag_legacy & ME_SMOOTH);
1280 sharp_faces.finish();
1283 attributes.remove(
"sharp_face");
1295 if (
mesh->attributes().contains(
".sculpt_face_set")) {
1298 void *faceset_data =
nullptr;
1302 if (
layer.type == CD_SCULPT_FACE_SETS) {
1303 faceset_data =
layer.data;
1304 faceset_sharing_info =
layer.sharing_info;
1305 layer.data =
nullptr;
1306 layer.sharing_info =
nullptr;
1311 if (faceset_data !=
nullptr) {
1317 faceset_sharing_info);
1319 if (faceset_sharing_info !=
nullptr) {
1332 if (
mesh->attributes().contains(
"face_maps")) {
1335 int *
data =
nullptr;
1339 if (
layer.type == CD_FACEMAP) {
1341 sharing_info =
layer.sharing_info;
1342 layer.data =
nullptr;
1343 layer.sharing_info =
nullptr;
1354 if (sharing_info !=
nullptr) {
1360 if (
data[i] == -1) {
1368 for (
const auto item : groups.
items()) {
1372 attribute.span.fill_indices(item.value.as_span(),
true);
1390 for (
const auto [i, face_map] :
object.fmaps.enumerate()) {
1391 mesh->attributes_for_write().rename(
".temp_face_map_" + std::to_string(i), face_map.name);
1393 object.fmaps.free_no_destruct();
1407 if (
mesh->cd_flag & ME_CDFLAG_VERT_BWEIGHT) {
1408 float *weights =
static_cast<float *
>(
1411 weights[i] = verts[i].bweight_legacy / 255.0f;
1418 if (
mesh->cd_flag & ME_CDFLAG_EDGE_BWEIGHT) {
1419 float *weights =
static_cast<float *
>(
1422 weights[i] = edges[i].bweight_legacy / 255.0f;
1431 const int elems_num,
1432 const char *new_name)
1434 void *
data =
nullptr;
1438 if (
layer.type == old_type) {
1440 sharing_info =
layer.sharing_info;
1441 layer.data =
nullptr;
1442 layer.sharing_info =
nullptr;
1447 if (
data !=
nullptr) {
1449 &custom_data, new_type,
data, elems_num, new_name, sharing_info);
1451 if (sharing_info !=
nullptr) {
1458 if (!
mesh->attributes().contains(
"bevel_weight_vert")) {
1462 if (!
mesh->attributes().contains(
"bevel_weight_edge")) {
1483 if (
mesh->cd_flag & ME_CDFLAG_EDGE_CREASE) {
1484 float *creases =
static_cast<float *
>(
1487 creases[i] = edges[i].crease_legacy / 255.0f;
1494 if (!
mesh->attributes().contains(
"crease_vert")) {
1498 if (!
mesh->attributes().contains(
"crease_edge")) {
1512 using namespace bke;
1518 if (attributes.
contains(
"sharp_edge")) {
1521 if (std::any_of(edges.
begin(),
1523 [](
const MEdge &edge) { return edge.flag_legacy & ME_SHARP; }))
1526 "sharp_edge", AttrDomain::Edge);
1528 for (const int i : range) {
1529 sharp_edges.span[i] = edges[i].flag_legacy & ME_SHARP;
1532 sharp_edges.finish();
1544 using namespace bke;
1550 if (attributes.
contains(
".uv_seam")) {
1553 if (std::any_of(edges.
begin(),
1555 [](
const MEdge &edge) { return edge.flag_legacy & ME_SEAM; }))
1558 ".uv_seam", AttrDomain::Edge);
1560 for (const int i : range) {
1561 uv_seams.span[i] = edges[i].flag_legacy & ME_SEAM;
1576 using namespace bke;
1584 if (std::any_of(verts.
begin(),
1586 [](
const MVert &vert) { return vert.flag_legacy & ME_HIDE; }))
1589 ".hide_vert", AttrDomain::Point);
1591 for (const int i : range) {
1592 hide_vert.span[i] = verts[i].flag_legacy & ME_HIDE;
1599 const Span<MEdge> edges(mesh->medge, mesh->edges_num);
1600 if (std::any_of(edges.begin(),
1602 [](
const MEdge &edge) { return int(edge.flag_legacy) & ME_HIDE; }))
1604 SpanAttributeWriter<bool> hide_edge = attributes.lookup_or_add_for_write_only_span<
bool>(
1605 ".hide_edge", AttrDomain::Edge);
1606 threading::parallel_for(edges.index_range(), 4096, [&](IndexRange range) {
1607 for (const int i : range) {
1608 hide_edge.span[i] = int(edges[i].flag_legacy) & ME_HIDE;
1618 if (std::any_of(polys.begin(),
1620 [](
const MPoly &poly) { return int(poly.flag_legacy) & ME_HIDE; }))
1622 SpanAttributeWriter<bool> hide_poly = attributes.lookup_or_add_for_write_only_span<
bool>(
1623 ".hide_poly", AttrDomain::Face);
1624 threading::parallel_for(polys.index_range(), 4096, [&](IndexRange range) {
1625 for (const int i : range) {
1626 hide_poly.span[i] = int(polys[i].flag_legacy) & ME_HIDE;
1641 using namespace bke;
1650 polys.
begin(), polys.
end(), [](
const MPoly &poly) { return poly.mat_nr_legacy != 0; }))
1653 "material_index", AttrDomain::Face);
1655 for (const int i : range) {
1656 material_indices.span[i] = polys[i].mat_nr_legacy;
1659 material_indices.finish();
1671 using namespace bke;
1683 const int active_name_i = uv_names.
as_span().first_index_try(
1685 const int default_name_i = uv_names.
as_span().first_index_try(
1689 const MLoopUV *mloopuv =
static_cast<const MLoopUV *
>(
1696 for (const int i : range) {
1697 init |= mloopuv[i].flag;
1704 bool *pin =
nullptr;
1705 if (needed_boolean_attributes & MLOOPUV_PINNED) {
1710 for (const int i : range) {
1711 coords[i] = mloopuv[i].uv;
1714 for (
const int i : range) {
1715 pin[i] = mloopuv[i].flag & MLOOPUV_PINNED;
1720 CustomData_free_layer_named(&mesh->corner_data, uv_names[i]);
1725 CustomData_add_layer_named_with_data(
1726 &mesh->corner_data, CD_PROP_FLOAT2, coords, mesh->corners_num, uv_names[i],
nullptr);
1727 const int new_layer_i = CustomData_get_layer_index_n(
1730 CustomData_number_of_layers(&mesh->corner_data, CD_PROP_FLOAT2) - 1);
1731 uv_names[i] = mesh->corner_data.layers[new_layer_i].name;
1735 CustomData_add_layer_named_with_data(&mesh->corner_data,
1739 BKE_uv_map_pin_name_get(uv_names[i], buffer),
1744 if (active_name_i != -1) {
1749 uv_names[active_name_i]));
1751 if (default_name_i != -1) {
1756 uv_names[default_name_i]));
1768 using namespace bke;
1770 if (!
mesh->mvert || attributes.
contains(
".select_vert") || attributes.
contains(
".select_edge") ||
1771 attributes.
contains(
".select_poly"))
1778 verts.
begin(), verts.
end(), [](
const MVert &vert) { return vert.flag_legacy & SELECT; }))
1781 ".select_vert", AttrDomain::Point);
1783 for (const int i : range) {
1784 select_vert.span[i] = verts[i].flag_legacy & SELECT;
1787 select_vert.finish();
1791 const Span<MEdge> edges(mesh->medge, mesh->edges_num);
1792 if (std::any_of(edges.begin(),
1794 [](
const MEdge &edge) { return edge.flag_legacy & SELECT; }))
1796 SpanAttributeWriter<bool> select_edge = attributes.lookup_or_add_for_write_only_span<
bool>(
1797 ".select_edge", AttrDomain::Edge);
1798 threading::parallel_for(edges.index_range(), 4096, [&](IndexRange range) {
1799 for (const int i : range) {
1800 select_edge.span[i] = edges[i].flag_legacy & SELECT;
1803 select_edge.finish();
1810 if (std::any_of(polys.begin(),
1812 [](
const MPoly &poly) { return poly.flag_legacy & ME_FACE_SEL; }))
1814 SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_only_span<
bool>(
1815 ".select_poly", AttrDomain::Face);
1816 threading::parallel_for(polys.index_range(), 4096, [&](IndexRange range) {
1817 for (const int i : range) {
1818 select_poly.span[i] = polys[i].flag_legacy & ME_FACE_SEL;
1821 select_poly.finish();
1833 using namespace bke;
1834 const MVert *mvert =
static_cast<const MVert *
>(
1846 for (const int i : range) {
1847 positions[i] = verts[i].co_legacy;
1851 CustomData_free_layers(&mesh->vert_data, CD_MVERT);
1852 mesh->mvert =
nullptr;
1863 using namespace bke;
1864 const MEdge *medge =
static_cast<const MEdge *
>(
1876 for (const int i : range) {
1877 edges[i] = int2(legacy_edges[i].v1, legacy_edges[i].v2);
1881 CustomData_free_layers(&mesh->edge_data, CD_MEDGE);
1882 mesh->medge =
nullptr;
1897 if (!
mesh->active_color_attribute) {
1899 if (
data.layers[i].flag & CD_FLAG_COLOR_ACTIVE) {
1906 if (!
mesh->active_color_attribute) {
1912 if (!
mesh->active_color_attribute) {
1920 if (!
mesh->default_color_attribute) {
1922 if (
data.layers[i].flag & CD_FLAG_COLOR_RENDER) {
1929 if (!
mesh->default_color_attribute) {
1935 if (!
mesh->default_color_attribute) {
1943 active_from_flags(
mesh->vert_data);
1944 active_from_flags(
mesh->corner_data);
1945 active_from_indices(
mesh->vert_data);
1946 active_from_indices(
mesh->corner_data);
1948 default_from_flags(
mesh->vert_data);
1949 default_from_flags(
mesh->corner_data);
1950 default_from_indices(
mesh->vert_data);
1951 default_from_indices(
mesh->corner_data);
1979 for (const int i : range) {
1980 corner_verts[i] = loops[i].v;
1981 corner_edges[i] = loops[i].e;
1985 CustomData_free_layers(&mesh->corner_data, CD_MLOOP);
1997 if (polys[i].loopstart > polys[i + 1].loopstart) {
2006 if (
mesh->face_offset_indices) {
2018 offsets[i] = polys[i].loopstart;
2025 std::stable_sort(orig_indices.
begin(), orig_indices.
end(), [polys](
const int a,
const int b) {
2026 return polys[a].loopstart < polys[b].loopstart;
2035 offsets[i] = offset;
2036 offset += polys[orig_indices[i]].totloop;
2040 for (const int i : range) {
2041 CustomData_copy_data(&old_poly_data, &mesh->face_data, orig_indices[i], i, 1);
2048 CustomData_free_layers(&mesh->face_data, CD_MPOLY);
2062 &bmain, owner_library,
DATA_(
"Auto Smooth"),
"GeometryNodeTree");
2075 angle_data.
min = 0.0f;
2080 group_output->
location[0] = 480.0f;
2081 group_output->
location[1] = -100.0f;
2083 group_input_angle->
location[0] = -420.0f;
2084 group_input_angle->
location[1] = -300.0f;
2091 group_input_mesh->
location[0] = -60.0f;
2092 group_input_mesh->
location[1] = -100.0f;
2098 bNode *shade_smooth_edge =
node_add_node(
nullptr, *group,
"GeometryNodeSetShadeSmooth"_ustr);
2100 shade_smooth_edge->
location[0] = 120.0f;
2101 shade_smooth_edge->
location[1] = -100.0f;
2102 bNode *shade_smooth_face =
node_add_node(
nullptr, *group,
"GeometryNodeSetShadeSmooth"_ustr);
2104 shade_smooth_face->
location[0] = 300.0f;
2105 shade_smooth_face->
location[1] = -100.0f;
2106 bNode *edge_angle =
node_add_node(
nullptr, *group,
"GeometryNodeInputMeshEdgeAngle"_ustr);
2109 bNode *edge_smooth =
node_add_node(
nullptr, *group,
"GeometryNodeInputEdgeSmooth"_ustr);
2111 edge_smooth->
location[1] = -160.0f;
2112 bNode *face_smooth =
node_add_node(
nullptr, *group,
"GeometryNodeInputShadeSmooth"_ustr);
2113 face_smooth->
location[0] = -240.0f;
2114 face_smooth->
location[1] = -340.0f;
2118 boolean_and->
location[1] = -220.0f;
2119 bNode *less_than_or_equal =
node_add_node(
nullptr, *group,
"FunctionNodeCompare"_ustr);
2122 less_than_or_equal->
location[0] = -240.0f;
2123 less_than_or_equal->
location[1] = -180.0f;
2128 *less_than_or_equal,
2138 *less_than_or_equal,
2141 *less_than_or_equal,
2201 if (
nodes.size() != 10) {
2210 const std::array<StringRef, 10> idnames({
"NodeGroupOutput",
2213 "GeometryNodeSetShadeSmooth",
2214 "GeometryNodeSetShadeSmooth",
2215 "GeometryNodeInputMeshEdgeAngle",
2216 "GeometryNodeInputEdgeSmooth",
2217 "GeometryNodeInputShadeSmooth",
2218 "FunctionNodeBooleanMath",
2219 "FunctionNodeCompare"});
2220 for (
const int i :
nodes.index_range()) {
2221 if (
nodes[i]->idname != idnames[i]) {
2241 if (group.
links.count() != 9) {
2245 const std::array<int, 9> link_from_socket_indices({16, 15, 3, 36, 19, 5, 18, 11, 22});
2246 const std::array<int, 9> link_to_socket_indices({23, 0, 24, 20, 21, 8, 9, 12, 10});
2249 for (
const auto [i, link] : group.
links.enumerate()) {
2250 if (socket_indices.index_of(link.fromsock) != link_from_socket_indices[i]) {
2253 if (socket_indices.index_of(link.tosock) != link_to_socket_indices[i]) {
2269 md->node_group = get_node_group(
object.
id.lib);
2287 md->modifier.system_properties = system_props;
2290 return &md->modifier;
2297 using namespace bke;
2301 const auto add_node_group = [&](
Library *owner_library) {
2308 if (existing_group.
id.
lib != owner_library) {
2312 group_by_library.
add_new(owner_library, &existing_group);
2313 return &existing_group;
2319 group_by_library.
add_new(owner_library, new_group);
2328 const float angle =
mesh->smoothresh_legacy;
2336 bool has_custom_normals =
mesh->attribute_storage.wrap().lookup(
"custom_normal");
2337 if (has_custom_normals) {
2346 has_custom_normals =
true;
2351 has_custom_normals =
true;
2369 has_custom_normals =
true;
2378 if (has_custom_normals) {
2406 if (
mesh.attributes().contains(
".sculpt_mask")) {
2409 void *
data =
nullptr;
2413 if (
layer.type == CD_PAINT_MASK) {
2415 sharing_info =
layer.sharing_info;
2416 layer.data =
nullptr;
2417 layer.sharing_info =
nullptr;
2422 if (
data !=
nullptr) {
2426 if (sharing_info !=
nullptr) {
2434 void *
data =
nullptr;
2438 if (
layer.type == CD_FREESTYLE_EDGE) {
2440 sharing_info =
layer.sharing_info;
2441 layer.data =
nullptr;
2442 layer.sharing_info =
nullptr;
2447 if (
data !=
nullptr) {
2448 static_assert(
sizeof(FreestyleEdge) ==
sizeof(bool));
2449 static_assert(char(FREESTYLE_EDGE_MARK) == char(
true));
2455 mesh.attribute_storage.wrap().add(
2458 if (sharing_info !=
nullptr) {
2463 void *
data =
nullptr;
2467 if (
layer.type == CD_FREESTYLE_FACE) {
2469 sharing_info =
layer.sharing_info;
2470 layer.data =
nullptr;
2471 layer.sharing_info =
nullptr;
2476 if (
data !=
nullptr) {
2477 static_assert(
sizeof(FreestyleFace) ==
sizeof(bool));
2478 static_assert(char(FREESTYLE_FACE_MARK) == char(
true));
2484 mesh.attribute_storage.wrap().add(
2487 if (sharing_info !=
nullptr) {
2495 if (
mesh.attributes().contains(
"skin_modifier_radius")) {
2498 const void *
data =
nullptr;
2501 if (
layer.type == CD_MVERT_SKIN) {
2506 if (
data ==
nullptr) {
2509 const Span src(
static_cast<const MVertSkin *
>(
data),
mesh.verts_num);
2515 for (const int i : range) {
2516 radius_data[i] = float2(src[i].radius[0], src[i].radius[1]);
2517 root_data[i] = (src[i].flag & MVERT_SKIN_ROOT) != 0;
2518 loose_data[i] = (src[i].flag & MVERT_SKIN_LOOSE) != 0;
2525 auto add_array = [&]<
typename T>(
const StringRef name,
const AttrType type,
T *array_data) {
2526 Attribute::ArrayData
array{};
2529 array.sharing_info = ImplicitSharingPtr<>(implicit_sharing::info_for_mem_free(array_data));
2530 storage.add(name, AttrDomain::Point, type, std::move(
array));
2532 add_array(
"skin_modifier_radius", AttrType::Float2, radius_data);
2533 add_array(
"skin_modifier_root", AttrType::Bool, root_data);
2534 add_array(
"skin_modifier_loose", AttrType::Bool, loose_data);
2540 const int verts_num)
2549 for (
const int i : attr_write_data.
attributes.index_range()) {
2555 STREQ(dna_attr.
name,
"skin_modifier_radius"))
2563 attrs_to_remove.
add(
"skin_modifier_radius");
2566 STREQ(dna_attr.
name,
"skin_modifier_root"))
2574 attrs_to_remove.
add(
"skin_modifier_root");
2577 STREQ(dna_attr.
name,
"skin_modifier_loose"))
2585 attrs_to_remove.
add(
"skin_modifier_loose");
2588 if (radius_array ==
nullptr && radius_single ==
nullptr) {
2593 if (radius_single) {
2598 Span(
static_cast<const float2 *
>(radius_array->
data), verts_num));
2615 Span(
static_cast<const bool *
>(loose_array->
data), verts_num));
2623 for (
const int i : range) {
2624 legacy_data[i].radius[0] = radius[i][0];
2625 legacy_data[i].radius[1] = radius[i][1];
2626 legacy_data[i].radius[2] = 0.0f;
2627 legacy_data[i].flag = eMVertSkinFlag(0);
2629 legacy_data[i].flag |= MVERT_SKIN_ROOT;
2632 legacy_data[i].flag |= MVERT_SKIN_LOOSE;
2638 layer.type = CD_MVERT_SKIN;
2642 return a.
type <
b.type;
2658 if (
mesh.attributes().contains(
"custom_normal")) {
2661 void *
data =
nullptr;
2665 if (
layer.type == CD_CUSTOMLOOPNORMAL) {
2667 sharing_info =
layer.sharing_info;
2668 layer.data =
nullptr;
2669 layer.sharing_info =
nullptr;
2674 if (
data !=
nullptr) {
2682 if (sharing_info !=
nullptr) {
2693 const std::string uv_select_vert_name_shared =
".uv_select_vert";
2694 const std::string uv_select_edge_name_shared =
".uv_select_edge";
2695 const std::string uv_select_face_name_shared =
".uv_select_face";
2697 const std::string uv_select_vert_prefix =
".vs.";
2698 const std::string uv_select_edge_prefix =
".es.";
2700 const std::string uv_select_vert_name = uv_select_vert_prefix + name;
2701 const std::string uv_select_edge_name = uv_select_edge_prefix + name;
2708 if (uv_select_vert != -1 && uv_select_edge != -1) {
2714 STRNCPY_UTF8(
mesh.corner_data.layers[uv_select_vert].name, uv_select_vert_name_shared.c_str());
2715 STRNCPY_UTF8(
mesh.corner_data.layers[uv_select_edge].name, uv_select_edge_name_shared.c_str());
2722 uv_select_face_name_shared,
2726 if (
mesh.faces_num > 0) {
2729 static_cast<bool *
>(
mesh.corner_data.layers[uv_select_edge].data),
mesh.corners_num);
2731 for (const int face : range) {
2732 uv_select_face[face] = !uv_select_edge_data.slice(faces[face]).contains(false);
2746 StringRef layer_name = StringRef(
layer.name);
2747 if (layer_name.startswith(uv_select_vert_prefix) ||
2748 layer_name.startswith(uv_select_edge_prefix))
2754 for (
const StringRef name_to_remove : attributes_to_remove) {
2765 const int nulegacy_faces =
mesh->totface_legacy;
2771 MFace *mf = legacy_faces;
2772 for (
int i = 0; i < nulegacy_faces; i++, mf++) {
2785 const int numEdges = eh.
size();
2801 edge_attributes.
add(attr.name());
2804 for (
const StringRef name : edge_attributes) {
2805 mesh->attribute_storage.wrap().remove(name);
2809 data.size = numEdges;
2810 data.data =
reinterpret_cast<int2 *
>(vector_data);
2812 mesh->attribute_storage.wrap().add(
2814 mesh->edge_data = edgeData;
2815 mesh->edges_num = numEdges;
Generic geometry attributes built on CustomData.
CustomData interface, see also DNA_customdata_types.h.
#define BLI_MEMARENA_STD_BUFSIZE
#define STRNCPY_UTF8(dst, src)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define MAX_CUSTOMDATA_LAYER_NAME
#define MEM_realloc_uninitialized(vmemh, len)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Span< T > as_span() const
IndexRange index_range() const
void remove_user_and_delete_if_last() const
constexpr IndexRange drop_back(int64_t n) const
MutableSpan< T > construct_array(int64_t size, Args &&...args)
const Value * lookup_ptr(const Key &key) const
bool add(const Key &key, const Value &value)
void add_new(const Key &key, const Value &value)
MapType::ItemIterator items() const
void add(const Key &key, const Value &value)
constexpr T * data() const
constexpr T * end() const
constexpr T * begin() const
constexpr IndexRange index_range() const
LinearAllocator & allocator()
bool contains_as(const ForwardKey &key) const
constexpr const T * data() const
constexpr int64_t size() const
constexpr const T * end() const
constexpr IndexRange index_range() const
constexpr const T * begin() const
static VArray from_single(T value, const int64_t size)
static VArray from_span(Span< T > values)
void reserve(const int64_t n)
void add_new(const Key &key)
void append(const T &value)
VectorData< T, Allocator > release()
GAttributeReader lookup_or_default(StringRef name, AttrDomain domain, AttrType data_type, const void *default_value=nullptr) const
bool contains(StringRef name) const
GAttributeReader lookup(const StringRef name) const
AttrStorageType storage_type() const
const DataVariant & data() const
AttrDomain domain() const
StringRefNull name() const
AttrType data_type() const
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef name, AttrDomain domain, AttrType data_type)
Span< NewT > constexpr cast() const
IndexRange index_range() const
#define storage(slot, qualifiers)
#define LAYER_CMP(l_a, t_a, l_b, t_b)
#define MESH_MLOOPCOL_FROM_MCOL(_mloopcol, _mcol)
#define MESH_MLOOPCOL_TO_MCOL(_mloopcol, _mcol)
#define ML_TO_MF(i1, i2, i3)
void fill_index_range(MutableSpan< T > span, const T start=0)
std::unique_ptr< IDProperty, IDPropertyDeleter > create(StringRef prop_name, int32_t value, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_INT, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
static bNodeTree * add_auto_smooth_node_tree(Main &bmain, Library *owner_library)
void mesh_sculpt_mask_to_generic(Mesh &mesh)
void mesh_skin_to_legacy(AttributeStorage::BlendWriteData &attr_write_data, CustomData &vert_data, Vector< CustomDataLayer, 16 > &vert_layers, int verts_num)
void mesh_freestyle_marks_to_generic(Mesh &mesh)
void mesh_convert_customdata_to_storage(Mesh &mesh)
bNode * node_add_node(const bContext *C, bNodeTree &ntree, UString idname, std::optional< int > unique_identifier=std::nullopt)
static bool is_auto_smooth_node_tree(const bNodeTree &group)
void mesh_skin_to_generic(Mesh &mesh)
bool node_set_selected(bNode &node, bool select)
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
void mesh_custom_normals_to_generic(Mesh &mesh)
bNodeSocket * node_find_socket(bNode &node, eNodeSocketInOut in_out, UString identifier)
void mesh_uv_select_to_single_attribute(Mesh &mesh)
bNodeTree * node_tree_add_in_lib(Main *bmain, Library *owner_library, StringRefNull name, StringRefNull idname)
static VectorSet< const bNodeSocket * > build_socket_indices(const Span< const bNode * > nodes)
static ModifierData * create_auto_smooth_modifier(Object &object, const FunctionRef< bNodeTree *(Library *owner_library)> get_node_group, const float angle)
const ImplicitSharingInfo * info_for_mem_free(T *data)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Value parallel_reduce(IndexRange range, int64_t grain_size, const Value &identity, const Function &function, const Reduction &reduction)
bool CustomData_external_test(CustomData *data, eCustomDataType type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static VectorSet< StringRefNull > get_mloopcol_names(const Mesh &mesh)
void BKE_mesh_legacy_crease_to_generic(Mesh *mesh)
int CustomData_number_of_layers(const CustomData *data, eCustomDataType type)
MemArena * BLI_memarena_new(size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void CustomData_swap_corners(CustomData *data, int index, const int *corner_indices)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void * CustomData_get_layer_n_for_write(CustomData *data, eCustomDataType type, int n, int totelem)
bool CustomData_free_layers(CustomData *data, eCustomDataType type)
void CustomData_free_elem(CustomData *data, int index, int count)
const void * CustomData_add_layer_named_with_data(CustomData *data, eCustomDataType type, void *layer_data, int totelem, StringRef name, const ImplicitSharingInfo *sharing_info)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
void BKE_mesh_legacy_edge_crease_to_layers(Mesh *mesh)
void CustomData_external_add(CustomData *data, ID *id, eCustomDataType type, int totelem, const char *filepath)
static void to_edgesort(EdgeSort *ed, uint v1, uint v2, char is_loose, short is_draw)
void BKE_mesh_legacy_attribute_flags_to_strings(Mesh *mesh)
MINLINE void copy_v2_v2(float r[2], const float a[2])
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
void BKE_mesh_face_offsets_ensure_alloc(Mesh *mesh)
void BKE_mesh_legacy_sharp_edges_from_flags(Mesh *mesh)
@ eModifierType_WeightedNormal
@ eModifierType_NormalEdit
void mul_v2_m3v3(float r[2], const float M[3][3], const float a[3])
void BKE_mesh_do_versions_cd_flag_init(Mesh *mesh)
@ MOD_WEIGHTEDNORMAL_KEEP_SHARP
static void bm_corners_to_loops_ex(ID *id, CustomData *fdata_legacy, const int totface, CustomData *ldata, MFace *mface, int totloop, int findex, int loopstart, int numTex, int numCol)
@ GEO_NODE_ASSET_MODIFIER
void BLI_polyfill_calc_arena(const float(*coords)[2], unsigned int coords_num, int coords_sign, unsigned int(*r_tris)[3], struct MemArena *arena)
void BKE_mesh_tessface_clear(Mesh *mesh)
bool CustomData_free_layer_named(CustomData *data, StringRef name)
static bool check_matching_legacy_layer_counts(CustomData *fdata_legacy, CustomData *ldata, bool fallback)
void CustomData_copy_data(const CustomData *source, CustomData *dest, int source_index, int dest_index, int count)
void BKE_mesh_do_versions_convert_mfaces_to_mpolys(Mesh *mesh)
int CustomData_get_active_layer_index(const CustomData *data, eCustomDataType type)
void BKE_mesh_legacy_convert_verts_to_positions(Mesh *mesh)
void BKE_modifiers_persistent_uid_init(const Object &object, ModifierData &md)
int BKE_mesh_mface_index_validate(MFace *mface, CustomData *fdata_legacy, int mfindex, int nr)
void BKE_mesh_legacy_bevel_weight_to_generic(Mesh *mesh)
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, StringRef name)
static void CustomData_bmesh_do_versions_update_active_layers(CustomData *fdata_legacy, CustomData *corner_data)
MINLINE void normal_float_to_short_v3(short out[3], const float in[3])
void BKE_mesh_calc_edges_tessface(Mesh *mesh)
void BKE_modifier_unique_name(ListBaseT< ModifierData > *modifiers, ModifierData *md)
const char * CustomData_get_render_layer_name(const CustomData *data, eCustomDataType type)
void BKE_mesh_legacy_face_set_to_generic(Mesh *mesh)
void * CustomData_get_n_for_write(CustomData *data, eCustomDataType type, int index, int n, int totelem)
void BKE_mesh_legacy_sharp_faces_from_flags(Mesh *mesh)
int CustomData_get_render_layer(const CustomData *data, eCustomDataType type)
void CustomData_set_layer_render_index(CustomData *data, eCustomDataType type, int n)
void BKE_mesh_legacy_convert_loops_to_corners(Mesh *mesh)
const void * CustomData_add_layer_with_data(CustomData *data, eCustomDataType type, void *layer_data, int totelem, const ImplicitSharingInfo *sharing_info)
MINLINE void normal_short_to_float_v3(float out[3], const short in[3])
static void replace_custom_data_layer_with_named(CustomData &custom_data, const eCustomDataType old_type, const eCustomDataType new_type, const int elems_num, const char *new_name)
@ eSubsurfModifierFlag_UseCustomNormals
VecBase< int32_t, 2 > int2
void CustomData_init_layout_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
VecBase< float, 2 > float2
int multires_mdisp_corners(const MDisps *s)
static bool poly_loops_orders_match(const Span< MPoly > polys)
static void update_active_fdata_layers(Mesh &mesh, CustomData *fdata_legacy, CustomData *ldata)
void BKE_mesh_tessface_calc(Mesh *mesh)
void CustomData_reset(CustomData *data)
BMesh const char void * data
static void add_mface_layers(Mesh &mesh, CustomData *fdata_legacy, CustomData *ldata, int total)
void BKE_mesh_legacy_convert_flags_to_hide_layers(Mesh *mesh)
void BKE_mesh_legacy_convert_flags_to_selection_layers(Mesh *mesh)
void BKE_mesh_legacy_face_map_to_generic(Main *bmain)
ModifierData * BKE_modifier_new(int type)
static void mesh_loops_to_tessdata(Mesh &mesh, CustomData *fdata_legacy, CustomData *corner_data, MFace *mface, uint(*loopindices)[4], const int num_faces)
void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
void * CustomData_add_layer_named(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem, StringRef name)
void BKE_ntree_update_after_single_tree_change(Main &bmain, bNodeTree &modified_tree, const NodeTreeUpdateExtraParams ¶ms={})
@ MOD_BEVEL_HARDEN_NORMALS
static int vergedgesort(const void *v1, const void *v2)
void BKE_mesh_legacy_convert_polys_to_offsets(Mesh *mesh)
void BKE_mesh_legacy_convert_uvs_to_generic(Mesh *mesh)
void BKE_mesh_calc_edges_legacy(Mesh *mesh)
@ NODE_COMPARE_LESS_EQUAL
void BKE_mesh_legacy_convert_edges_to_generic(Mesh *mesh)
bool CustomData_free_layer(CustomData *data, eCustomDataType type, int index)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
static void convert_mfaces_to_mpolys(ID *id, CustomData *fdata_legacy, CustomData *ldata, CustomData *pdata, int totedge_i, int totface_i, int, int, int2 *edges, MFace *mface, int *r_totloop, int *r_faces_num)
const char * CustomData_get_active_layer_name(const CustomData *data, eCustomDataType type)
MINLINE int poly_to_tri_count(int poly_count, int corner_count)
MINLINE void zero_v3(float r[3])
void BKE_mesh_legacy_bevel_weight_to_layers(Mesh *mesh)
void BLI_insertlinkbefore(ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1)
int CustomData_get_named_layer_index(const CustomData *data, eCustomDataType type, StringRef name)
static void CustomData_to_bmeshpoly(CustomData *fdata_legacy, CustomData *ldata, int totloop)
static void move_face_map_data_to_attributes(Mesh *mesh)
void CustomData_set_layer_render(CustomData *data, eCustomDataType type, int n)
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])
void BKE_mesh_strip_loose_faces(Mesh *mesh)
void BKE_main_mesh_legacy_convert_auto_smooth(Main &bmain)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
ATTR_WARN_UNUSED_RESULT const BMVert * v2
const CustomData_MeshMasks CD_MASK_MESH
void CustomData_free(CustomData *data)
const char * CustomData_get_layer_name(const CustomData *data, eCustomDataType type, int n)
int CustomData_get_render_layer_index(const CustomData *data, eCustomDataType type)
MINLINE void add_newell_cross_v3_v3v3(float n[3], const float v_prev[3], const float v_curr[3])
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, StringRef name, int totelem)
void BKE_mesh_tessface_ensure(Mesh *mesh)
void CustomData_set_layer_active(CustomData *data, eCustomDataType type, int n)
int CustomData_get_active_layer(const CustomData *data, eCustomDataType type)
void CustomData_set_layer_active_index(CustomData *data, eCustomDataType type, int n)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
void * CustomData_get_for_write(CustomData *data, int index, eCustomDataType type, int totelem)
@ NODE_INTERFACE_SOCKET_OUTPUT
@ NODE_INTERFACE_SOCKET_INPUT
VecBase< float, 3 > float3
bool CustomData_has_layer_named(const CustomData *data, eCustomDataType type, StringRef name)
void CustomData_external_read(CustomData *data, StringRefNull basepath, ID *id, eCustomDataMask mask, int totelem)
int CustomData_get_named_layer(const CustomData *data, eCustomDataType type, StringRef name)
void BKE_mesh_legacy_uv_seam_from_flags(Mesh *mesh)
static void mesh_ensure_tessellation_customdata(Mesh *mesh)
static void mesh_tessface_calc(Mesh &mesh)
void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
ColorSceneLinearByteEncoded4b< eAlpha::Premultiplied > ColorGeometry4b
static void mesh_calc_edges_mdata(const MVert *, const MFace *allface, MLoop *allloop, const MPoly *allpoly, int, int totface, int, int faces_num, MEdge **r_medge, int *r_totedge)
void BLI_memarena_free(MemArena *ma) ATTR_NONNULL(1)
void axis_dominant_v3_to_m3_negate(float r_mat[3][3], const float normal[3])
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)
void BKE_mesh_legacy_convert_mpoly_to_material_indices(Mesh *mesh)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
CustomDataExternal * external
ListBaseT< bNodeTree > nodetrees
ListBaseT< Object > objects
struct bNodeTree * node_group
SubsurfModifierFlag flags
WeightedNormalModifierFlag flag
ListBaseT< bNodeLink > links
struct GeometryNodeAssetTraits * geometry_node_asset_traits
bNodeTreeInterface tree_interface
ListBaseT< bNodeSocket > outputs
Vector< blender::Attribute, 16 > & attributes
ImplicitSharingPtr sharing_info