44 const Mesh *me_settings)
52 mesh->
runtime->cd_mask_extra = *cd_mask_extra;
56 mesh->
runtime->is_original_bmesh =
true;
59 mesh->
runtime->deformed_only =
true;
61 mesh->
runtime->edit_mesh = std::move(em);
117 mesh->vert_positions_for_write().copy_from(edit_data.
vert_positions);
118 mesh->
runtime->is_original_bmesh =
false;
121 mesh->
runtime->edit_data.reset();
124 BLI_assert(!
"Should not be converting subd wrapper to mdata wrapper");
139 switch (mesh->
runtime->wrapper_type) {
141 return mesh->
runtime->edit_data->vert_positions;
144 return mesh->vert_positions();
152 switch (mesh->
runtime->wrapper_type) {
158 return mesh->face_normals();
166 switch (mesh->
runtime->wrapper_type) {
169 edit_data->vert_normals = {};
170 edit_data->face_centers = {};
171 edit_data->face_normals = {};
176 mesh->tag_positions_changed();
183 switch (mesh->
runtime->wrapper_type) {
202 positions.
copy_from(mesh->vert_positions());
210 float (*vert_coords)[3],
212 const float mat[4][4])
214 switch (mesh->
runtime->wrapper_type) {
220 for (
int i = 0;
i < vert_coords_len;
i++) {
238 for (
int i = 0;
i < vert_coords_len;
i++) {
255 switch (mesh->
runtime->wrapper_type) {
257 return mesh->
runtime->edit_mesh->bm->totvert;
268 switch (mesh->
runtime->wrapper_type) {
270 return mesh->
runtime->edit_mesh->bm->totedge;
281 switch (mesh->
runtime->wrapper_type) {
283 return mesh->
runtime->edit_mesh->bm->totloop;
294 switch (mesh->
runtime->wrapper_type) {
296 return mesh->
runtime->edit_mesh->bm->totface;
333 runtime_data,
mesh,
false);
345 memcpy(
data,
mesh->corner_normals().data(),
mesh->corner_normals().size_in_bytes());
363 if (subdiv_mesh !=
mesh) {
367 if (
mesh->runtime->mesh_eval !=
nullptr) {
370 mesh->runtime->mesh_eval = subdiv_mesh;
375 return mesh->runtime->mesh_eval;
380 if (
mesh->runtime->subsurf_runtime_data ==
nullptr) {
386 return (
mesh->runtime->mesh_eval) ?
mesh->runtime->mesh_eval :
mesh;
390 std::lock_guard
lock{
mesh->runtime->eval_mutex};
392 return (
mesh->runtime->mesh_eval) ?
mesh->runtime->mesh_eval :
mesh;
void CustomData_free_layers(CustomData *data, eCustomDataType type)
void * CustomData_get_layer_for_write(CustomData *data, eCustomDataType type, int totelem)
void * CustomData_add_layer(CustomData *data, eCustomDataType type, eCDAllocType alloctype, int totelem)
blender::Span< blender::float3 > BKE_editmesh_cache_ensure_face_normals(BMEditMesh &em, blender::bke::EditMeshData &emd)
void BKE_id_free(Main *bmain, void *idv)
void * BKE_id_new_nomain(short type, const char *name)
void BKE_mesh_copy_parameters_for_eval(Mesh *me_dst, const Mesh *me_src)
void BKE_mesh_ensure_default_orig_index_customdata_no_check(Mesh *mesh)
void BKE_mesh_runtime_ensure_edit_data(Mesh *mesh)
blender::bke::subdiv::Subdiv * BKE_subsurf_modifier_subdiv_descriptor_ensure(SubsurfRuntimeData *runtime_data, const Mesh *mesh, bool for_draw_code)
#define BLI_assert_unreachable()
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
#define BM_ITER_MESH_INDEX(ele, iter, bm, itype, indexvar)
BMesh const char void * data
void BM_mesh_bm_to_me_for_eval(BMesh &bm, Mesh &mesh, const CustomData_MeshMasks *cd_mask_extra)
ATTR_WARN_UNUSED_RESULT const BMVert * v
constexpr void copy_from(Span< T > values) const
Span< float3 > BKE_mesh_wrapper_vert_coords(const Mesh *mesh)
Span< float3 > BKE_mesh_wrapper_face_normals(Mesh *mesh)
static Mesh * mesh_wrapper_ensure_subdivision(Mesh *mesh)
void BKE_mesh_wrapper_vert_coords_copy(const Mesh *mesh, blender::MutableSpan< float3 > positions)
Mesh * BKE_mesh_wrapper_from_editmesh(std::shared_ptr< BMEditMesh > em, const CustomData_MeshMasks *cd_mask_extra, const Mesh *me_settings)
int BKE_mesh_wrapper_loop_len(const Mesh *mesh)
int BKE_mesh_wrapper_vert_len(const Mesh *mesh)
void BKE_mesh_wrapper_ensure_mdata(Mesh *mesh)
int BKE_mesh_wrapper_edge_len(const Mesh *mesh)
void BKE_mesh_wrapper_tag_positions_changed(Mesh *mesh)
void BKE_mesh_wrapper_vert_coords_copy_with_mat4(const Mesh *mesh, float(*vert_coords)[3], int vert_coords_len, const float mat[4][4])
int BKE_mesh_wrapper_face_len(const Mesh *mesh)
Mesh * BKE_mesh_wrapper_ensure_subdivision(Mesh *mesh)
void free(Subdiv *subdiv)
Mesh * subdiv_to_mesh(Subdiv *subdiv, const ToMeshSettings *settings, const Mesh *coarse_mesh)
void mesh_set_custom_normals_normalized(Mesh &mesh, MutableSpan< float3 > corner_normals)
void isolate_task(const Function &function)
VecBase< float, 3 > float3
MeshRuntimeHandle * runtime
blender::bke::subdiv::Settings settings
blender::bke::subdiv::Subdiv * subdiv_cpu
blender::bke::subdiv::Subdiv * subdiv_gpu
Array< float3 > vert_positions