[Bf-blender-cvs] [5fce94f8253] refactor-mesh-sharp-edge-generic: Move code to make diff smaller
Hans Goudey
noreply at git.blender.org
Thu Jan 5 04:54:48 CET 2023
Commit: 5fce94f8253b73325f34758b3f0b3257e467b4e5
Author: Hans Goudey
Date: Wed Jan 4 22:46:50 2023 -0500
Branches: refactor-mesh-sharp-edge-generic
https://developer.blender.org/rB5fce94f8253b73325f34758b3f0b3257e467b4e5
Move code to make diff smaller
===================================================================
M source/blender/blenkernel/intern/curve_to_mesh_convert.cc
===================================================================
diff --git a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
index 9a14ab26ce2..fc9da6b7e6c 100644
--- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
+++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc
@@ -716,10 +716,34 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main,
verts.slice(info.vert_range));
});
- Set<AttributeIDRef> main_attributes_set;
-
MutableAttributeAccessor mesh_attributes = mesh->attributes_for_write();
+ SpanAttributeWriter<bool> sharp_edges;
+ write_sharp_bezier_edges(curves_info, offsets, mesh_attributes, sharp_edges);
+ if (fill_caps) {
+ if (!sharp_edges) {
+ sharp_edges = mesh_attributes.lookup_or_add_for_write_span<bool>(".sharp_edge",
+ ATTR_DOMAIN_EDGE);
+ }
+ foreach_curve_combination(curves_info, offsets, [&](const CombinationInfo &info) {
+ if (info.main_cyclic || !info.profile_cyclic) {
+ return;
+ }
+ const int main_edges_start = info.edge_range.start();
+ const int last_ring_index = info.main_points.size() - 1;
+ const int profile_edges_start = main_edges_start +
+ info.profile_points.size() * info.main_segment_num;
+ const int last_ring_edge_offset = profile_edges_start +
+ info.profile_segment_num * last_ring_index;
+
+ sharp_edges.span.slice(profile_edges_start, info.profile_segment_num).fill(true);
+ sharp_edges.span.slice(last_ring_edge_offset, info.profile_segment_num).fill(true);
+ });
+ }
+ sharp_edges.finish();
+
+ Set<AttributeIDRef> main_attributes_set;
+
main_attributes.for_all([&](const AttributeIDRef &id, const AttributeMetaData meta_data) {
if (!should_add_attribute_to_mesh(main_attributes, mesh_attributes, id, meta_data)) {
return true;
@@ -789,30 +813,6 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main,
return true;
});
- SpanAttributeWriter<bool> sharp_edges;
- write_sharp_bezier_edges(curves_info, offsets, mesh_attributes, sharp_edges);
- if (fill_caps) {
- if (!sharp_edges) {
- sharp_edges = mesh_attributes.lookup_or_add_for_write_span<bool>(".sharp_edge",
- ATTR_DOMAIN_EDGE);
- }
- foreach_curve_combination(curves_info, offsets, [&](const CombinationInfo &info) {
- if (info.main_cyclic || !info.profile_cyclic) {
- return;
- }
- const int main_edges_start = info.edge_range.start();
- const int last_ring_index = info.main_points.size() - 1;
- const int profile_edges_start = main_edges_start +
- info.profile_points.size() * info.main_segment_num;
- const int last_ring_edge_offset = profile_edges_start +
- info.profile_segment_num * last_ring_index;
-
- sharp_edges.span.slice(profile_edges_start, info.profile_segment_num).fill(true);
- sharp_edges.span.slice(last_ring_edge_offset, info.profile_segment_num).fill(true);
- });
- }
- sharp_edges.finish();
-
return mesh;
}
More information about the Bf-blender-cvs
mailing list