14#define DNA_DEPRECATED_ALLOW
88 Mesh *mesh =
reinterpret_cast<Mesh *
>(id);
107 std::optional<Library *> owner_library,
112 Mesh *mesh_dst =
reinterpret_cast<Mesh *
>(id_dst);
113 const Mesh *mesh_src =
reinterpret_cast<const Mesh *
>(id_src);
116 mesh_dst->
runtime->deformed_only = mesh_src->
runtime->deformed_only;
120 mesh_src->
runtime->wrapper_type;
121 mesh_dst->
runtime->subsurf_runtime_data = mesh_src->
runtime->subsurf_runtime_data;
122 mesh_dst->
runtime->cd_mask_extra = mesh_src->
runtime->cd_mask_extra;
126 mesh_dst->
runtime->subsurf_face_dot_tags = mesh_src->
runtime->subsurf_face_dot_tags;
127 mesh_dst->
runtime->subsurf_optimal_display_edges =
128 mesh_src->
runtime->subsurf_optimal_display_edges;
131 mesh_dst->
runtime->deformed_only =
true;
142 mesh_dst->
runtime->is_original_bmesh =
false;
147 mesh_dst->
runtime->bounds_cache = mesh_src->
runtime->bounds_cache;
148 mesh_dst->
runtime->vert_normals_cache = mesh_src->
runtime->vert_normals_cache;
149 mesh_dst->
runtime->vert_normals_true_cache = mesh_src->
runtime->vert_normals_true_cache;
150 mesh_dst->
runtime->face_normals_cache = mesh_src->
runtime->face_normals_cache;
151 mesh_dst->
runtime->face_normals_true_cache = mesh_src->
runtime->face_normals_true_cache;
152 mesh_dst->
runtime->corner_normals_cache = mesh_src->
runtime->corner_normals_cache;
153 mesh_dst->
runtime->loose_verts_cache = mesh_src->
runtime->loose_verts_cache;
154 mesh_dst->
runtime->verts_no_face_cache = mesh_src->
runtime->verts_no_face_cache;
155 mesh_dst->
runtime->loose_edges_cache = mesh_src->
runtime->loose_edges_cache;
156 mesh_dst->
runtime->corner_tris_cache = mesh_src->
runtime->corner_tris_cache;
157 mesh_dst->
runtime->corner_tri_faces_cache = mesh_src->
runtime->corner_tri_faces_cache;
158 mesh_dst->
runtime->vert_to_face_offset_cache = mesh_src->
runtime->vert_to_face_offset_cache;
159 mesh_dst->
runtime->vert_to_face_map_cache = mesh_src->
runtime->vert_to_face_map_cache;
160 mesh_dst->
runtime->vert_to_corner_map_cache = mesh_src->
runtime->vert_to_corner_map_cache;
161 mesh_dst->
runtime->corner_to_face_map_cache = mesh_src->
runtime->corner_to_face_map_cache;
162 mesh_dst->
runtime->bvh_cache_verts = mesh_src->
runtime->bvh_cache_verts;
163 mesh_dst->
runtime->bvh_cache_edges = mesh_src->
runtime->bvh_cache_edges;
164 mesh_dst->
runtime->bvh_cache_faces = mesh_src->
runtime->bvh_cache_faces;
165 mesh_dst->
runtime->bvh_cache_corner_tris = mesh_src->
runtime->bvh_cache_corner_tris;
166 mesh_dst->
runtime->bvh_cache_corner_tris_no_hidden =
167 mesh_src->
runtime->bvh_cache_corner_tris_no_hidden;
168 mesh_dst->
runtime->bvh_cache_loose_verts = mesh_src->
runtime->bvh_cache_loose_verts;
169 mesh_dst->
runtime->bvh_cache_loose_verts_no_hidden =
170 mesh_src->
runtime->bvh_cache_loose_verts_no_hidden;
171 mesh_dst->
runtime->bvh_cache_loose_edges = mesh_src->
runtime->bvh_cache_loose_edges;
172 mesh_dst->
runtime->bvh_cache_loose_edges_no_hidden =
173 mesh_src->
runtime->bvh_cache_loose_edges_no_hidden;
174 mesh_dst->
runtime->max_material_index = mesh_src->
runtime->max_material_index;
175 if (mesh_src->
runtime->bake_materials) {
176 mesh_dst->
runtime->bake_materials = std::make_unique<blender::bke::bake::BakeMaterialsList>(
177 *mesh_src->
runtime->bake_materials);
193 mesh_dst->
runtime->edit_data = std::make_unique<blender::bke::EditMeshData>(*edit_data);
220 mesh_src->
runtime->face_offsets_sharing_info,
222 &mesh_dst->
runtime->face_offsets_sharing_info);
238 reinterpret_cast<ID **
>(&mesh_dst->
key),
245 Mesh *mesh =
reinterpret_cast<Mesh *
>(id);
260 &mesh->
runtime->face_offsets_sharing_info);
269 Mesh *mesh =
reinterpret_cast<Mesh *
>(id);
285 Mesh *mesh =
reinterpret_cast<Mesh *
>(id);
301 if (
STREQ(layer.name,
".uv_seam")) {
317 if (
STREQ(layer.name,
".uv_seam")) {
322 if (
STREQ(layer.name,
".uv_seam")) {
327 if (
STREQ(layer.name,
".uv_seam")) {
332 if (
STREQ(vertex_group->name,
".uv_seam")) {
355 mesh->mface =
nullptr;
356 mesh->totface_legacy = 0;
367 mesh->corners_num = 0;
372 mesh->face_offset_indices =
nullptr;
376 {{AttrDomain::Point, &vert_layers},
377 {AttrDomain::Edge, &edge_layers},
378 {AttrDomain::Face, &face_layers},
379 {AttrDomain::Corner, &loop_layers}},
390 mesh->attribute_storage.dna_attributes =
nullptr;
391 mesh->attribute_storage.dna_attributes_num = 0;
394 mesh->attribute_storage.dna_attributes = attribute_data.
attributes.data();
395 mesh->attribute_storage.dna_attributes_num = attribute_data.
attributes.size();
400 mesh->vertex_group_names, vert_layers, edge_layers, face_layers, loop_layers);
407 mesh->runtime =
nullptr;
431 mesh->attribute_storage.wrap().blend_write(*writer, attribute_data);
433 if (
mesh->face_offset_indices) {
436 mesh->face_offset_indices,
437 sizeof(
int) *
mesh->faces_num,
439 [&]() { BLO_write_int32_array(writer, mesh->faces_num + 1, mesh->face_offset_indices); });
471 mesh->attribute_storage.wrap().blend_read(*reader);
472 if (
mesh->deform_verts().is_empty()) {
489 if (
mesh->face_offset_indices) {
491 reader, &
mesh->face_offset_indices, [&]() {
492 BLO_read_int32_array(reader, mesh->faces_num + 1, &mesh->face_offset_indices);
493 return blender::implicit_sharing::info_for_mem_free(mesh->face_offset_indices);
497 if (
mesh->mselect ==
nullptr) {
502 TFace *tf =
mesh->tface;
503 for (
int i = 0;
i <
mesh->totface_legacy;
i++, tf++) {
541 return ELEM(name,
"position",
".corner_vert",
".corner_edge",
".edge_verts");
546 BMesh *
bm =
mesh->runtime->edit_mesh ?
mesh->runtime->edit_mesh->bm :
nullptr;
579 if (
mesh->runtime->edit_mesh) {
584 return mesh->attributes().contains(
"custom_normal");
602 if (
mesh.default_color_attribute) {
622 const eCustomDataMask
types)
675 if (
mesh.face_offset_indices) {
677 &
mesh.runtime->face_offsets_sharing_info);
683 mesh.totface_legacy = 0;
684 mesh.corners_num = 0;
712 if (free_customdata) {
719 mesh->totface_legacy = 0;
731 if (
mesh->faces_num == 0) {
736 mesh->face_offset_indices);
740 mesh->face_offsets_for_write().fill(-1);
743 mesh->face_offset_indices[0] = 0;
744 mesh->face_offset_indices[
mesh->faces_num] =
mesh->corners_num;
749 return {
static_cast<const float3 *
>(
762 return {
static_cast<const int2 *
>(
796 return {
static_cast<const int *
>(
809 return {
static_cast<const int *
>(
844 this->face_offsets().size_in_bytes());
858 return blender::bke::MutableAttributeAccessor(
this,
865 const int corners_num)
871 mesh->verts_num = verts_num;
872 mesh->edges_num = edges_num;
873 mesh->faces_num = faces_num;
874 mesh->corners_num = corners_num;
887 const int corners_num)
890 mesh->verts_num = verts_num;
891 mesh->edges_num = edges_num;
892 mesh->corners_num = corners_num;
949 if (me_dst->
mat !=
nullptr) {
961 const int tessface_num,
963 const int corners_num,
967 const bool do_tessface = (tessface_num ||
1010 const int verts_num,
1011 const int edges_num,
1012 const int faces_num,
1013 const int corners_num)
1021 return reinterpret_cast<Mesh *
>(
1038 const int active_shapekey,
1039 const bool add_key_index,
1053 const Mesh *me_settings)
1064 const Mesh *me_settings)
1101 float texspace_location[3], texspace_size[3];
1104 texspace_size[0] = (
bounds.max[0] -
bounds.min[0]) / 2.0f;
1105 texspace_size[1] = (
bounds.max[1] -
bounds.min[1]) / 2.0f;
1106 texspace_size[2] = (
bounds.max[2] -
bounds.min[2]) / 2.0f;
1108 for (
int a = 0; a < 3; a++) {
1109 if (texspace_size[a] == 0.0f) {
1110 texspace_size[a] = 1.0f;
1112 else if (texspace_size[a] > 0.0f && texspace_size[a] < 0.00001f) {
1113 texspace_size[a] = 0.00001f;
1115 else if (texspace_size[a] < 0.0f && texspace_size[a] > -0.00001f) {
1116 texspace_size[a] = -0.00001f;
1140 if (r_texspace_location) {
1143 if (r_texspace_size) {
1149 char **r_texspace_flag,
1150 float **r_texspace_location,
1151 float **r_texspace_size)
1155 if (r_texspace_flag !=
nullptr) {
1156 *r_texspace_flag = &
mesh->texspace_flag;
1158 if (r_texspace_location !=
nullptr) {
1159 *r_texspace_location =
mesh->texspace_location;
1161 if (r_texspace_size !=
nullptr) {
1162 *r_texspace_size =
mesh->texspace_size;
1173 result.as_mutable_span().take_front(positions.
size()).copy_from(positions);
1181 float texspace_location[3], texspace_size[3];
1184 mesh->texcomesh ?
mesh->texcomesh :
mesh, texspace_location, texspace_size);
1195 co[0] = (co[0] - texspace_location[0]) / texspace_size[0];
1196 co[1] = (co[1] - texspace_location[1]) / texspace_size[1];
1197 co[2] = (co[2] - texspace_location[2]) / texspace_size[2];
1223 if (ob ==
nullptr) {
1227 return static_cast<Mesh *
>(ob->
data);
1235 Mesh *old =
nullptr;
1237 if (ob ==
nullptr) {
1244 old =
static_cast<Mesh *
>(ob->
data);
1263 if (!material_indices) {
1272 if (indices_span[
i] > 0 && indices_span[
i] >= index) {
1276 indices_span.
save();
1277 material_indices.
finish();
1293 return indices_span.
contains(index);
1301 attributes.
remove(
"material_index");
1310 const short remap_len_short = short(remap_len);
1312#define MAT_NR_REMAP(n) \
1313 if (n < remap_len_short) { \
1314 BLI_assert(n >= 0 && remap[n] < remap_len_short); \
1331 if (!material_indices) {
1334 for (
const int i : material_indices.
span.index_range()) {
1337 material_indices.
span.save();
1338 material_indices.
finish();
1349 if (!keep_sharp_edges) {
1350 attributes.
remove(
"sharp_edge");
1352 attributes.
remove(
"sharp_face");
1354 attributes.
add<
bool>(
"sharp_face",
1367 if (
angle == 0.0f) {
1371 if (!keep_sharp_edges) {
1372 attributes.
remove(
"sharp_edge");
1378 mesh.corner_verts(),
1379 mesh.corner_edges(),
1380 mesh.face_normals(),
1381 mesh.corner_to_face_map(),
1390std::optional<blender::Bounds<blender::float3>> Mesh::bounds_min_max()
const
1395 return std::nullopt;
1397 this->
runtime->bounds_cache.ensure([&](Bounds<float3> &r_bounds) {
1398 switch (this->
runtime->wrapper_type) {
1401 *
this->runtime->edit_data);
1405 r_bounds = *bounds::min_max(this->vert_positions());
1409 return this->
runtime->bounds_cache.data();
1414 this->
runtime->bounds_cache.ensure([&](blender::Bounds<float3> &r_data) { r_data =
bounds; });
1420 mesh.runtime->edit_mesh->bm;
1423std::optional<int> Mesh::material_index_max()
const
1425 this->
runtime->max_material_index.ensure([&](std::optional<int> &value) {
1429 value = std::nullopt;
1432 int max_material_index = 0;
1436 max_material_index = std::max<int>(max_material_index, efa->
mat_nr);
1438 value = max_material_index;
1442 value = std::nullopt;
1449 if (value.has_value()) {
1450 value = std::clamp(*value, 0,
MAXMAT);
1453 return this->
runtime->max_material_index.data();
1458 using namespace blender;
1459 this->
runtime->used_material_indices.ensure([&](VectorSet<int> &r_data) {
1460 const std::optional<int> max_material_index_opt = this->material_index_max();
1462 if (!max_material_index_opt.has_value()) {
1465 const int max_material_index = *max_material_index_opt;
1466 const auto clamp_material_index = [&](
const int index) {
1467 return std::clamp<int>(
index, 0, max_material_index);
1471 Array<bool> used_indices(max_material_index + 1,
false);
1477 used_indices[clamp_material_index(efa->
mat_nr)] =
true;
1480 else if (
const VArray<int> material_indices =
1482 .lookup_or_default<int>(
"material_index", bke::AttrDomain::Face, 0)
1485 if (
const std::optional<int> single_material_index = material_indices.get_if_single()) {
1486 used_indices[clamp_material_index(*single_material_index)] =
true;
1489 VArraySpan<int> material_indices_span = material_indices;
1490 threading::parallel_for(
1491 material_indices_span.
index_range(), 1024, [&](
const IndexRange range) {
1492 for (const int i : range) {
1493 used_indices[clamp_material_index(material_indices_span[i])] = true;
1498 for (
const int i : used_indices.index_range()) {
1499 if (used_indices[i]) {
1504 return this->runtime->used_material_indices.data();
1512 for (float3 &position : positions.slice(range)) {
1513 position = math::transform_point(matrix, position);
1521 for (float3 &position : positions.slice(range)) {
1522 position += translation;
1533 std::optional<Bounds<float3>>
bounds;
1534 if (
mesh.runtime->bounds_cache.is_cached()) {
1540 if (do_shape_keys &&
mesh.key) {
1546 mesh.tag_positions_changed_uniformly();
1549 bounds->min += translation;
1550 bounds->max += translation;
1559 if (do_shape_keys &&
mesh.key) {
1567 mesh.tag_positions_changed();
1583 mesh->totselect = 0;
1590 MSelect *mselect_src, *mselect_dst;
1593 if (
mesh->totselect == 0) {
1597 mselect_src =
mesh->mselect;
1608 for (i_src = 0, i_dst = 0; i_src <
mesh->totselect; i_src++) {
1609 int index = mselect_src[i_src].
index;
1610 switch (mselect_src[i_src].type) {
1612 if (select_vert[index]) {
1613 mselect_dst[i_dst] = mselect_src[i_src];
1619 if (select_edge[index]) {
1620 mselect_dst[i_dst] = mselect_src[i_src];
1626 if (select_poly[index]) {
1627 mselect_dst[i_dst] = mselect_src[i_src];
1643 mselect_dst =
nullptr;
1645 else if (i_dst !=
mesh->totselect) {
1649 mesh->totselect = i_dst;
1650 mesh->mselect = mselect_dst;
1657 for (
int i = 0;
i <
mesh->totselect;
i++) {
1658 if ((
mesh->mselect[
i].index == index) && (
mesh->mselect[
i].type == type)) {
1670 if (
mesh->totselect) {
1671 if (
mesh->mselect[
mesh->totselect - 1].type == type) {
1672 return mesh->mselect[
mesh->totselect - 1].index;
1682 if (msel_index == -1) {
1686 mesh->mselect[
mesh->totselect].index = index;
1687 mesh->mselect[
mesh->totselect].type = type;
1690 else if (msel_index !=
mesh->totselect - 1) {
1692 std::swap(
mesh->mselect[msel_index],
mesh->mselect[
mesh->totselect - 1]);
1696 (
mesh->mselect[
mesh->totselect - 1].type == type));
1701 r_count[0] = r_count[1] = r_count[2] = 0;
1702 if (
mesh->runtime->edit_mesh) {
1704 r_count[0] =
bm->totvertsel;
1705 r_count[1] =
bm->totedgesel;
1706 r_count[2] =
bm->totfacesel;
1720 if (
mesh->runtime->mesh_eval !=
nullptr) {
1722 mesh->runtime->mesh_eval =
nullptr;
#define ATTR_DOMAIN_MASK_COLOR
#define ATTR_DOMAIN_AS_MASK(domain)
bool BKE_bpath_foreach_path_fixed_process(BPathForeachPathData *bpath_data, char *path, size_t path_maxncpy)
void CustomData_blend_write_prepare(CustomData &data, blender::bke::AttrDomain domain, int domain_size, blender::Vector< CustomDataLayer, 16 > &layers_to_write, blender::bke::AttributeStorage::BlendWriteData &write_data)
void CustomData_count_memory(const CustomData &data, int totelem, blender::MemoryCounter &memory)
const CustomData_MeshMasks CD_MASK_EVERYTHING
void * CustomData_get_layer_named_for_write(CustomData *data, eCustomDataType type, blender::StringRef name, int totelem)
const void * CustomData_get_layer(const CustomData *data, eCustomDataType type)
const void * CustomData_get_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
void CustomData_reset(CustomData *data)
bool CustomData_has_layer_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void * CustomData_bmesh_get(const CustomData *data, void *block, eCustomDataType type)
void CustomData_blend_write(BlendWriter *writer, CustomData *data, blender::Span< CustomDataLayer > layers_to_write, int count, eCustomDataMask cddata_mask, ID *id)
void CustomData_free(CustomData *data)
void CustomData_init_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, int totelem)
void CustomData_blend_read(BlendDataReader *reader, CustomData *data, int count)
void CustomData_init_layout_from(const CustomData *source, CustomData *dest, eCustomDataMask mask, eCDAllocType alloctype, int totelem)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
bool CustomData_has_layer(const CustomData *data, eCustomDataType type)
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
const CustomData_MeshMasks CD_MASK_DERIVEDMESH
#define CD_TYPE_AS_MASK(_type)
bool CustomData_free_layer_named(CustomData *data, blender::StringRef name)
const CustomData_MeshMasks CD_MASK_MESH
std::optional< blender::Bounds< blender::float3 > > BKE_editmesh_cache_calc_minmax(const BMEditMesh &em, const blender::bke::EditMeshData &emd)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
const char * BKE_idtype_idcode_to_name(short idcode)
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, std::optional< const ID * > new_owner_id, ID **new_id_p, int flag)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
void BKE_id_free(Main *bmain, void *idv)
void BKE_libblock_init_empty(ID *id) ATTR_NONNULL(1)
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
void * BKE_id_new(Main *bmain, short type, const char *name)
void * BKE_id_new_nomain(short type, const char *name)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_DO_DEPRECATED_POINTERS
#define BKE_LIB_FOREACHID_PROCESS_ID_NOCHECK(data_, id_, cb_flag_)
General operations, lookup, etc. for materials.
void BKE_object_materials_sync_length(Main *bmain, Object *ob, ID *id)
Mesh * BKE_mesh_new_nomain(int verts_num, int edges_num, int faces_num, int corners_num)
void BKE_mesh_runtime_clear_cache(Mesh *mesh)
int BKE_mesh_wrapper_vert_len(const Mesh *mesh)
void BKE_modifiers_test_object(Object *ob)
void multires_force_sculpt_rebuild(Object *object)
General operations, lookup, etc. for blender objects.
#define BLI_assert_unreachable()
void BLI_endian_switch_uint32_array(unsigned int *val, int size) ATTR_NONNULL(1)
BLI_INLINE unsigned int BLI_hash_int(unsigned int k)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
MINLINE void madd_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void range_vn_i(int *array_tar, int size, int start)
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * STRNCPY(char(&dst)[N], const char *src)
Platform independent time functions.
long int BLI_time_now_seconds_i(void)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
void BLO_write_string(BlendWriter *writer, const char *data_ptr)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
bool BLO_read_requires_endian_switch(BlendDataReader *reader)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct_array(reader, struct_name, array_size, ptr_p)
void BLO_write_pointer_array(BlendWriter *writer, int64_t num, const void *data_ptr)
void BLO_read_pointer_array(BlendDataReader *reader, int64_t array_size, void **ptr_p)
bool BLO_write_is_undo(BlendWriter *writer)
void BLO_write_shared(BlendWriter *writer, const void *data, size_t approximate_size_in_bytes, const blender::ImplicitSharingInfo *sharing_info, blender::FunctionRef< void()> write_fn)
const blender::ImplicitSharingInfo * BLO_read_shared(BlendDataReader *reader, T **data_ptr, blender::FunctionRef< const blender::ImplicitSharingInfo *()> read_fn)
#define BLT_I18NCONTEXT_ID_MESH
bool DEG_is_active(const Depsgraph *depsgraph)
void DEG_debug_print_eval(Depsgraph *depsgraph, const char *function_name, const char *object_name, const void *object_address)
T * DEG_get_original(T *id)
#define DNA_struct_default_get(struct_name)
@ ME_TEXSPACE_FLAG_AUTO_EVALUATED
struct MDeformVert MDeformVert
Object is a sort of wrapper for general info.
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
void BKE_mesh_mselect_clear(Mesh *mesh)
void BKE_mesh_copy_parameters_for_eval(Mesh *me_dst, const Mesh *me_src)
void BKE_mesh_orco_verts_transform(Mesh *mesh, MutableSpan< float3 > orco, const bool invert)
void BKE_mesh_tessface_clear(Mesh *mesh)
BMesh * BKE_mesh_to_bmesh(Mesh *mesh, const int active_shapekey, const bool add_key_index, const BMeshCreateParams *params)
void BKE_mesh_ensure_skin_customdata(Mesh *mesh)
Mesh * BKE_mesh_new_nomain(const int verts_num, const int edges_num, const int faces_num, const int corners_num)
Mesh * BKE_mesh_from_bmesh_nomain(BMesh *bm, const BMeshToMeshParams *params, const Mesh *me_settings)
void BKE_mesh_clear_geometry_and_metadata(Mesh *mesh)
int BKE_mesh_mselect_active_get(const Mesh *mesh, int type)
static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address)
void BKE_mesh_orco_ensure(Object *ob, Mesh *mesh)
bool BKE_mesh_attribute_required(const StringRef name)
static void mesh_foreach_path(ID *id, BPathForeachPathData *bpath_data)
void BKE_mesh_count_selected_items(const Mesh *mesh, int r_count[3])
Mesh * BKE_mesh_new_nomain_from_template(const Mesh *me_src, const int verts_num, const int edges_num, const int faces_num, const int corners_num)
bool BKE_mesh_has_custom_loop_normals(Mesh *mesh)
void BKE_mesh_texspace_ensure(Mesh *mesh)
static void rename_seam_layer_to_old_name(const ListBase vertex_groups, const Span< CustomDataLayer > vert_layers, MutableSpan< CustomDataLayer > edge_layers, const Span< CustomDataLayer > face_layers, const Span< CustomDataLayer > corner_layers)
void BKE_mesh_mselect_active_set(Mesh *mesh, int index, int type)
Mesh * BKE_mesh_add(Main *bmain, const char *name)
void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *mesh)
bool BKE_mesh_material_index_used(Mesh *mesh, short index)
void BKE_mesh_copy_parameters(Mesh *me_dst, const Mesh *me_src)
static void copy_attribute_names(const Mesh &mesh_src, Mesh &mesh_dst)
Mesh * BKE_mesh_copy_for_eval(const Mesh &source)
static void mesh_clear_geometry(Mesh &mesh)
void BKE_mesh_mselect_validate(Mesh *mesh)
static void mesh_free_data(ID *id)
static void clear_attribute_names(Mesh &mesh)
Mesh * BKE_mesh_from_bmesh_for_eval_nomain(BMesh *bm, const CustomData_MeshMasks *cd_mask_extra, const Mesh *me_settings)
static void ensure_orig_index_layer(CustomData &data, const int size)
static void mesh_blend_read_data(BlendDataReader *reader, ID *id)
Mesh * BKE_mesh_from_object(Object *ob)
int BKE_mesh_mselect_find(const Mesh *mesh, int index, int type)
static void mesh_init_data(ID *id)
static void mesh_foreach_id(ID *id, LibraryForeachIDData *data)
void BKE_mesh_texspace_get(Mesh *mesh, float r_texspace_location[3], float r_texspace_size[3])
blender::Array< float3 > BKE_mesh_orco_verts_get(const Object *ob)
static void mesh_tessface_clear_intern(Mesh *mesh, int free_customdata)
void BKE_mesh_material_index_clear(Mesh *mesh)
static bool use_bmesh_material_indices(const Mesh &mesh)
void BKE_mesh_material_index_remove(Mesh *mesh, short index)
void BKE_mesh_texspace_get_reference(Mesh *mesh, char **r_texspace_flag, float **r_texspace_location, float **r_texspace_size)
void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh *mesh)
static void mesh_copy_data(Main *bmain, std::optional< Library * > owner_library, ID *id_dst, const ID *id_src, const int flag)
void BKE_mesh_clear_geometry(Mesh *mesh)
void BKE_mesh_face_offsets_ensure_alloc(Mesh *mesh)
BMesh * BKE_mesh_to_bmesh_ex(const Mesh *mesh, const BMeshCreateParams *create_params, const BMeshFromMeshParams *convert_params)
void BKE_mesh_material_remap(Mesh *mesh, const uint *remap, uint remap_len)
Mesh * BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src, const int verts_num, const int edges_num, const int tessface_num, const int faces_num, const int corners_num, const CustomData_MeshMasks mask)
void BKE_mesh_ensure_default_orig_index_customdata(Mesh *mesh)
void BKE_mesh_ensure_default_orig_index_customdata_no_check(Mesh *mesh)
void BKE_mesh_texspace_calc(Mesh *mesh)
void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
#define BM_ITER_MESH(ele, iter, bm, itype)
BMesh const char void * data
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
#define BMALLOC_TEMPLATE_FROM_ME(...)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *mesh, const BMeshFromMeshParams *params)
void BM_mesh_bm_to_me_for_eval(BMesh &bm, Mesh &mesh, const CustomData_MeshMasks *cd_mask_extra)
void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *mesh, const BMeshToMeshParams *params)
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
SIMD_FORCE_INLINE btVector3 transform(const btVector3 &point) const
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
constexpr IndexRange index_range() const
constexpr void copy_from(Span< T > values) const
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool contains(const T &value) const
T get_internal_single() const
static VArray ForSingle(T value, const int64_t size)
GAttributeReader lookup(const StringRef attribute_id) const
GAttributeReader lookup_or_default(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const void *default_value=nullptr) const
std::optional< AttributeMetaData > lookup_meta_data(StringRef attribute_id) const
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef attribute_id, AttrDomain domain, eCustomDataType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GAttributeWriter lookup_for_write(StringRef attribute_id)
bool remove(const StringRef attribute_id)
bool add(const StringRef attribute_id, const AttrDomain domain, const eCustomDataType data_type, const AttributeInit &initializer)
void add_shared(const ImplicitSharingInfo *sharing_info, const FunctionRef< void(MemoryCounter &shared_memory)> count_fn)
#define CD_MASK_COLOR_ALL
#define MEM_reallocN(vmemh, len)
#define ID_IS_OVERRIDE_LIBRARY(_id)
static void transform_positions(const Span< blender::float3 > src, const blender::float4x4 &transform, blender::MutableSpan< blender::float3 > dst)
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
void edges_sharp_from_angle_set(OffsetIndices< int > faces, Span< int > corner_verts, Span< int > corner_edges, Span< float3 > face_normals, Span< int > corner_to_face, Span< bool > sharp_faces, const float split_angle, MutableSpan< bool > sharp_edges)
bool attribute_name_is_anonymous(const StringRef name)
static void translate_positions(MutableSpan< float3 > positions, const float3 &translation)
void mesh_sharp_edges_set_from_angle(Mesh &mesh, float angle, bool keep_sharp_edges=false)
const AttributeAccessorFunctions & mesh_attribute_accessor_functions()
void mesh_remove_invalid_attribute_strings(Mesh &mesh)
static bool meta_data_matches(const std::optional< bke::AttributeMetaData > meta_data, const AttrDomainMask domains, const eCustomDataMask types)
void mesh_convert_storage_to_customdata(Mesh &mesh)
void mesh_smooth_set(Mesh &mesh, bool use_smooth, bool keep_sharp_edges=false)
void mesh_ensure_default_color_attribute_on_add(Mesh &mesh, StringRef id, AttrDomain domain, eCustomDataType data_type)
void mesh_custom_normals_to_legacy(MutableSpan< CustomDataLayer > corner_layers)
Mesh * mesh_new_no_attributes(int verts_num, int edges_num, int faces_num, int corners_num)
void mesh_transform(Mesh &mesh, const float4x4 &transform, bool do_shape_keys)
void mesh_sculpt_mask_to_legacy(MutableSpan< CustomDataLayer > vert_layers)
void transform_custom_normal_attribute(const float4x4 &transform, MutableAttributeAccessor &attributes)
void mesh_ensure_required_data_layers(Mesh &mesh)
static void transform_positions(MutableSpan< float3 > positions, const float4x4 &matrix)
void mesh_translate(Mesh &mesh, const float3 &translation, bool do_shape_keys)
void attribute_storage_blend_write_prepare(AttributeStorage &data, const Map< AttrDomain, Vector< CustomDataLayer, 16 > * > &layers_to_write, AttributeStorage::BlendWriteData &write_data)
std::optional< T > max(const VArray< T > &values)
void copy_shared_pointer(T *src_ptr, const ImplicitSharingInfo *src_sharing_info, T **r_dst_ptr, const ImplicitSharingInfo **r_dst_sharing_info)
const ImplicitSharingInfo * info_for_mem_free(void *data)
void free_shared_data(T **data, const ImplicitSharingInfo **sharing_info)
void make_trivial_data_mutable(T **data, const ImplicitSharingInfo **sharing_info, const int64_t size)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
MatBase< float, 4, 4 > float4x4
VecBase< int32_t, 2 > int2
VecBase< float, 3 > float3
CustomDataExternal * external
float remesh_voxel_adaptivity
struct AttributeStorage attribute_storage
MeshRuntimeHandle * runtime
char * active_uv_map_attribute
char * default_color_attribute
ListBase vertex_group_names
int * face_offset_indices
int attributes_active_index
int vertex_group_active_index
int face_sets_color_default
char * default_uv_map_attribute
float texspace_location[3]
char * active_color_attribute
Vector<::Attribute, 16 > & attributes
VMutableArray< T > varray
const ImplicitSharingInfo * face_offsets_sharing_info
MutableVArraySpan< T > span