Commit: 6a596e03faf20653639c917de99b69c02ea47edc
Author: Hans Goudey
Date: Thu Jan 5 14:46:50 2023 -0500
Branches: refactor-mesh-sharp-face-generic
https://developer.blender.org/rB6a596e03faf20653639c917de99b69c02ea47edc
Fix Mesh BMesh conversion
===================================================================
M source/blender/bmesh/intern/bmesh_mesh_convert.cc
===================================================================
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 6f5d79237bd..f0381385cd4 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -1082,7 +1082,7 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me,
const struct BMeshToMesh
}
if (need_sharp_face) {
BM_mesh_elem_table_ensure(bm, BM_FACE);
- write_fn_to_attribute<int>(
+ write_fn_to_attribute<bool>(
me->attributes_for_write(), "sharp_face", ATTR_DOMAIN_FACE, [&](const
int i) {
return !BM_elem_flag_test(BM_face_at_index(bm, i), BM_ELEM_SMOOTH);
});
@@ -1321,6 +1321,13 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me,
const CustomData_MeshMasks *
BM_elem_index_set(efa, i); /* set_inline */
mp->totloop = efa->len;
+ if (!BM_elem_flag_test(efa, BM_ELEM_SMOOTH)) {
+ if (!sharp_face_attribute) {
+ sharp_face_attribute =
mesh_attributes.lookup_or_add_for_write_span<bool>(
+ "sharp_face", ATTR_DOMAIN_FACE);
+ }
+ sharp_face_attribute.span[i] = true;
+ }
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
if (!hide_poly_attribute) {
hide_poly_attribute =
mesh_attributes.lookup_or_add_for_write_span<bool>(".hide_poly",
@@ -1342,13 +1349,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me,
const CustomData_MeshMasks *
material_index_attribute =
mesh_attributes.lookup_or_add_for_write_span<int>(
"material_index", ATTR_DOMAIN_FACE);
}
- }
- if (!BM_elem_flag_test(efa, BM_ELEM_SMOOTH)) {
- if (!sharp_face_attribute) {
- sharp_face_attribute =
mesh_attributes.lookup_or_add_for_write_span<bool>(
- "sharp_face", ATTR_DOMAIN_FACE);
- }
- sharp_face_attribute.span[i] = true;
+ material_index_attribute.span[i] = efa->mat_nr;
}
l_iter = l_first = BM_FACE_FIRST_LOOP(efa);
@@ -1370,6 +1371,7 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const
CustomData_MeshMasks *
assert_bmesh_has_no_mesh_only_attributes(*bm);
material_index_attribute.finish();
+ sharp_face_attribute.finish();
hide_vert_attribute.finish();
hide_edge_attribute.finish();
hide_poly_attribute.finish();
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs