[Bf-blender-cvs] [37d5248b2ac] refactor-mesh-corners-generic: Merge branch 'master' into refactor-mesh-corners-generic
Hans Goudey
noreply at git.blender.org
Thu Jan 19 01:44:26 CET 2023
Commit: 37d5248b2accd54ac7f4ab4cf58461a7e5e52285
Author: Hans Goudey
Date: Wed Jan 18 18:33:51 2023 -0600
Branches: refactor-mesh-corners-generic
https://developer.blender.org/rB37d5248b2accd54ac7f4ab4cf58461a7e5e52285
Merge branch 'master' into refactor-mesh-corners-generic
===================================================================
===================================================================
diff --cc source/blender/blenkernel/BKE_mesh.h
index c3ff1a14972,557b70b8a11..653a2407887
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@@ -472,11 -473,9 +473,10 @@@ void BKE_mesh_ensure_normals_for_displa
* Used when defining an empty custom loop normals data layer,
* to keep same shading as with auto-smooth!
*/
- void BKE_edges_sharp_from_angle_set(struct MEdge *medges,
- int numEdges,
+ void BKE_edges_sharp_from_angle_set(int numEdges,
- const struct MLoop *mloops,
- int numLoops,
+ const int *corner_verts,
+ const int *corner_edges,
+ int corners_num,
const struct MPoly *mpolys,
const float (*poly_normals)[3],
int numPolys,
@@@ -615,10 -617,9 +619,10 @@@ void BKE_mesh_normals_loop_split(const
void BKE_mesh_normals_loop_custom_set(const float (*vert_positions)[3],
const float (*vert_normals)[3],
int numVerts,
- struct MEdge *medges,
+ const struct MEdge *medges,
int numEdges,
- const struct MLoop *mloops,
+ const int *corner_verts,
+ const int *corner_edges,
float (*r_custom_loop_normals)[3],
int numLoops,
const struct MPoly *mpolys,
@@@ -629,11 -631,10 +634,11 @@@ void BKE_mesh_normals_loop_custom_from_
const float (*vert_normals)[3],
float (*r_custom_vert_normals)[3],
int numVerts,
- struct MEdge *medges,
+ const struct MEdge *medges,
int numEdges,
- const struct MLoop *mloops,
- int numLoops,
+ const int *corner_verts,
+ const int *corner_edges,
+ int corners_num,
const struct MPoly *mpolys,
const float (*poly_normals)[3],
int numPolys,
@@@ -756,9 -759,9 +762,10 @@@ void BKE_mesh_polygon_flip_ex(const str
struct MDisps *mdisp,
bool use_loop_mdisp_flip);
void BKE_mesh_polygon_flip(const struct MPoly *mpoly,
- struct MLoop *mloop,
+ int *corner_verts,
+ int *corner_edges,
- struct CustomData *ldata);
+ struct CustomData *ldata,
+ int totloop);
/**
* Flip (invert winding of) all polygons (used to inverse their normals).
*
@@@ -1018,27 -1019,16 +1025,27 @@@ BLI_INLINE const MPoly *BKE_mesh_polys(
}
BLI_INLINE MPoly *BKE_mesh_polys_for_write(Mesh *mesh)
{
- return (MPoly *)CustomData_duplicate_referenced_layer(&mesh->pdata, CD_MPOLY, mesh->totpoly);
+ return (MPoly *)CustomData_get_layer_for_write(&mesh->pdata, CD_MPOLY, mesh->totpoly);
}
-BLI_INLINE const MLoop *BKE_mesh_loops(const Mesh *mesh)
+BLI_INLINE const int *BKE_mesh_corner_verts(const Mesh *mesh)
{
- return (const MLoop *)CustomData_get_layer(&mesh->ldata, CD_MLOOP);
+ return (const int *)CustomData_get_layer_named(&mesh->ldata, CD_PROP_INT32, ".corner_vert");
}
-BLI_INLINE MLoop *BKE_mesh_loops_for_write(Mesh *mesh)
+BLI_INLINE int *BKE_mesh_corner_verts_for_write(Mesh *mesh)
{
- return (int *)CustomData_duplicate_referenced_layer_named(
- return (MLoop *)CustomData_get_layer_for_write(&mesh->ldata, CD_MLOOP, mesh->totloop);
++ return (int *)CustomData_get_layer_named_for_write(
+ &mesh->ldata, CD_PROP_INT32, ".corner_vert", mesh->totloop);
+}
+
+BLI_INLINE const int *BKE_mesh_corner_edges(const Mesh *mesh)
+{
+ return (const int *)CustomData_get_layer_named(&mesh->ldata, CD_PROP_INT32, ".corner_edge");
+}
+BLI_INLINE int *BKE_mesh_corner_edges_for_write(Mesh *mesh)
+{
- return (int *)CustomData_duplicate_referenced_layer_named(
++ return (int *)CustomData_get_layer_named_for_write(
+ &mesh->ldata, CD_PROP_INT32, ".corner_edge", mesh->totloop);
}
BLI_INLINE const MDeformVert *BKE_mesh_deform_verts(const Mesh *mesh)
diff --cc source/blender/blenkernel/BKE_mesh_mapping.h
index ae99915a965,4db3ea414f4..a5b70fc8a28
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@@ -322,8 -320,9 +322,9 @@@ int *BKE_mesh_calc_smoothgroups(const s
int totedge,
const struct MPoly *mpoly,
int totpoly,
- const struct MLoop *mloop,
+ const int *corner_edges,
int totloop,
+ const bool *sharp_edges,
int *r_totgroup,
bool use_bitflags);
diff --cc source/blender/blenkernel/intern/DerivedMesh.cc
index 8a3c101d844,39a68b72d2a..fae3c782ed0
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@@ -121,40 -122,19 +122,40 @@@ static MEdge *dm_getEdgeArray(DerivedMe
return medge;
}
-static MLoop *dm_getLoopArray(DerivedMesh *dm)
+static int *dm_getCornerVertArray(DerivedMesh *dm)
{
- int *corner_verts = (int *)CustomData_get_layer_named(
- &dm->loopData, CD_PROP_INT32, ".corner_vert");
- MLoop *mloop = (MLoop *)CustomData_get_layer_for_write(
- &dm->loopData, CD_MLOOP, dm->getNumLoops(dm));
++ int *corner_verts = (int *)CustomData_get_layer_named_for_write(
++ &dm->loopData, CD_PROP_INT32, ".corner_vert", dm->getNumLoops(dm));
- if (!mloop) {
- mloop = (MLoop *)CustomData_add_layer(
- &dm->loopData, CD_MLOOP, CD_SET_DEFAULT, nullptr, dm->getNumLoops(dm));
- CustomData_set_layer_flag(&dm->loopData, CD_MLOOP, CD_FLAG_TEMPORARY);
- dm->copyLoopArray(dm, mloop);
+ if (!corner_verts) {
+ corner_verts = (int *)CustomData_add_layer_named(&dm->loopData,
+ CD_PROP_INT32,
+ CD_SET_DEFAULT,
+ nullptr,
+ dm->getNumLoops(dm),
+ ".corner_vert");
+ dm->copyCornerVertArray(dm, corner_verts);
}
- return mloop;
+ return corner_verts;
+}
+
+static int *dm_getCornerEdgeArray(DerivedMesh *dm)
+{
+ int *corner_edges = (int *)CustomData_get_layer_named(
+ &dm->loopData, CD_PROP_INT32, ".corner_edge");
+
+ if (!corner_edges) {
+ corner_edges = (int *)CustomData_add_layer_named(&dm->loopData,
+ CD_PROP_INT32,
+ CD_SET_DEFAULT,
+ nullptr,
+ dm->getNumLoops(dm),
+ ".corner_edge");
+ dm->copyCornerEdgeArray(dm, corner_edges);
+ }
+
+ return corner_edges;
}
static MPoly *dm_getPolyArray(DerivedMesh *dm)
diff --cc source/blender/blenkernel/intern/cdderivedmesh.c
index 2cdc840594f,a5d179fb2cb..720c78d283e
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@@ -233,10 -226,9 +234,12 @@@ static DerivedMesh *cdDM_from_mesh_ex(M
/* Though this may be an unnecessary calculation, simply retrieving the layer may return nothing
* or dirty normals. */
cddm->vert_normals = BKE_mesh_vertex_normals_ensure(mesh);
- cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
- cddm->corner_verts = CustomData_get_layer_named(&dm->loopData, CD_PROP_INT32, ".corner_vert");
- cddm->corner_edges = CustomData_get_layer_named(&dm->loopData, CD_PROP_INT32, ".corner_edge");
- cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
+ cddm->medge = CustomData_get_layer_for_write(&dm->edgeData, CD_MEDGE, mesh->totedge);
- cddm->mloop = CustomData_get_layer_for_write(&dm->loopData, CD_MLOOP, mesh->totloop);
++ cddm->corner_verts = CustomData_get_layer_named_for_write(
++ &dm->loopData, CD_PROP_INT32, ".corner_vert", mesh->totloop);
++ cddm->corner_edges = CustomData_get_layer_named_for_write(
++ &dm->loopData, CD_PROP_INT32, ".corner_edge", mesh->totloop);
+ cddm->mpoly = CustomData_get_layer_for_write(&dm->polyData, CD_MPOLY, mesh->totpoly);
#if 0
cddm->mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
#else
diff --cc source/blender/blenkernel/intern/curve_to_mesh_convert.cc
index 6ff0331ec86,9fd35fbfb65..364606e0cb3
--- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
+++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
@@@ -147,17 -140,14 +140,14 @@@ static void fill_mesh_topology(const in
for (const int i : IndexRange(profile_segment_num)) {
const int i_inv = profile_segment_num - i - 1;
- MLoop &loop_start = loops[cap_loop_offset + i];
- loop_start.v = vert_offset + i_inv;
- loop_sta
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list