Add "vert_" prefix to accessor function names

This commit is contained in:
Hans Goudey 2022-12-16 11:01:30 -06:00
parent 63e5276ccd
commit ec0c030c50
139 changed files with 292 additions and 296 deletions

View File

@ -989,11 +989,11 @@ BLI_INLINE int *BKE_mesh_material_indices_for_write(Mesh *mesh)
&mesh->pdata, CD_PROP_INT32, CD_SET_DEFAULT, NULL, mesh->totpoly, "material_index");
}
BLI_INLINE const float (*BKE_mesh_positions(const Mesh *mesh))[3]
BLI_INLINE const float (*BKE_mesh_vert_positions(const Mesh *mesh))[3]
{
return (const float(*)[3])CustomData_get_layer_named(&mesh->vdata, CD_PROP_FLOAT3, "position");
}
BLI_INLINE float (*BKE_mesh_positions_for_write(Mesh *mesh))[3]
BLI_INLINE float (*BKE_mesh_vert_positions_for_write(Mesh *mesh))[3]
{
return (float(*)[3])CustomData_duplicate_referenced_layer_named(
&mesh->vdata, CD_PROP_FLOAT3, "position", mesh->totvert);
@ -1050,13 +1050,13 @@ BLI_INLINE MDeformVert *BKE_mesh_deform_verts_for_write(Mesh *mesh)
# include "BLI_math_vec_types.hh"
# include "BLI_span.hh"
inline blender::Span<blender::float3> Mesh::positions() const
inline blender::Span<blender::float3> Mesh::vert_positions() const
{
return {reinterpret_cast<const blender::float3 *>(BKE_mesh_positions(this)), this->totvert};
return {reinterpret_cast<const blender::float3 *>(BKE_mesh_vert_positions(this)), this->totvert};
}
inline blender::MutableSpan<blender::float3> Mesh::positions_for_write()
inline blender::MutableSpan<blender::float3> Mesh::vert_positions_for_write()
{
return {reinterpret_cast<blender::float3 *>(BKE_mesh_positions_for_write(this)), this->totvert};
return {reinterpret_cast<blender::float3 *>(BKE_mesh_vert_positions_for_write(this)), this->totvert};
}
inline blender::Span<MEdge> Mesh::edges() const

View File

@ -47,7 +47,7 @@ typedef enum eMeshBatchDirtyMode {
/** #MeshRuntime.wrapper_type */
typedef enum eMeshWrapperType {
/** Use mesh data (#Mesh.positions(), #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
/** Use mesh data (#Mesh.vert_positions(), #Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */
ME_WRAPPER_TYPE_MDATA = 0,
/** Use edit-mesh data (#Mesh.edit_mesh, #MeshRuntime.edit_data). */
ME_WRAPPER_TYPE_BMESH = 1,

View File

@ -1921,7 +1921,7 @@ void mesh_get_mapped_verts_coords(Mesh *me_eval, float (*r_cos)[3], const int to
MEM_freeN(userData.vertex_visit);
}
else {
const Span<float3> positions = me_eval->positions();
const Span<float3> positions = me_eval->vert_positions();
for (int i = 0; i < totcos; i++) {
copy_v3_v3(r_cos[i], positions[i]);
}
@ -1936,7 +1936,7 @@ static void mesh_init_origspace(Mesh *mesh)
CD_ORIGSPACE_MLOOP);
const int numpoly = mesh->totpoly;
// const int numloop = mesh->totloop;
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
const Span<MPoly> polys = mesh->polys();
const Span<MLoop> loops = mesh->loops();

View File

@ -1213,7 +1213,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
looptri = BKE_mesh_runtime_looptri_ensure(mesh);
looptri_len = BKE_mesh_runtime_looptri_len(mesh);
}
const float(*positions)[3] = reinterpret_cast<const float(*)[3]>(mesh->positions().data());
const float(*positions)[3] = reinterpret_cast<const float(*)[3]>(mesh->vert_positions().data());
const Span<MEdge> edges = mesh->edges();
const Span<MLoop> loops = mesh->loops();

View File

@ -258,7 +258,7 @@ static int do_step_cloth(
cloth = clmd->clothObject;
verts = cloth->verts;
const Span<float3> positions = result->positions();
const Span<float3> positions = result->vert_positions();
vert_mass_changed = verts->mass != clmd->sim_parms->mass;
/* force any pinned verts to their constrained location. */
@ -759,7 +759,7 @@ static bool cloth_from_object(
CustomData_get_layer(&mesh->vdata, CD_CLOTH_ORCO));
}
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
verts = clmd->clothObject->verts;
@ -1155,7 +1155,7 @@ static void cloth_update_verts(Object *ob, ClothModifierData *clmd, Mesh *mesh)
{
using namespace blender;
uint i = 0;
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
ClothVertex *verts = clmd->clothObject->verts;
/* vertex count is already ensured to match */
@ -1171,7 +1171,7 @@ static Mesh *cloth_make_rest_mesh(ClothModifierData *clmd, Mesh *mesh)
using namespace blender;
Mesh *new_mesh = BKE_mesh_copy_for_eval(mesh, false);
ClothVertex *verts = clmd->clothObject->verts;
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
/* vertex count is already ensured to match */
for (int i = 0; i < mesh->totvert; i++, verts++) {

View File

@ -548,7 +548,7 @@ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[
else if (me_eval) {
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(me_eval);
const MDeformVert *dvert = CustomData_get_layer(&me_eval->vdata, CD_MDEFORMVERT);
const float(*positions)[3] = BKE_mesh_positions(me_eval);
const float(*positions)[3] = BKE_mesh_vert_positions(me_eval);
int numVerts = me_eval->totvert;
/* check that dvert is a valid pointers (just in case) */

View File

@ -188,7 +188,7 @@ void BKE_crazyspace_set_quats_mesh(Mesh *me,
BLI_bitmap *vert_tag = BLI_BITMAP_NEW(me->totvert, __func__);
/* first store two sets of tangent vectors in vertices, we derive it just from the face-edges */
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();

View File

@ -639,7 +639,7 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main,
offsets.vert.last(), offsets.edge.last(), 0, offsets.loop.last(), offsets.poly.last());
mesh->flag |= ME_AUTOSMOOTH;
mesh->smoothresh = DEG2RADF(180.0f);
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
MutableSpan<MEdge> edges = mesh->edges_for_write();
MutableSpan<MPoly> polys = mesh->polys_for_write();
MutableSpan<MLoop> loops = mesh->loops_for_write();

View File

@ -257,7 +257,7 @@ static void data_transfer_dtdata_type_preprocess(Mesh *me_src,
if (dtdata_type == DT_TYPE_LNOR) {
/* Compute custom normals into regular loop normals, which will be used for the transfer. */
const float(*positions_dst)[3] = BKE_mesh_positions(me_dst);
const float(*positions_dst)[3] = BKE_mesh_vert_positions(me_dst);
const int num_verts_dst = me_dst->totvert;
const MEdge *edges_dst = BKE_mesh_edges(me_dst);
const int num_edges_dst = me_dst->totedge;
@ -320,7 +320,7 @@ static void data_transfer_dtdata_type_postprocess(Object *UNUSED(ob_src),
}
/* Bake edited destination loop normals into custom normals again. */
const float(*positions_dst)[3] = BKE_mesh_positions(me_dst);
const float(*positions_dst)[3] = BKE_mesh_vert_positions(me_dst);
const int num_verts_dst = me_dst->totvert;
MEdge *edges_dst = BKE_mesh_edges_for_write(me_dst);
const int num_edges_dst = me_dst->totedge;
@ -1314,7 +1314,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
}
BKE_mesh_remap_find_best_match_from_mesh(
BKE_mesh_positions(me_dst), me_dst->totvert, me_src, space_transform);
BKE_mesh_vert_positions(me_dst), me_dst->totvert, me_src, space_transform);
}
/* Check all possible data types.
@ -1342,7 +1342,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
}
if (DT_DATATYPE_IS_VERT(dtdata_type)) {
float(*positions_dst)[3] = BKE_mesh_positions_for_write(me_dst);
float(*positions_dst)[3] = BKE_mesh_vert_positions_for_write(me_dst);
const int num_verts_dst = me_dst->totvert;
if (!geom_map_init[VDATA]) {
@ -1426,7 +1426,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
}
}
if (DT_DATATYPE_IS_EDGE(dtdata_type)) {
const float(*positions_dst)[3] = BKE_mesh_positions_for_write(me_dst);
const float(*positions_dst)[3] = BKE_mesh_vert_positions_for_write(me_dst);
const int num_verts_dst = me_dst->totvert;
const MEdge *edges_dst = BKE_mesh_edges(me_dst);
const int num_edges_dst = me_dst->totedge;
@ -1507,7 +1507,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
}
}
if (DT_DATATYPE_IS_LOOP(dtdata_type)) {
const float(*positions_dst)[3] = BKE_mesh_positions(me_dst);
const float(*positions_dst)[3] = BKE_mesh_vert_positions(me_dst);
const int num_verts_dst = me_dst->totvert;
const MEdge *edges_dst = BKE_mesh_edges(me_dst);
const int num_edges_dst = me_dst->totedge;
@ -1604,7 +1604,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
}
}
if (DT_DATATYPE_IS_POLY(dtdata_type)) {
const float(*positions_dst)[3] = BKE_mesh_positions(me_dst);
const float(*positions_dst)[3] = BKE_mesh_vert_positions(me_dst);
const int num_verts_dst = me_dst->totvert;
const MPoly *polys_dst = BKE_mesh_polys(me_dst);
const int num_polys_dst = me_dst->totpoly;

View File

@ -1809,7 +1809,7 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Mesh
/* displace paint */
if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE) {
float(*positions)[3] = BKE_mesh_positions_for_write(result);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(result);
DynamicPaintModifierApplyData data = {
.surface = surface,
@ -2007,7 +2007,7 @@ static Mesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData *pmd, Object *
}
/* wave simulation */
else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
float(*positions)[3] = BKE_mesh_positions_for_write(result);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(result);
DynamicPaintModifierApplyData data = {
.surface = surface,
@ -3777,7 +3777,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph,
mesh_p = BKE_mesh_copy_for_eval(dynamicPaint_brush_mesh_get(brush), false);
numOfVerts_p = mesh_p->totvert;
float(*positions_p)[3] = BKE_mesh_positions_for_write(mesh_p);
float(*positions_p)[3] = BKE_mesh_vert_positions_for_write(mesh_p);
copy_m4_m4(prev_obmat, ob->object_to_world);
/* current frame mesh */
@ -3793,7 +3793,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Depsgraph *depsgraph,
eModifierType_DynamicPaint);
mesh_c = dynamicPaint_brush_mesh_get(brush);
numOfVerts_c = mesh_c->totvert;
float(*positions_c)[3] = BKE_mesh_positions_for_write(mesh_c);
float(*positions_c)[3] = BKE_mesh_vert_positions_for_write(mesh_c);
(*brushVel) = (struct Vec3f *)MEM_mallocN(numOfVerts_c * sizeof(Vec3f),
"Dynamic Paint brush velocity");
@ -4263,7 +4263,7 @@ static bool dynamicPaint_paintMesh(Depsgraph *depsgraph,
VolumeGrid *grid = bData->grid;
mesh = BKE_mesh_copy_for_eval(brush_mesh, false);
float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh);
mlooptri = BKE_mesh_runtime_looptri_ensure(mesh);
mloop = BKE_mesh_loops(mesh);
@ -4752,7 +4752,7 @@ static bool dynamicPaint_paintSinglePoint(
}
const Mesh *brush_mesh = dynamicPaint_brush_mesh_get(brush);
const float(*positions)[3] = BKE_mesh_positions(brush_mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(brush_mesh);
/*
* Loop through every surface point
@ -5855,7 +5855,7 @@ static bool dynamicPaint_surfaceHasMoved(DynamicPaintSurface *surface, Object *o
PaintSurfaceData *sData = surface->data;
PaintBakeData *bData = sData->bData;
Mesh *mesh = dynamicPaint_canvas_mesh_get(surface->canvas);
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
int numOfVerts = mesh->totvert;
@ -6015,7 +6015,7 @@ static bool dynamicPaint_generateBakeData(DynamicPaintSurface *surface,
const bool do_accel_data = (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) != 0;
int canvasNumOfVerts = mesh->totvert;
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
Vec3f *canvas_verts;
if (bData) {

View File

@ -701,7 +701,7 @@ bool get_effector_data(EffectorCache *eff,
else if (eff->pd && eff->pd->shape == PFIELD_SHAPE_POINTS) {
/* TODO: hair and points object support */
const Mesh *me_eval = BKE_object_get_evaluated_mesh(eff->ob);
const float(*positions)[3] = BKE_mesh_positions(me_eval);
const float(*positions)[3] = BKE_mesh_vert_positions(me_eval);
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(me_eval);
if (me_eval != NULL) {
copy_v3_v3(efd->loc, positions[*efd->index]);

View File

@ -404,7 +404,7 @@ static void manta_set_domain_from_mesh(FluidDomainSettings *fds,
float min[3] = {FLT_MAX, FLT_MAX, FLT_MAX}, max[3] = {-FLT_MAX, -FLT_MAX, -FLT_MAX};
float size[3];
float(*positions)[3] = BKE_mesh_positions_for_write(me);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
float scale = 0.0;
int res;
@ -1005,7 +1005,7 @@ static void obstacles_from_mesh(Object *coll_ob,
bool has_velocity = false;
Mesh *me = BKE_mesh_copy_for_eval(fes->mesh, false);
float(*positions)[3] = BKE_mesh_positions_for_write(me);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
int min[3], max[3], res[3];
@ -2062,7 +2062,7 @@ static void emit_from_mesh(
/* Copy mesh for thread safety as we modify it.
* Main issue is its VertArray being modified, then replaced and freed. */
Mesh *me = BKE_mesh_copy_for_eval(ffs->mesh, false);
float(*positions)[3] = BKE_mesh_positions_for_write(me);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
const MLoop *mloop = BKE_mesh_loops(me);
const MLoopTri *mlooptri = BKE_mesh_runtime_looptri_ensure(me);
@ -3247,7 +3247,7 @@ static Mesh *create_liquid_geometry(FluidDomainSettings *fds,
if (!me) {
return NULL;
}
float(*positions)[3] = BKE_mesh_positions_for_write(me);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(me);
mpolys = BKE_mesh_polys_for_write(me);
mloops = BKE_mesh_loops_for_write(me);
@ -3382,7 +3382,7 @@ static Mesh *create_smoke_geometry(FluidDomainSettings *fds, Mesh *orgmesh, Obje
}
result = BKE_mesh_new_nomain(num_verts, 0, 0, num_faces * 4, num_faces);
float(*positions)[3] = BKE_mesh_positions_for_write(result);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(result);
mpolys = BKE_mesh_polys_for_write(result);
mloops = BKE_mesh_loops_for_write(result);

View File

@ -2471,7 +2471,7 @@ static void gpencil_generate_edgeloops(Object *ob,
if (me->totedge == 0) {
return;
}
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const Span<MEdge> edges = me->edges();
const Span<MDeformVert> dverts = me->deform_verts();
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(me);
@ -2679,7 +2679,7 @@ bool BKE_gpencil_convert_mesh(Main *bmain,
/* Use evaluated data to get mesh with all modifiers on top. */
Object *ob_eval = (Object *)DEG_get_evaluated_object(depsgraph, ob_mesh);
const Mesh *me_eval = BKE_object_get_evaluated_mesh(ob_eval);
const Span<float3> positions = me_eval->positions();
const Span<float3> positions = me_eval->vert_positions();
const Span<MPoly> polys = me_eval->polys();
const Span<MLoop> loops = me_eval->loops();
int mpoly_len = me_eval->totpoly;

View File

@ -1610,7 +1610,7 @@ float *BKE_key_evaluate_object_ex(
switch (GS(obdata->name)) {
case ID_ME: {
Mesh *mesh = (Mesh *)obdata;
const float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
const int totvert = min_ii(tot, mesh->totvert);
memcpy(out, positions, sizeof(float[3]) * totvert);
break;
@ -2196,7 +2196,7 @@ void BKE_keyblock_update_from_mesh(const Mesh *me, KeyBlock *kb)
return;
}
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
memcpy(kb->data, positions, sizeof(float[3]) * tot);
}
@ -2232,7 +2232,7 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
return;
}
float(*positions)[3] = static_cast<float(*)[3]>(MEM_dupallocN(BKE_mesh_positions(mesh)));
float(*positions)[3] = static_cast<float(*)[3]>(MEM_dupallocN(BKE_mesh_vert_positions(mesh)));
BKE_keyblock_convert_to_mesh(kb, positions, mesh->totvert);
const MEdge *edges = BKE_mesh_edges(mesh);
const MPoly *polys = BKE_mesh_polys(mesh);

View File

@ -1288,7 +1288,7 @@ float (*BKE_mesh_orco_verts_get(Object *ob))[3]
/* Get appropriate vertex coordinates */
float(*vcos)[3] = (float(*)[3])MEM_calloc_arrayN(me->totvert, sizeof(*vcos), "orco mesh");
const Span<float3> positions = tme->positions();
const Span<float3> positions = tme->vert_positions();
int totvert = min_ii(tme->totvert, me->totvert);
@ -1544,7 +1544,7 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3])
}
me->runtime->bounds_cache.ensure(
[me](Bounds<float3> &r_bounds) { r_bounds = *bounds::min_max(me->positions()); });
[me](Bounds<float3> &r_bounds) { r_bounds = *bounds::min_max(me->vert_positions()); });
const Bounds<float3> &bounds = me->runtime->bounds_cache.data();
copy_v3_v3(r_min, math::min(bounds.min, float3(r_min)));
@ -1555,7 +1555,7 @@ bool BKE_mesh_minmax(const Mesh *me, float r_min[3], float r_max[3])
void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys)
{
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
for (float3 &position : positions) {
mul_m4_v3(mat, position);
@ -1589,7 +1589,7 @@ void BKE_mesh_transform(Mesh *me, const float mat[4][4], bool do_keys)
void BKE_mesh_translate(Mesh *me, const float offset[3], const bool do_keys)
{
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
for (float3 &position : positions) {
position += offset;
}
@ -1765,7 +1765,7 @@ float (*BKE_mesh_vert_coords_alloc(const Mesh *mesh, int *r_vert_len))[3]
void BKE_mesh_vert_coords_apply(Mesh *mesh, const float (*vert_coords)[3])
{
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
for (const int i : positions.index_range()) {
copy_v3_v3(positions[i], vert_coords[i]);
}
@ -1776,7 +1776,7 @@ void BKE_mesh_vert_coords_apply_with_mat4(Mesh *mesh,
const float (*vert_coords)[3],
const float mat[4][4])
{
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
for (const int i : positions.index_range()) {
mul_v3_m4v3(positions[i], mat, vert_coords[i]);
}
@ -1814,7 +1814,7 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh,
/* may be nullptr */
clnors = (short(*)[2])CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
const Span<MEdge> edges = mesh->edges();
const Span<MPoly> polys = mesh->polys();
const Span<MLoop> loops = mesh->loops();

View File

@ -306,7 +306,7 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes,
bool need_face_flip = r_info->has_negative_transform[mi] != r_info->has_negative_transform[0];
Vector<Vert *> verts(me->totvert);
const Span<float3> mesh_positions = me->positions();
const Span<float3> mesh_positions = me->vert_positions();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();
@ -552,7 +552,7 @@ static void get_poly2d_cos(const Mesh *me,
const float4x4 &trans_mat,
float r_axis_mat[3][3])
{
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const Span<MLoop> loops = me->loops();
const Span<MLoop> poly_loops = loops.slice(mp->loopstart, mp->totloop);
@ -601,7 +601,7 @@ static void copy_or_interp_loop_attributes(Mesh *dest_mesh,
get_poly2d_cos(orig_me, orig_mp, cos_2d, mim.to_target_transform[orig_me_index], axis_mat);
}
CustomData *target_cd = &dest_mesh->ldata;
const Span<float3> dst_positions = dest_mesh->positions();
const Span<float3> dst_positions = dest_mesh->vert_positions();
const Span<MLoop> dst_loops = dest_mesh->loops();
for (int i = 0; i < mp->totloop; ++i) {
int loop_index = mp->loopstart + i;
@ -715,7 +715,7 @@ static Mesh *imesh_to_mesh(IMesh *im, MeshesToIMeshInfo &mim)
merge_vertex_loop_poly_customdata_layers(result, mim);
/* Set the vertex coordinate values and other data. */
MutableSpan<float3> positions = result->positions_for_write();
MutableSpan<float3> positions = result->vert_positions_for_write();
for (int vi : im->vert_index_range()) {
const Vert *v = im->vert(vi);
if (v->orig != NO_INDEX) {

View File

@ -188,7 +188,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba
}
Mesh *mesh = BKE_mesh_new_nomain(totvert, totedge, 0, totloop, totpoly);
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
MutableSpan<MEdge> edges = mesh->edges_for_write();
MutableSpan<MPoly> polys = mesh->polys_for_write();
MutableSpan<MLoop> loops = mesh->loops_for_write();
@ -455,7 +455,7 @@ static void appendPolyLineVert(ListBase *lb, uint index)
void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int edge_users_test)
{
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const Span<MEdge> mesh_edges = me->edges();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();
@ -1208,5 +1208,5 @@ void BKE_mesh_nomain_to_meshkey(Mesh *mesh_src, Mesh *mesh_dst, KeyBlock *kb)
}
kb->data = MEM_malloc_arrayN(mesh_dst->key->elemsize, mesh_dst->totvert, "kb->data");
kb->totelem = totvert;
MutableSpan(static_cast<float3 *>(kb->data), kb->totelem).copy_from(mesh_src->positions());
MutableSpan(static_cast<float3 *>(kb->data), kb->totelem).copy_from(mesh_src->vert_positions());
}

View File

@ -99,7 +99,7 @@ float BKE_mesh_calc_poly_area(const MPoly *mpoly,
float BKE_mesh_calc_area(const Mesh *me)
{
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();
@ -295,7 +295,7 @@ void BKE_mesh_poly_edgebitmap_insert(uint *edge_bitmap, const MPoly *mp, const M
bool BKE_mesh_center_median(const Mesh *me, float r_cent[3])
{
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
zero_v3(r_cent);
for (const int i : positions.index_range()) {
add_v3_v3(r_cent, positions[i]);
@ -310,7 +310,7 @@ bool BKE_mesh_center_median(const Mesh *me, float r_cent[3])
bool BKE_mesh_center_median_from_polys(const Mesh *me, float r_cent[3])
{
int tot = 0;
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();
zero_v3(r_cent);
@ -347,7 +347,7 @@ bool BKE_mesh_center_of_surface(const Mesh *me, float r_cent[3])
float poly_area;
float total_area = 0.0f;
float poly_cent[3];
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MPoly *polys = BKE_mesh_polys(me);
const MLoop *loops = BKE_mesh_loops(me);
@ -381,7 +381,7 @@ bool BKE_mesh_center_of_volume(const Mesh *me, float r_cent[3])
float poly_volume;
float total_volume = 0.0f;
float poly_cent[3];
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const MPoly *polys = BKE_mesh_polys(me);
const MLoop *loops = BKE_mesh_loops(me);

View File

@ -197,7 +197,7 @@ class MeshFairingContext : public FairingContext {
totvert_ = mesh->totvert;
totloop_ = mesh->totloop;
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
medge_ = mesh->edges();
mpoly_ = mesh->polys();
mloop_ = mesh->loops();

View File

@ -65,7 +65,7 @@ void BKE_mesh_foreach_mapped_vert(
}
}
else {
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const int *index = static_cast<const int *>(CustomData_get_layer(&mesh->vdata, CD_ORIGINDEX));
const float(*vert_normals)[3] = (flag & MESH_FOREACH_USE_NORMAL) ?
BKE_mesh_vertex_normals_ensure(mesh) :
@ -120,7 +120,7 @@ void BKE_mesh_foreach_mapped_edge(
}
}
else {
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const MEdge *med = BKE_mesh_edges(mesh);
const int *index = static_cast<const int *>(CustomData_get_layer(&mesh->edata, CD_ORIGINDEX));
@ -190,7 +190,7 @@ void BKE_mesh_foreach_mapped_loop(Mesh *mesh,
CustomData_get_layer(&mesh->ldata, CD_NORMAL)) :
nullptr;
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const MLoop *ml = BKE_mesh_loops(mesh);
const MPoly *mp = BKE_mesh_polys(mesh);
const int *v_index = static_cast<const int *>(
@ -265,7 +265,7 @@ void BKE_mesh_foreach_mapped_face_center(
}
}
else {
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const MPoly *mp = BKE_mesh_polys(mesh);
const MLoop *loops = BKE_mesh_loops(mesh);
const MLoop *ml;
@ -308,7 +308,7 @@ void BKE_mesh_foreach_mapped_subdiv_face_center(
void *userData,
MeshForeachFlag flag)
{
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const MPoly *mp = BKE_mesh_polys(mesh);
const MLoop *loops = BKE_mesh_loops(mesh);
const MLoop *ml;

View File

@ -1195,7 +1195,7 @@ void BKE_mesh_tessface_calc(Mesh *mesh)
&mesh->fdata,
&mesh->ldata,
&mesh->pdata,
BKE_mesh_positions_for_write(mesh),
BKE_mesh_vert_positions_for_write(mesh),
mesh->totface,
mesh->totloop,
mesh->totpoly);
@ -1593,7 +1593,7 @@ MVert *BKE_mesh_legacy_convert_positions_to_verts(
{
using namespace blender;
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
CustomDataLayer mvert_layer{};
mvert_layer.type = CD_MVERT;

View File

@ -204,9 +204,9 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
/* Subdivision-surface for eg won't have mesh data in the custom-data arrays.
* Now add position/#MEdge/#MPoly layers. */
if (BKE_mesh_positions(mesh) != NULL) {
memcpy(BKE_mesh_positions_for_write(result),
BKE_mesh_positions(mesh),
if (BKE_mesh_vert_positions(mesh) != NULL) {
memcpy(BKE_mesh_vert_positions_for_write(result),
BKE_mesh_vert_positions(mesh),
sizeof(float[3]) * mesh->totvert);
}
if (!CustomData_has_layer(&mesh->edata, CD_MEDGE)) {
@ -234,7 +234,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
}
/* mirror vertex coordinates */
float(*positions)[3] = BKE_mesh_positions_for_write(result);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(result);
for (i = 0; i < maxVerts; i++) {
const int vert_index_prev = i;
const int vert_index = maxVerts + i;
@ -408,7 +408,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
/* calculate custom normals into loop_normals, then mirror first half into second half */
BKE_mesh_normals_loop_split(BKE_mesh_positions(result),
BKE_mesh_normals_loop_split(BKE_mesh_vert_positions(result),
BKE_mesh_vertex_normals_ensure(result),
result->totvert,
BKE_mesh_edges(result),

View File

@ -386,7 +386,7 @@ const float (*BKE_mesh_vertex_normals_ensure(const Mesh *mesh))[3]
/* Isolate task because a mutex is locked and computing normals is multi-threaded. */
blender::threading::isolate_task([&]() {
Mesh &mesh_mutable = *const_cast<Mesh *>(mesh);
const Span<float3> positions = mesh_mutable.positions();
const Span<float3> positions = mesh_mutable.vert_positions();
const Span<MPoly> polys = mesh_mutable.polys();
const Span<MLoop> loops = mesh_mutable.loops();
@ -431,7 +431,7 @@ const float (*BKE_mesh_poly_normals_ensure(const Mesh *mesh))[3]
/* Isolate task because a mutex is locked and computing normals is multi-threaded. */
blender::threading::isolate_task([&]() {
Mesh &mesh_mutable = *const_cast<Mesh *>(mesh);
const Span<float3> positions = mesh_mutable.positions();
const Span<float3> positions = mesh_mutable.vert_positions();
const Span<MPoly> polys = mesh_mutable.polys();
const Span<MLoop> loops = mesh_mutable.loops();
@ -1916,7 +1916,7 @@ static void mesh_set_custom_normals(Mesh *mesh, float (*r_custom_nors)[3], const
clnors = (short(*)[2])CustomData_add_layer(
&mesh->ldata, CD_CUSTOMLOOPNORMAL, CD_SET_DEFAULT, nullptr, numloops);
}
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
MutableSpan<MEdge> edges = mesh->edges_for_write();
const Span<MPoly> polys = mesh->polys();
const Span<MLoop> loops = mesh->loops();

View File

@ -1304,7 +1304,7 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
/* Unlike above, those are one-to-one mappings, simpler! */
int *loop_to_poly_map_src = nullptr;
const float(*positions_src)[3] = BKE_mesh_positions(me_src);
const float(*positions_src)[3] = BKE_mesh_vert_positions(me_src);
const int num_verts_src = me_src->totvert;
float(*vcos_src)[3] = nullptr;
const MEdge *edges_src = BKE_mesh_edges(me_src);

View File

@ -63,7 +63,7 @@ static Mesh *remesh_quadriflow(const Mesh *input_mesh,
void (*update_cb)(void *, float progress, int *cancel),
void *update_cb_data)
{
const Span<float3> input_positions = input_mesh->positions();
const Span<float3> input_positions = input_mesh->vert_positions();
const Span<MLoop> input_loops = input_mesh->loops();
const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(input_mesh);
@ -125,7 +125,7 @@ static Mesh *remesh_quadriflow(const Mesh *input_mesh,
MutableSpan<MPoly> polys = mesh->polys_for_write();
MutableSpan<MLoop> loops = mesh->loops_for_write();
mesh->positions_for_write().copy_from(
mesh->vert_positions_for_write().copy_from(
Span(reinterpret_cast<float3 *>(qrd.out_verts), qrd.out_totverts));
for (const int i : IndexRange(qrd.out_totfaces)) {
@ -186,7 +186,7 @@ Mesh *BKE_mesh_remesh_quadriflow(const Mesh *mesh,
static openvdb::FloatGrid::Ptr remesh_voxel_level_set_create(const Mesh *mesh,
const float voxel_size)
{
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
const Span<MLoop> loops = mesh->loops();
const Span<MLoopTri> looptris = mesh->looptris();
@ -225,7 +225,7 @@ static Mesh *remesh_voxel_volume_to_mesh(const openvdb::FloatGrid::Ptr level_set
Mesh *mesh = BKE_mesh_new_nomain(
vertices.size(), 0, 0, quads.size() * 4 + tris.size() * 3, quads.size() + tris.size());
MutableSpan<float3> mesh_positions = mesh->positions_for_write();
MutableSpan<float3> mesh_positions = mesh->vert_positions_for_write();
MutableSpan<MPoly> mesh_polys = mesh->polys_for_write();
MutableSpan<MLoop> mesh_loops = mesh->loops_for_write();
@ -281,7 +281,7 @@ void BKE_mesh_remesh_reproject_paint_mask(Mesh *target, const Mesh *source)
{
BVHTreeFromMesh bvhtree = {nullptr};
BKE_bvhtree_from_mesh_get(&bvhtree, source, BVHTREE_FROM_VERTS, 2);
const Span<float3> target_positions = target->positions();
const Span<float3> target_positions = target->vert_positions();
const float *source_mask = (const float *)CustomData_get_layer(&source->vdata, CD_PAINT_MASK);
if (source_mask == nullptr) {
return;
@ -317,7 +317,7 @@ void BKE_remesh_reproject_sculpt_face_sets(Mesh *target, const Mesh *source)
using namespace blender::bke;
const AttributeAccessor src_attributes = source->attributes();
MutableAttributeAccessor dst_attributes = target->attributes_for_write();
const Span<float3> target_positions = target->positions();
const Span<float3> target_positions = target->vert_positions();
const Span<MPoly> target_polys = target->polys();
const Span<MLoop> target_loops = target->loops();
@ -397,7 +397,7 @@ void BKE_remesh_reproject_vertex_paint(Mesh *target, const Mesh *source)
size_t data_size = CustomData_sizeof(layer->type);
void *target_data = target_cdata->layers[layer_i].data;
void *source_data = layer->data;
const Span<float3> target_positions = target->positions();
const Span<float3> target_positions = target->vert_positions();
if (domain == ATTR_DOMAIN_POINT) {
blender::threading::parallel_for(

View File

@ -144,7 +144,7 @@ void Mesh::loose_edges_tag_none() const
blender::Span<MLoopTri> Mesh::looptris() const
{
this->runtime->looptris_cache.ensure([&](blender::Array<MLoopTri> &r_data) {
const Span<float3> positions = this->positions();
const Span<float3> positions = this->vert_positions();
const Span<MPoly> polys = this->polys();
const Span<MLoop> loops = this->loops();

View File

@ -156,7 +156,7 @@ Span<float3> MeshAttributeInterpolator::ensure_barycentric_coords()
}
bary_coords_.reinitialize(mask_.min_array_size());
const Span<float3> positions = mesh_->positions();
const Span<float3> positions = mesh_->vert_positions();
const Span<MLoop> loops = mesh_->loops();
const Span<MLoopTri> looptris = mesh_->looptris();
@ -185,7 +185,7 @@ Span<float3> MeshAttributeInterpolator::ensure_nearest_weights()
}
nearest_weights_.reinitialize(mask_.min_array_size());
const Span<float3> positions = mesh_->positions();
const Span<float3> positions = mesh_->vert_positions();
const Span<MLoop> loops = mesh_->loops();
const Span<MLoopTri> looptris = mesh_->looptris();
@ -258,7 +258,7 @@ int sample_surface_points_spherical(RandomNumberGenerator &rng,
Vector<int> &r_looptri_indices,
Vector<float3> &r_positions)
{
const Span<float3> positions = mesh.positions();
const Span<float3> positions = mesh.vert_positions();
const Span<MLoop> loops = mesh.loops();
const Span<MLoopTri> looptris = mesh.looptris();
@ -355,7 +355,7 @@ int sample_surface_points_projected(
Vector<int> &r_looptri_indices,
Vector<float3> &r_positions)
{
const Span<float3> positions = mesh.positions();
const Span<float3> positions = mesh.vert_positions();
const Span<MLoop> loops = mesh.loops();
const Span<MLoopTri> looptris = mesh.looptris();

View File

@ -141,7 +141,7 @@ void BKE_mesh_calc_loop_tangent_single(Mesh *mesh,
return;
}
BKE_mesh_calc_loop_tangent_single_ex(BKE_mesh_positions(mesh),
BKE_mesh_calc_loop_tangent_single_ex(BKE_mesh_vert_positions(mesh),
mesh->totvert,
BKE_mesh_loops(mesh),
r_looptangents,
@ -573,7 +573,7 @@ void BKE_mesh_calc_loop_tangents(Mesh *me_eval,
/* TODO(@campbellbarton): store in Mesh.runtime to avoid recalculation. */
short tangent_mask = 0;
BKE_mesh_calc_loop_tangent_ex(
BKE_mesh_positions(me_eval),
BKE_mesh_vert_positions(me_eval),
BKE_mesh_polys(me_eval),
uint(me_eval->totpoly),
BKE_mesh_loops(me_eval),

View File

@ -1066,7 +1066,7 @@ bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_
do_verbose,
true,
&changed);
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
MutableSpan<MEdge> edges = me->edges_for_write();
MutableSpan<MPoly> polys = me->polys_for_write();
MutableSpan<MLoop> loops = me->loops_for_write();
@ -1117,7 +1117,7 @@ bool BKE_mesh_is_valid(Mesh *me)
do_fixes,
&changed);
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
MutableSpan<MEdge> edges = me->edges_for_write();
MutableSpan<MPoly> polys = me->polys_for_write();
MutableSpan<MLoop> loops = me->loops_for_write();

View File

@ -193,7 +193,7 @@ void BKE_mesh_wrapper_vert_coords_copy(const Mesh *me,
case ME_WRAPPER_TYPE_MDATA:
case ME_WRAPPER_TYPE_SUBD: {
BLI_assert(vert_coords_len <= me->totvert);
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
for (int i = 0; i < vert_coords_len; i++) {
copy_v3_v3(vert_coords[i], positions[i]);
}
@ -231,7 +231,7 @@ void BKE_mesh_wrapper_vert_coords_copy_with_mat4(const Mesh *me,
case ME_WRAPPER_TYPE_MDATA:
case ME_WRAPPER_TYPE_SUBD: {
BLI_assert(vert_coords_len == me->totvert);
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
for (int i = 0; i < vert_coords_len; i++) {
mul_v3_m4v3(vert_coords[i], mat, positions[i]);
}

View File

@ -30,7 +30,7 @@
void multires_reshape_apply_base_update_mesh_coords(MultiresReshapeContext *reshape_context)
{
Mesh *base_mesh = reshape_context->base_mesh;
float(*base_positions)[3] = BKE_mesh_positions_for_write(base_mesh);
float(*base_positions)[3] = BKE_mesh_vert_positions_for_write(base_mesh);
/* Update the context in case the vertices were duplicated. */
reshape_context->base_positions = base_positions;
@ -68,7 +68,7 @@ static float v3_dist_from_plane(const float v[3], const float center[3], const f
void multires_reshape_apply_base_refit_base_mesh(MultiresReshapeContext *reshape_context)
{
Mesh *base_mesh = reshape_context->base_mesh;
float(*base_positions)[3] = BKE_mesh_positions_for_write(base_mesh);
float(*base_positions)[3] = BKE_mesh_vert_positions_for_write(base_mesh);
/* Update the context in case the vertices were duplicated. */
reshape_context->base_positions = base_positions;
MeshElemMap *pmap;

View File

@ -28,7 +28,7 @@
static void multires_subdivide_create_object_space_linear_grids(Mesh *mesh)
{
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const MPoly *polys = BKE_mesh_polys(mesh);
const MLoop *loops = BKE_mesh_loops(mesh);

View File

@ -152,7 +152,7 @@ bool multires_reshape_context_create_from_base_mesh(MultiresReshapeContext *resh
reshape_context->mmd = mmd;
reshape_context->base_mesh = base_mesh;
reshape_context->base_positions = BKE_mesh_positions(base_mesh);
reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh);
reshape_context->base_edges = BKE_mesh_edges(base_mesh);
reshape_context->base_polys = BKE_mesh_polys(base_mesh);
reshape_context->base_loops = BKE_mesh_loops(base_mesh);
@ -189,7 +189,7 @@ bool multires_reshape_context_create_from_object(MultiresReshapeContext *reshape
reshape_context->mmd = mmd;
reshape_context->base_mesh = base_mesh;
reshape_context->base_positions = BKE_mesh_positions(base_mesh);
reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh);
reshape_context->base_edges = BKE_mesh_edges(base_mesh);
reshape_context->base_polys = BKE_mesh_polys(base_mesh);
reshape_context->base_loops = BKE_mesh_loops(base_mesh);
@ -221,7 +221,7 @@ bool multires_reshape_context_create_from_ccg(MultiresReshapeContext *reshape_co
context_zero(reshape_context);
reshape_context->base_mesh = base_mesh;
reshape_context->base_positions = BKE_mesh_positions(base_mesh);
reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh);
reshape_context->base_edges = BKE_mesh_edges(base_mesh);
reshape_context->base_polys = BKE_mesh_polys(base_mesh);
reshape_context->base_loops = BKE_mesh_loops(base_mesh);
@ -268,7 +268,7 @@ bool multires_reshape_context_create_from_subdiv(MultiresReshapeContext *reshape
reshape_context->mmd = mmd;
reshape_context->base_mesh = base_mesh;
reshape_context->base_positions = BKE_mesh_positions(base_mesh);
reshape_context->base_positions = BKE_mesh_vert_positions(base_mesh);
reshape_context->base_edges = BKE_mesh_edges(base_mesh);
reshape_context->base_polys = BKE_mesh_polys(base_mesh);
reshape_context->base_loops = BKE_mesh_loops(base_mesh);

View File

@ -3239,7 +3239,7 @@ static void give_parvert(Object *par, int nr, float vec[3])
BKE_object_get_evaluated_mesh(par);
if (me_eval) {
const Span<float3> positions = me_eval->positions();
const Span<float3> positions = me_eval->vert_positions();
int count = 0;
int numVerts = me_eval->totvert;
@ -4179,7 +4179,7 @@ void BKE_object_foreach_display_point(Object *ob,
float3 co;
if (mesh_eval != nullptr) {
const Span<float3> positions = mesh_eval->positions();
const Span<float3> positions = mesh_eval->vert_positions();
for (const int i : positions.index_range()) {
mul_v3_m4v3(co, obmat, positions[i]);
func_cb(co, user_data);
@ -4806,7 +4806,7 @@ bool BKE_object_shapekey_remove(Main *bmain, Object *ob, KeyBlock *kb)
switch (ob->type) {
case OB_MESH: {
Mesh *mesh = (Mesh *)ob->data;
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
BKE_keyblock_convert_to_mesh(
key->refkey, reinterpret_cast<float(*)[3]>(positions.data()), mesh->totvert);
break;
@ -5306,7 +5306,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
const int *index;
if (me_eval && (index = (const int *)CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX))) {
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
/* Tree over-allocates in case where some verts have #ORIGINDEX_NONE. */
tot = 0;
@ -5323,7 +5323,7 @@ KDTree_3d *BKE_object_as_kdtree(Object *ob, int *r_tot)
}
}
else {
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
tot = positions.size();
tree = BLI_kdtree_3d_new(tot);

View File

@ -734,7 +734,7 @@ static void make_duplis_verts(const DupliContext *ctx)
VertexDupliData_Mesh vdd{};
vdd.params = vdd_params;
vdd.totvert = me_eval->totvert;
vdd.positions = me_eval->positions();
vdd.positions = me_eval->vert_positions();
vdd.vert_normals = BKE_mesh_vertex_normals_ensure(me_eval);
vdd.orco = (const float(*)[3])CustomData_get_layer(&me_eval->vdata, CD_ORCO);
@ -1322,7 +1322,7 @@ static void make_duplis_faces(const DupliContext *ctx)
fdd.totface = me_eval->totpoly;
fdd.mpoly = me_eval->polys().data();
fdd.mloop = me_eval->loops().data();
fdd.positions = me_eval->positions();
fdd.positions = me_eval->vert_positions();
fdd.mloopuv = (uv_idx != -1) ? (const MLoopUV *)CustomData_get_layer_n(
&me_eval->ldata, CD_MLOOPUV, uv_idx) :
nullptr;

View File

@ -1697,7 +1697,7 @@ static void sculpt_update_object(
/* These are assigned to the base mesh in Multires. This is needed because Face Sets operators
* and tools use the Face Sets data from the base mesh when Multires is active. */
ss->positions = BKE_mesh_positions_for_write(me);
ss->positions = BKE_mesh_vert_positions_for_write(me);
ss->mpoly = BKE_mesh_polys(me);
ss->mloop = BKE_mesh_loops(me);
}
@ -1705,7 +1705,7 @@ static void sculpt_update_object(
ss->totvert = me->totvert;
ss->totpoly = me->totpoly;
ss->totfaces = me->totpoly;
ss->positions = BKE_mesh_positions_for_write(me);
ss->positions = BKE_mesh_vert_positions_for_write(me);
ss->mpoly = BKE_mesh_polys(me);
ss->mloop = BKE_mesh_loops(me);
ss->multires.active = false;
@ -2186,7 +2186,7 @@ static PBVH *build_pbvh_from_regular_mesh(Object *ob, Mesh *me_eval_deform, bool
PBVH *pbvh = BKE_pbvh_new(PBVH_FACES);
BKE_pbvh_respect_hide_set(pbvh, respect_hide);
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();

View File

@ -1426,7 +1426,7 @@ static void init_particle_interpolation(Object *ob,
pind->dietime = (key + pa->totkey - 1)->time;
if (pind->mesh) {
float(*positions)[3] = BKE_mesh_positions_for_write(pind->mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(pind->mesh);
pind->positions[0] = positions[pa->hair_index];
pind->positions[1] = positions[pa->hair_index + 1];
}
@ -2147,7 +2147,7 @@ void psys_particle_on_dm(Mesh *mesh_final,
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh_final);
if (from == PART_FROM_VERT) {
const float(*positions)[3] = BKE_mesh_positions(mesh_final);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh_final);
copy_v3_v3(vec, positions[mapindex]);
if (nor) {
@ -2175,7 +2175,7 @@ void psys_particle_on_dm(Mesh *mesh_final,
MFace *mfaces = CustomData_get_layer(&mesh_final->fdata, CD_MFACE);
mface = &mfaces[mapindex];
const float(*positions)[3] = BKE_mesh_positions(mesh_final);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh_final);
mtface = CustomData_get_layer(&mesh_final->fdata, CD_MTFACE);
if (mtface) {
@ -3892,7 +3892,7 @@ static void psys_face_mat(Object *ob, Mesh *mesh, ParticleData *pa, float mat[4]
}
}
else {
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
copy_v3_v3(v[0], positions[mface->v1]);
copy_v3_v3(v[1], positions[mface->v2]);
copy_v3_v3(v[2], positions[mface->v3]);

View File

@ -98,7 +98,7 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys)
{
ParticleData *pa = NULL;
float min[3], max[3], delta[3], d;
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
int totvert = mesh->totvert, from = psys->part->from;
int i, j, k, p, res = psys->part->grid_res, size[3], axis;
@ -575,7 +575,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa,
int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls won't need skipping */
MFace *mface;
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
pa->num = i = ctx->index[p];
MFace *mfaces = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
@ -1001,7 +1001,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
BKE_mesh_orco_ensure(ob, mesh);
if (from == PART_FROM_VERT) {
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const float(*orcodata)[3] = CustomData_get_layer(&mesh->vdata, CD_ORCO);
int totvert = mesh->totvert;
@ -1071,7 +1071,7 @@ static int psys_thread_context_init_distribute(ParticleThreadContext *ctx,
}
}
else {
const float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
copy_v3_v3(co1, positions[mf->v1]);
copy_v3_v3(co2, positions[mf->v2]);
copy_v3_v3(co3, positions[mf->v3]);

View File

@ -3320,7 +3320,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim,
if (!mesh) {
*r_mesh = mesh = BKE_mesh_new_nomain(totpoint, totedge, 0, 0, 0);
}
float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
medge = BKE_mesh_edges_for_write(mesh);
dvert = BKE_mesh_deform_verts_for_write(mesh);

View File

@ -364,7 +364,7 @@ static rbCollisionShape *rigidbody_get_shape_convexhull_from_mesh(Object *ob,
if (ob->type == OB_MESH && ob->data) {
mesh = rigidbody_get_mesh(ob);
positions = (mesh) ? BKE_mesh_positions_for_write(mesh) : NULL;
positions = (mesh) ? BKE_mesh_vert_positions_for_write(mesh) : NULL;
totvert = (mesh) ? mesh->totvert : 0;
}
else {
@ -402,7 +402,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
return NULL;
}
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
totvert = mesh->totvert;
looptri = BKE_mesh_runtime_looptri_ensure(mesh);
tottri = BKE_mesh_runtime_looptri_len(mesh);
@ -677,7 +677,7 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol)
return;
}
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
totvert = mesh->totvert;
lt = BKE_mesh_runtime_looptri_ensure(mesh);
tottri = BKE_mesh_runtime_looptri_len(mesh);
@ -751,7 +751,7 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3])
return;
}
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
totvert = mesh->totvert;
looptri = BKE_mesh_runtime_looptri_ensure(mesh);
tottri = BKE_mesh_runtime_looptri_len(mesh);
@ -1674,7 +1674,7 @@ static void rigidbody_update_sim_ob(Depsgraph *depsgraph, Object *ob, RigidBodyO
if (rbo->shape == RB_SHAPE_TRIMESH && rbo->flag & RBO_FLAG_USE_DEFORM) {
Mesh *mesh = ob->runtime.mesh_deform_eval;
if (mesh) {
float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
int totvert = mesh->totvert;
const BoundBox *bb = BKE_object_boundbox_get(ob);

View File

@ -188,7 +188,7 @@ static void merge_vert_dir(ShrinkwrapBoundaryVertData *vdata,
static ShrinkwrapBoundaryData *shrinkwrap_build_boundary_data(Mesh *mesh)
{
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const MEdge *medge = BKE_mesh_edges(mesh);
const MLoop *mloop = BKE_mesh_loops(mesh);
@ -1405,7 +1405,7 @@ void shrinkwrapModifier_deform(ShrinkwrapModifierData *smd,
if (mesh != nullptr && smd->shrinkType == MOD_SHRINKWRAP_PROJECT) {
/* Setup arrays to get vertexs positions, normals and deform weights */
calc.positions = BKE_mesh_positions_for_write(mesh);
calc.positions = BKE_mesh_vert_positions_for_write(mesh);
calc.vert_normals = BKE_mesh_vertex_normals_ensure(mesh);
/* Using vertices positions/normals as if a subsurface was applied */
@ -1570,7 +1570,7 @@ void BKE_shrinkwrap_remesh_target_project(Mesh *src_me, Mesh *target_me, Object
calc.vgroup = -1;
calc.target = target_me;
calc.keepDist = ssmd.keepDist;
calc.positions = BKE_mesh_positions_for_write(src_me);
calc.positions = BKE_mesh_vert_positions_for_write(src_me);
BLI_SPACE_TRANSFORM_SETUP(&calc.local2target, ob_target, ob_target);
ShrinkwrapTreeData tree;

View File

@ -2632,7 +2632,7 @@ static void springs_from_mesh(Object *ob)
BodyPoint *bp;
int a;
float scale = 1.0f;
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
sb = ob->soft;
if (me && sb) {
@ -2755,7 +2755,7 @@ static void mesh_faces_to_scratch(Object *ob)
MLoopTri *looptri, *lt;
BodyFace *bodyface;
int a;
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MPoly *polys = BKE_mesh_polys(me);
const MLoop *loops = BKE_mesh_loops(me);

View File

@ -395,7 +395,7 @@ static void init_user_data(OpenSubdiv_Converter *converter,
ConverterStorage *user_data = MEM_mallocN(sizeof(ConverterStorage), __func__);
user_data->settings = *settings;
user_data->mesh = mesh;
user_data->positions = BKE_mesh_positions(mesh);
user_data->positions = BKE_mesh_vert_positions(mesh);
user_data->edges = BKE_mesh_edges(mesh);
user_data->polys = BKE_mesh_polys(mesh);
user_data->loops = BKE_mesh_loops(mesh);

View File

@ -81,7 +81,7 @@ static void set_coarse_positions(Subdiv *subdiv,
const Mesh *mesh,
const float (*coarse_vertex_cos)[3])
{
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const MPoly *mpoly = BKE_mesh_polys(mesh);
const MLoop *mloop = BKE_mesh_loops(mesh);
/* Mark vertices which needs new coordinates. */

View File

@ -84,7 +84,7 @@ static void subdiv_mesh_ctx_cache_uv_layers(SubdivMeshContext *ctx)
static void subdiv_mesh_ctx_cache_custom_data_layers(SubdivMeshContext *ctx)
{
Mesh *subdiv_mesh = ctx->subdiv_mesh;
ctx->subdiv_positions = subdiv_mesh->positions_for_write().data();
ctx->subdiv_positions = subdiv_mesh->vert_positions_for_write().data();
ctx->subdiv_edges = BKE_mesh_edges_for_write(subdiv_mesh);
ctx->subdiv_polys = BKE_mesh_polys_for_write(subdiv_mesh);
ctx->subdiv_loops = BKE_mesh_loops_for_write(subdiv_mesh);
@ -1184,7 +1184,7 @@ Mesh *BKE_subdiv_to_mesh(Subdiv *subdiv,
subdiv_context.settings = settings;
subdiv_context.coarse_mesh = coarse_mesh;
subdiv_context.coarse_positions = BKE_mesh_positions(coarse_mesh);
subdiv_context.coarse_positions = BKE_mesh_vert_positions(coarse_mesh);
subdiv_context.coarse_edges = BKE_mesh_edges(coarse_mesh);
subdiv_context.coarse_polys = BKE_mesh_polys(coarse_mesh);
subdiv_context.coarse_loops = BKE_mesh_loops(coarse_mesh);

View File

@ -175,7 +175,7 @@ Mesh *volume_to_mesh(const openvdb::GridBase &grid,
0,
0,
0,
mesh->positions_for_write(),
mesh->vert_positions_for_write(),
mesh->polys_for_write(),
mesh->loops_for_write());

View File

@ -822,7 +822,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (mp->totloop == 2) {
bool changed;
BKE_mesh_validate_arrays(me,
BKE_mesh_positions_for_write(me),
BKE_mesh_vert_positions_for_write(me),
me->totvert,
BKE_mesh_edges_for_write(me),
me->totedge,

View File

@ -304,7 +304,7 @@ void BM_mesh_bm_from_me(BMesh *bm, const Mesh *me, const struct BMeshFromMeshPar
const int *material_indices = (const int *)CustomData_get_layer_named(
&me->pdata, CD_PROP_INT32, "material_index");
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
Array<BMVert *> vtable(me->totvert);
for (const int i : positions.index_range()) {
BMVert *v = vtable[i] = BM_vert_create(
@ -970,7 +970,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
CustomData_add_layer(&me->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, me->totedge);
CustomData_add_layer(&me->ldata, CD_MLOOP, CD_SET_DEFAULT, nullptr, me->totloop);
CustomData_add_layer(&me->pdata, CD_MPOLY, CD_SET_DEFAULT, nullptr, me->totpoly);
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
MutableSpan<MEdge> medge = me->edges_for_write();
MutableSpan<MPoly> mpoly = me->polys_for_write();
MutableSpan<MLoop> mloop = me->loops_for_write();
@ -1232,7 +1232,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
BMVert *eve;
BMEdge *eed;
BMFace *efa;
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
MutableSpan<MEdge> medge = me->edges_for_write();
MutableSpan<MPoly> mpoly = me->polys_for_write();
MutableSpan<MLoop> loops = me->loops_for_write();

View File

@ -542,7 +542,7 @@ MeshRenderData *mesh_render_data_create(Object *object,
mr->poly_len = mr->me->totpoly;
mr->tri_len = poly_to_tri_count(mr->poly_len, mr->loop_len);
mr->positions = mr->me->positions().data();
mr->positions = mr->me->vert_positions().data();
mr->medge = BKE_mesh_edges(mr->me);
mr->mpoly = BKE_mesh_polys(mr->me);
mr->mloop = BKE_mesh_loops(mr->me);

View File

@ -2201,7 +2201,7 @@ void DRW_subdivide_loose_geom(DRWSubdivCache *subdiv_cache, MeshBufferCache *cac
int subd_vert_offset = 0;
/* Subdivide each loose coarse edge. */
const Span<float3> coarse_positions = coarse_mesh->positions();
const Span<float3> coarse_positions = coarse_mesh->vert_positions();
const Span<MEdge> coarse_edges = coarse_mesh->edges();
int *vert_to_edge_buffer;

View File

@ -409,7 +409,7 @@ static void add_verts_to_dgroups(ReportList *reports,
}
/* transform verts to global space */
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
for (int i = 0; i < mesh->totvert; i++) {
if (!vertsfilled) {
copy_v3_v3(verts[i], positions[i]);

View File

@ -652,7 +652,7 @@ void heat_bone_weighting(Object *ob,
int a, tris_num, j, bbone, firstsegment, lastsegment;
bool use_topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
const float(*mesh_positions)[3] = BKE_mesh_positions(me);
const float(*mesh_positions)[3] = BKE_mesh_vert_positions(me);
const MPoly *polys = BKE_mesh_polys(me);
const MLoop *loops = BKE_mesh_loops(me);
bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
@ -1772,7 +1772,7 @@ void ED_mesh_deform_bind_callback(Object *object,
mdb.cagecos = MEM_callocN(sizeof(*mdb.cagecos) * mdb.cage_verts_num, "MeshDeformBindCos");
copy_m4_m4(mdb.cagemat, cagemat);
const float(*positions)[3] = BKE_mesh_positions(mdb.cagemesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mdb.cagemesh);
for (a = 0; a < mdb.cage_verts_num; a++) {
copy_v3_v3(mdb.cagecos[a], positions[a]);
}

View File

@ -285,7 +285,7 @@ static void try_convert_single_object(Object &curves_ob,
const bke::CurvesSurfaceTransforms transforms{curves_ob, &surface_ob};
const MFace *mfaces = (const MFace *)CustomData_get_layer(&surface_me.fdata, CD_MFACE);
const Span<float3> positions = surface_me.positions();
const Span<float3> positions = surface_me.vert_positions();
for (const int new_hair_i : IndexRange(hair_num)) {
const int curve_i = new_hair_i;
@ -542,7 +542,7 @@ static void snap_curves_to_surface_exec_object(Object &curves_ob,
CurvesGeometry &curves = CurvesGeometry::wrap(curves_id.geometry);
const Mesh &surface_mesh = *static_cast<const Mesh *>(surface_ob.data);
const Span<float3> surface_positions = surface_mesh.positions();
const Span<float3> surface_positions = surface_mesh.vert_positions();
const Span<MLoop> loops = surface_mesh.loops();
const Span<MLoopTri> surface_looptris = surface_mesh.looptris();
VArraySpan<float2> surface_uv_map;

View File

@ -385,7 +385,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
copy_m3_m4(bmat, ob->object_to_world);
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();
bke::AttributeAccessor attributes = me->attributes();

View File

@ -55,7 +55,7 @@ void ED_mesh_mirror_spatial_table_begin(Object *ob, BMEditMesh *em, Mesh *me_eva
}
}
else {
const float(*positions)[3] = BKE_mesh_positions(me_eval ? me_eval : me);
const float(*positions)[3] = BKE_mesh_vert_positions(me_eval ? me_eval : me);
for (int i = 0; i < totvert; i++) {
BLI_kdtree_3d_insert(MirrKdStore.tree, i, positions[i]);
}

View File

@ -898,7 +898,7 @@ static bool ed_mesh_mirror_topo_table_update(Object *ob, Mesh *me_eval)
static int mesh_get_x_mirror_vert_spatial(Object *ob, Mesh *me_eval, int index)
{
Mesh *me = static_cast<Mesh *>(ob->data);
const Span<float3> positions = me_eval ? me_eval->positions() : me->positions();
const Span<float3> positions = me_eval ? me_eval->vert_positions() : me->vert_positions();
float vec[3];
@ -1134,7 +1134,7 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em, Mesh *me_eval)
mirrorverts = static_cast<int *>(MEM_callocN(sizeof(int) * totvert, "MirrorVerts"));
mirrorfaces = static_cast<int *>(MEM_callocN(sizeof(int[2]) * totface, "MirrorFaces"));
const Span<float3> positions = me_eval ? me_eval->positions() : me->positions();
const Span<float3> positions = me_eval ? me_eval->vert_positions() : me->vert_positions();
MFace *mface = (MFace *)CustomData_get_layer(&(me_eval ? me_eval : me)->fdata, CD_MFACE);
ED_mesh_mirror_spatial_table_begin(ob, em, me_eval);
@ -1266,7 +1266,7 @@ bool ED_mesh_pick_face_vert(
const float mval_f[2] = {float(mval[0]), float(mval[1])};
float len_best = FLT_MAX;
const Span<float3> positions = me_eval->positions();
const Span<float3> positions = me_eval->vert_positions();
const Span<MPoly> polys = me_eval->polys();
const Span<MLoop> loops = me_eval->loops();
@ -1397,7 +1397,7 @@ bool ED_mesh_pick_vert(
}
/* setup data */
data.positions = me->positions();
data.positions = me->vert_positions();
data.region = region;
data.mval_f = mval_f;
data.len_best = FLT_MAX;

View File

@ -1034,7 +1034,7 @@ static void bake_targets_populate_pixels_color_attributes(BakeTargets *targets,
const MLoop *loops = BKE_mesh_loops(me_eval);
BKE_mesh_recalc_looptri(loops,
BKE_mesh_polys(me_eval),
BKE_mesh_positions(me_eval),
BKE_mesh_vert_positions(me_eval),
me_eval->totloop,
me_eval->totpoly,
looptri);

View File

@ -600,7 +600,7 @@ bool ED_object_modifier_convert_psys_to_mesh(ReportList * /*reports*/,
CustomData_add_layer(&me->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, edges_num);
CustomData_add_layer(&me->fdata, CD_MFACE, CD_SET_DEFAULT, nullptr, 0);
blender::MutableSpan<float3> positions = me->positions_for_write();
blender::MutableSpan<float3> positions = me->vert_positions_for_write();
blender::MutableSpan<MEdge> edges = me->edges_for_write();
MEdge *medge = edges.data();
@ -715,7 +715,7 @@ static Mesh *create_applied_mesh_for_modifier(Depsgraph *depsgraph,
if (KeyBlock *kb = static_cast<KeyBlock *>(
BLI_findlink(&me->key->block, ob_eval->shapenr - 1))) {
BKE_keyblock_convert_to_mesh(
kb, reinterpret_cast<float(*)[3]>(me->positions_for_write().data()), me->totvert);
kb, reinterpret_cast<float(*)[3]>(me->vert_positions_for_write().data()), me->totvert);
}
}
@ -2866,7 +2866,7 @@ static void skin_armature_bone_create(Object *skin_ob,
static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain, Object *skin_ob)
{
Mesh *me = static_cast<Mesh *>(skin_ob->data);
const Span<float3> me_positions = me->positions();
const Span<float3> me_positions = me->vert_positions();
const Span<MEdge> me_edges = me->edges();
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
@ -2874,7 +2874,7 @@ static Object *modifier_skin_armature_create(Depsgraph *depsgraph, Main *bmain,
const Mesh *me_eval_deform = mesh_get_eval_deform(
depsgraph, scene_eval, ob_eval, &CD_MASK_BAREMESH);
const Span<float3> positions_eval = me_eval_deform->positions();
const Span<float3> positions_eval = me_eval_deform->vert_positions();
/* add vertex weights to original mesh */
CustomData_add_layer(&me->vdata, CD_MDEFORMVERT, CD_SET_DEFAULT, nullptr, me->totvert);

View File

@ -676,7 +676,7 @@ static bool mesh_is_manifold_consistent(Mesh *mesh)
* check that the direction of the faces are consistent and doesn't suddenly
* flip
*/
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
const Span<MEdge> edges = mesh->edges();
const Span<MLoop> loops = mesh->loops();

View File

@ -1383,7 +1383,7 @@ static void moveCloserToDistanceFromPlane(Depsgraph *depsgraph,
do {
wasChange = false;
me_deform = mesh_get_eval_deform(depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
const Span<float3> positions = me_deform->positions();
const Span<float3> positions = me_deform->vert_positions();
m = positions[index];
copy_v3_v3(oldPos, m);
distToStart = dot_v3v3(norm, oldPos) + d;
@ -1548,7 +1548,7 @@ static void vgroup_fix(
Mesh *me_deform = mesh_get_eval_deform(
depsgraph, scene_eval, object_eval, &CD_MASK_BAREMESH);
const Span<float3> positions_deform = me_deform->positions();
const Span<float3> positions_deform = me_deform->vert_positions();
k = count;
while (k--) {
p[k] = positions_deform[verts[k]];

View File

@ -1452,7 +1452,7 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part
vec = edit->emitter_cosnos;
nor = vec + 3;
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh);
MFace *mfaces = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
for (i = 0; i < totface; i++, vec += 6, nor += 6) {
@ -4174,7 +4174,7 @@ static int particle_intersect_mesh(Depsgraph *depsgraph,
totface = mesh->totface;
mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
/* lets intersect the faces */
for (i = 0; i < totface; i++, mface++) {

View File

@ -751,7 +751,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph,
BKE_mesh_tessface_ensure(mesh);
numverts = mesh->totvert;
float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
/* convert to global coordinates */
for (int i = 0; i < numverts; i++) {

View File

@ -142,7 +142,7 @@ struct AddOperationExecutor {
report_empty_evaluated_surface(stroke_extension.reports);
return;
}
surface_positions_eval_ = surface_eval_->positions();
surface_positions_eval_ = surface_eval_->vert_positions();
surface_loops_eval_ = surface_eval_->loops();
surface_looptris_eval_ = surface_eval_->looptris();
BKE_bvhtree_from_mesh_get(&surface_bvh_eval_, surface_eval_, BVHTREE_FROM_LOOPTRI, 2);

View File

@ -119,7 +119,7 @@ struct PuffOperationExecutor {
reinterpret_cast<const float3 *>(CustomData_get_layer(&surface_->ldata, CD_NORMAL)),
surface_->totloop};
surface_positions_ = surface_->positions();
surface_positions_ = surface_->vert_positions();
surface_loops_ = surface_->loops();
surface_looptris_ = surface_->looptris();
BKE_bvhtree_from_mesh_get(&surface_bvh_, surface_, BVHTREE_FROM_LOOPTRI, 2);

View File

@ -197,7 +197,7 @@ struct SlideOperationExecutor {
return;
}
surface_looptris_eval_ = surface_eval_->looptris();
surface_positions_eval_ = surface_eval_->positions();
surface_positions_eval_ = surface_eval_->vert_positions();
surface_loops_eval_ = surface_eval_->loops();
surface_uv_map_eval_ = surface_eval_->attributes().lookup<float2>(uv_map_name,
ATTR_DOMAIN_CORNER);
@ -314,7 +314,7 @@ struct SlideOperationExecutor {
{
const float4x4 brush_transform_inv = brush_transform.inverted();
const Span<float3> positions_orig_su = surface_orig_->positions();
const Span<float3> positions_orig_su = surface_orig_->vert_positions();
const Span<MLoop> loops_orig = surface_orig_->loops();
MutableSpan<float3> positions_orig_cu = curves_orig_->positions_for_write();

View File

@ -4076,7 +4076,7 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p
}
ps->mat_array[totmat - 1] = nullptr;
ps->positions_eval = BKE_mesh_positions(ps->me_eval);
ps->positions_eval = BKE_mesh_vert_positions(ps->me_eval);
ps->vert_normals = BKE_mesh_vertex_normals_ensure(ps->me_eval);
if (ps->do_mask_cavity) {
ps->medge_eval = BKE_mesh_edges(ps->me_eval);

View File

@ -1148,7 +1148,7 @@ static void sculpt_gesture_trim_geometry_generate(SculptGestureContext *sgcontex
const float(*ob_imat)[4] = vc->obact->world_to_object;
/* Write vertices coordinates for the front face. */
float(*positions)[3] = BKE_mesh_positions_for_write(trim_operation->mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(trim_operation->mesh);
float depth_point[3];
madd_v3_v3v3fl(depth_point, shape_origin, shape_normal, depth_front);
for (int i = 0; i < tot_screen_points; i++) {
@ -1362,7 +1362,7 @@ static void sculpt_gesture_trim_apply_for_symmetry_pass(bContext *UNUSED(C),
{
SculptGestureTrimOperation *trim_operation = (SculptGestureTrimOperation *)sgcontext->operation;
Mesh *trim_mesh = trim_operation->mesh;
float(*positions)[3] = BKE_mesh_positions_for_write(trim_mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(trim_mesh);
for (int i = 0; i < trim_mesh->totvert; i++) {
flip_v3_v3(positions[i], trim_operation->true_mesh_co[i], sgcontext->symmpass);
}

View File

@ -288,7 +288,7 @@ static void imapaint_pick_uv(
const MLoopTri *lt = BKE_mesh_runtime_looptri_ensure(me_eval);
const int tottri = BKE_mesh_runtime_looptri_len(me_eval);
const float(*positions)[3] = BKE_mesh_positions(me_eval);
const float(*positions)[3] = BKE_mesh_vert_positions(me_eval);
const MLoop *mloop = BKE_mesh_loops(me_eval);
const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);

View File

@ -3741,7 +3741,7 @@ static void sculpt_combine_proxies_node(Object &object,
BKE_pbvh_node_get_proxies(&node, &proxies, &proxy_count);
Mesh &mesh = *static_cast<Mesh *>(object.data);
MutableSpan<float3> positions = mesh.positions_for_write();
MutableSpan<float3> positions = mesh.vert_positions_for_write();
PBVHVertexIter vd;
BKE_pbvh_vertex_iter_begin (ss->pbvh, &node, vd, PBVH_ITER_UNIQUE) {
@ -3878,7 +3878,7 @@ void SCULPT_flush_stroke_deform(Sculpt * /*sd*/, Object *ob, bool is_proxy_used)
BKE_pbvh_search_gather(ss->pbvh, nullptr, nullptr, &nodes, &totnode);
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
threading::parallel_for(IndexRange(totnode), 1, [&](IndexRange range) {
for (const int i : range) {

View File

@ -69,7 +69,7 @@ void ED_draw_object_facemap(Depsgraph *depsgraph,
if (facemap_data) {
GPU_blend(GPU_BLEND_ALPHA);
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MPoly *polys = BKE_mesh_polys(me);
const MLoop *loops = BKE_mesh_loops(me);

View File

@ -302,7 +302,7 @@ void meshobject_foreachScreenVert(ViewContext *vc,
data.func = func;
data.userData = userData;
data.clip_flag = clip_flag;
data.positions = BKE_mesh_positions_for_write((Mesh *)vc->obact->data);
data.positions = BKE_mesh_vert_positions_for_write((Mesh *)vc->obact->data);
data.hide_vert = (const bool *)CustomData_get_layer_named(
&me->vdata, CD_PROP_BOOL, ".hide_vert");

View File

@ -241,7 +241,7 @@ static void snap_object_data_mesh_get(SnapObjectContext *sctx,
bool use_hide,
BVHTreeFromMesh *r_treedata)
{
const Span<float3> positions = me_eval->positions();
const Span<float3> positions = me_eval->vert_positions();
const Span<MPoly> polys = me_eval->polys();
const Span<MLoop> loops = me_eval->loops();
@ -254,7 +254,7 @@ static void snap_object_data_mesh_get(SnapObjectContext *sctx,
BKE_bvhtree_from_mesh_get(
r_treedata, me_eval, use_hide ? BVHTREE_FROM_LOOPTRI_NO_HIDDEN : BVHTREE_FROM_LOOPTRI, 4);
BLI_assert(r_treedata->positions == positions.data());
BLI_assert(reinterpret_cast<const float3 *>(r_treedata->positions) == positions.data());
BLI_assert(r_treedata->loop == loops.data());
BLI_assert(!polys.data() || r_treedata->looptri);
BLI_assert(!r_treedata->tree || r_treedata->looptri);
@ -1713,7 +1713,7 @@ static void nearest2d_data_init_mesh(const Mesh *mesh,
r_nearest2d->get_tri_verts_index = cb_mlooptri_verts_get;
r_nearest2d->get_tri_edges_index = cb_mlooptri_edges_get;
r_nearest2d->positions = BKE_mesh_positions(mesh);
r_nearest2d->positions = BKE_mesh_vert_positions(mesh);
r_nearest2d->vert_normals = BKE_mesh_vertex_normals_ensure(mesh);
r_nearest2d->edge = mesh->edges().data();
r_nearest2d->loop = mesh->loops().data();

View File

@ -619,7 +619,7 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene,
Mesh *subdiv_mesh = subdivide_edit_mesh(ob, em, &smd);
const float(*subsurfedPositions)[3] = BKE_mesh_positions(subdiv_mesh);
const float(*subsurfedPositions)[3] = BKE_mesh_vert_positions(subdiv_mesh);
const MEdge *subsurfedEdges = BKE_mesh_edges(subdiv_mesh);
const MPoly *subsurfedPolys = BKE_mesh_polys(subdiv_mesh);
const MLoop *subsurfedLoops = BKE_mesh_loops(subdiv_mesh);

View File

@ -402,7 +402,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
{
char *name = ob->id.name + 2;
const Span<float3> mesh_positions = me->positions();
const Span<float3> mesh_positions = me->vert_positions();
const Span<MPoly> mesh_polys = me->polys();
const Span<MLoop> mesh_loops = me->loops();

View File

@ -246,7 +246,7 @@ AddCurvesOnMeshOutputs add_curves_on_mesh(CurvesGeometry &curves,
Vector<float2> used_uvs;
/* Find faces that the passed in uvs belong to. */
const Span<float3> surface_positions = inputs.surface->positions();
const Span<float3> surface_positions = inputs.surface->vert_positions();
const Span<MLoop> surface_loops = inputs.surface->loops();
for (const int i : inputs.uvs.index_range()) {
const float2 &uv = inputs.uvs[i];

View File

@ -1564,7 +1564,7 @@ std::optional<Mesh *> mesh_merge_by_distance_all(const Mesh &mesh,
KDTree_3d *tree = BLI_kdtree_3d_new(selection.size());
const Span<float3> positions = mesh.positions();
const Span<float3> positions = mesh.vert_positions();
for (const int i : selection) {
BLI_kdtree_3d_insert(tree, i, positions[i]);
}
@ -1591,7 +1591,7 @@ std::optional<Mesh *> mesh_merge_by_distance_connected(const Mesh &mesh,
const float merge_distance,
const bool only_loose_edges)
{
const Span<float3> positions = mesh.positions();
const Span<float3> positions = mesh.vert_positions();
const Span<MEdge> edges = mesh.edges();
int vert_kill_len = 0;

View File

@ -405,7 +405,7 @@ Mesh *create_cuboid_mesh(const float3 &size,
Mesh *mesh = BKE_mesh_new_nomain(
config.vertex_count, 0, 0, config.loop_count, config.poly_count);
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
MutableSpan<MPoly> polys = mesh->polys_for_write();
MutableSpan<MLoop> loops = mesh->loops_for_write();

View File

@ -30,7 +30,7 @@ class OpenVDBMeshAdapter {
};
OpenVDBMeshAdapter::OpenVDBMeshAdapter(const Mesh &mesh, float4x4 transform)
: positions_(mesh.positions()),
: positions_(mesh.vert_positions()),
loops_(mesh.loops()),
looptris_(mesh.looptris()),
transform_(transform)

View File

@ -885,7 +885,7 @@ static AllMeshesInfo preprocess_meshes(const GeometrySet &geometry_set,
MeshRealizeInfo &mesh_info = info.realize_info[mesh_index];
const Mesh *mesh = info.order[mesh_index];
mesh_info.mesh = mesh;
mesh_info.positions = mesh->positions();
mesh_info.positions = mesh->vert_positions();
mesh_info.edges = mesh->edges();
mesh_info.polys = mesh->polys();
mesh_info.loops = mesh->loops();
@ -1064,7 +1064,7 @@ static void execute_realize_mesh_tasks(const RealizeInstancesOptions &options,
MeshComponent &dst_component = r_realized_geometry.get_component_for_write<MeshComponent>();
dst_component.replace(dst_mesh);
bke::MutableAttributeAccessor dst_attributes = dst_mesh->attributes_for_write();
MutableSpan<float3> dst_positions = dst_mesh->positions_for_write();
MutableSpan<float3> dst_positions = dst_mesh->vert_positions_for_write();
MutableSpan<MEdge> dst_edges = dst_mesh->edges_for_write();
MutableSpan<MPoly> dst_polys = dst_mesh->polys_for_write();
MutableSpan<MLoop> dst_loops = dst_mesh->loops_for_write();

View File

@ -2025,7 +2025,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *ob_info,
vert_settings.min_iter_per_thread = 4000;
VertData vert_data;
vert_data.positions = BKE_mesh_positions(me);
vert_data.positions = BKE_mesh_vert_positions(me);
vert_data.v_arr = la_v_arr;
vert_data.model_view = ob_info->model_view;
vert_data.model_view_proj = ob_info->model_view_proj;
@ -2042,7 +2042,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *ob_info,
TriData tri_data;
tri_data.ob_info = ob_info;
tri_data.positions = me->positions();
tri_data.positions = me->vert_positions();
tri_data.mlooptri = mlooptri;
tri_data.loops = me->loops();
tri_data.material_indices = material_indices;

View File

@ -122,7 +122,7 @@ void ABCHairWriter::write_hair_sample(const HierarchyContext &context,
MTFace *mtface = (MTFace *)CustomData_get_layer(&mesh->fdata, CD_MTFACE);
MFace *mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh);
if ((!mtface || !mface) && !uv_warning_shown_) {
@ -246,7 +246,7 @@ void ABCHairWriter::write_hair_child_sample(const HierarchyContext &context,
MFace *mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
MTFace *mtface = (MTFace *)CustomData_get_layer(&mesh->fdata, CD_MTFACE);
const float(*positions)[3] = BKE_mesh_positions(mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh);
ParticleSystem *psys = context.particle_system;

View File

@ -436,7 +436,7 @@ static void get_vertices(struct Mesh *mesh, std::vector<Imath::V3f> &points)
points.clear();
points.resize(mesh->totvert);
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
for (int i = 0, e = mesh->totvert; i < e; i++) {
copy_yup_from_zup(points[i].getValue(), positions[i]);
}

View File

@ -155,7 +155,7 @@ static void read_mverts(CDStreamConfig &config, const AbcMeshData &mesh_data)
void read_mverts(Mesh &mesh, const P3fArraySamplePtr positions, const N3fArraySamplePtr normals)
{
MutableSpan<float3> mesh_positions = mesh.positions_for_write();
MutableSpan<float3> mesh_positions = mesh.vert_positions_for_write();
for (int i = 0; i < positions->size(); i++) {
Imath::V3f pos_in = (*positions)[i];
@ -517,7 +517,7 @@ CDStreamConfig get_config(Mesh *mesh, const bool use_vertex_interpolation)
{
CDStreamConfig config;
config.mesh = mesh;
config.positions = mesh->positions_for_write().data();
config.positions = mesh->vert_positions_for_write().data();
config.mloop = mesh->loops_for_write().data();
config.mpoly = mesh->polys_for_write().data();
config.totvert = mesh->totvert;

View File

@ -120,7 +120,7 @@ void GeometryExporter::operator()(Object *ob)
if (this->export_settings.get_include_shapekeys()) {
Key *key = BKE_key_from_object(ob);
if (key) {
blender::MutableSpan<float3> positions = me->positions_for_write();
blender::MutableSpan<float3> positions = me->vert_positions_for_write();
KeyBlock *kb = (KeyBlock *)key->block.first;
/* skip the basis */
kb = kb->next;
@ -438,7 +438,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index,
void GeometryExporter::createVertsSource(std::string geom_id, Mesh *me)
{
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
COLLADASW::FloatSourceF source(mSW);
source.setId(getIdBySemantics(geom_id, COLLADASW::InputSemantic::POSITION));
@ -616,7 +616,7 @@ void GeometryExporter::create_normals(std::vector<Normal> &normals,
std::map<Normal, uint> shared_normal_indices;
int last_normal_index = -1;
const Span<float3> positions = me->positions();
const Span<float3> positions = me->vert_positions();
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(me);
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();

View File

@ -353,7 +353,7 @@ void MeshImporter::read_vertices(COLLADAFW::Mesh *mesh, Mesh *me)
me->totvert = pos.getFloatValues()->getCount() / stride;
CustomData_add_layer_named(
&me->vdata, CD_PROP_FLOAT3, CD_CONSTRUCT, nullptr, me->totvert, "position");
MutableSpan<float3> positions = me->positions_for_write();
MutableSpan<float3> positions = me->vert_positions_for_write();
for (const int i : positions.index_range()) {
get_vector(positions[i], pos, i, stride);
}

View File

@ -78,7 +78,7 @@ Mesh *STLMeshHelper::to_mesh(Main *bmain, char *mesh_name)
mesh->totvert = verts_.size();
CustomData_add_layer_named(
&mesh->vdata, CD_PROP_FLOAT3, CD_CONSTRUCT, nullptr, mesh->totvert, "position");
mesh->positions_for_write().copy_from(verts_);
mesh->vert_positions_for_write().copy_from(verts_);
mesh->totpoly = tris_.size();
mesh->totloop = tris_.size() * 3;

View File

@ -695,7 +695,7 @@ void USDMeshReader::read_mesh_sample(ImportSettings *settings,
* in code that expect this data to be there. */
if (new_mesh || (settings->read_flag & MOD_MESHSEQ_READ_VERT) != 0) {
MutableSpan<float3> mesh_positions = mesh->positions_for_write();
MutableSpan<float3> mesh_positions = mesh->vert_positions_for_write();
for (int i = 0; i < positions_.size(); i++) {
mesh_positions[i] = {positions_[i][0], positions_[i][1], positions_[i][2]};
}

View File

@ -249,7 +249,7 @@ static void get_vertices(const Mesh *mesh, USDMeshData &usd_mesh_data)
{
usd_mesh_data.points.reserve(mesh->totvert);
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
for (const int i : positions.index_range()) {
const float3 &position = positions[i];
usd_mesh_data.points.push_back(pxr::GfVec3f(position.x, position.y, position.z));

View File

@ -37,7 +37,7 @@ OBJMesh::OBJMesh(Depsgraph *depsgraph, const OBJExportParams &export_params, Obj
BKE_object_get_evaluated_mesh(&export_object_eval_) :
BKE_object_get_pre_modified_mesh(&export_object_eval_);
if (export_mesh_) {
mesh_positions_ = export_mesh_->positions();
mesh_positions_ = export_mesh_->vert_positions();
mesh_edges_ = export_mesh_->edges();
mesh_polys_ = export_mesh_->polys();
mesh_loops_ = export_mesh_->loops();
@ -69,7 +69,7 @@ void OBJMesh::set_mesh(Mesh *mesh)
}
owned_export_mesh_ = mesh;
export_mesh_ = owned_export_mesh_;
mesh_positions_ = mesh->positions();
mesh_positions_ = mesh->vert_positions();
mesh_edges_ = mesh->edges();
mesh_polys_ = mesh->polys();
mesh_loops_ = mesh->loops();

View File

@ -154,7 +154,7 @@ void MeshFromGeometry::fixup_invalid_faces()
void MeshFromGeometry::create_vertices(Mesh *mesh)
{
MutableSpan<float3> positions = mesh->positions_for_write();
MutableSpan<float3> positions = mesh->vert_positions_for_write();
/* Go through all the global vertex indices from min to max,
* checking which ones are actually and building a global->local
* index mapping. Write out the used vertex positions into the Mesh

View File

@ -101,7 +101,7 @@ class obj_importer_test : public BlendfileLoadingBaseTest {
EXPECT_EQ(mesh->totedge, exp.mesh_totedge_or_curve_endp);
EXPECT_EQ(mesh->totpoly, exp.mesh_totpoly_or_curve_order);
EXPECT_EQ(mesh->totloop, exp.mesh_totloop_or_curve_cyclic);
const Span<float3> positions = mesh->positions();
const Span<float3> positions = mesh->vert_positions();
EXPECT_V3_NEAR(positions.first(), exp.vert_first, 0.0001f);
EXPECT_V3_NEAR(positions.last(), exp.vert_last, 0.0001f);
const float3 *lnors = (const float3 *)CustomData_get_layer(&mesh->ldata, CD_NORMAL);

View File

@ -220,9 +220,9 @@ typedef struct Mesh {
/**
* Array of vertex positions. Edges and faces are defined by indices into this array.
*/
blender::Span<blender::float3> positions() const;
blender::Span<blender::float3> vert_positions() const;
/** Write access to vertex data. */
blender::MutableSpan<blender::float3> positions_for_write();
blender::MutableSpan<blender::float3> vert_positions_for_write();
/**
* Array of edges, containing vertex indices. For simple triangle or quad meshes, edges could be
* calculated from the #MPoly and #MLoop arrays, however, edges need to be stored explicitly to

View File

@ -366,7 +366,7 @@ static int rna_MeshVertex_index_get(PointerRNA *ptr)
{
const Mesh *mesh = rna_mesh(ptr);
const float(*position)[3] = (const float(*)[3])ptr->data;
const int index = (int)(position - BKE_mesh_positions(mesh));
const int index = (int)(position - BKE_mesh_vert_positions(mesh));
BLI_assert(index >= 0);
BLI_assert(index < mesh->totvert);
return index;
@ -628,7 +628,7 @@ static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
{
Mesh *me = rna_mesh(ptr);
MPoly *mp = (MPoly *)ptr->data;
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MLoop *loops = BKE_mesh_loops(me);
BKE_mesh_calc_poly_normal(mp, loops + mp->loopstart, positions, values);
}
@ -705,7 +705,7 @@ static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values)
{
Mesh *me = rna_mesh(ptr);
MPoly *mp = (MPoly *)ptr->data;
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MLoop *loops = BKE_mesh_loops(me);
BKE_mesh_calc_poly_center(mp, loops + mp->loopstart, positions, values);
}
@ -714,7 +714,7 @@ static float rna_MeshPolygon_area_get(PointerRNA *ptr)
{
Mesh *me = (Mesh *)ptr->owner_id;
MPoly *mp = (MPoly *)ptr->data;
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MLoop *loops = BKE_mesh_loops(me);
return BKE_mesh_calc_poly_area(mp, loops + mp->loopstart, positions);
}
@ -742,7 +742,7 @@ static void rna_MeshLoopTriangle_normal_get(PointerRNA *ptr, float *values)
{
Mesh *me = rna_mesh(ptr);
MLoopTri *lt = (MLoopTri *)ptr->data;
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MLoop *loops = BKE_mesh_loops(me);
uint v1 = loops[lt->tri[0]].v;
uint v2 = loops[lt->tri[1]].v;
@ -773,7 +773,7 @@ static float rna_MeshLoopTriangle_area_get(PointerRNA *ptr)
{
Mesh *me = rna_mesh(ptr);
MLoopTri *lt = (MLoopTri *)ptr->data;
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
const MLoop *loops = BKE_mesh_loops(me);
uint v1 = loops[lt->tri[0]].v;
uint v2 = loops[lt->tri[1]].v;
@ -1661,7 +1661,7 @@ static void rna_Mesh_vertices_begin(CollectionPropertyIterator *iter, PointerRNA
{
Mesh *mesh = rna_mesh(ptr);
rna_iterator_array_begin(
iter, BKE_mesh_positions_for_write(mesh), sizeof(float[3]), mesh->totvert, false, NULL);
iter, BKE_mesh_vert_positions_for_write(mesh), sizeof(float[3]), mesh->totvert, false, NULL);
}
static int rna_Mesh_vertices_length(PointerRNA *ptr)
{
@ -1676,7 +1676,7 @@ int rna_Mesh_vertices_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
}
r_ptr->owner_id = &mesh->id;
r_ptr->type = &RNA_MeshVertex;
r_ptr->data = &BKE_mesh_positions_for_write(mesh)[index];
r_ptr->data = &BKE_mesh_vert_positions_for_write(mesh)[index];
return true;
}

View File

@ -213,7 +213,7 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu
if (pa) {
Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
if (hair_mesh) {
const float(*positions)[3] = BKE_mesh_positions(hair_mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(hair_mesh);
copy_v3_v3(values, positions[pa->hair_index + (hkey - pa->hair)]);
}
else {
@ -278,7 +278,7 @@ static void hair_key_location_object_set(HairKey *hair_key,
if (hair_key_index == -1) {
return;
}
float(*positions)[3] = BKE_mesh_positions_for_write(hair_mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(hair_mesh);
copy_v3_v3(positions[particle->hair_index + (hair_key_index)], src_co);
return;
}
@ -322,7 +322,7 @@ static void rna_ParticleHairKey_co_object(HairKey *hairkey,
NULL;
if (particle) {
if (hair_mesh) {
const float(*positions)[3] = BKE_mesh_positions(hair_mesh);
const float(*positions)[3] = BKE_mesh_vert_positions(hair_mesh);
copy_v3_v3(n_co, positions[particle->hair_index + (hairkey - particle->hair)]);
}
else {

View File

@ -279,7 +279,7 @@ static void mesh_merge_transform(Mesh *result,
MEdge *me;
MLoop *ml;
MPoly *mp;
float(*result_positions)[3] = BKE_mesh_positions_for_write(result);
float(*result_positions)[3] = BKE_mesh_vert_positions_for_write(result);
MEdge *result_edges = BKE_mesh_edges_for_write(result);
MPoly *result_polys = BKE_mesh_polys_for_write(result);
MLoop *result_loops = BKE_mesh_loops_for_write(result);
@ -534,7 +534,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
/* Initialize a result dm */
result = BKE_mesh_new_nomain_from_template(
mesh, result_nverts, result_nedges, 0, result_nloops, result_npolys);
float(*result_positions)[3] = BKE_mesh_positions_for_write(result);
float(*result_positions)[3] = BKE_mesh_vert_positions_for_write(result);
MEdge *result_edges = BKE_mesh_edges_for_write(result);
MPoly *result_polys = BKE_mesh_polys_for_write(result);
MLoop *result_loops = BKE_mesh_loops_for_write(result);

View File

@ -143,7 +143,7 @@ static Mesh *get_quick_mesh(
invert_m4_m4(imat, ob_self->object_to_world);
mul_m4_m4m4(omat, imat, ob_operand_ob->object_to_world);
MutableSpan<float3> positions = result->positions_for_write();
MutableSpan<float3> positions = result->vert_positions_for_write();
for (const int i : positions.index_range()) {
mul_m4_v3(omat, positions[i]);
}

View File

@ -144,7 +144,7 @@ static void deformVerts(ModifierData *md,
if (collmd->time_xnew == -1000) { /* first time */
collmd->x = MEM_dupallocN(BKE_mesh_positions(mesh_src)); /* frame start position */
collmd->x = MEM_dupallocN(BKE_mesh_vert_positions(mesh_src)); /* frame start position */
for (uint i = 0; i < mvert_num; i++) {
/* we save global positions */
@ -181,7 +181,7 @@ static void deformVerts(ModifierData *md,
collmd->xnew = temp;
collmd->time_x = collmd->time_xnew;
memcpy(collmd->xnew, BKE_mesh_positions(mesh_src), mvert_num * sizeof(float[3]));
memcpy(collmd->xnew, BKE_mesh_vert_positions(mesh_src), mvert_num * sizeof(float[3]));
bool is_static = true;

View File

@ -175,9 +175,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
BLI_SPACE_TRANSFORM_SETUP(space_transform, ctx->object, ob_source);
}
const float(*me_positions)[3] = BKE_mesh_positions(me);
const float(*me_positions)[3] = BKE_mesh_vert_positions(me);
const MEdge *me_edges = BKE_mesh_edges(me);
const float(*result_positions)[3] = BKE_mesh_positions(result);
const float(*result_positions)[3] = BKE_mesh_vert_positions(result);
const MEdge *result_edges = BKE_mesh_edges(result);
if (((result == me) || (me_positions == result_positions) || (me_edges == result_edges)) &&

View File

@ -99,7 +99,7 @@ static void createFacepa(ExplodeModifierData *emd, ParticleSystemModifierData *p
int i, p, v1, v2, v3, v4 = 0;
const bool invert_vgroup = (emd->flag & eExplodeFlag_INVERT_VGROUP) != 0;
float(*positions)[3] = BKE_mesh_positions_for_write(mesh);
float(*positions)[3] = BKE_mesh_vert_positions_for_write(mesh);
mface = (MFace *)CustomData_get_layer(&mesh->fdata, CD_MFACE);
totvert = mesh->totvert;
totface = mesh->totface;
@ -729,7 +729,7 @@ static Mesh *cutEdges(ExplodeModifierData *emd, Mesh *mesh)
layers_num = CustomData_number_of_layers(&split_m->fdata, CD_MTFACE);
float(*split_m_positions)[3] = BKE_mesh_positions_for_write(split_m);
float(*split_m_positions)[3] = BKE_mesh_vert_positions_for_write(split_m);
/* copy new faces & verts (is it really this painful with custom data??) */
for (i = 0; i < totvert; i++) {
@ -978,8 +978,8 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
psys_sim_data_init(&sim);
const float(*positions)[3] = BKE_mesh_positions(mesh);
float(*explode_positions)[3] = BKE_mesh_positions_for_write(explode);
const float(*positions)[3] = BKE_mesh_vert_positions(mesh);
float(*explode_positions)[3] = BKE_mesh_vert_positions_for_write(explode);
/* duplicate & displace vertices */
ehi = BLI_edgehashIterator_new(vertpahash);

View File

@ -177,7 +177,7 @@ static void meshcache_do(MeshCacheModifierData *mcmd,
}
else {
float(*vertexCos_New)[3] = MEM_malloc_arrayN(verts_num, sizeof(*vertexCos_New), __func__);
const float(*positions)[3] = BKE_mesh_positions(me);
const float(*positions)[3] = BKE_mesh_vert_positions(me);
BKE_mesh_calc_relative_deform(
BKE_mesh_polys(me),

Some files were not shown because too many files have changed in this diff Show More