Differential D10803 Diff 35545 source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc
Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_spreadsheet/spreadsheet_from_geometry.cc
| Show First 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | static void get_selected_corner_indices(const Mesh &mesh, | ||||
| for (const int i : IndexRange(mesh.totloop)) { | for (const int i : IndexRange(mesh.totloop)) { | ||||
| const MLoop &loop = mesh.mloop[i]; | const MLoop &loop = mesh.mloop[i]; | ||||
| if (is_vertex_selected_fn(loop.v)) { | if (is_vertex_selected_fn(loop.v)) { | ||||
| r_corner_indices.append(i); | r_corner_indices.append(i); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void get_selected_polygon_indices(const Mesh &mesh, | static void get_selected_face_indices(const Mesh &mesh, | ||||
| const IsVertexSelectedFn is_vertex_selected_fn, | const IsVertexSelectedFn is_vertex_selected_fn, | ||||
| Vector<int64_t> &r_polygon_indices) | Vector<int64_t> &r_face_indices) | ||||
| { | { | ||||
| for (const int poly_index : IndexRange(mesh.totpoly)) { | for (const int poly_index : IndexRange(mesh.totpoly)) { | ||||
| const MPoly &poly = mesh.mpoly[poly_index]; | const MPoly &poly = mesh.mpoly[poly_index]; | ||||
| bool is_selected = true; | bool is_selected = true; | ||||
| for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) { | for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) { | ||||
| const MLoop &loop = mesh.mloop[loop_index]; | const MLoop &loop = mesh.mloop[loop_index]; | ||||
| if (!is_vertex_selected_fn(loop.v)) { | if (!is_vertex_selected_fn(loop.v)) { | ||||
| is_selected = false; | is_selected = false; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (is_selected) { | if (is_selected) { | ||||
| r_polygon_indices.append(poly_index); | r_face_indices.append(poly_index); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void get_selected_edge_indices(const Mesh &mesh, | static void get_selected_edge_indices(const Mesh &mesh, | ||||
| const IsVertexSelectedFn is_vertex_selected_fn, | const IsVertexSelectedFn is_vertex_selected_fn, | ||||
| Vector<int64_t> &r_edge_indices) | Vector<int64_t> &r_edge_indices) | ||||
| { | { | ||||
| for (const int i : IndexRange(mesh.totedge)) { | for (const int i : IndexRange(mesh.totedge)) { | ||||
| const MEdge &edge = mesh.medge[i]; | const MEdge &edge = mesh.medge[i]; | ||||
| if (is_vertex_selected_fn(edge.v1) && is_vertex_selected_fn(edge.v2)) { | if (is_vertex_selected_fn(edge.v1) && is_vertex_selected_fn(edge.v2)) { | ||||
| r_edge_indices.append(i); | r_edge_indices.append(i); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void get_selected_indices_on_domain(const Mesh &mesh, | static void get_selected_indices_on_domain(const Mesh &mesh, | ||||
| const AttributeDomain domain, | const AttributeDomain domain, | ||||
| const IsVertexSelectedFn is_vertex_selected_fn, | const IsVertexSelectedFn is_vertex_selected_fn, | ||||
| Vector<int64_t> &r_indices) | Vector<int64_t> &r_indices) | ||||
| { | { | ||||
| switch (domain) { | switch (domain) { | ||||
| case ATTR_DOMAIN_POINT: | case ATTR_DOMAIN_POINT: | ||||
| return get_selected_vertex_indices(mesh, is_vertex_selected_fn, r_indices); | return get_selected_vertex_indices(mesh, is_vertex_selected_fn, r_indices); | ||||
| case ATTR_DOMAIN_POLYGON: | case ATTR_DOMAIN_FACE: | ||||
| return get_selected_polygon_indices(mesh, is_vertex_selected_fn, r_indices); | return get_selected_face_indices(mesh, is_vertex_selected_fn, r_indices); | ||||
| case ATTR_DOMAIN_CORNER: | case ATTR_DOMAIN_CORNER: | ||||
| return get_selected_corner_indices(mesh, is_vertex_selected_fn, r_indices); | return get_selected_corner_indices(mesh, is_vertex_selected_fn, r_indices); | ||||
| case ATTR_DOMAIN_EDGE: | case ATTR_DOMAIN_EDGE: | ||||
| return get_selected_edge_indices(mesh, is_vertex_selected_fn, r_indices); | return get_selected_edge_indices(mesh, is_vertex_selected_fn, r_indices); | ||||
| default: | default: | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines | |||||