123 if (name[0] ==
'.') {
138 return ELEM(name,
"position",
"uv_seam",
"material_index",
"sharp_face",
"sharp_edge");
147 const int size = face_verts.
size();
152 verts[i] = vtable[face_verts[i]];
153 edges[i] = etable[face_edges[i]];
180 return mesh.vert_data;
182 return mesh.edge_data;
184 return mesh.face_data;
186 return mesh.corner_data;
189 return mesh.vert_data;
219 std::array<int, CD_NUMTYPES> per_type_index;
220 per_type_index.
fill(0);
230 if (attr && attr->
domain() == domain) {
233 const auto &array_data = std::get<bke::Attribute::ArrayData>(attr->
data());
239 const auto &single_data = std::get<bke::Attribute::SingleData>(attr->
data());
247 const int mesh_layer_index =
251 if (mesh_layer_index != -1) {
259 per_type_index[type]++;
266 const int mesh_index,
271 if (info.mesh_data) {
289 if (attr.domain() != domain) {
327 float (*keyco)[3] =
nullptr;
343 for (
const int layer_index :
353 temporary_layers_to_delete.
append(std::string(name));
359 for (
const std::string &name : temporary_layers_to_delete) {
363 MEM_SAFE_DELETE(mesh_ldata.
external);
365 MEM_SAFE_DELETE(mesh_vdata.
layers);
366 MEM_SAFE_DELETE(mesh_edata.
layers);
367 MEM_SAFE_DELETE(mesh_pdata.
layers);
368 MEM_SAFE_DELETE(mesh_ldata.
layers);
371 if (
mesh->verts_num == 0) {
389 vert_normals =
mesh->vert_normals();
422 int tot_shape_keys = 0;
427 tot_shape_keys =
mesh->key->block.count();
447 if (is_new ==
false) {
450 Array<
const float (*)[3], 32> shape_key_table_buf(tot_shape_keys);
451 const float (**shape_key_table)[3] = tot_shape_keys ? shape_key_table_buf.
data() :
nullptr;
466 if (tot_shape_keys) {
470 if (!
mesh->key->uidgen) {
472 "%s had to generate shape key uid's in a situation we shouldn't need to! "
473 "(bmesh internal error)\n",
476 mesh->key->uidgen = 1;
478 block.
uid =
mesh->key->uidgen++;
483 if (actkey && actkey->
totelem ==
mesh->verts_num) {
484 keyco = params->
use_shapekey ?
static_cast<float (*)[3]
>(actkey->
data) :
nullptr;
492 for (i = 0, block =
mesh->key->block.first(); i < tot_shape_keys; block = block->next, i++) {
498 shape_key_table[i] =
static_cast<const float (*)[3]
>(block->
data);
521 const int cd_shape_keyindex_offset = is_new && (tot_shape_keys || params->
add_key_index) ?
526 const VArraySpan select_vert = *attributes.
lookup<
bool>(
".select_vert", AttrDomain::Point);
527 const VArraySpan select_edge = *attributes.
lookup<
bool>(
".select_edge", AttrDomain::Edge);
528 const VArraySpan select_poly = *attributes.
lookup<
bool>(
".select_poly", AttrDomain::Face);
529 const VArraySpan hide_vert = *attributes.
lookup<
bool>(
".hide_vert", AttrDomain::Point);
530 const VArraySpan hide_edge = *attributes.
lookup<
bool>(
".hide_edge", AttrDomain::Edge);
531 const VArraySpan hide_poly = *attributes.
lookup<
bool>(
".hide_poly", AttrDomain::Face);
532 const VArraySpan material_indices = *attributes.
lookup<
int>(
"material_index", AttrDomain::Face);
533 const VArraySpan sharp_faces = *attributes.
lookup<
bool>(
"sharp_face", AttrDomain::Face);
534 const VArraySpan sharp_edges = *attributes.
lookup<
bool>(
"sharp_edge", AttrDomain::Edge);
535 const VArraySpan uv_seams = *attributes.
lookup<
bool>(
"uv_seam", AttrDomain::Edge);
537 const VArraySpan uv_select_vert = *attributes.
lookup<
bool>(
".uv_select_vert",
539 const VArraySpan uv_select_edge = *attributes.
lookup<
bool>(
".uv_select_edge",
541 const VArraySpan uv_select_face = *attributes.
lookup<
bool>(
".uv_select_face", AttrDomain::Face);
543 const bool need_uv_select = is_new && (!uv_select_vert.is_empty() &&
544 !uv_select_edge.is_empty() && !uv_select_face.is_empty());
553 if (!hide_vert.is_empty() && hide_vert[i]) {
556 if (!select_vert.
is_empty() && select_vert[i]) {
567 if (cd_shape_keyindex_offset != -1) {
572 if (tot_shape_keys) {
574 for (
int j = 0; j < tot_shape_keys; j++, co_dst++) {
591 if (!uv_seams.is_empty() && uv_seams[i]) {
594 if (!hide_edge.is_empty() && hide_edge[i]) {
597 if (!select_edge.is_empty() && select_edge[i]) {
600 if (!(!sharp_edges.is_empty() && sharp_edges[i])) {
617 if (
mesh->mselect &&
mesh->totselect != 0) {
625 *
bm, corner_verts.
slice(face), corner_edges.
slice(face), vtable, etable);
630 if (f ==
nullptr) [[unlikely]] {
632 "%s: Warning! Bad face in mesh"
633 " \"%s\" at index %d!, skipping\n",
644 if (!(!sharp_faces.is_empty() && sharp_faces[i])) {
647 if (!hide_poly.is_empty() && hide_poly[i]) {
650 if (!select_poly.is_empty() && select_poly[i]) {
654 f->
mat_nr = material_indices.is_empty() ? 0 : material_indices[i];
655 if (i ==
mesh->act_face) {
659 int j = face.
start();
668 if (need_uv_select) {
669 if (uv_select_vert[j]) {
672 if (uv_select_edge[j]) {
678 }
while ((l_iter = l_iter->
next) != l_first);
682 if (need_uv_select) {
683 if (uv_select_face[i]) {
704 if (
mesh->mselect &&
mesh->totselect != 0) {
711 ele_p =
reinterpret_cast<BMElem **
>(&vtable[msel.
index]);
714 ele_p =
reinterpret_cast<BMElem **
>(&etable[msel.
index]);
717 ele_p =
reinterpret_cast<BMElem **
>(&ftable[msel.
index]);
723 if (*ele_p !=
nullptr) {
740 BMVert **vertMap =
nullptr;
749 if (cd_shape_keyindex_offset != -1) {
756 (vertMap[keyi] ==
nullptr))
764 if (i < old_verts_num) {
892 const bool active_shapekey_to_mvert)
897 bool actkey_has_layer =
false;
907 for (currkey = key->
block.first(); currkey; currkey = currkey->
next) {
914 if (currkey == actkey) {
915 actkey_has_layer =
true;
927 float (*ofs)[3] =
nullptr;
928 std::optional<Array<bool>> dependent;
933 (actkey_has_layer ==
true) &&
935 (cd_shape_keyindex_offset != -1) &&
977 bool update_vertex_coords_from_refkey =
false;
978 int cd_shape_offset_refkey = -1;
979 if (active_shapekey_to_mvert ==
false) {
980 if ((actkey != key->
refkey) && (cd_shape_keyindex_offset != -1)) {
982 if (refkey_uuid != -1) {
984 if (cd_shape_offset_refkey != -1) {
985 update_vertex_coords_from_refkey =
true;
991 for (
const auto [currkey_i, currkey] : key->
block.enumerate()) {
993 float (*currkey_data)[3];
996 const int cd_shape_offset = (currkey_uuid == -1) ?
1001 if (cd_shape_offset != -1) {
1002 const bool apply_offset = (ofs !=
nullptr) && (&currkey != actkey) &&
1003 (*dependent)[currkey_i];
1005 if (currkey.data && (currkey.totelem ==
bm->
totvert)) {
1012 currkey_data =
static_cast<float (*)[3]
>(currkey.data);
1018 if (&currkey == actkey) {
1021 if (update_vertex_coords_from_refkey) {
1026 eve, cd_shape_offset_refkey);
1049 if (currkey.data && (cd_shape_keyindex_offset != -1)) {
1051 "Found shape-key but no CD_SHAPEKEY layers to read from, "
1052 "using existing shape-key data where possible");
1056 "Found shape-key but no CD_SHAPEKEY layers to read from, "
1057 "using basis shape-key data");
1060 currkey_data =
static_cast<float (*)[3]
>(
1066 if ((currkey.data !=
nullptr) && (cd_shape_keyindex_offset != -1) &&
1068 (keyi < currkey.totelem))
1075 const float (*oldkey)[3] =
static_cast<const float (*)[3]
>(currkey.data);
1088 currkey.data = currkey_data;
1092 MEM_SAFE_DELETE(ofs);
1117 const int old_totvert)
1119 BMVert **vertMap =
nullptr;
1127 if (vertMap ==
nullptr) {
1131 if (ob.
par1 < old_totvert) {
1132 eve = vertMap[ob.
par1];
1137 if (ob.
par2 < old_totvert) {
1138 eve = vertMap[ob.
par2];
1143 if (ob.
par3 < old_totvert) {
1144 eve = vertMap[ob.
par3];
1150 if (ob.
data == id_cast<ID *>(&
mesh)) {
1155 if (vertMap ==
nullptr) {
1160 if (hmd->
indexar[i] < old_totvert) {
1161 eve = vertMap[hmd->
indexar[i]];
1179 MEM_delete(vertMap);
1203 std::array<int, CD_NUMTYPES> per_type_index;
1204 per_type_index.
fill(0);
1208 const int bm_layer_index =
1209 mesh_layer.
name[0] ==
'\0' ?
1215 if (bm_layer_index == -1) {
1230 per_type_index[type]++;
1233 if (attr.domain() != domain) {
1238 if (bm_layer_index == -1) {
1246 info.
type = cd_type;
1248 info.
mesh_data = std::get<bke::Attribute::ArrayData>(attr.data_for_write()).data;
1257 bool &need_select_vert,
1258 bool &need_hide_vert)
1267 hflag |= vert->head.hflag;
1275 bool &need_select_edge,
1276 bool &need_hide_edge,
1277 bool &need_sharp_edge,
1278 bool &need_uv_seams)
1304 bool &need_select_poly,
1305 bool &need_hide_poly,
1306 bool &need_sharp_face,
1307 bool &need_material_index,
1317 if (layer_index != -1) {
1318 layers.
append(layer_index);
1336 face_table[face_i] = face;
1339 need_material_index |= face->
mat_nr != 0;
1342 for ([[maybe_unused]]
const int i :
IndexRange(face->
len)) {
1344 loop_table[loop_i] = loop;
1359 loop_layers_not_to_copy.
append(pin_layers[i]);
1365 const int mesh_index,
1386 if (attr.domain() != domain) {
1389 if (skip_names.
contains(attr.name())) {
1392 attrs_.append(&attr);
1394 spans_.reinitialize(attrs_.size());
1395 can_be_single_.reinitialize(attrs_.size());
1396 for (
const int attr_i : attrs_.index_range()) {
1398 const auto &
data = std::get<bke::Attribute::ArrayData>(attrs_[attr_i]->
data());
1411 for (
const int attr_i : attrs_.index_range()) {
1412 if (!can_be_single_[attr_i].load(std::memory_order_relaxed)) {
1417 const T &first =
data.first();
1418 if (std::any_of(range.
begin(), range.
end(), [&](
const int i) { return data[i] != first; }))
1420 can_be_single_[attr_i].store(
false, std::memory_order_relaxed);
1429 for (
const int attr_i : attrs_.index_range()) {
1430 if (spans_[attr_i].is_empty()) {
1433 if (can_be_single_[attr_i]) {
1434 const GPointer value(spans_[attr_i].type(), spans_[attr_i][0]);
1450 std::atomic<bool> any_loose_vert =
false;
1451 const auto process_verts = [&](
const IndexRange range) {
1452 bool any_loose_vert_local =
false;
1453 for (
const int vert_i : range) {
1454 const BMVert &src_vert = *bm_verts[vert_i];
1457 any_loose_vert_local = any_loose_vert_local || src_vert.
e ==
nullptr;
1459 if (any_loose_vert_local) {
1460 any_loose_vert.store(
true, std::memory_order_relaxed);
1463 for (
const int vert_i : range) {
1468 for (
const int vert_i : range) {
1477 process_verts(range);
1478 single_checker.check_range(range);
1481 if (!any_loose_vert) {
1482 mesh.tag_loose_verts_none();
1497 std::atomic<bool> any_loose_edge =
false;
1498 const auto process_edges = [&](
const IndexRange range) {
1499 bool any_loose_edge_local =
false;
1500 for (
const int edge_i : range) {
1501 const BMEdge &src_edge = *bm_edges[edge_i];
1506 if (any_loose_edge_local) {
1507 any_loose_edge.store(
true, std::memory_order_relaxed);
1510 for (
const int edge_i : range) {
1515 for (
const int edge_i : range) {
1520 for (
const int edge_i : range) {
1525 for (
const int edge_i : range) {
1534 process_edges(range);
1535 single_checker.check_range(range);
1538 if (!any_loose_edge) {
1539 mesh.tag_loose_edges_none();
1557 const auto process_faces = [&](
const IndexRange range) {
1558 for (
const int face_i : range) {
1559 const BMFace &src_face = *bm_faces[face_i];
1564 for (
const int face_i : range) {
1569 for (
const int face_i : range) {
1573 if (!material_indices.
is_empty()) {
1574 for (
const int face_i : range) {
1575 material_indices[face_i] = bm_faces[face_i]->mat_nr;
1579 for (
const int face_i : range) {
1584 for (
const int face_i : range) {
1593 process_faces(range);
1594 single_checker.check_range(range);
1606 const int domain_size = attrs.
domain_size(domain);
1640 const bool need_uv_select = !uv_select_vert.
is_empty() && !uv_select_edge.
is_empty();
1642 const auto process_corners = [&](
const IndexRange range) {
1643 for (
const int loop_i : range) {
1644 const BMLoop &src_loop = *bm_loops[loop_i];
1650 if (need_uv_select) {
1651 for (
const int loop_i : range) {
1652 const BMLoop &src_loop = *bm_loops[loop_i];
1663 process_corners(range);
1664 single_checker.check_range(range);
1670 const int old_verts_num =
mesh->verts_num;
1674 if (attributes_active_name.empty()) {
1676 mesh->attributes_active_index = -1;
1683 mesh->totface_legacy = 0;
1686 mesh->act_face = -1;
1694 bool need_select_vert =
false;
1695 bool need_select_edge =
false;
1696 bool need_select_poly =
false;
1697 bool need_hide_vert =
false;
1698 bool need_hide_edge =
false;
1699 bool need_hide_poly =
false;
1700 bool need_material_index =
false;
1701 bool need_sharp_edge =
false;
1702 bool need_sharp_face =
false;
1703 bool need_uv_seams =
false;
1710 (
mesh->faces_num +
mesh->edges_num) > 1024,
1712 vert_table.reinitialize(bm->totvert);
1713 bm_vert_table_build(*bm, vert_table, need_select_vert, need_hide_vert);
1716 edge_table.reinitialize(bm->totedge);
1717 bm_edge_table_build(
1718 *bm, edge_table, need_select_edge, need_hide_edge, need_sharp_edge, need_uv_seams);
1721 face_table.reinitialize(bm->totface);
1722 loop_table.reinitialize(bm->totloop);
1723 bm_face_loop_table_build(*bm,
1729 need_material_index,
1730 loop_layers_not_to_copy);
1731 for (const int i : loop_layers_not_to_copy) {
1732 bm->ldata.layers[i].flag |= CD_FLAG_NOCOPY;
1743 if (bm_data.external) {
1744 mesh_data.external = MEM_dupalloc(bm_data.external);
1754 MEM_SAFE_DELETE(
mesh->active_uv_map_attribute);
1758 MEM_SAFE_DELETE(
mesh->default_uv_map_attribute);
1778 if (need_select_vert) {
1779 select_vert = attrs.lookup_or_add_for_write_only_span<
bool>(
".select_vert", AttrDomain::Point);
1781 if (need_hide_vert) {
1782 hide_vert = attrs.lookup_or_add_for_write_only_span<
bool>(
".hide_vert", AttrDomain::Point);
1784 if (need_select_edge) {
1785 select_edge = attrs.lookup_or_add_for_write_only_span<
bool>(
".select_edge", AttrDomain::Edge);
1787 if (need_sharp_edge) {
1788 sharp_edge = attrs.lookup_or_add_for_write_only_span<
bool>(
"sharp_edge", AttrDomain::Edge);
1790 if (need_uv_seams) {
1791 uv_seams = attrs.lookup_or_add_for_write_only_span<
bool>(
"uv_seam", AttrDomain::Edge);
1793 if (need_hide_edge) {
1794 hide_edge = attrs.lookup_or_add_for_write_only_span<
bool>(
".hide_edge", AttrDomain::Edge);
1796 if (need_select_poly) {
1797 select_poly = attrs.lookup_or_add_for_write_only_span<
bool>(
".select_poly", AttrDomain::Face);
1799 if (need_hide_poly) {
1800 hide_poly = attrs.lookup_or_add_for_write_only_span<
bool>(
".hide_poly", AttrDomain::Face);
1802 if (need_sharp_face) {
1803 sharp_face = attrs.lookup_or_add_for_write_only_span<
bool>(
"sharp_face", AttrDomain::Face);
1805 if (need_uv_select) {
1806 uv_select_vert = attrs.lookup_or_add_for_write_only_span<
bool>(
".uv_select_vert",
1807 AttrDomain::Corner);
1808 uv_select_edge = attrs.lookup_or_add_for_write_only_span<
bool>(
".uv_select_edge",
1809 AttrDomain::Corner);
1810 uv_select_face = attrs.lookup_or_add_for_write_only_span<
bool>(
".uv_select_face",
1813 if (need_material_index) {
1814 material_index = attrs.lookup_or_add_for_write_only_span<
int>(
"material_index",
1842 (
mesh->faces_num +
mesh->edges_num) > 1024,
1844 bm_to_mesh_verts(*mesh,
1847 vert_single_checker,
1852 bm, mesh->key, mesh->vert_positions_for_write(), params->active_shapekey_to_mvert);
1859 edge_single_checker,
1869 face_single_checker,
1873 uv_select_face.span,
1874 material_index.span);
1883 corner_single_checker,
1884 uv_select_vert.span,
1885 uv_select_edge.span);
1888 for (
const int i : loop_layers_not_to_copy) {
1894 if (params->calc_object_remap && (old_verts_num > 0)) {
1901 MEM_SAFE_DELETE(mesh->mselect);
1902 if (mesh->totselect != 0) {
1904 "Mesh selection history");
1907 for (
const auto [i, selected] :
bm->
selected.enumerate()) {
1908 if (selected.htype ==
BM_VERT) {
1909 mesh->mselect[i].type =
ME_VSEL;
1911 else if (selected.htype ==
BM_EDGE) {
1912 mesh->mselect[i].type =
ME_ESEL;
1914 else if (selected.htype ==
BM_FACE) {
1915 mesh->mselect[i].type =
ME_FSEL;
1924 if (params->update_shapekey_indices) {
1929 if (cd_shape_keyindex_offset != -1) {
1940 select_vert.finish();
1942 select_edge.finish();
1944 sharp_edge.finish();
1946 select_poly.finish();
1948 sharp_face.finish();
1949 uv_select_vert.finish();
1950 uv_select_edge.finish();
1951 uv_select_face.finish();
1952 material_index.finish();
1954 vert_single_checker.optimize_storage();
1955 edge_single_checker.optimize_storage();
1956 face_single_checker.optimize_storage();
1957 corner_single_checker.optimize_storage();
1961 if (!attributes_active_name.empty()) {
1962 BLI_assert(bke::allow_procedural_attribute_access(attributes_active_name));
1966 BLI_assert(mesh->attributes_active_index == -1);
1967 mesh->attributes_active_index = -1;
1974 const bool only_select_and_hide)
1987 mesh.totface_legacy = 0;
1992 const bool need_uv_select = !only_select_and_hide &&
1998 mesh.runtime->deformed_only =
true;
2000 const bool use_threading = (
mesh.faces_num +
mesh.edges_num) > 1024;
2005 bool need_select_vert =
false;
2006 bool need_select_edge =
false;
2007 bool need_select_poly =
false;
2008 bool need_hide_vert =
false;
2009 bool need_hide_edge =
false;
2010 bool need_hide_poly =
false;
2011 bool need_material_index =
false;
2012 bool need_sharp_edge =
false;
2013 bool need_sharp_face =
false;
2014 bool need_uv_seams =
false;
2030 bm, edge_table, need_select_edge, need_hide_edge, need_sharp_edge, need_uv_seams);
2041 need_material_index,
2042 loop_layers_not_to_copy);
2043 for (
const int i : loop_layers_not_to_copy) {
2049 if (only_select_and_hide) {
2050 need_material_index =
false;
2051 need_sharp_edge =
false;
2052 need_sharp_face =
false;
2053 need_uv_seams =
false;
2070 MEM_SAFE_DELETE(
mesh.active_uv_map_attribute);
2075 MEM_SAFE_DELETE(
mesh.default_uv_map_attribute);
2097 if (need_select_vert) {
2100 if (need_hide_vert) {
2103 if (need_select_edge) {
2106 if (need_sharp_edge) {
2109 if (need_uv_seams) {
2112 if (need_hide_edge) {
2115 if (need_select_poly) {
2118 if (need_hide_poly) {
2121 if (need_sharp_face) {
2124 if (need_uv_select) {
2126 AttrDomain::Corner);
2128 AttrDomain::Corner);
2132 if (need_material_index) {
2166 vert_single_checker,
2174 edge_single_checker,
2184 face_single_checker,
2188 uv_select_face.
span,
2189 material_index.
span);
2198 corner_single_checker,
2199 uv_select_vert.
span,
2200 uv_select_edge.
span);
2201 for (
const int i : loop_layers_not_to_copy) {
2231 if (cd_mask_extra !=
nullptr) {
Generic geometry attributes built on CustomData.
CustomData interface, see also DNA_customdata_types.h.
#define BLI_SCOPED_DEFER(function_to_defer)
#define CLOG_WARN(clg_ref,...)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define POINTER_OFFSET(v, ofs)
#define BM_ELEM_CD_GET_BOOL(ele, offset)
#define BM_ELEM_CD_GET_INT(ele, offset)
#define BM_ELEM_CD_SET_INT(ele, offset, f)
#define BM_ELEM_SELECT_UV_EDGE
#define BM_FACE_FIRST_LOOP(p)
#define BM_ELEM_CD_GET_VOID_P(ele, offset)
#define BM_elem_index_get(ele)
#define BM_elem_index_set(ele, index)
#define BM_elem_flag_test(ele, hflag)
#define BM_elem_flag_enable(ele, hflag)
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
#define BM_select_history_store_notest(bm, ele)
#define MAX_CUSTOMDATA_LAYER_NAME
#define MEM_realloc_uninitialized(vmemh, len)
IndexRange index_range() const
void reinitialize(const int64_t new_size)
void check_range(const IndexRange range)
AttrSingleValueChecker(bke::AttributeStorage &storage, const bke::AttrDomain domain, const Set< StringRef > &skip_names)
static AttributeOwner from_id(ID *id)
constexpr Iterator end() const
constexpr IndexRange()=default
constexpr int64_t start() const
constexpr Iterator begin() const
constexpr bool is_empty() const
constexpr IndexRange index_range() const
bool contains(const Key &key) const
constexpr Span slice(int64_t start, int64_t size) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
void append(const T &value)
IndexRange index_range() const
void fill(const T &value) const
GAttributeReader lookup(const StringRef name) const
int domain_size(const AttrDomain domain) const
AttrStorageType storage_type() const
const DataVariant & data() const
AttrDomain domain() const
AttrType data_type() const
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef name, AttrDomain domain, AttrType data_type)
constexpr IndexRange drop_front(int64_t n) const
constexpr IndexRange take_front(int64_t n) const
constexpr bool is_empty() const
constexpr bool is_empty() const
IndexRange index_range() const
#define storage(slot, qualifiers)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void to_static_type(const CPPType &cpp_type, Fn &&fn)
std::optional< eCustomDataType > attr_type_to_custom_data_type(AttrType attr_type)
std::optional< AttrType > custom_data_type_to_attr_type(eCustomDataType data_type)
const CPPType & attribute_type_to_cpp_type(AttrType type)
void parallel_invoke(Functions &&...functions)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
std::optional< StringRefNull > BKE_attributes_active_name_get(AttributeOwner &owner)
void * MEM_new_uninitialized(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
int CustomData_get_offset(const CustomData *data, eCustomDataType type)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
unsigned __int64 uint64_t
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void multires_topology_changed(Mesh *mesh)
void CustomData_bmesh_alloc_block(CustomData *data, void **block)
int CustomData_number_of_layers(const CustomData *data, eCustomDataType type)
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
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
void BKE_mesh_face_offsets_ensure_alloc(Mesh *mesh)
void BM_mesh_bm_to_me_only_select_and_hide(BMesh &bm, Mesh &mesh)
int CustomData_get_n_offset(const CustomData *data, eCustomDataType type, int n)
size_t CustomData_get_elem_size(const CustomDataLayer *layer)
static void bm_to_mesh_edges(Mesh &mesh, const Span< const BMEdge * > bm_edges, const Span< BMeshToMeshLayerInfo > copy_info, AttrSingleValueChecker &single_checker, MutableSpan< bool > select_edge, MutableSpan< bool > hide_edge, MutableSpan< bool > sharp_edge, MutableSpan< bool > uv_seams)
bool CustomData_bmesh_merge_layout(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, BMesh *bm, char htype)
void BKE_attributes_active_set(AttributeOwner &owner, StringRef name)
int CustomData_get_layer_index(const CustomData *data, eCustomDataType type)
static const CustomData & get_bm_custom_data(const BMesh &bm, const bke::AttrDomain domain)
bool CustomData_free_layer_named(CustomData *data, StringRef name)
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.
BMFace * BM_face_create(BMesh *bm, BMVert *const *verts, BMEdge *const *edges, const int len, const BMFace *f_example, const eBMCreateFlag create_flag)
void MEM_delete_void(void *vmemh)
void BM_mesh_bm_to_me_for_eval(BMesh &bm, Mesh &mesh, const CustomData_MeshMasks *cd_mask_extra)
std::optional< Array< bool > > BKE_keyblock_get_dependent_keys(const Key *key, int index)
bool DEG_is_original(const T *id)
const char * CustomData_get_render_layer_name(const CustomData *data, eCustomDataType type)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *mesh, const BMeshFromMeshParams *params)
Mesh -> BMesh.
static BMFace * bm_face_create_from_mpoly(BMesh &bm, Span< int > face_verts, Span< int > face_edges, Span< BMVert * > vtable, Span< BMEdge * > etable)
static void bm_to_mesh_shape(BMesh *bm, Key *key, MutableSpan< float3 > positions, const bool active_shapekey_to_mvert)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
static Vector< BMeshToMeshLayerInfo > bm_to_mesh_copy_info_calc(const CustomData &bm_data, const bke::AttrDomain domain, Mesh &mesh)
static void bm_vert_table_build(BMesh &bm, MutableSpan< const BMVert * > table, bool &need_select_vert, bool &need_hide_vert)
VecBase< int32_t, 2 > int2
void CustomData_init_layout_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void CustomData_data_set_default_value(eCustomDataType type, void *elem)
static void assert_bmesh_has_no_mesh_only_attributes(const BMesh &bm)
static void bm_edge_table_build(BMesh &bm, MutableSpan< const BMEdge * > table, bool &need_select_edge, bool &need_hide_edge, bool &need_sharp_edge, bool &need_uv_seams)
void BM_face_normal_update(BMFace *f)
static void bmesh_block_copy_to_mesh_attributes(const Span< BMeshToMeshLayerInfo > copy_info, const int mesh_index, const void *block)
void CustomData_reset(CustomData *data)
static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
BMesh const char void * data
void CustomData_data_copy_value(eCustomDataType type, const void *source, void *dest)
void * CustomData_add_layer_named(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem, StringRef name)
static void bm_face_loop_table_build(BMesh &bm, MutableSpan< const BMFace * > face_table, MutableSpan< const BMLoop * > loop_table, bool &need_select_poly, bool &need_hide_poly, bool &need_sharp_face, bool &need_material_index, Vector< int > &loop_layers_not_to_copy)
void BM_face_select_set(BMesh *bm, BMFace *f, const bool select)
Select Face.
static void bm_to_mesh_verts(Mesh &mesh, const Span< const BMVert * > bm_verts, const Span< BMeshToMeshLayerInfo > copy_info, AttrSingleValueChecker &single_checker, MutableSpan< bool > select_vert, MutableSpan< bool > hide_vert)
const CustomData_MeshMasks CD_MASK_BMESH
static BMVert ** bm_to_mesh_vertex_map(BMesh *bm, const int old_verts_num)
BMesh -> Mesh.
static void add_bm_cd_to_mesh(const BMesh &bm, const bke::AttrDomain domain, const uint64_t cd_type_mask, Mesh &mesh)
static void mesh_attributes_copy_to_bmesh_block(CustomData &data, const Span< MeshToBMeshLayerInfo > copy_info, const int mesh_index, BMHeader &header)
eCustomDataMask CD_TYPE_AS_MASK(eCustomDataType type)
const char * CustomData_get_active_layer_name(const CustomData *data, eCustomDataType type)
@ ME_FLAG_UV_SELECT_SYNC_VALID
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
int CustomData_get_named_layer_index(const CustomData *data, eCustomDataType type, StringRef name)
static CustomData get_mesh_to_bm_custom_data(const Mesh &mesh, const bke::AttrDomain domain, const uint64_t cd_type_mask)
void CustomData_set_layer_render(CustomData *data, eCustomDataType type, int n)
const CustomData_MeshMasks CD_MASK_DERIVEDMESH
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])
int CustomData_get_layer_index_n(const CustomData *data, eCustomDataType type, int n)
static void bmesh_to_mesh_calc_object_remap(Main &bmain, Mesh &mesh, BMesh &bm, const int old_totvert)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
const CustomData_MeshMasks CD_MASK_MESH
const char * CustomData_get_layer_name(const CustomData *data, eCustomDataType type, int n)
KeyBlock * BKE_keyblock_add(Key *key, const char *name)
static void bm_to_mesh_faces(Mesh &mesh, const Span< const BMFace * > bm_faces, const Span< BMeshToMeshLayerInfo > copy_info, AttrSingleValueChecker &single_checker, MutableSpan< bool > select_poly, MutableSpan< bool > hide_poly, MutableSpan< bool > sharp_faces, MutableSpan< bool > uv_select_face, MutableSpan< int > material_indices)
void CustomData_bmesh_init_pool(CustomData *data, int totelem, char htype)
void CustomData_set_layer_active(CustomData *data, eCustomDataType type, int n)
void BM_select_history_clear(BMesh *bm)
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params)
VecBase< float, 3 > float3
static void mesh_bm_to_me_compact(BMesh &bm, Mesh &mesh, const CustomData_MeshMasks *mask, const bool only_select_and_hide)
static const CustomData & get_mesh_custom_data(const Mesh &mesh, const bke::AttrDomain domain)
bool CustomData_has_layer_named(const CustomData *data, eCustomDataType type, StringRef name)
StringRef BKE_uv_map_pin_name_get(StringRef uv_map_name, char *buffer)
int CustomData_get_named_layer(const CustomData *data, eCustomDataType type, StringRef name)
MINLINE int min_ii(int a, int b)
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.
void BKE_mesh_clear_geometry(Mesh *mesh)
bool BM_attribute_stored_in_bmesh_builtin(const StringRef name)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static void bm_to_mesh_loops(Mesh &mesh, const Span< const BMLoop * > bm_loops, const Span< BMeshToMeshLayerInfo > copy_info, AttrSingleValueChecker &single_checker, MutableSpan< bool > uv_select_vert, MutableSpan< bool > uv_select_edge)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
void BKE_mesh_runtime_clear_geometry(Mesh *mesh)
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
static Vector< MeshToBMeshLayerInfo > mesh_to_bm_copy_info_calc(const Mesh &mesh, const bke::AttrDomain domain, CustomData &bm_data)
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
Select Edge.
void vert(const int vert_id, float4 &position)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
struct CustomData_MeshMasks cd_mask_extra
ListBaseT< BMEditSelection > selected
bool uv_select_sync_valid
eCustomDataLayer_Flag flag
CustomDataExternal * external
ListBaseT< KeyBlock > block
ShapekeyContainerType type
ListBaseT< Object > objects
ListBaseT< ModifierData > modifiers
static SingleData from_value(const GPointer &value)
MutableVArraySpan< T > span
bool uv_select_sync_valid