diff options
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc | 300 |
1 files changed, 150 insertions, 150 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc index cf6837817c2..c3b1a141f4a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc @@ -168,12 +168,12 @@ static void copy_attributes_based_on_map(const Map<AttributeIDRef, AttributeKind static void copy_face_corner_attributes(const Map<AttributeIDRef, AttributeKind> &attributes, const GeometryComponent &in_component, GeometryComponent &out_component, - const int num_selected_loops, + const int selected_loops_num, const Span<int> selected_poly_indices, const Mesh &mesh_in) { Vector<int64_t> indices; - indices.reserve(num_selected_loops); + indices.reserve(selected_loops_num); for (const int src_poly_index : selected_poly_indices) { const MPoly &src_poly = mesh_in.mpoly[src_poly_index]; const int src_loop_start = src_poly.loopstart; @@ -546,47 +546,47 @@ static void separate_instance_selection(GeometrySet &geometry_set, static void compute_selected_vertices_from_vertex_selection(const Span<bool> vertex_selection, const bool invert, MutableSpan<int> r_vertex_map, - int *r_num_selected_vertices) + int *r_selected_vertices_num) { BLI_assert(vertex_selection.size() == r_vertex_map.size()); - int num_selected_vertices = 0; + int selected_verts_num = 0; for (const int i : r_vertex_map.index_range()) { if (vertex_selection[i] != invert) { - r_vertex_map[i] = num_selected_vertices; - num_selected_vertices++; + r_vertex_map[i] = selected_verts_num; + selected_verts_num++; } else { r_vertex_map[i] = -1; } } - *r_num_selected_vertices = num_selected_vertices; + *r_selected_vertices_num = selected_verts_num; } static void compute_selected_edges_from_vertex_selection(const Mesh &mesh, const Span<bool> vertex_selection, const bool invert, MutableSpan<int> r_edge_map, - int *r_num_selected_edges) + int *r_selected_edges_num) { BLI_assert(mesh.totedge == r_edge_map.size()); - int num_selected_edges = 0; + int selected_edges_num = 0; for (const int i : IndexRange(mesh.totedge)) { const MEdge &edge = mesh.medge[i]; /* Only add the edge if both vertices will be in the new mesh. */ if (vertex_selection[edge.v1] != invert && vertex_selection[edge.v2] != invert) { - r_edge_map[i] = num_selected_edges; - num_selected_edges++; + r_edge_map[i] = selected_edges_num; + selected_edges_num++; } else { r_edge_map[i] = -1; } } - *r_num_selected_edges = num_selected_edges; + *r_selected_edges_num = selected_edges_num; } static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh, @@ -594,15 +594,15 @@ static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh, const bool invert, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_polys_num, + int *r_selected_loops_num) { BLI_assert(mesh.totvert == vertex_selection.size()); r_selected_poly_indices.reserve(mesh.totpoly); r_loop_starts.reserve(mesh.totloop); - int num_selected_loops = 0; + int selected_loops_num = 0; for (const int i : IndexRange(mesh.totpoly)) { const MPoly &poly_src = mesh.mpoly[i]; @@ -617,13 +617,13 @@ static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh, if (all_verts_in_selection) { r_selected_poly_indices.append_unchecked(i); - r_loop_starts.append_unchecked(num_selected_loops); - num_selected_loops += poly_src.totloop; + r_loop_starts.append_unchecked(selected_loops_num); + selected_loops_num += poly_src.totloop; } } - *r_num_selected_polys = r_selected_poly_indices.size(); - *r_num_selected_loops = num_selected_loops; + *r_selected_polys_num = r_selected_poly_indices.size(); + *r_selected_loops_num = selected_loops_num; } /** @@ -636,25 +636,25 @@ static void compute_selected_vertices_and_edges_from_edge_selection( const bool invert, MutableSpan<int> r_vertex_map, MutableSpan<int> r_edge_map, - int *r_num_selected_vertices, - int *r_num_selected_edges) + int *r_selected_vertices_num, + int *r_selected_edges_num) { BLI_assert(mesh.totedge == edge_selection.size()); - int num_selected_edges = 0; - int num_selected_vertices = 0; + int selected_edges_num = 0; + int selected_verts_num = 0; for (const int i : IndexRange(mesh.totedge)) { const MEdge &edge = mesh.medge[i]; if (edge_selection[i] != invert) { - r_edge_map[i] = num_selected_edges; - num_selected_edges++; + r_edge_map[i] = selected_edges_num; + selected_edges_num++; if (r_vertex_map[edge.v1] == -1) { - r_vertex_map[edge.v1] = num_selected_vertices; - num_selected_vertices++; + r_vertex_map[edge.v1] = selected_verts_num; + selected_verts_num++; } if (r_vertex_map[edge.v2] == -1) { - r_vertex_map[edge.v2] = num_selected_vertices; - num_selected_vertices++; + r_vertex_map[edge.v2] = selected_verts_num; + selected_verts_num++; } } else { @@ -662,8 +662,8 @@ static void compute_selected_vertices_and_edges_from_edge_selection( } } - *r_num_selected_vertices = num_selected_vertices; - *r_num_selected_edges = num_selected_edges; + *r_selected_vertices_num = selected_verts_num; + *r_selected_edges_num = selected_edges_num; } /** @@ -673,22 +673,22 @@ static void compute_selected_edges_from_edge_selection(const Mesh &mesh, const Span<bool> edge_selection, const bool invert, MutableSpan<int> r_edge_map, - int *r_num_selected_edges) + int *r_selected_edges_num) { BLI_assert(mesh.totedge == edge_selection.size()); - int num_selected_edges = 0; + int selected_edges_num = 0; for (const int i : IndexRange(mesh.totedge)) { if (edge_selection[i] != invert) { - r_edge_map[i] = num_selected_edges; - num_selected_edges++; + r_edge_map[i] = selected_edges_num; + selected_edges_num++; } else { r_edge_map[i] = -1; } } - *r_num_selected_edges = num_selected_edges; + *r_selected_edges_num = selected_edges_num; } /** @@ -700,13 +700,13 @@ static void compute_selected_polygons_from_edge_selection(const Mesh &mesh, const bool invert, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_polys_num, + int *r_selected_loops_num) { r_selected_poly_indices.reserve(mesh.totpoly); r_loop_starts.reserve(mesh.totloop); - int num_selected_loops = 0; + int selected_loops_num = 0; for (const int i : IndexRange(mesh.totpoly)) { const MPoly &poly_src = mesh.mpoly[i]; @@ -721,13 +721,13 @@ static void compute_selected_polygons_from_edge_selection(const Mesh &mesh, if (all_edges_in_selection) { r_selected_poly_indices.append_unchecked(i); - r_loop_starts.append_unchecked(num_selected_loops); - num_selected_loops += poly_src.totloop; + r_loop_starts.append_unchecked(selected_loops_num); + selected_loops_num += poly_src.totloop; } } - *r_num_selected_polys = r_selected_poly_indices.size(); - *r_num_selected_loops = num_selected_loops; + *r_selected_polys_num = r_selected_poly_indices.size(); + *r_selected_loops_num = selected_loops_num; } /** @@ -740,21 +740,21 @@ static void compute_selected_mesh_data_from_vertex_selection_edge_face( MutableSpan<int> r_edge_map, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_edges, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_edges_num, + int *r_selected_polys_num, + int *r_selected_loops_num) { compute_selected_edges_from_vertex_selection( - mesh, vertex_selection, invert, r_edge_map, r_num_selected_edges); + mesh, vertex_selection, invert, r_edge_map, r_selected_edges_num); compute_selected_polygons_from_vertex_selection(mesh, vertex_selection, invert, r_selected_poly_indices, r_loop_starts, - r_num_selected_polys, - r_num_selected_loops); + r_selected_polys_num, + r_selected_loops_num); } /** @@ -768,24 +768,24 @@ static void compute_selected_mesh_data_from_vertex_selection(const Mesh &mesh, MutableSpan<int> r_edge_map, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_vertices, - int *r_num_selected_edges, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_vertices_num, + int *r_selected_edges_num, + int *r_selected_polys_num, + int *r_selected_loops_num) { compute_selected_vertices_from_vertex_selection( - vertex_selection, invert, r_vertex_map, r_num_selected_vertices); + vertex_selection, invert, r_vertex_map, r_selected_vertices_num); compute_selected_edges_from_vertex_selection( - mesh, vertex_selection, invert, r_edge_map, r_num_selected_edges); + mesh, vertex_selection, invert, r_edge_map, r_selected_edges_num); compute_selected_polygons_from_vertex_selection(mesh, vertex_selection, invert, r_selected_poly_indices, r_loop_starts, - r_num_selected_polys, - r_num_selected_loops); + r_selected_polys_num, + r_selected_loops_num); } /** @@ -799,19 +799,19 @@ static void compute_selected_mesh_data_from_edge_selection_edge_face( MutableSpan<int> r_edge_map, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_edges, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_edges_num, + int *r_selected_polys_num, + int *r_selected_loops_num) { compute_selected_edges_from_edge_selection( - mesh, edge_selection, invert, r_edge_map, r_num_selected_edges); + mesh, edge_selection, invert, r_edge_map, r_selected_edges_num); compute_selected_polygons_from_edge_selection(mesh, edge_selection, invert, r_selected_poly_indices, r_loop_starts, - r_num_selected_polys, - r_num_selected_loops); + r_selected_polys_num, + r_selected_loops_num); } /** @@ -825,10 +825,10 @@ static void compute_selected_mesh_data_from_edge_selection(const Mesh &mesh, MutableSpan<int> r_edge_map, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_vertices, - int *r_num_selected_edges, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_vertices_num, + int *r_selected_edges_num, + int *r_selected_polys_num, + int *r_selected_loops_num) { r_vertex_map.fill(-1); compute_selected_vertices_and_edges_from_edge_selection(mesh, @@ -836,15 +836,15 @@ static void compute_selected_mesh_data_from_edge_selection(const Mesh &mesh, invert, r_vertex_map, r_edge_map, - r_num_selected_vertices, - r_num_selected_edges); + r_selected_vertices_num, + r_selected_edges_num); compute_selected_polygons_from_edge_selection(mesh, edge_selection, invert, r_selected_poly_indices, r_loop_starts, - r_num_selected_polys, - r_num_selected_loops); + r_selected_polys_num, + r_selected_loops_num); } /** @@ -855,26 +855,26 @@ static void compute_selected_polygons_from_poly_selection(const Mesh &mesh, const bool invert, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_polys_num, + int *r_selected_loops_num) { BLI_assert(mesh.totpoly == poly_selection.size()); r_selected_poly_indices.reserve(mesh.totpoly); r_loop_starts.reserve(mesh.totloop); - int num_selected_loops = 0; + int selected_loops_num = 0; for (const int i : IndexRange(mesh.totpoly)) { const MPoly &poly_src = mesh.mpoly[i]; /* We keep this one. */ if (poly_selection[i] != invert) { r_selected_poly_indices.append_unchecked(i); - r_loop_starts.append_unchecked(num_selected_loops); - num_selected_loops += poly_src.totloop; + r_loop_starts.append_unchecked(selected_loops_num); + selected_loops_num += poly_src.totloop; } } - *r_num_selected_polys = r_selected_poly_indices.size(); - *r_num_selected_loops = num_selected_loops; + *r_selected_polys_num = r_selected_poly_indices.size(); + *r_selected_loops_num = selected_loops_num; } /** * Checks for every polygon if it is in `poly_selection`. If it is, the edges @@ -887,9 +887,9 @@ static void compute_selected_mesh_data_from_poly_selection_edge_face( MutableSpan<int> r_edge_map, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_edges, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_edges_num, + int *r_selected_polys_num, + int *r_selected_loops_num) { BLI_assert(mesh.totpoly == poly_selection.size()); BLI_assert(mesh.totedge == r_edge_map.size()); @@ -898,30 +898,30 @@ static void compute_selected_mesh_data_from_poly_selection_edge_face( r_selected_poly_indices.reserve(mesh.totpoly); r_loop_starts.reserve(mesh.totloop); - int num_selected_loops = 0; - int num_selected_edges = 0; + int selected_loops_num = 0; + int selected_edges_num = 0; for (const int i : IndexRange(mesh.totpoly)) { const MPoly &poly_src = mesh.mpoly[i]; /* We keep this one. */ if (poly_selection[i] != invert) { r_selected_poly_indices.append_unchecked(i); - r_loop_starts.append_unchecked(num_selected_loops); - num_selected_loops += poly_src.totloop; + r_loop_starts.append_unchecked(selected_loops_num); + selected_loops_num += poly_src.totloop; /* Add the vertices and the edges. */ Span<MLoop> loops_src(&mesh.mloop[poly_src.loopstart], poly_src.totloop); for (const MLoop &loop : loops_src) { /* Check first if it has not yet been added. */ if (r_edge_map[loop.e] == -1) { - r_edge_map[loop.e] = num_selected_edges; - num_selected_edges++; + r_edge_map[loop.e] = selected_edges_num; + selected_edges_num++; } } } } - *r_num_selected_edges = num_selected_edges; - *r_num_selected_polys = r_selected_poly_indices.size(); - *r_num_selected_loops = num_selected_loops; + *r_selected_edges_num = selected_edges_num; + *r_selected_polys_num = r_selected_poly_indices.size(); + *r_selected_loops_num = selected_loops_num; } /** @@ -935,10 +935,10 @@ static void compute_selected_mesh_data_from_poly_selection(const Mesh &mesh, MutableSpan<int> r_edge_map, Vector<int> &r_selected_poly_indices, Vector<int> &r_loop_starts, - int *r_num_selected_vertices, - int *r_num_selected_edges, - int *r_num_selected_polys, - int *r_num_selected_loops) + int *r_selected_vertices_num, + int *r_selected_edges_num, + int *r_selected_polys_num, + int *r_selected_loops_num) { BLI_assert(mesh.totpoly == poly_selection.size()); BLI_assert(mesh.totedge == r_edge_map.size()); @@ -948,36 +948,36 @@ static void compute_selected_mesh_data_from_poly_selection(const Mesh &mesh, r_selected_poly_indices.reserve(mesh.totpoly); r_loop_starts.reserve(mesh.totloop); - int num_selected_loops = 0; - int num_selected_vertices = 0; - int num_selected_edges = 0; + int selected_loops_num = 0; + int selected_verts_num = 0; + int selected_edges_num = 0; for (const int i : IndexRange(mesh.totpoly)) { const MPoly &poly_src = mesh.mpoly[i]; /* We keep this one. */ if (poly_selection[i] != invert) { r_selected_poly_indices.append_unchecked(i); - r_loop_starts.append_unchecked(num_selected_loops); - num_selected_loops += poly_src.totloop; + r_loop_starts.append_unchecked(selected_loops_num); + selected_loops_num += poly_src.totloop; /* Add the vertices and the edges. */ Span<MLoop> loops_src(&mesh.mloop[poly_src.loopstart], poly_src.totloop); for (const MLoop &loop : loops_src) { /* Check first if it has not yet been added. */ if (r_vertex_map[loop.v] == -1) { - r_vertex_map[loop.v] = num_selected_vertices; - num_selected_vertices++; + r_vertex_map[loop.v] = selected_verts_num; + selected_verts_num++; } if (r_edge_map[loop.e] == -1) { - r_edge_map[loop.e] = num_selected_edges; - num_selected_edges++; + r_edge_map[loop.e] = selected_edges_num; + selected_edges_num++; } } } } - *r_num_selected_vertices = num_selected_vertices; - *r_num_selected_edges = num_selected_edges; - *r_num_selected_polys = r_selected_poly_indices.size(); - *r_num_selected_loops = num_selected_loops; + *r_selected_vertices_num = selected_verts_num; + *r_selected_edges_num = selected_edges_num; + *r_selected_polys_num = r_selected_poly_indices.size(); + *r_selected_loops_num = selected_loops_num; } /** @@ -993,8 +993,8 @@ static void do_mesh_separation(GeometrySet &geometry_set, /* Needed in all cases. */ Vector<int> selected_poly_indices; Vector<int> new_loop_starts; - int num_selected_polys = 0; - int num_selected_loops = 0; + int selected_polys_num = 0; + int selected_loops_num = 0; const Mesh &mesh_in = *in_component.get_for_read(); Mesh *mesh_out; @@ -1007,10 +1007,10 @@ static void do_mesh_separation(GeometrySet &geometry_set, switch (mode) { case GEO_NODE_DELETE_GEOMETRY_MODE_ALL: { Array<int> vertex_map(mesh_in.totvert); - int num_selected_vertices = 0; + int selected_verts_num = 0; Array<int> edge_map(mesh_in.totedge); - int num_selected_edges = 0; + int selected_edges_num = 0; /* Fill all the maps based on the selection. */ switch (domain) { @@ -1022,10 +1022,10 @@ static void do_mesh_separation(GeometrySet &geometry_set, edge_map, selected_poly_indices, new_loop_starts, - &num_selected_vertices, - &num_selected_edges, - &num_selected_polys, - &num_selected_loops); + &selected_verts_num, + &selected_edges_num, + &selected_polys_num, + &selected_loops_num); break; case ATTR_DOMAIN_EDGE: compute_selected_mesh_data_from_edge_selection(mesh_in, @@ -1035,10 +1035,10 @@ static void do_mesh_separation(GeometrySet &geometry_set, edge_map, selected_poly_indices, new_loop_starts, - &num_selected_vertices, - &num_selected_edges, - &num_selected_polys, - &num_selected_loops); + &selected_verts_num, + &selected_edges_num, + &selected_polys_num, + &selected_loops_num); break; case ATTR_DOMAIN_FACE: compute_selected_mesh_data_from_poly_selection(mesh_in, @@ -1048,21 +1048,21 @@ static void do_mesh_separation(GeometrySet &geometry_set, edge_map, selected_poly_indices, new_loop_starts, - &num_selected_vertices, - &num_selected_edges, - &num_selected_polys, - &num_selected_loops); + &selected_verts_num, + &selected_edges_num, + &selected_polys_num, + &selected_loops_num); break; default: BLI_assert_unreachable(); break; } mesh_out = BKE_mesh_new_nomain_from_template(&mesh_in, - num_selected_vertices, - num_selected_edges, + selected_verts_num, + selected_edges_num, 0, - num_selected_loops, - num_selected_polys); + selected_loops_num, + selected_polys_num); out_component.replace(mesh_out, GeometryOwnershipType::Editable); /* Copy the selected parts of the mesh over to the new mesh. */ @@ -1084,14 +1084,14 @@ static void do_mesh_separation(GeometrySet &geometry_set, copy_face_corner_attributes(attributes, in_component, out_component, - num_selected_loops, + selected_loops_num, selected_poly_indices, mesh_in); break; } case GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE: { Array<int> edge_map(mesh_in.totedge); - int num_selected_edges = 0; + int selected_edges_num = 0; /* Fill all the maps based on the selection. */ switch (domain) { @@ -1102,9 +1102,9 @@ static void do_mesh_separation(GeometrySet &geometry_set, edge_map, selected_poly_indices, new_loop_starts, - &num_selected_edges, - &num_selected_polys, - &num_selected_loops); + &selected_edges_num, + &selected_polys_num, + &selected_loops_num); break; case ATTR_DOMAIN_EDGE: compute_selected_mesh_data_from_edge_selection_edge_face(mesh_in, @@ -1113,9 +1113,9 @@ static void do_mesh_separation(GeometrySet &geometry_set, edge_map, selected_poly_indices, new_loop_starts, - &num_selected_edges, - &num_selected_polys, - &num_selected_loops); + &selected_edges_num, + &selected_polys_num, + &selected_loops_num); break; case ATTR_DOMAIN_FACE: compute_selected_mesh_data_from_poly_selection_edge_face(mesh_in, @@ -1124,9 +1124,9 @@ static void do_mesh_separation(GeometrySet &geometry_set, edge_map, selected_poly_indices, new_loop_starts, - &num_selected_edges, - &num_selected_polys, - &num_selected_loops); + &selected_edges_num, + &selected_polys_num, + &selected_loops_num); break; default: BLI_assert_unreachable(); @@ -1134,10 +1134,10 @@ static void do_mesh_separation(GeometrySet &geometry_set, } mesh_out = BKE_mesh_new_nomain_from_template(&mesh_in, mesh_in.totvert, - num_selected_edges, + selected_edges_num, 0, - num_selected_loops, - num_selected_polys); + selected_loops_num, + selected_polys_num); out_component.replace(mesh_out, GeometryOwnershipType::Editable); /* Copy the selected parts of the mesh over to the new mesh. */ @@ -1158,7 +1158,7 @@ static void do_mesh_separation(GeometrySet &geometry_set, copy_face_corner_attributes(attributes, in_component, out_component, - num_selected_loops, + selected_loops_num, selected_poly_indices, mesh_in); break; @@ -1172,8 +1172,8 @@ static void do_mesh_separation(GeometrySet &geometry_set, invert, selected_poly_indices, new_loop_starts, - &num_selected_polys, - &num_selected_loops); + &selected_polys_num, + &selected_loops_num); break; case ATTR_DOMAIN_EDGE: compute_selected_polygons_from_edge_selection(mesh_in, @@ -1181,8 +1181,8 @@ static void do_mesh_separation(GeometrySet &geometry_set, invert, selected_poly_indices, new_loop_starts, - &num_selected_polys, - &num_selected_loops); + &selected_polys_num, + &selected_loops_num); break; case ATTR_DOMAIN_FACE: compute_selected_polygons_from_poly_selection(mesh_in, @@ -1190,15 +1190,15 @@ static void do_mesh_separation(GeometrySet &geometry_set, invert, selected_poly_indices, new_loop_starts, - &num_selected_polys, - &num_selected_loops); + &selected_polys_num, + &selected_loops_num); break; default: BLI_assert_unreachable(); break; } mesh_out = BKE_mesh_new_nomain_from_template( - &mesh_in, mesh_in.totvert, mesh_in.totedge, 0, num_selected_loops, num_selected_polys); + &mesh_in, mesh_in.totvert, mesh_in.totedge, 0, selected_loops_num, selected_polys_num); out_component.replace(mesh_out, GeometryOwnershipType::Editable); /* Copy the selected parts of the mesh over to the new mesh. */ @@ -1217,7 +1217,7 @@ static void do_mesh_separation(GeometrySet &geometry_set, copy_face_corner_attributes(attributes, in_component, out_component, - num_selected_loops, + selected_loops_num, selected_poly_indices, mesh_in); break; |