Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc
| Show First 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static Vector<ElementIsland> prepare_face_islands(const Mesh &mesh, const IndexMask face_selection) | static Vector<ElementIsland> prepare_face_islands(const Mesh &mesh, const IndexMask face_selection) | ||||
| { | { | ||||
| const Span<MPoly> polys = mesh.polys(); | const Span<MPoly> polys = mesh.polys(); | ||||
| const Span<MLoop> loops = mesh.loops(); | const Span<MLoop> loops = mesh.loops(); | ||||
| /* Use the disjoint set data structure to determine which vertices have to be scaled together. */ | /* Use the disjoint set data structure to determine which vertices have to be scaled together. */ | ||||
| DisjointSet disjoint_set(mesh.totvert); | DisjointSet<int> disjoint_set(mesh.totvert); | ||||
| for (const int poly_index : face_selection) { | for (const int poly_index : face_selection) { | ||||
| const MPoly &poly = polys[poly_index]; | const MPoly &poly = polys[poly_index]; | ||||
| const Span<MLoop> poly_loops = loops.slice(poly.loopstart, poly.totloop); | const Span<MLoop> poly_loops = loops.slice(poly.loopstart, poly.totloop); | ||||
| for (const int loop_index : IndexRange(poly.totloop - 1)) { | for (const int loop_index : IndexRange(poly.totloop - 1)) { | ||||
| const int v1 = poly_loops[loop_index].v; | const int v1 = poly_loops[loop_index].v; | ||||
| const int v2 = poly_loops[loop_index + 1].v; | const int v2 = poly_loops[loop_index + 1].v; | ||||
| disjoint_set.join(v1, v2); | disjoint_set.join(v1, v2); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | static void scale_faces_uniformly(Mesh &mesh, const UniformScaleFields &fields) | ||||
| scale_vertex_islands_uniformly(mesh, island, params, get_face_verts); | scale_vertex_islands_uniformly(mesh, island, params, get_face_verts); | ||||
| } | } | ||||
| static Vector<ElementIsland> prepare_edge_islands(const Mesh &mesh, const IndexMask edge_selection) | static Vector<ElementIsland> prepare_edge_islands(const Mesh &mesh, const IndexMask edge_selection) | ||||
| { | { | ||||
| const Span<MEdge> edges = mesh.edges(); | const Span<MEdge> edges = mesh.edges(); | ||||
| /* Use the disjoint set data structure to determine which vertices have to be scaled together. */ | /* Use the disjoint set data structure to determine which vertices have to be scaled together. */ | ||||
| DisjointSet disjoint_set(mesh.totvert); | DisjointSet<int> disjoint_set(mesh.totvert); | ||||
| for (const int edge_index : edge_selection) { | for (const int edge_index : edge_selection) { | ||||
| const MEdge &edge = edges[edge_index]; | const MEdge &edge = edges[edge_index]; | ||||
| disjoint_set.join(edge.v1, edge.v2); | disjoint_set.join(edge.v1, edge.v2); | ||||
| } | } | ||||
| VectorSet<int> island_ids; | VectorSet<int> island_ids; | ||||
| Vector<ElementIsland> islands; | Vector<ElementIsland> islands; | ||||
| /* There are at most as many islands as there are selected edges. */ | /* There are at most as many islands as there are selected edges. */ | ||||
| ▲ Show 20 Lines • Show All 119 Lines • Show Last 20 Lines | |||||