Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| static VArray<float3> construct_uv_gvarray(const Mesh &mesh, | static VArray<float3> construct_uv_gvarray(const Mesh &mesh, | ||||
| const Field<bool> selection_field, | const Field<bool> selection_field, | ||||
| const Field<bool> seam_field, | const Field<bool> seam_field, | ||||
| const bool fill_holes, | const bool fill_holes, | ||||
| const float margin, | const float margin, | ||||
| const GeometryNodeUVUnwrapMethod method, | const GeometryNodeUVUnwrapMethod method, | ||||
| const eAttrDomain domain) | const eAttrDomain domain) | ||||
| { | { | ||||
| const Span<MVert> verts = mesh.verts(); | const Span<float3> positions = mesh.positions(); | ||||
| const Span<MEdge> edges = mesh.edges(); | const Span<MEdge> edges = mesh.edges(); | ||||
| const Span<MPoly> polys = mesh.polys(); | const Span<MPoly> polys = mesh.polys(); | ||||
| const Span<MLoop> loops = mesh.loops(); | const Span<MLoop> loops = mesh.loops(); | ||||
| bke::MeshFieldContext face_context{mesh, ATTR_DOMAIN_FACE}; | bke::MeshFieldContext face_context{mesh, ATTR_DOMAIN_FACE}; | ||||
| FieldEvaluator face_evaluator{face_context, polys.size()}; | FieldEvaluator face_evaluator{face_context, polys.size()}; | ||||
| face_evaluator.add(selection_field); | face_evaluator.add(selection_field); | ||||
| face_evaluator.evaluate(); | face_evaluator.evaluate(); | ||||
| Show All 16 Lines | for (const int mp_index : selection) { | ||||
| Array<ParamKey, 16> mp_vkeys(mp.totloop); | Array<ParamKey, 16> mp_vkeys(mp.totloop); | ||||
| Array<bool, 16> mp_pin(mp.totloop); | Array<bool, 16> mp_pin(mp.totloop); | ||||
| Array<bool, 16> mp_select(mp.totloop); | Array<bool, 16> mp_select(mp.totloop); | ||||
| Array<const float *, 16> mp_co(mp.totloop); | Array<const float *, 16> mp_co(mp.totloop); | ||||
| Array<float *, 16> mp_uv(mp.totloop); | Array<float *, 16> mp_uv(mp.totloop); | ||||
| for (const int i : IndexRange(mp.totloop)) { | for (const int i : IndexRange(mp.totloop)) { | ||||
| const MLoop &ml = loops[mp.loopstart + i]; | const MLoop &ml = loops[mp.loopstart + i]; | ||||
| mp_vkeys[i] = ml.v; | mp_vkeys[i] = ml.v; | ||||
| mp_co[i] = verts[ml.v].co; | mp_co[i] = positions[ml.v]; | ||||
| mp_uv[i] = uv[mp.loopstart + i]; | mp_uv[i] = uv[mp.loopstart + i]; | ||||
| mp_pin[i] = false; | mp_pin[i] = false; | ||||
| mp_select[i] = false; | mp_select[i] = false; | ||||
| } | } | ||||
| GEO_uv_parametrizer_face_add(handle, | GEO_uv_parametrizer_face_add(handle, | ||||
| mp_index, | mp_index, | ||||
| mp.totloop, | mp.totloop, | ||||
| mp_vkeys.data(), | mp_vkeys.data(), | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||