[Bf-blender-cvs] [6192f0c712f] refactor-mesh-position-generic: Merge branch 'master' into refactor-mesh-position-generic
Hans Goudey
noreply at git.blender.org
Fri Oct 14 23:27:44 CEST 2022
Commit: 6192f0c712f253a467ccdcea62e328c9e29fd7f3
Author: Hans Goudey
Date: Fri Oct 14 15:05:35 2022 -0500
Branches: refactor-mesh-position-generic
https://developer.blender.org/rB6192f0c712f253a467ccdcea62e328c9e29fd7f3
Merge branch 'master' into refactor-mesh-position-generic
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/mesh_runtime.cc
index 1ee0489e44a,e90a298ad8d..86e8eff1bf1
--- a/source/blender/blenkernel/intern/mesh_runtime.cc
+++ b/source/blender/blenkernel/intern/mesh_runtime.cc
@@@ -157,34 -93,34 +94,34 @@@ static void mesh_ensure_looptri_data(Me
void BKE_mesh_runtime_looptri_recalc(Mesh *mesh)
{
mesh_ensure_looptri_data(mesh);
- BLI_assert(mesh->totpoly == 0 || mesh->runtime.looptris.array_wip != nullptr);
+ BLI_assert(mesh->totpoly == 0 || mesh->runtime->looptris.array_wip != nullptr);
- const Span<MVert> verts = mesh->verts();
+ const Span<float3> positions = mesh->positions();
const Span<MPoly> polys = mesh->polys();
const Span<MLoop> loops = mesh->loops();
if (!BKE_mesh_poly_normals_are_dirty(mesh)) {
BKE_mesh_recalc_looptri_with_normals(loops.data(),
polys.data(),
- verts.data(),
+ reinterpret_cast<const float(*)[3]>(positions.data()),
mesh->totloop,
mesh->totpoly,
- mesh->runtime.looptris.array_wip,
+ mesh->runtime->looptris.array_wip,
BKE_mesh_poly_normals_ensure(mesh));
}
else {
BKE_mesh_recalc_looptri(loops.data(),
polys.data(),
- verts.data(),
+ reinterpret_cast<const float(*)[3]>(positions.data()),
mesh->totloop,
mesh->totpoly,
- mesh->runtime.looptris.array_wip);
+ mesh->runtime->looptris.array_wip);
}
- BLI_assert(mesh->runtime.looptris.array == nullptr);
- atomic_cas_ptr((void **)&mesh->runtime.looptris.array,
- mesh->runtime.looptris.array,
- mesh->runtime.looptris.array_wip);
- mesh->runtime.looptris.array_wip = nullptr;
+ BLI_assert(mesh->runtime->looptris.array == nullptr);
+ atomic_cas_ptr((void **)&mesh->runtime->looptris.array,
+ mesh->runtime->looptris.array,
+ mesh->runtime->looptris.array_wip);
+ mesh->runtime->looptris.array_wip = nullptr;
}
int BKE_mesh_runtime_looptri_len(const Mesh *mesh)
diff --cc source/blender/blenkernel/intern/rigidbody.c
index 9b677be561a,ffc6bc8d7a3..e0ab11c9c70
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@@ -402,10 -401,10 +402,10 @@@ static rbCollisionShape *rigidbody_get_
return NULL;
}
- const MVert *mvert = BKE_mesh_verts(mesh);
+ const float(*positions)[3] = BKE_mesh_positions(mesh);
totvert = mesh->totvert;
looptri = BKE_mesh_runtime_looptri_ensure(mesh);
- tottri = mesh->runtime.looptris.len;
+ tottri = BKE_mesh_runtime_looptri_len(mesh);
const MLoop *mloop = BKE_mesh_loops(mesh);
/* sanity checking - potential case when no data will be present */
@@@ -677,10 -676,10 +677,10 @@@ void BKE_rigidbody_calc_volume(Object *
return;
}
- const MVert *mvert = BKE_mesh_verts(mesh);
+ const float(*positions)[3] = BKE_mesh_positions(mesh);
totvert = mesh->totvert;
lt = BKE_mesh_runtime_looptri_ensure(mesh);
- tottri = mesh->runtime.looptris.len;
+ tottri = BKE_mesh_runtime_looptri_len(mesh);
const MLoop *mloop = BKE_mesh_loops(mesh);
if (totvert > 0 && tottri > 0) {
@@@ -751,10 -750,10 +751,10 @@@ void BKE_rigidbody_calc_center_of_mass(
return;
}
- const MVert *mvert = BKE_mesh_verts(mesh);
+ const float(*positions)[3] = BKE_mesh_positions(mesh);
totvert = mesh->totvert;
looptri = BKE_mesh_runtime_looptri_ensure(mesh);
- tottri = mesh->runtime.looptris.len;
+ tottri = BKE_mesh_runtime_looptri_len(mesh);
const MLoop *mloop = BKE_mesh_loops(mesh);
if (totvert > 0 && tottri > 0) {
diff --cc source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 356f7a020e7,d65cac08db8..d43107cb507
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@@ -952,14 -971,13 +972,14 @@@ void BM_mesh_bm_to_me(Main *bmain, BMes
{
CustomData_MeshMasks mask = CD_MASK_MESH;
CustomData_MeshMasks_update(&mask, ¶ms->cd_mask_extra);
- CustomData_copy_mesh_to_bmesh(&bm->vdata, &me->vdata, mask.vmask, CD_SET_DEFAULT, me->totvert);
- CustomData_copy_mesh_to_bmesh(&bm->edata, &me->edata, mask.emask, CD_SET_DEFAULT, me->totedge);
- CustomData_copy_mesh_to_bmesh(&bm->ldata, &me->ldata, mask.lmask, CD_SET_DEFAULT, me->totloop);
- CustomData_copy_mesh_to_bmesh(&bm->pdata, &me->pdata, mask.pmask, CD_SET_DEFAULT, me->totpoly);
+ CustomData_copy(&bm->vdata, &me->vdata, mask.vmask, CD_SET_DEFAULT, me->totvert);
+ CustomData_copy(&bm->edata, &me->edata, mask.emask, CD_SET_DEFAULT, me->totedge);
+ CustomData_copy(&bm->ldata, &me->ldata, mask.lmask, CD_SET_DEFAULT, me->totloop);
+ CustomData_copy(&bm->pdata, &me->pdata, mask.pmask, CD_SET_DEFAULT, me->totpoly);
}
- CustomData_add_layer(&me->vdata, CD_MVERT, CD_SET_DEFAULT, nullptr, me->totvert);
+ CustomData_add_layer_named(
+ &me->vdata, CD_PROP_FLOAT3, CD_CONSTRUCT, nullptr, me->totvert, "position");
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);
diff --cc source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
index b77acb1224b,d43eb6117df..03e70dc7ef7
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_fdots_pos.cc
@@@ -75,8 -75,9 +75,8 @@@ static void extract_fdots_pos_iter_poly
float *co = center[mp_index];
zero_v3(co);
- const MVert *mvert = mr->mvert;
const MLoop *mloop = mr->mloop;
- const BLI_bitmap *facedot_tags = mr->me->runtime.subsurf_face_dot_tags;
+ const BLI_bitmap *facedot_tags = mr->me->runtime->subsurf_face_dot_tags;
const int ml_index_end = mp->loopstart + mp->totloop;
for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) {
diff --cc source/blender/editors/sculpt_paint/paint_utils.c
index 21861e0d6a7,ce4a5151a20..96792c5f232
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@@ -286,9 -286,9 +286,9 @@@ static void imapaint_pick_uv
const ePaintCanvasSource mode = scene->toolsettings->imapaint.mode;
const MLoopTri *lt = BKE_mesh_runtime_looptri_ensure(me_eval);
- const int tottri = me_eval->runtime.looptris.len;
+ const int tottri = BKE_mesh_runtime_looptri_len(me_eval);
- const MVert *mvert = BKE_mesh_verts(me_eval);
+ const float(*positions)[3] = BKE_mesh_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);
diff --cc source/blender/editors/transform/transform_snap_object.cc
index 9901903e50f,7971e1ca9af..f3a2983747c
--- a/source/blender/editors/transform/transform_snap_object.cc
+++ b/source/blender/editors/transform/transform_snap_object.cc
@@@ -267,11 -267,10 +267,11 @@@ static SnapData_Mesh *snap_object_data_
/* The tree is owned by the Mesh and may have been freed since we last used. */
is_dirty = true;
}
- else if (sod->treedata_mesh.looptri != me_eval->runtime.looptris.array) {
+ else if (sod->treedata_mesh.looptri != me_eval->looptris().data()) {
is_dirty = true;
}
- else if (sod->treedata_mesh.vert != verts.data()) {
+ else if (sod->treedata_mesh.positions !=
+ reinterpret_cast<const float(*)[3]>(positions.data())) {
is_dirty = true;
}
else if (sod->treedata_mesh.loop != loops.data()) {
diff --cc source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index 1fb4f0ba34b,d00c09b9013..3929ebda32c
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@@ -265,13 -265,13 +265,13 @@@ const char *OBJMesh::get_object_materia
return mat->id.name + 2;
}
- float3 OBJMesh::calc_vertex_coords(const int vert_index, const float scaling_factor) const
+ float3 OBJMesh::calc_vertex_coords(const int vert_index, const float global_scale) const
{
float3 r_coords;
- const Span<MVert> verts = export_mesh_eval_->verts();
- copy_v3_v3(r_coords, verts[vert_index].co);
+ const Span<float3> positions = export_mesh_eval_->positions();
+ copy_v3_v3(r_coords, positions[vert_index]);
mul_m4_v3(world_and_axes_transform_, r_coords);
- mul_v3_fl(r_coords, scaling_factor);
+ mul_v3_fl(r_coords, global_scale);
return r_coords;
}
diff --cc source/blender/makesdna/DNA_mesh_types.h
index 3512dc401a0,3f951583741..7f2fe4dfeb1
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@@ -40,126 -39,9 +43,8 @@@ struct Key
struct MCol;
struct MEdge;
struct MFace;
- struct MLoopCol;
struct MLoopTri;
-struct MVert;
struct Material;
- struct Mesh;
- struct SubdivCCG;
- struct SubsurfRuntimeData;
-
- #
- #
- typedef struct EditMeshData {
- /** when set, \a vertexNos, polyNos are lazy initialized */
- const float (*vertexCos)[3];
-
- /** lazy initialize (when \a vertexCos is set) */
- float const (*vertexNos)[3];
- float const (*polyNos)[3];
- /** also lazy init but don't depend on \a vertexCos */
- const float (*polyCos)[3];
- } EditMeshData;
-
- /**
- * \warning Typical access is done via
- * #BKE_mesh_runtime_looptri_ensure, #BKE_mesh_runtime_looptri_len.
- */
- struct MLoopTri_Store {
- DNA_DEFINE_CXX_METHODS(MLoopTri_Store)
-
- /* WARNING!
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list