diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-08 05:41:39 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-08 05:41:39 +0300 |
commit | d5934974219135102f364f57c45a8b1465e2b8d9 (patch) | |
tree | 415beea6d138085505b74d52301ff913781203dd /source/blender/blenkernel | |
parent | 17bc29253070f1707acd40c75e4a0e5c53704b24 (diff) |
Cleanup: Use C++ methods to retrieve attribute accessors
Replace `mesh_attributes`, `mesh_attributes_for_write` and the point
cloud versions with methods on the `Mesh` and `PointCloud` types.
This makes them friendlier to use and improves readability.
Differential Revision: https://developer.blender.org/D15907
Diffstat (limited to 'source/blender/blenkernel')
17 files changed, 50 insertions, 55 deletions
diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh index 83e1a3208ae..4aa6c133e9e 100644 --- a/source/blender/blenkernel/BKE_attribute.hh +++ b/source/blender/blenkernel/BKE_attribute.hh @@ -755,12 +755,6 @@ class CustomDataAttributes { bool foreach_attribute(const AttributeForeachCallback callback, eAttrDomain domain) const; }; -AttributeAccessor mesh_attributes(const Mesh &mesh); -MutableAttributeAccessor mesh_attributes_for_write(Mesh &mesh); - -AttributeAccessor pointcloud_attributes(const PointCloud &pointcloud); -MutableAttributeAccessor pointcloud_attributes_for_write(PointCloud &pointcloud); - /* -------------------------------------------------------------------- */ /** \name #AttributeIDRef Inline Methods * \{ */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index c282305af5b..0036ed1cf61 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -826,7 +826,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, mesh_final = BKE_mesh_copy_for_eval(mesh_input, true); ASSERT_IS_VALID_MESH(mesh_final); } - MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh_final); + MutableAttributeAccessor attributes = mesh_final->attributes_for_write(); SpanAttributeWriter<float3> rest_positions = attributes.lookup_or_add_for_write_only_span<float3>("rest_position", ATTR_DOMAIN_POINT); if (rest_positions) { diff --git a/source/blender/blenkernel/intern/attribute.cc b/source/blender/blenkernel/intern/attribute.cc index 941003d6c96..f66a1f9ee93 100644 --- a/source/blender/blenkernel/intern/attribute.cc +++ b/source/blender/blenkernel/intern/attribute.cc @@ -103,11 +103,11 @@ static std::optional<blender::bke::MutableAttributeAccessor> get_attribute_acces Mesh &mesh = reinterpret_cast<Mesh &>(id); /* The attribute API isn't implemented for BMesh, so edit mode meshes are not supported. */ BLI_assert(mesh.edit_mesh == nullptr); - return mesh_attributes_for_write(mesh); + return mesh.attributes_for_write(); } case ID_PT: { PointCloud &pointcloud = reinterpret_cast<PointCloud &>(id); - return pointcloud_attributes_for_write(pointcloud); + return pointcloud.attributes_for_write(); } case ID_CV: { Curves &curves_id = reinterpret_cast<Curves &>(id); diff --git a/source/blender/blenkernel/intern/bvhutils.cc b/source/blender/blenkernel/intern/bvhutils.cc index 1d8b53a28ba..9bea8a0d6d3 100644 --- a/source/blender/blenkernel/intern/bvhutils.cc +++ b/source/blender/blenkernel/intern/bvhutils.cc @@ -1294,7 +1294,7 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, break; case BVHTREE_FROM_LOOPTRI_NO_HIDDEN: { - blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*mesh); + blender::bke::AttributeAccessor attributes = mesh->attributes(); mask = looptri_no_hidden_map_get( mesh->polys().data(), attributes.lookup_or_default(".hide_poly", ATTR_DOMAIN_FACE, false), @@ -1454,7 +1454,7 @@ BVHTree *BKE_bvhtree_from_pointcloud_get(BVHTreeFromPointCloud *data, return nullptr; } - blender::bke::AttributeAccessor attributes = blender::bke::pointcloud_attributes(*pointcloud); + blender::bke::AttributeAccessor attributes = pointcloud->attributes(); blender::VArraySpan<blender::float3> positions = attributes.lookup_or_default<blender::float3>( "position", ATTR_DOMAIN_POINT, blender::float3(0)); diff --git a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc index 8be7cec1b04..b9fea2a27b8 100644 --- a/source/blender/blenkernel/intern/curve_to_mesh_convert.cc +++ b/source/blender/blenkernel/intern/curve_to_mesh_convert.cc @@ -711,7 +711,7 @@ Mesh *curve_to_mesh_sweep(const CurvesGeometry &main, Set<AttributeIDRef> main_attributes_set; - MutableAttributeAccessor mesh_attributes = bke::mesh_attributes_for_write(*mesh); + MutableAttributeAccessor mesh_attributes = mesh->attributes_for_write(); main_attributes.for_all([&](const AttributeIDRef &id, const AttributeMetaData meta_data) { if (!should_add_attribute_to_mesh(main_attributes, mesh_attributes, id)) { diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index 1a994266df7..715c7d6c743 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -149,7 +149,7 @@ VArray<float3> mesh_normals_varray(const Mesh &mesh, * array and copy the face normal for each of its corners. In this case using the mesh * component's generic domain interpolation is fine, the data will still be normalized, * since the face normal is just copied to every corner. */ - return mesh_attributes(mesh).adapt_domain( + return mesh.attributes().adapt_domain( VArray<float3>::ForSpan({(float3 *)BKE_mesh_poly_normals_ensure(&mesh), mesh.totpoly}), ATTR_DOMAIN_FACE, ATTR_DOMAIN_CORNER); @@ -1324,18 +1324,19 @@ static const AttributeAccessorFunctions &get_mesh_accessor_functions_ref() return fn; } -AttributeAccessor mesh_attributes(const Mesh &mesh) +} // namespace blender::bke + +blender::bke::AttributeAccessor Mesh::attributes() const { - return AttributeAccessor(&mesh, get_mesh_accessor_functions_ref()); + return blender::bke::AttributeAccessor(this, blender::bke::get_mesh_accessor_functions_ref()); } -MutableAttributeAccessor mesh_attributes_for_write(Mesh &mesh) +blender::bke::MutableAttributeAccessor Mesh::attributes_for_write() { - return MutableAttributeAccessor(&mesh, get_mesh_accessor_functions_ref()); + return blender::bke::MutableAttributeAccessor(this, + blender::bke::get_mesh_accessor_functions_ref()); } -} // namespace blender::bke - std::optional<blender::bke::AttributeAccessor> MeshComponent::attributes() const { return blender::bke::AttributeAccessor(mesh_, blender::bke::get_mesh_accessor_functions_ref()); diff --git a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc index 238854c987e..6980b561bc3 100644 --- a/source/blender/blenkernel/intern/geometry_component_pointcloud.cc +++ b/source/blender/blenkernel/intern/geometry_component_pointcloud.cc @@ -201,18 +201,20 @@ static const AttributeAccessorFunctions &get_pointcloud_accessor_functions_ref() return fn; } -AttributeAccessor pointcloud_attributes(const PointCloud &pointcloud) +} // namespace blender::bke + +blender::bke::AttributeAccessor PointCloud::attributes() const { - return AttributeAccessor(&pointcloud, get_pointcloud_accessor_functions_ref()); + return blender::bke::AttributeAccessor(this, + blender::bke::get_pointcloud_accessor_functions_ref()); } -MutableAttributeAccessor pointcloud_attributes_for_write(PointCloud &pointcloud) +blender::bke::MutableAttributeAccessor PointCloud::attributes_for_write() { - return MutableAttributeAccessor(&pointcloud, get_pointcloud_accessor_functions_ref()); + return blender::bke::MutableAttributeAccessor( + this, blender::bke::get_pointcloud_accessor_functions_ref()); } -} // namespace blender::bke - std::optional<blender::bke::AttributeAccessor> PointCloudComponent::attributes() const { return blender::bke::AttributeAccessor(pointcloud_, diff --git a/source/blender/blenkernel/intern/geometry_fields.cc b/source/blender/blenkernel/intern/geometry_fields.cc index a52ffb6496b..56e9e9dcdff 100644 --- a/source/blender/blenkernel/intern/geometry_fields.cc +++ b/source/blender/blenkernel/intern/geometry_fields.cc @@ -18,7 +18,7 @@ namespace blender::bke { MeshFieldContext::MeshFieldContext(const Mesh &mesh, const eAttrDomain domain) : mesh_(mesh), domain_(domain) { - BLI_assert(mesh_attributes(mesh).domain_supported(domain_)); + BLI_assert(mesh.attributes().domain_supported(domain_)); } CurvesFieldContext::CurvesFieldContext(const CurvesGeometry &curves, const eAttrDomain domain) @@ -94,13 +94,13 @@ GeometryFieldContext::GeometryFieldContext(const InstancesComponent &instances) std::optional<AttributeAccessor> GeometryFieldContext::attributes() const { if (const Mesh *mesh = this->mesh()) { - return mesh_attributes(*mesh); + return mesh->attributes(); } if (const CurvesGeometry *curves = this->curves()) { return curves->attributes(); } if (const PointCloud *pointcloud = this->pointcloud()) { - return pointcloud_attributes(*pointcloud); + return pointcloud->attributes(); } if (const InstancesComponent *instances = this->instances()) { return instances->attributes(); diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc index 02f0a8398b0..4d0db4d5386 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.cc +++ b/source/blender/blenkernel/intern/gpencil_geom.cc @@ -2715,7 +2715,7 @@ bool BKE_gpencil_convert_mesh(Main *bmain, gpl_fill, scene->r.cfra + frame_offset, GP_GETFRAME_ADD_NEW); int i; - const VArray<int> mesh_material_indices = mesh_attributes(*me_eval).lookup_or_default<int>( + const VArray<int> mesh_material_indices = me_eval->attributes().lookup_or_default<int>( "material_index", ATTR_DOMAIN_FACE, 0); for (i = 0; i < mpoly_len; i++) { const MPoly *mp = &polys[i]; diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index 84fc9005d53..6b99085ea28 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -1343,7 +1343,7 @@ void BKE_mesh_material_index_remove(Mesh *me, short index) { using namespace blender; using namespace blender::bke; - MutableAttributeAccessor attributes = mesh_attributes_for_write(*me); + MutableAttributeAccessor attributes = me->attributes_for_write(); AttributeWriter<int> material_indices = attributes.lookup_for_write<int>("material_index"); if (!material_indices) { return; @@ -1368,7 +1368,7 @@ bool BKE_mesh_material_index_used(Mesh *me, short index) { using namespace blender; using namespace blender::bke; - const AttributeAccessor attributes = mesh_attributes(*me); + const AttributeAccessor attributes = me->attributes(); const VArray<int> material_indices = attributes.lookup_or_default<int>( "material_index", ATTR_DOMAIN_FACE, 0); if (material_indices.is_single()) { @@ -1382,7 +1382,7 @@ void BKE_mesh_material_index_clear(Mesh *me) { using namespace blender; using namespace blender::bke; - MutableAttributeAccessor attributes = mesh_attributes_for_write(*me); + MutableAttributeAccessor attributes = me->attributes_for_write(); attributes.remove("material_index"); BKE_mesh_tessface_clear(me); @@ -1411,7 +1411,7 @@ void BKE_mesh_material_remap(Mesh *me, const uint *remap, uint remap_len) } } else { - MutableAttributeAccessor attributes = mesh_attributes_for_write(*me); + MutableAttributeAccessor attributes = me->attributes_for_write(); AttributeWriter<int> material_indices = attributes.lookup_for_write<int>("material_index"); if (!material_indices) { return; @@ -1763,7 +1763,7 @@ void BKE_mesh_count_selected_items(const Mesh *mesh, int r_count[3]) void BKE_mesh_vert_coords_get(const Mesh *mesh, float (*vert_coords)[3]) { - blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*mesh); + blender::bke::AttributeAccessor attributes = mesh->attributes(); VArray<float3> positions = attributes.lookup_or_default( "position", ATTR_DOMAIN_POINT, float3(0)); positions.materialize({(float3 *)vert_coords, mesh->totvert}); diff --git a/source/blender/blenkernel/intern/mesh_boolean_convert.cc b/source/blender/blenkernel/intern/mesh_boolean_convert.cc index 4201b03c1f7..4b08e0b2ed5 100644 --- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc +++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc @@ -415,7 +415,7 @@ static void copy_poly_attributes(Mesh *dest_mesh, Span<short> material_remap, MutableSpan<int> dst_material_indices) { - const VArray<int> src_material_indices = bke::mesh_attributes(*orig_me).lookup_or_default<int>( + const VArray<int> src_material_indices = orig_me->attributes().lookup_or_default<int>( "material_index", ATTR_DOMAIN_FACE, 0); const int src_index = src_material_indices[index_in_orig_me]; if (material_remap.size() > 0 && material_remap.index_range().contains(src_index)) { @@ -739,8 +739,8 @@ static Mesh *imesh_to_mesh(IMesh *im, MeshesToIMeshInfo &mim) /* Set the loopstart and totloop for each output poly, * and set the vertices in the appropriate loops. */ bke::SpanAttributeWriter<int> dst_material_indices = - bke::mesh_attributes_for_write(*result).lookup_or_add_for_write_only_span<int>( - "material_index", ATTR_DOMAIN_FACE); + result->attributes_for_write().lookup_or_add_for_write_only_span<int>("material_index", + ATTR_DOMAIN_FACE); int cur_loop_index = 0; MutableSpan<MLoop> dst_loops = result->loops_for_write(); MutableSpan<MPoly> dst_polys = result->polys_for_write(); diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc index 9f8326454d2..a8ff90c128a 100644 --- a/source/blender/blenkernel/intern/mesh_convert.cc +++ b/source/blender/blenkernel/intern/mesh_convert.cc @@ -193,7 +193,7 @@ static Mesh *mesh_nurbs_displist_to_mesh(const Curve *cu, const ListBase *dispba MEdge *medge = edges.data(); MPoly *mpoly = polys.data(); MLoop *mloop = loops.data(); - MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh); + MutableAttributeAccessor attributes = mesh->attributes_for_write(); SpanAttributeWriter<int> material_indices = attributes.lookup_or_add_for_write_only_span<int>( "material_index", ATTR_DOMAIN_FACE); MLoopUV *mloopuv = static_cast<MLoopUV *>(CustomData_add_layer_named( @@ -639,9 +639,8 @@ void BKE_pointcloud_from_mesh(Mesh *me, PointCloud *pointcloud) /* Copy over all attributes. */ CustomData_merge(&me->vdata, &pointcloud->pdata, CD_MASK_PROP_ALL, CD_DUPLICATE, me->totvert); - bke::AttributeAccessor mesh_attributes = bke::mesh_attributes(*me); - bke::MutableAttributeAccessor point_attributes = bke::pointcloud_attributes_for_write( - *pointcloud); + bke::AttributeAccessor mesh_attributes = me->attributes(); + bke::MutableAttributeAccessor point_attributes = pointcloud->attributes_for_write(); const VArray<float3> mesh_positions = mesh_attributes.lookup_or_default<float3>( "position", ATTR_DOMAIN_POINT, float3(0)); @@ -1085,7 +1084,7 @@ Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain, BKE_mesh_nomain_to_mesh(mesh, mesh_in_bmain, nullptr, &CD_MASK_MESH, true); /* Anonymous attributes shouldn't exist on original data. */ - blender::bke::mesh_attributes_for_write(*mesh_in_bmain).remove_anonymous(); + mesh_in_bmain->attributes_for_write().remove_anonymous(); /* User-count is required because so far mesh was in a limbo, where library management does * not perform any user management (i.e. copy of a mesh will not increase users of materials). */ diff --git a/source/blender/blenkernel/intern/mesh_evaluate.cc b/source/blender/blenkernel/intern/mesh_evaluate.cc index b1a70d5450c..938d7e42aa3 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.cc +++ b/source/blender/blenkernel/intern/mesh_evaluate.cc @@ -736,7 +736,7 @@ void BKE_mesh_flush_hidden_from_verts(Mesh *me) { using namespace blender; using namespace blender::bke; - MutableAttributeAccessor attributes = mesh_attributes_for_write(*me); + MutableAttributeAccessor attributes = me->attributes_for_write(); const VArray<bool> hide_vert = attributes.lookup_or_default<bool>( ".hide_vert", ATTR_DOMAIN_POINT, false); @@ -776,7 +776,7 @@ void BKE_mesh_flush_hidden_from_polys(Mesh *me) { using namespace blender; using namespace blender::bke; - MutableAttributeAccessor attributes = mesh_attributes_for_write(*me); + MutableAttributeAccessor attributes = me->attributes_for_write(); const VArray<bool> hide_poly = attributes.lookup_or_default<bool>( ".hide_poly", ATTR_DOMAIN_FACE, false); @@ -907,7 +907,7 @@ static void mesh_flush_select_from_verts(const Span<MVert> verts, void BKE_mesh_flush_select_from_verts(Mesh *me) { - const blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*me); + const blender::bke::AttributeAccessor attributes = me->attributes(); mesh_flush_select_from_verts( me->verts(), me->loops(), diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc index 39b1ffb7cf4..2f67e303095 100644 --- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc +++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc @@ -925,7 +925,7 @@ void BKE_mesh_legacy_convert_hide_layers_to_flags(Mesh *mesh) { using namespace blender; using namespace blender::bke; - const AttributeAccessor attributes = mesh_attributes(*mesh); + const AttributeAccessor attributes = mesh->attributes(); MutableSpan<MVert> verts = mesh->verts_for_write(); const VArray<bool> hide_vert = attributes.lookup_or_default<bool>( @@ -959,7 +959,7 @@ void BKE_mesh_legacy_convert_flags_to_hide_layers(Mesh *mesh) { using namespace blender; using namespace blender::bke; - MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh); + MutableAttributeAccessor attributes = mesh->attributes_for_write(); const Span<MVert> verts = mesh->verts(); if (std::any_of( @@ -1010,7 +1010,7 @@ void BKE_mesh_legacy_convert_material_indices_to_mpoly(Mesh *mesh) { using namespace blender; using namespace blender::bke; - const AttributeAccessor attributes = mesh_attributes(*mesh); + const AttributeAccessor attributes = mesh->attributes(); MutableSpan<MPoly> polys = mesh->polys_for_write(); const VArray<int> material_indices = attributes.lookup_or_default<int>( "material_index", ATTR_DOMAIN_FACE, 0); @@ -1025,7 +1025,7 @@ void BKE_mesh_legacy_convert_mpoly_to_material_indices(Mesh *mesh) { using namespace blender; using namespace blender::bke; - MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh); + MutableAttributeAccessor attributes = mesh->attributes_for_write(); const Span<MPoly> polys = mesh->polys(); if (std::any_of( polys.begin(), polys.end(), [](const MPoly &poly) { return poly.mat_nr != 0; })) { diff --git a/source/blender/blenkernel/intern/mesh_validate.cc b/source/blender/blenkernel/intern/mesh_validate.cc index 50577969a83..47de7245ccc 100644 --- a/source/blender/blenkernel/intern/mesh_validate.cc +++ b/source/blender/blenkernel/intern/mesh_validate.cc @@ -243,7 +243,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, (void)0 blender::bke::AttributeWriter<int> material_indices = - blender::bke::mesh_attributes_for_write(*mesh).lookup_for_write<int>("material_index"); + mesh->attributes_for_write().lookup_for_write<int>("material_index"); blender::MutableVArraySpan<int> material_indices_span(material_indices.varray); MVert *mv = mverts; @@ -1152,7 +1152,7 @@ bool BKE_mesh_validate_material_indices(Mesh *me) bool is_valid = true; blender::bke::AttributeWriter<int> material_indices = - blender::bke::mesh_attributes_for_write(*me).lookup_for_write<int>("material_index"); + me->attributes_for_write().lookup_for_write<int>("material_index"); blender::MutableVArraySpan<int> material_indices_span(material_indices.varray); for (const int i : material_indices_span.index_range()) { if (material_indices_span[i] < 0 || material_indices_span[i] > mat_nr_max) { diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc index cb15dbef69d..d9ce9f0e490 100644 --- a/source/blender/blenkernel/intern/paint.cc +++ b/source/blender/blenkernel/intern/paint.cc @@ -2134,7 +2134,7 @@ void BKE_sculpt_sync_face_sets_visibility_to_base_mesh(Mesh *mesh) return; } - MutableAttributeAccessor attributes = mesh_attributes_for_write(*mesh); + MutableAttributeAccessor attributes = mesh->attributes_for_write(); SpanAttributeWriter<bool> hide_poly = attributes.lookup_or_add_for_write_only_span<bool>( ".hide_poly", ATTR_DOMAIN_FACE); if (!hide_poly) { diff --git a/source/blender/blenkernel/intern/pointcloud.cc b/source/blender/blenkernel/intern/pointcloud.cc index 14ca3f58db9..29248466cdd 100644 --- a/source/blender/blenkernel/intern/pointcloud.cc +++ b/source/blender/blenkernel/intern/pointcloud.cc @@ -194,8 +194,7 @@ static void pointcloud_random(PointCloud *pointcloud) RNG *rng = BLI_rng_new(0); - blender::bke::MutableAttributeAccessor attributes = - blender::bke::pointcloud_attributes_for_write(*pointcloud); + blender::bke::MutableAttributeAccessor attributes = pointcloud->attributes_for_write(); blender::bke::SpanAttributeWriter positions = attributes.lookup_or_add_for_write_only_span<float3>(POINTCLOUD_ATTR_POSITION, ATTR_DOMAIN_POINT); @@ -258,7 +257,7 @@ PointCloud *BKE_pointcloud_new_nomain(const int totpoint) static std::optional<blender::bounds::MinMaxResult<float3>> point_cloud_bounds( const PointCloud &pointcloud) { - blender::bke::AttributeAccessor attributes = blender::bke::pointcloud_attributes(pointcloud); + blender::bke::AttributeAccessor attributes = pointcloud.attributes(); blender::VArraySpan<float3> positions = attributes.lookup_or_default<float3>( POINTCLOUD_ATTR_POSITION, ATTR_DOMAIN_POINT, float3(0)); blender::VArray<float> radii = attributes.lookup_or_default<float>( |