[Bf-blender-cvs] [95c87fe2490] temp-vert-normals-cleanup: Merge branch 'master' into temp-vert-normals-cleanup
Hans Goudey
noreply at git.blender.org
Tue Sep 21 06:27:03 CEST 2021
Commit: 95c87fe2490bc3521f7666df2ce03c8205d4f2b6
Author: Hans Goudey
Date: Mon Sep 20 23:26:54 2021 -0500
Branches: temp-vert-normals-cleanup
https://developer.blender.org/rB95c87fe2490bc3521f7666df2ce03c8205d4f2b6
Merge branch 'master' into temp-vert-normals-cleanup
===================================================================
===================================================================
diff --cc source/blender/blenkernel/intern/mesh.c
index 59a94d65fbd,d631993c4e8..5ea830fcd96
--- a/source/blender/blenkernel/intern/mesh.c
+++ b/source/blender/blenkernel/intern/mesh.c
@@@ -1872,9 -1872,20 +1872,9 @@@ void BKE_mesh_vert_coords_apply_with_ma
for (int i = 0; i < mesh->totvert; i++, mv++) {
mul_v3_m4v3(mv->co, mat, vert_coords[i]);
}
- mesh->runtime.cd_dirty_vert |= CD_MASK_NORMAL;
+ BKE_mesh_normals_tag_dirty(mesh);
}
-void BKE_mesh_vert_normals_apply(Mesh *mesh, const short (*vert_normals)[3])
-{
- /* This will just return the pointer if it wasn't a referenced layer. */
- MVert *mv = CustomData_duplicate_referenced_layer(&mesh->vdata, CD_MVERT, mesh->totvert);
- mesh->mvert = mv;
- for (int i = 0; i < mesh->totvert; i++, mv++) {
- copy_v3_v3_short(mv->no, vert_normals[i]);
- }
- mesh->runtime.cd_dirty_vert &= ~CD_MASK_NORMAL;
-}
-
/**
* Compute 'split' (aka loop, or per face corner's) normals.
*
diff --cc source/blender/blenkernel/intern/mesh_convert.cc
index f93fedd6867,07dc6db05aa..e2258d48118
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@@ -90,12 -90,10 +90,13 @@@ void BKE_mesh_from_metaball(ListBase *l
}
if (dl->type == DL_INDEX4) {
- mvert = CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, dl->nr);
- allloop = mloop = CustomData_add_layer(&me->ldata, CD_MLOOP, CD_CALLOC, NULL, dl->parts * 4);
- mpoly = CustomData_add_layer(&me->pdata, CD_MPOLY, CD_CALLOC, NULL, dl->parts);
- mvert = (MVert *)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, nullptr, dl->nr);
++ mvert = (MVert *)CustomData_add_layer(&me->vdata, CD_MVERT, CD_CALLOC, NULL, dl->nr);
+ allloop = mloop = (MLoop *)CustomData_add_layer(
- &me->ldata, CD_MLOOP, CD_CALLOC, nullptr, dl->parts * 4);
- mpoly = (MPoly *)CustomData_add_layer(&me->pdata, CD_MPOLY, CD_CALLOC, nullptr, dl->parts);
++ &me->ldata, CD_MLOOP, CD_CALLOC, NULL, dl->parts * 4);
++ mpoly = (MPoly *)CustomData_add_layer(&me->pdata, CD_MPOLY, CD_CALLOC, NULL, dl->parts);
+ float(*vert_normals)[3] = (float(*)[3])CustomData_add_layer(
+ &me->vdata, CD_NORMAL, CD_DEFAULT, NULL, me->totvert);
+
me->mvert = mvert;
me->mloop = mloop;
me->mpoly = mpoly;
diff --cc source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
index 2891165a1d7,07818f2a3ad..e120c557138
--- a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc
@@@ -46,12 -97,17 +46,12 @@@ static const GVArray *construct_mesh_no
const AttributeDomain domain,
ResourceScope &scope)
{
- Span<MVert> verts{mesh.mvert, mesh.totvert};
- Span<MEdge> edges{mesh.medge, mesh.totedge};
- Span<MPoly> polys{mesh.mpoly, mesh.totpoly};
- Span<MLoop> loops{mesh.mloop, mesh.totloop};
-
switch (domain) {
case ATTR_DOMAIN_FACE: {
- return scope.add_value(mesh_face_normals_gvarray(mesh), __func__).get();
- return scope.add_value(mesh_face_normals(mesh, verts, polys, loops, mask)).get();
++ return scope.add_value(mesh_face_normals_gvarray(mesh)).get();
}
case ATTR_DOMAIN_POINT: {
- return scope.add_value(mesh_vert_normals_gvarray(mesh), __func__).get();
- return scope.add_value(mesh_vertex_normals(mesh, verts, polys, loops, mask)).get();
++ return scope.add_value(mesh_vert_normals_gvarray(mesh)).get();
}
case ATTR_DOMAIN_EDGE: {
/* In this case, start with vertex normals and convert to the edge domain, since the
@@@ -72,12 -132,15 +72,12 @@@
}
case ATTR_DOMAIN_CORNER: {
/* The normals on corners are just the mesh's face normals, so start with the face normal
- * array and copy the face normal for each of its corners. */
- GVArrayPtr face_normals = mesh_face_normals(
- mesh, verts, polys, loops, IndexRange(polys.size()));
-
- /* In this case using the mesh component's generic domain interpolation is fine, the data
- * will still be normalized, since the face normal is just copied to every corner. */
+ * array and copy the face normal for each of its corners. In this case using the mesh
+ * component's generic domain interpolation is fine, the data will still be normalized,
+ * since the face normal is just copied to every corner. */
GVArrayPtr loop_normals = mesh_component.attribute_try_adapt_domain(
- std::move(face_normals), ATTR_DOMAIN_FACE, ATTR_DOMAIN_CORNER);
+ mesh_face_normals_gvarray(mesh), ATTR_DOMAIN_FACE, ATTR_DOMAIN_CORNER);
- return scope.add_value(std::move(loop_normals), __func__).get();
+ return scope.add_value(std::move(loop_normals)).get();
}
default:
return nullptr;
More information about the Bf-blender-cvs
mailing list