diff options
Diffstat (limited to 'source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc')
-rw-r--r-- | source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc index 68f172169f4..3c79e66f436 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc @@ -168,45 +168,49 @@ std::unique_ptr<ColumnValues> GeometryDataSource::get_column_values( else if (G.debug_value == 4001 && component_->type() == GEO_COMPONENT_TYPE_MESH) { const MeshComponent &component = static_cast<const MeshComponent &>(*component_); if (const Mesh *mesh = component.get_for_read()) { + const Span<MEdge> edges = mesh->edges(); + const Span<MPoly> polys = mesh->polygons(); + const Span<MLoop> loops = mesh->loops(); + if (domain_ == ATTR_DOMAIN_EDGE) { if (STREQ(column_id.name, "Vertex 1")) { return std::make_unique<ColumnValues>( - column_id.name, VArray<int>::ForFunc(mesh->totedge, [mesh](int64_t index) { - return mesh->medge[index].v1; + column_id.name, VArray<int>::ForFunc(edges.size(), [edges](int64_t index) { + return edges[index].v1; })); } if (STREQ(column_id.name, "Vertex 2")) { return std::make_unique<ColumnValues>( - column_id.name, VArray<int>::ForFunc(mesh->totedge, [mesh](int64_t index) { - return mesh->medge[index].v2; + column_id.name, VArray<int>::ForFunc(edges.size(), [edges](int64_t index) { + return edges[index].v2; })); } } else if (domain_ == ATTR_DOMAIN_FACE) { if (STREQ(column_id.name, "Corner Start")) { return std::make_unique<ColumnValues>( - column_id.name, VArray<int>::ForFunc(mesh->totpoly, [mesh](int64_t index) { - return mesh->mpoly[index].loopstart; + column_id.name, VArray<int>::ForFunc(polys.size(), [polys](int64_t index) { + return polys[index].loopstart; })); } if (STREQ(column_id.name, "Corner Size")) { return std::make_unique<ColumnValues>( - column_id.name, VArray<int>::ForFunc(mesh->totpoly, [mesh](int64_t index) { - return mesh->mpoly[index].totloop; + column_id.name, VArray<int>::ForFunc(polys.size(), [polys](int64_t index) { + return polys[index].totloop; })); } } else if (domain_ == ATTR_DOMAIN_CORNER) { if (STREQ(column_id.name, "Vertex")) { return std::make_unique<ColumnValues>( - column_id.name, VArray<int>::ForFunc(mesh->totloop, [mesh](int64_t index) { - return mesh->mloop[index].v; + column_id.name, VArray<int>::ForFunc(loops.size(), [loops](int64_t index) { + return loops[index].v; })); } if (STREQ(column_id.name, "Edge")) { return std::make_unique<ColumnValues>( - column_id.name, VArray<int>::ForFunc(mesh->totloop, [mesh](int64_t index) { - return mesh->mloop[index].e; + column_id.name, VArray<int>::ForFunc(loops.size(), [loops](int64_t index) { + return loops[index].e; })); } } |