Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-08 05:42:00 +0300
committerHans Goudey <h.goudey@me.com>2022-09-08 05:42:00 +0300
commit8ccd26154c63be172db23ab6647c11db7c211e8e (patch)
tree40740630db9240118b91275a7f190eba4591caba
parentacbe1e3774ace83d82fda0d39303a1c0e16f81f9 (diff)
parentd5934974219135102f364f57c45a8b1465e2b8d9 (diff)
Merge branch 'master' into refactor-mesh-bevel-weight-genericrefactor-mesh-bevel-weight-generic
-rw-r--r--source/blender/blenkernel/BKE_attribute.hh6
-rw-r--r--source/blender/blenkernel/BKE_mesh.h36
-rw-r--r--source/blender/blenkernel/BKE_mesh_fair.h14
-rw-r--r--source/blender/blenkernel/BKE_paint.h12
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h2
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc2
-rw-r--r--source/blender/blenkernel/intern/attribute.cc4
-rw-r--r--source/blender/blenkernel/intern/bvhutils.cc4
-rw-r--r--source/blender/blenkernel/intern/curve_to_mesh_convert.cc2
-rw-r--r--source/blender/blenkernel/intern/customdata.cc3
-rw-r--r--source/blender/blenkernel/intern/fcurve_test.cc1
-rw-r--r--source/blender/blenkernel/intern/geometry_component_mesh.cc15
-rw-r--r--source/blender/blenkernel/intern/geometry_component_pointcloud.cc14
-rw-r--r--source/blender/blenkernel/intern/geometry_fields.cc6
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.cc2
-rw-r--r--source/blender/blenkernel/intern/mesh.cc20
-rw-r--r--source/blender/blenkernel/intern/mesh_boolean_convert.cc14
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.cc9
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.cc8
-rw-r--r--source/blender/blenkernel/intern/mesh_fair.cc58
-rw-r--r--source/blender/blenkernel/intern/mesh_legacy_convert.cc8
-rw-r--r--source/blender/blenkernel/intern/mesh_merge.c6
-rw-r--r--source/blender/blenkernel/intern/mesh_normals.cc26
-rw-r--r--source/blender/blenkernel/intern/mesh_validate.cc4
-rw-r--r--source/blender/blenkernel/intern/multires_reshape_smooth.c9
-rw-r--r--source/blender/blenkernel/intern/multires_unsubdivide.c22
-rw-r--r--source/blender/blenkernel/intern/paint.cc4
-rw-r--r--source/blender/blenkernel/intern/particle.c4
-rw-r--r--source/blender/blenkernel/intern/pbvh.c2
-rw-r--r--source/blender/blenkernel/intern/pointcloud.cc5
-rw-r--r--source/blender/blenkernel/intern/softbody.c10
-rw-r--r--source/blender/blenloader/intern/versioning_250.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_convert.cc18
-rw-r--r--source/blender/draw/intern/draw_cache_impl_pointcloud.cc2
-rw-r--r--source/blender/draw/intern/draw_cache_impl_subdivision.cc21
-rw-r--r--source/blender/editors/animation/anim_markers.c5
-rw-r--r--source/blender/editors/curve/editcurve.c51
-rw-r--r--source/blender/editors/curve/editcurve_select.c60
-rw-r--r--source/blender/editors/curves/intern/curves_ops.cc2
-rw-r--r--source/blender/editors/geometry/geometry_attributes.cc5
-rw-r--r--source/blender/editors/include/ED_types.h27
-rw-r--r--source/blender/editors/mesh/editface.cc38
-rw-r--r--source/blender/editors/mesh/editmesh_extrude_screw.c6
-rw-r--r--source/blender/editors/mesh/meshtools.cc2
-rw-r--r--source/blender/editors/object/object_add.cc2
-rw-r--r--source/blender/editors/object/object_modifier.cc2
-rw-r--r--source/blender/editors/object/object_remesh.cc4
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_add.cc9
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_density.cc4
-rw-r--r--source/blender/editors/sculpt_paint/curves_sculpt_slide.cc8
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc12
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c14
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_boundary.c131
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_expand.c102
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.c18
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_geodesic.c43
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_ops.c27
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c56
-rw-r--r--source/blender/editors/space_info/info_stats.cc2
-rw-r--r--source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc2
-rw-r--r--source/blender/editors/space_view3d/view3d_select.cc11
-rw-r--r--source/blender/editors/util/CMakeLists.txt1
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp5
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp26
-rw-r--r--source/blender/geometry/intern/mesh_primitive_cuboid.cc6
-rw-r--r--source/blender/geometry/intern/mesh_to_curve_convert.cc2
-rw-r--r--source/blender/geometry/intern/mesh_to_volume.cc8
-rw-r--r--source/blender/geometry/intern/point_merge_by_distance.cc5
-rw-r--r--source/blender/geometry/intern/realize_instances.cc9
-rw-r--r--source/blender/io/alembic/exporter/abc_writer_mesh.cc2
-rw-r--r--source/blender/io/alembic/intern/abc_customdata.cc6
-rw-r--r--source/blender/io/alembic/intern/abc_reader_mesh.cc6
-rw-r--r--source/blender/io/collada/GeometryExporter.cpp4
-rw-r--r--source/blender/io/usd/intern/usd_reader_mesh.cc4
-rw-r--r--source/blender/io/usd/intern/usd_writer_mesh.cc2
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc4
-rw-r--r--source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc10
-rw-r--r--source/blender/io/wavefront_obj/importer/obj_import_mesh.cc4
-rw-r--r--source/blender/makesdna/DNA_anim_types.h3
-rw-r--r--source/blender/makesdna/DNA_curve_types.h4
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h7
-rw-r--r--source/blender/makesdna/DNA_object_types.h8
-rw-r--r--source/blender/makesdna/DNA_pointcloud_types.h12
-rw-r--r--source/blender/makesdna/DNA_sequence_types.h7
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c8
-rw-r--r--source/blender/makesrna/intern/rna_particle.c18
-rw-r--r--source/blender/modifiers/intern/MOD_array.c6
-rw-r--r--source/blender/modifiers/intern/MOD_mask.cc76
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.cc8
-rw-r--r--source/blender/modifiers/intern/MOD_ocean.c16
-rw-r--r--source/blender/modifiers/intern/MOD_weighted_normal.c26
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_boolean.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc248
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc11
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc40
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc51
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc10
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc12
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc12
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc5
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_material_selection.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc8
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc7
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_points.cc3
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_raycast.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc28
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_set_material.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc20
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_transform.cc4
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc2
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc2
-rw-r--r--source/blender/windowmanager/WM_api.h2
128 files changed, 901 insertions, 948 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/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index a5b0e21f0ca..1048ca39958 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -665,18 +665,18 @@ void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts,
const float (*polynors)[3],
int numPolys,
short (*r_clnors_data)[2]);
-void BKE_mesh_normals_loop_custom_from_vertices_set(const struct MVert *mverts,
- const float (*vert_normals)[3],
- float (*r_custom_vertnors)[3],
- int numVerts,
- struct MEdge *medges,
- int numEdges,
- const struct MLoop *mloops,
- int numLoops,
- const struct MPoly *mpolys,
- const float (*polynors)[3],
- int numPolys,
- short (*r_clnors_data)[2]);
+void BKE_mesh_normals_loop_custom_from_verts_set(const struct MVert *mverts,
+ const float (*vert_normals)[3],
+ float (*r_custom_vertnors)[3],
+ int numVerts,
+ struct MEdge *medges,
+ int numEdges,
+ const struct MLoop *mloops,
+ int numLoops,
+ const struct MPoly *mpolys,
+ const float (*polynors)[3],
+ int numPolys,
+ short (*r_clnors_data)[2]);
/**
* Computes average per-vertex normals from given custom loop normals.
@@ -717,12 +717,12 @@ void BKE_mesh_calc_normals_split_ex(struct Mesh *mesh,
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loopnors)[3]);
/**
* Higher level functions hiding most of the code needed around call to
- * #BKE_mesh_normals_loop_custom_from_vertices_set().
+ * #BKE_mesh_normals_loop_custom_from_verts_set().
*
* \param r_custom_vertnors: is not const, since code will replace zero_v3 normals there
* with automatically computed vectors.
*/
-void BKE_mesh_set_custom_normals_from_vertices(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
+void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vertnors)[3]);
/* *** mesh_evaluate.cc *** */
@@ -812,10 +812,10 @@ void BKE_mesh_polygon_flip(const struct MPoly *mpoly,
*
* \note Invalidates tessellation, caller must handle that.
*/
-void BKE_mesh_polygons_flip(const struct MPoly *mpoly,
- struct MLoop *mloop,
- struct CustomData *ldata,
- int totpoly);
+void BKE_mesh_polys_flip(const struct MPoly *mpoly,
+ struct MLoop *mloop,
+ struct CustomData *ldata,
+ int totpoly);
/* Merge verts. */
/* Enum for merge_mode of #BKE_mesh_merge_verts.
diff --git a/source/blender/blenkernel/BKE_mesh_fair.h b/source/blender/blenkernel/BKE_mesh_fair.h
index 0dc44ecb247..9d94c692858 100644
--- a/source/blender/blenkernel/BKE_mesh_fair.h
+++ b/source/blender/blenkernel/BKE_mesh_fair.h
@@ -25,16 +25,16 @@ typedef enum eMeshFairingDepth {
/* affect_vertices is used to define the fairing area. Indexed by vertex index, set to true when
* the vertex should be modified by fairing. */
-void BKE_bmesh_prefair_and_fair_vertices(struct BMesh *bm,
- bool *affect_vertices,
- eMeshFairingDepth depth);
+void BKE_bmesh_prefair_and_fair_verts(struct BMesh *bm,
+ bool *affect_verts,
+ eMeshFairingDepth depth);
/* This function can optionally use the MVert coordinates of deform_mverts to read and write the
* fairing result. When NULL, the function will use mesh->mverts directly. */
-void BKE_mesh_prefair_and_fair_vertices(struct Mesh *mesh,
- struct MVert *deform_mverts,
- bool *affect_vertices,
- eMeshFairingDepth depth);
+void BKE_mesh_prefair_and_fair_verts(struct Mesh *mesh,
+ struct MVert *deform_mverts,
+ bool *affect_verts,
+ eMeshFairingDepth depth);
#ifdef __cplusplus
}
diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h
index 2197fa3af1e..9a067e761d7 100644
--- a/source/blender/blenkernel/BKE_paint.h
+++ b/source/blender/blenkernel/BKE_paint.h
@@ -402,7 +402,7 @@ typedef struct SculptBoundaryEditInfo {
int original_vertex_i;
/* How many steps were needed to reach this vertex from the boundary. */
- int num_propagation_steps;
+ int propagation_steps_num;
/* Strength that is used to deform this vertex. */
float strength_factor;
@@ -416,10 +416,10 @@ typedef struct SculptBoundaryPreviewEdge {
typedef struct SculptBoundary {
/* Vertex indices of the active boundary. */
- PBVHVertRef *vertices;
- int *vertices_i;
- int vertices_capacity;
- int num_vertices;
+ PBVHVertRef *verts;
+ int *verts_i;
+ int verts_capacity;
+ int verts_num;
/* Distance from a vertex in the boundary to initial vertex indexed by vertex index, taking into
* account the length of all edges between them. Any vertex that is not in the boundary will have
@@ -429,7 +429,7 @@ typedef struct SculptBoundary {
/* Data for drawing the preview. */
SculptBoundaryPreviewEdge *edges;
int edges_capacity;
- int num_edges;
+ int edges_num;
/* True if the boundary loops into itself. */
bool forms_loop;
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 8c9488b0b46..716ee7d2a21 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -389,7 +389,7 @@ const struct CCGKey *BKE_pbvh_get_grid_key(const PBVH *pbvh);
struct CCGElem **BKE_pbvh_get_grids(const PBVH *pbvh);
BLI_bitmap **BKE_pbvh_get_grid_visibility(const PBVH *pbvh);
-int BKE_pbvh_get_grid_num_vertices(const PBVH *pbvh);
+int BKE_pbvh_get_grid_num_verts(const PBVH *pbvh);
int BKE_pbvh_get_grid_num_faces(const PBVH *pbvh);
/**
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/customdata.cc b/source/blender/blenkernel/intern/customdata.cc
index c972e18fc12..d01ccd96f2f 100644
--- a/source/blender/blenkernel/intern/customdata.cc
+++ b/source/blender/blenkernel/intern/customdata.cc
@@ -5404,6 +5404,9 @@ void CustomData_blend_read(BlendDataReader *reader, CustomData *data, const int
else if (layer->type == CD_GRID_PAINT_MASK) {
blend_read_paint_mask(reader, count, static_cast<GridPaintMask *>(layer->data));
}
+ else if (layer->type == CD_MDEFORMVERT) {
+ BKE_defvert_blend_read(reader, count, static_cast<MDeformVert *>(layer->data));
+ }
i++;
}
}
diff --git a/source/blender/blenkernel/intern/fcurve_test.cc b/source/blender/blenkernel/intern/fcurve_test.cc
index 1912e3a9d8d..285c6a0af4d 100644
--- a/source/blender/blenkernel/intern/fcurve_test.cc
+++ b/source/blender/blenkernel/intern/fcurve_test.cc
@@ -7,7 +7,6 @@
#include "BKE_fcurve.h"
#include "ED_keyframing.h"
-#include "ED_types.h" /* For SELECT. */
#include "DNA_anim_types.h"
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 707518c0c34..b7063395052 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -249,7 +249,6 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
else {
Set<std::string> names_to_skip;
if (!BLO_write_is_undo(writer)) {
-
BKE_mesh_legacy_convert_hide_layers_to_flags(mesh);
BKE_mesh_legacy_convert_material_indices_to_mpoly(mesh);
BKE_mesh_legacy_bevel_weight_from_layers(mesh);
@@ -261,6 +260,7 @@ static void mesh_blend_write(BlendWriter *writer, ID *id, const void *id_address
mesh->medge = const_cast<MEdge *>(mesh->edges().data());
mesh->mpoly = const_cast<MPoly *>(mesh->polys().data());
mesh->mloop = const_cast<MLoop *>(mesh->loops().data());
+ mesh->dvert = const_cast<MDeformVert *>(mesh->deform_verts().data());
}
CustomData_blend_write_prepare(mesh->vdata, vert_layers, names_to_skip);
@@ -315,9 +315,6 @@ static void mesh_blend_read_data(BlendDataReader *reader, ID *id)
BLO_read_data_address(reader, &mesh->adt);
BKE_animdata_blend_read_data(reader, mesh->adt);
- /* Normally BKE_defvert_blend_read should be called in CustomData_blend_read,
- * but for backwards compatibility in do_versions to work we do it here. */
- BKE_defvert_blend_read(reader, mesh->totvert, mesh->dvert);
BLO_read_list(reader, &mesh->vertex_group_names);
CustomData_blend_read(reader, &mesh->vdata, mesh->totvert);
@@ -325,6 +322,11 @@ static void mesh_blend_read_data(BlendDataReader *reader, ID *id)
CustomData_blend_read(reader, &mesh->fdata, mesh->totface);
CustomData_blend_read(reader, &mesh->ldata, mesh->totloop);
CustomData_blend_read(reader, &mesh->pdata, mesh->totpoly);
+ if (mesh->deform_verts().is_empty()) {
+ /* Vertex group data was also an owning pointer in old Blender versions.
+ * Don't read them again if they were read as part of #CustomData. */
+ BKE_defvert_blend_read(reader, mesh->totvert, mesh->dvert);
+ }
mesh->texflag &= ~ME_AUTOSPACE_EVALUATED;
mesh->edit_mesh = nullptr;
@@ -1343,7 +1345,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 +1370,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 +1384,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 +1413,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 +1765,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 479b635341a..7a04e45fe00 100644
--- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc
@@ -414,7 +414,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)) {
@@ -607,7 +607,7 @@ static void copy_or_interp_loop_attributes(Mesh *dest_mesh,
get_poly2d_cos(orig_me, orig_mp, cos_2d, mim.to_target_transform[orig_me_index], axis_mat);
}
CustomData *target_cd = &dest_mesh->ldata;
- const Span<MVert> dst_vertices = dest_mesh->verts();
+ const Span<MVert> dst_verts = dest_mesh->verts();
const Span<MLoop> dst_loops = dest_mesh->loops();
for (int i = 0; i < mp->totloop; ++i) {
int loop_index = mp->loopstart + i;
@@ -618,7 +618,7 @@ static void copy_or_interp_loop_attributes(Mesh *dest_mesh,
* The coordinate needs to be projected into 2d, just like the interpolating polygon's
* coordinates were. The `dest_mesh` coordinates are already in object 0 local space. */
float co[2];
- mul_v2_m3v3(co, axis_mat, dst_vertices[dst_loops[loop_index].v].co);
+ mul_v2_m3v3(co, axis_mat, dst_verts[dst_loops[loop_index].v].co);
interp_weights_poly_v2(weights.data(), cos_2d, orig_mp->totloop, co);
}
for (int source_layer_i = 0; source_layer_i < source_cd->totlayer; ++source_layer_i) {
@@ -721,10 +721,10 @@ static Mesh *imesh_to_mesh(IMesh *im, MeshesToIMeshInfo &mim)
merge_vertex_loop_poly_customdata_layers(result, mim);
/* Set the vertex coordinate values and other data. */
- MutableSpan<MVert> vertices = result->verts_for_write();
+ MutableSpan<MVert> verts = result->verts_for_write();
for (int vi : im->vert_index_range()) {
const Vert *v = im->vert(vi);
- MVert *mv = &vertices[vi];
+ MVert *mv = &verts[vi];
copy_v3fl_v3db(mv->co, v->co);
if (v->orig != NO_INDEX) {
const Mesh *orig_me;
@@ -737,8 +737,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 e816dff7b4c..6422d4fa1df 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 f2fe2e0b141..938d7e42aa3 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.cc
+++ b/source/blender/blenkernel/intern/mesh_evaluate.cc
@@ -717,7 +717,7 @@ void BKE_mesh_polygon_flip(const MPoly *mpoly, MLoop *mloop, CustomData *ldata)
BKE_mesh_polygon_flip_ex(mpoly, mloop, ldata, nullptr, mdisp, true);
}
-void BKE_mesh_polygons_flip(const MPoly *mpoly, MLoop *mloop, CustomData *ldata, int totpoly)
+void BKE_mesh_polys_flip(const MPoly *mpoly, MLoop *mloop, CustomData *ldata, int totpoly)
{
MDisps *mdisp = (MDisps *)CustomData_get_layer(ldata, CD_MDISPS);
const MPoly *mp;
@@ -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_fair.cc b/source/blender/blenkernel/intern/mesh_fair.cc
index fe5add864ea..41dcb3501cc 100644
--- a/source/blender/blenkernel/intern/mesh_fair.cc
+++ b/source/blender/blenkernel/intern/mesh_fair.cc
@@ -76,13 +76,13 @@ class FairingContext {
virtual ~FairingContext() = default;
- void fair_vertices(bool *affected,
- const eMeshFairingDepth depth,
- VertexWeight *vertex_weight,
- LoopWeight *loop_weight)
+ void fair_verts(bool *affected,
+ const eMeshFairingDepth depth,
+ VertexWeight *vertex_weight,
+ LoopWeight *loop_weight)
{
- fair_vertices_ex(affected, (int)depth, vertex_weight, loop_weight);
+ fair_verts_ex(affected, (int)depth, vertex_weight, loop_weight);
}
protected:
@@ -143,28 +143,28 @@ class FairingContext {
loop_weight);
}
- void fair_vertices_ex(const bool *affected,
- const int order,
- VertexWeight *vertex_weight,
- LoopWeight *loop_weight)
+ void fair_verts_ex(const bool *affected,
+ const int order,
+ VertexWeight *vertex_weight,
+ LoopWeight *loop_weight)
{
Map<int, int> vert_col_map;
- int num_affected_vertices = 0;
+ int affected_verts_num = 0;
for (int i = 0; i < totvert_; i++) {
if (!affected[i]) {
continue;
}
- vert_col_map.add(i, num_affected_vertices);
- num_affected_vertices++;
+ vert_col_map.add(i, affected_verts_num);
+ affected_verts_num++;
}
/* Early return, nothing to do. */
- if (ELEM(num_affected_vertices, 0, totvert_)) {
+ if (ELEM(affected_verts_num, 0, totvert_)) {
return;
}
/* Setup fairing matrices */
- LinearSolver *solver = EIG_linear_solver_new(num_affected_vertices, num_affected_vertices, 3);
+ LinearSolver *solver = EIG_linear_solver_new(affected_verts_num, affected_verts_num, 3);
for (auto item : vert_col_map.items()) {
const int v = item.key;
const int col = item.value;
@@ -450,42 +450,40 @@ class UniformLoopWeight : public LoopWeight {
}
};
-static void prefair_and_fair_vertices(FairingContext *fairing_context,
- bool *affected_vertices,
- const eMeshFairingDepth depth)
+static void prefair_and_fair_verts(FairingContext *fairing_context,
+ bool *affected_verts,
+ const eMeshFairingDepth depth)
{
/* Prefair. */
UniformVertexWeight *uniform_vertex_weights = new UniformVertexWeight(fairing_context);
UniformLoopWeight *uniform_loop_weights = new UniformLoopWeight();
- fairing_context->fair_vertices(
- affected_vertices, depth, uniform_vertex_weights, uniform_loop_weights);
+ fairing_context->fair_verts(affected_verts, depth, uniform_vertex_weights, uniform_loop_weights);
delete uniform_vertex_weights;
/* Fair. */
VoronoiVertexWeight *voronoi_vertex_weights = new VoronoiVertexWeight(fairing_context);
/* TODO: Implement cotangent loop weights. */
- fairing_context->fair_vertices(
- affected_vertices, depth, voronoi_vertex_weights, uniform_loop_weights);
+ fairing_context->fair_verts(affected_verts, depth, voronoi_vertex_weights, uniform_loop_weights);
delete uniform_loop_weights;
delete voronoi_vertex_weights;
}
-void BKE_mesh_prefair_and_fair_vertices(struct Mesh *mesh,
- struct MVert *deform_mverts,
- bool *affect_vertices,
- const eMeshFairingDepth depth)
+void BKE_mesh_prefair_and_fair_verts(struct Mesh *mesh,
+ struct MVert *deform_mverts,
+ bool *affect_verts,
+ const eMeshFairingDepth depth)
{
MeshFairingContext *fairing_context = new MeshFairingContext(mesh, deform_mverts);
- prefair_and_fair_vertices(fairing_context, affect_vertices, depth);
+ prefair_and_fair_verts(fairing_context, affect_verts, depth);
delete fairing_context;
}
-void BKE_bmesh_prefair_and_fair_vertices(struct BMesh *bm,
- bool *affect_vertices,
- const eMeshFairingDepth depth)
+void BKE_bmesh_prefair_and_fair_verts(struct BMesh *bm,
+ bool *affect_verts,
+ const eMeshFairingDepth depth)
{
BMeshFairingContext *fairing_context = new BMeshFairingContext(bm);
- prefair_and_fair_vertices(fairing_context, affect_vertices, depth);
+ prefair_and_fair_verts(fairing_context, affect_verts, depth);
delete fairing_context;
}
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 31ae8478257..10fc8ff3195 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -986,7 +986,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>(
@@ -1020,7 +1020,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(
@@ -1071,7 +1071,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);
@@ -1086,7 +1086,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_merge.c b/source/blender/blenkernel/intern/mesh_merge.c
index dc1ebf4c6e0..9c0e3c1bf59 100644
--- a/source/blender/blenkernel/intern/mesh_merge.c
+++ b/source/blender/blenkernel/intern/mesh_merge.c
@@ -354,11 +354,11 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
ml = src_loops + mp->loopstart;
/* check faces with all vertices merged */
- bool all_vertices_merged = true;
+ bool all_verts_merged = true;
for (j = 0; j < mp->totloop; j++, ml++) {
if (vtargetmap[ml->v] == -1) {
- all_vertices_merged = false;
+ all_verts_merged = false;
/* This will be used to check for poly using several time the same vert. */
BLI_BITMAP_DISABLE(vert_tag, ml->v);
}
@@ -368,7 +368,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh,
}
}
- if (UNLIKELY(all_vertices_merged)) {
+ if (UNLIKELY(all_verts_merged)) {
if (merge_mode == MESH_MERGE_VERTS_DUMP_IF_MAPPED) {
/* In this mode, all vertices merged is enough to dump face */
continue;
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc
index a88ff4e9d90..21dd39586ec 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -2021,18 +2021,18 @@ void BKE_mesh_normals_loop_custom_set(const MVert *mverts,
false);
}
-void BKE_mesh_normals_loop_custom_from_vertices_set(const MVert *mverts,
- const float (*vert_normals)[3],
- float (*r_custom_vertnors)[3],
- const int numVerts,
- MEdge *medges,
- const int numEdges,
- const MLoop *mloops,
- const int numLoops,
- const MPoly *mpolys,
- const float (*polynors)[3],
- const int numPolys,
- short (*r_clnors_data)[2])
+void BKE_mesh_normals_loop_custom_from_verts_set(const MVert *mverts,
+ const float (*vert_normals)[3],
+ float (*r_custom_vertnors)[3],
+ const int numVerts,
+ MEdge *medges,
+ const int numEdges,
+ const MLoop *mloops,
+ const int numLoops,
+ const MPoly *mpolys,
+ const float (*polynors)[3],
+ const int numPolys,
+ short (*r_clnors_data)[2])
{
mesh_normals_loop_custom_set(mverts,
vert_normals,
@@ -2087,7 +2087,7 @@ void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loopnors)[3])
mesh_set_custom_normals(mesh, r_custom_loopnors, false);
}
-void BKE_mesh_set_custom_normals_from_vertices(Mesh *mesh, float (*r_custom_vertnors)[3])
+void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vertnors)[3])
{
mesh_set_custom_normals(mesh, r_custom_vertnors, true);
}
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/multires_reshape_smooth.c b/source/blender/blenkernel/intern/multires_reshape_smooth.c
index 97c85ae526c..e887f543dc5 100644
--- a/source/blender/blenkernel/intern/multires_reshape_smooth.c
+++ b/source/blender/blenkernel/intern/multires_reshape_smooth.c
@@ -354,10 +354,9 @@ static GridCoord *vertex_grid_coord_with_grid_index(const Vertex *vertex, const
/* Get grid coordinates which correspond to corners of the given face.
* All the grid coordinates will be from the same grid index. */
-static void grid_coords_from_face_vertices(
- const MultiresReshapeSmoothContext *reshape_smooth_context,
- const Face *face,
- const GridCoord *grid_coords[])
+static void grid_coords_from_face_verts(const MultiresReshapeSmoothContext *reshape_smooth_context,
+ const Face *face,
+ const GridCoord *grid_coords[])
{
BLI_assert(face->num_corners == 4);
@@ -417,7 +416,7 @@ static void foreach_toplevel_grid_coord_task(void *__restrict userdata_v,
const Face *face = &reshape_smooth_context->geometry.faces[face_index];
const GridCoord *face_grid_coords[4];
- grid_coords_from_face_vertices(reshape_smooth_context, face, face_grid_coords);
+ grid_coords_from_face_verts(reshape_smooth_context, face, face_grid_coords);
for (int y = 0; y < inner_grid_size; ++y) {
const float ptex_v = (float)y * inner_grid_size_1_inv;
diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c
index 7884d6718af..9a0f7aa2126 100644
--- a/source/blender/blenkernel/intern/multires_unsubdivide.c
+++ b/source/blender/blenkernel/intern/multires_unsubdivide.c
@@ -161,7 +161,7 @@ static bool is_vertex_diagonal(BMVert *from_v, BMVert *to_v)
*/
static void unsubdivide_face_center_vertex_tag(BMesh *bm, BMVert *initial_vertex)
{
- bool *visited_vertices = MEM_calloc_arrayN(bm->totvert, sizeof(bool), "visited vertices");
+ bool *visited_verts = MEM_calloc_arrayN(bm->totvert, sizeof(bool), "visited vertices");
GSQueue *queue;
queue = BLI_gsqueue_new(sizeof(BMVert *));
@@ -177,7 +177,7 @@ static void unsubdivide_face_center_vertex_tag(BMesh *bm, BMVert *initial_vertex
int neighbor_vertex_index = BM_elem_index_get(neighbor_v);
if (neighbor_v != initial_vertex && is_vertex_diagonal(neighbor_v, initial_vertex)) {
BLI_gsqueue_push(queue, &neighbor_v);
- visited_vertices[neighbor_vertex_index] = true;
+ visited_verts[neighbor_vertex_index] = true;
BM_elem_flag_set(neighbor_v, BM_ELEM_TAG, true);
}
}
@@ -211,10 +211,10 @@ static void unsubdivide_face_center_vertex_tag(BMesh *bm, BMVert *initial_vertex
BM_ITER_ELEM (f, &iter, diagonal_v, BM_FACES_OF_VERT) {
BM_ITER_ELEM (neighbor_v, &iter_a, f, BM_VERTS_OF_FACE) {
int neighbor_vertex_index = BM_elem_index_get(neighbor_v);
- if (!visited_vertices[neighbor_vertex_index] && neighbor_v != diagonal_v &&
+ if (!visited_verts[neighbor_vertex_index] && neighbor_v != diagonal_v &&
is_vertex_diagonal(neighbor_v, diagonal_v)) {
BLI_gsqueue_push(queue, &neighbor_v);
- visited_vertices[neighbor_vertex_index] = true;
+ visited_verts[neighbor_vertex_index] = true;
BM_elem_flag_set(neighbor_v, BM_ELEM_TAG, true);
}
}
@@ -224,7 +224,7 @@ static void unsubdivide_face_center_vertex_tag(BMesh *bm, BMVert *initial_vertex
}
BLI_gsqueue_free(queue);
- MEM_freeN(visited_vertices);
+ MEM_freeN(visited_verts);
}
/**
@@ -352,14 +352,14 @@ static bool unsubdivide_tag_disconnected_mesh_element(BMesh *bm, int *elem_id, i
*/
static int unsubdivide_init_elem_ids(BMesh *bm, int *elem_id)
{
- bool *visited_vertices = MEM_calloc_arrayN(bm->totvert, sizeof(bool), "visited vertices");
+ bool *visited_verts = MEM_calloc_arrayN(bm->totvert, sizeof(bool), "visited vertices");
int current_id = 0;
for (int i = 0; i < bm->totvert; i++) {
- if (!visited_vertices[i]) {
+ if (!visited_verts[i]) {
GSQueue *queue;
queue = BLI_gsqueue_new(sizeof(BMVert *));
- visited_vertices[i] = true;
+ visited_verts[i] = true;
elem_id[i] = current_id;
BMVert *iv = BM_vert_at_index(bm, i);
BLI_gsqueue_push(queue, &iv);
@@ -372,8 +372,8 @@ static int unsubdivide_init_elem_ids(BMesh *bm, int *elem_id)
BM_ITER_ELEM (ed, &iter, current_v, BM_EDGES_OF_VERT) {
neighbor_v = BM_edge_other_vert(ed, current_v);
const int neighbor_index = BM_elem_index_get(neighbor_v);
- if (!visited_vertices[neighbor_index]) {
- visited_vertices[neighbor_index] = true;
+ if (!visited_verts[neighbor_index]) {
+ visited_verts[neighbor_index] = true;
elem_id[neighbor_index] = current_id;
BLI_gsqueue_push(queue, &neighbor_v);
}
@@ -383,7 +383,7 @@ static int unsubdivide_init_elem_ids(BMesh *bm, int *elem_id)
BLI_gsqueue_free(queue);
}
}
- MEM_freeN(visited_vertices);
+ MEM_freeN(visited_verts);
return current_id;
}
diff --git a/source/blender/blenkernel/intern/paint.cc b/source/blender/blenkernel/intern/paint.cc
index 73db00e7306..d9ce9f0e490 100644
--- a/source/blender/blenkernel/intern/paint.cc
+++ b/source/blender/blenkernel/intern/paint.cc
@@ -1511,7 +1511,7 @@ void BKE_sculptsession_free(Object *ob)
}
if (ss->boundary_preview) {
- MEM_SAFE_FREE(ss->boundary_preview->vertices);
+ MEM_SAFE_FREE(ss->boundary_preview->verts);
MEM_SAFE_FREE(ss->boundary_preview->edges);
MEM_SAFE_FREE(ss->boundary_preview->distance);
MEM_SAFE_FREE(ss->boundary_preview->edit_info);
@@ -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/particle.c b/source/blender/blenkernel/intern/particle.c
index ea058ba1dc5..7f4cded559c 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -2120,8 +2120,8 @@ void psys_particle_on_dm(Mesh *mesh_final,
const float(*vert_normals)[3] = BKE_mesh_vertex_normals_ensure(mesh_final);
if (from == PART_FROM_VERT) {
- const MVert *vertices = BKE_mesh_verts(mesh_final);
- copy_v3_v3(vec, vertices[mapindex].co);
+ const MVert *verts = BKE_mesh_verts(mesh_final);
+ copy_v3_v3(vec, verts[mapindex].co);
if (nor) {
copy_v3_v3(nor, vert_normals[mapindex]);
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 1c6274ef35e..6d761f56f13 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1831,7 +1831,7 @@ BLI_bitmap **BKE_pbvh_get_grid_visibility(const PBVH *pbvh)
return pbvh->grid_hidden;
}
-int BKE_pbvh_get_grid_num_vertices(const PBVH *pbvh)
+int BKE_pbvh_get_grid_num_verts(const PBVH *pbvh)
{
BLI_assert(pbvh->header.type == PBVH_GRIDS);
return pbvh->totgrid * pbvh->gridkey.grid_area;
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>(
diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c
index 6ca598a3688..d1451353feb 100644
--- a/source/blender/blenkernel/intern/softbody.c
+++ b/source/blender/blenkernel/intern/softbody.c
@@ -2632,7 +2632,7 @@ static void springs_from_mesh(Object *ob)
BodyPoint *bp;
int a;
float scale = 1.0f;
- const MVert *vertices = BKE_mesh_verts(me);
+ const MVert *verts = BKE_mesh_verts(me);
sb = ob->soft;
if (me && sb) {
@@ -2643,7 +2643,7 @@ static void springs_from_mesh(Object *ob)
if (me->totvert) {
bp = ob->soft->bpoint;
for (a = 0; a < me->totvert; a++, bp++) {
- copy_v3_v3(bp->origS, vertices[a].co);
+ copy_v3_v3(bp->origS, verts[a].co);
mul_m4_v3(ob->obmat, bp->origS);
}
}
@@ -2755,15 +2755,15 @@ static void mesh_faces_to_scratch(Object *ob)
MLoopTri *looptri, *lt;
BodyFace *bodyface;
int a;
- const MVert *vertices = BKE_mesh_verts(me);
- const MPoly *polygons = BKE_mesh_polys(me);
+ const MVert *verts = BKE_mesh_verts(me);
+ const MPoly *polys = BKE_mesh_polys(me);
const MLoop *loops = BKE_mesh_loops(me);
/* Allocate and copy faces. */
sb->scratch->totface = poly_to_tri_count(me->totpoly, me->totloop);
looptri = lt = MEM_mallocN(sizeof(*looptri) * sb->scratch->totface, __func__);
- BKE_mesh_recalc_looptri(loops, polygons, vertices, me->totloop, me->totpoly, looptri);
+ BKE_mesh_recalc_looptri(loops, polys, verts, me->totloop, me->totpoly, looptri);
bodyface = sb->scratch->bodyface = MEM_mallocN(sizeof(BodyFace) * sb->scratch->totface,
"SB_body_Faces");
diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index 11d75e0d8b8..9e5ef41892a 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -996,9 +996,9 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
if ((key = blo_do_versions_newlibadr(fd, lib, me->key)) && key->refkey) {
data = key->refkey->data;
tot = MIN2(me->totvert, key->refkey->totelem);
- MVert *vertices = BKE_mesh_verts_for_write(me);
+ MVert *verts = BKE_mesh_verts_for_write(me);
for (a = 0; a < tot; a++, data += 3) {
- copy_v3_v3(vertices[a].co, data);
+ copy_v3_v3(verts[a].co, data);
}
}
}
diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.cc b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
index 8092fe55cc0..94440916603 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_convert.cc
+++ b/source/blender/bmesh/intern/bmesh_mesh_convert.cc
@@ -924,7 +924,7 @@ static void convert_bmesh_hide_flags_to_mesh_attributes(BMesh &bm,
return;
}
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ bke::MutableAttributeAccessor attributes = mesh.attributes_for_write();
BM_mesh_elem_table_ensure(&bm, BM_VERT | BM_EDGE | BM_FACE);
write_fn_to_attribute<bool>(
@@ -1104,11 +1104,9 @@ void BM_mesh_bm_to_me(Main *bmain, BMesh *bm, Mesh *me, const struct BMeshToMesh
if (need_material_index) {
BM_mesh_elem_table_ensure(bm, BM_FACE);
write_fn_to_attribute<int>(
- blender::bke::mesh_attributes_for_write(*me),
- "material_index",
- ATTR_DOMAIN_FACE,
- true,
- [&](const int i) { return static_cast<int>(BM_face_at_index(bm, i)->mat_nr); });
+ me->attributes_for_write(), "material_index", ATTR_DOMAIN_FACE, true, [&](const int i) {
+ return static_cast<int>(BM_face_at_index(bm, i)->mat_nr);
+ });
}
/* Patch hook indices and vertex parents. */
@@ -1360,11 +1358,9 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
if (need_material_index) {
BM_mesh_elem_table_ensure(bm, BM_FACE);
write_fn_to_attribute<int>(
- blender::bke::mesh_attributes_for_write(*me),
- "material_index",
- ATTR_DOMAIN_FACE,
- true,
- [&](const int i) { return static_cast<int>(BM_face_at_index(bm, i)->mat_nr); });
+ me->attributes_for_write(), "material_index", ATTR_DOMAIN_FACE, true, [&](const int i) {
+ return static_cast<int>(BM_face_at_index(bm, i)->mat_nr);
+ });
}
convert_bmesh_hide_flags_to_mesh_attributes(
diff --git a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
index 57efed855f5..a43b23c8969 100644
--- a/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
+++ b/source/blender/draw/intern/draw_cache_impl_pointcloud.cc
@@ -141,7 +141,7 @@ static void pointcloud_batch_cache_ensure_pos(const PointCloud &pointcloud,
return;
}
- const bke::AttributeAccessor attributes = bke::pointcloud_attributes(pointcloud);
+ const bke::AttributeAccessor attributes = pointcloud.attributes();
const VArraySpan<float3> positions = attributes.lookup<float3>("position", ATTR_DOMAIN_POINT);
const VArray<float> radii = attributes.lookup<float>("radius", ATTR_DOMAIN_POINT);
/* From the opengl wiki:
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index 4e985843123..51fbc5a3027 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -807,15 +807,15 @@ struct DRWCacheBuildingContext {
};
static bool draw_subdiv_topology_info_cb(const SubdivForeachContext *foreach_context,
- const int num_vertices,
+ const int num_verts,
const int num_edges,
const int num_loops,
- const int num_polygons,
+ const int num_polys,
const int *subdiv_polygon_offset)
{
/* num_loops does not take into account meshes with only loose geometry, which might be meshes
- * used as custom bone shapes, so let's check the num_vertices also. */
- if (num_vertices == 0 && num_loops == 0) {
+ * used as custom bone shapes, so let's check the num_verts also. */
+ if (num_verts == 0 && num_loops == 0) {
return false;
}
@@ -826,12 +826,12 @@ static bool draw_subdiv_topology_info_cb(const SubdivForeachContext *foreach_con
if (num_loops != 0) {
cache->num_subdiv_edges = (uint)num_edges;
cache->num_subdiv_loops = (uint)num_loops;
- cache->num_subdiv_verts = (uint)num_vertices;
- cache->num_subdiv_quads = (uint)num_polygons;
+ cache->num_subdiv_verts = (uint)num_verts;
+ cache->num_subdiv_quads = (uint)num_polys;
cache->subdiv_polygon_offset = static_cast<int *>(MEM_dupallocN(subdiv_polygon_offset));
}
- cache->may_have_loose_geom = num_vertices != 0 || num_edges != 0;
+ cache->may_have_loose_geom = num_verts != 0 || num_edges != 0;
/* Initialize cache buffers, prefer dynamic usage so we can reuse memory on the host even after
* it was sent to the device, since we may use the data while building other buffers on the CPU
@@ -882,7 +882,7 @@ static bool draw_subdiv_topology_info_cb(const SubdivForeachContext *foreach_con
if (cache->num_subdiv_verts) {
ctx->vert_origindex_map = static_cast<int *>(
MEM_mallocN(cache->num_subdiv_verts * sizeof(int), "subdiv_vert_origindex_map"));
- for (int i = 0; i < num_vertices; i++) {
+ for (int i = 0; i < num_verts; i++) {
ctx->vert_origindex_map[i] = -1;
}
}
@@ -1967,9 +1967,8 @@ static void draw_subdiv_cache_ensure_mat_offsets(DRWSubdivCache *cache,
return;
}
- const blender::VArraySpan<int> material_indices = blender::bke::mesh_attributes(*mesh_eval)
- .lookup_or_default<int>(
- "material_index", ATTR_DOMAIN_FACE, 0);
+ const blender::VArraySpan<int> material_indices = mesh_eval->attributes().lookup_or_default<int>(
+ "material_index", ATTR_DOMAIN_FACE, 0);
/* Count number of subdivided polygons for each material. */
int *mat_start = static_cast<int *>(MEM_callocN(sizeof(int) * mat_len, "subdiv mat_start"));
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 2e324cb3ed8..f1562fac7ee 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -51,7 +51,6 @@
#include "ED_screen.h"
#include "ED_select_utils.h"
#include "ED_transform.h"
-#include "ED_types.h"
#include "ED_util.h"
#include "DEG_depsgraph.h"
@@ -459,9 +458,7 @@ static void draw_marker_line(const uchar *color, int xpos, int ymin, int ymax)
static int marker_get_icon_id(TimeMarker *marker, int flag)
{
if (flag & DRAW_MARKERS_LOCAL) {
- return (marker->flag & ACTIVE) ? ICON_PMARKER_ACT :
- (marker->flag & SELECT) ? ICON_PMARKER_SEL :
- ICON_PMARKER;
+ return (marker->flag & SELECT) ? ICON_PMARKER_SEL : ICON_PMARKER;
}
#ifdef DURIAN_CAMERA_SWITCH
if (marker->camera) {
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index b8c0ea42daa..2829e8bc115 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -47,7 +47,6 @@
#include "ED_select_utils.h"
#include "ED_transform.h"
#include "ED_transform_snap_object_context.h"
-#include "ED_types.h"
#include "ED_view3d.h"
#include "curve_intern.h"
@@ -2088,7 +2087,7 @@ bool ed_editnurb_extrude_flag(EditNurb *editnurb, const uint8_t flag)
const int copy_from = intvls_u[i - 1];
const int copy_to = intvls_u[i];
const int copy_count = copy_to - copy_from + 1;
- const bool sel_status = selected_u || selected_v ? SELECT : DESELECT;
+ const bool sel_status = selected_u || selected_v ? true : false;
ED_curve_bpcpy(editnurb, new_bp_u_v, old_bp_v + copy_from, copy_count);
select_bpoints(new_bp_u_v, 1, copy_count, sel_status, flag, HIDDEN);
new_bp_u_v += copy_count;
@@ -2154,7 +2153,7 @@ static void adduplicateflagNurb(
starta = a;
while ((bezt->f1 & flag) || (bezt->f2 & flag) || (bezt->f3 & flag)) {
if (!split) {
- select_beztriple(bezt, DESELECT, flag, HIDDEN);
+ select_beztriple(bezt, false, flag, HIDDEN);
}
enda = a;
if (a >= nu->pntsu - 1) {
@@ -2194,7 +2193,7 @@ static void adduplicateflagNurb(
}
for (b = 0, bezt1 = newnu->bezt; b < newnu->pntsu; b++, bezt1++) {
- select_beztriple(bezt1, SELECT, flag, HIDDEN);
+ select_beztriple(bezt1, true, flag, HIDDEN);
}
BLI_addtail(newnurb, newnu);
@@ -2212,7 +2211,7 @@ static void adduplicateflagNurb(
newnu->flagu &= ~CU_NURB_CYCLIC;
for (b = 0, bezt1 = newnu->bezt; b < newnu->pntsu; b++, bezt1++) {
- select_beztriple(bezt1, SELECT, flag, HIDDEN);
+ select_beztriple(bezt1, true, flag, HIDDEN);
}
BLI_addtail(newnurb, newnu);
@@ -2224,7 +2223,7 @@ static void adduplicateflagNurb(
starta = a;
while (bp->f1 & flag) {
if (!split) {
- select_bpoint(bp, DESELECT, flag, HIDDEN);
+ select_bpoint(bp, false, flag, HIDDEN);
}
enda = a;
if (a >= nu->pntsu - 1) {
@@ -2264,7 +2263,7 @@ static void adduplicateflagNurb(
}
for (b = 0, bp1 = newnu->bp; b < newnu->pntsu; b++, bp1++) {
- select_bpoint(bp1, SELECT, flag, HIDDEN);
+ select_bpoint(bp1, true, flag, HIDDEN);
}
BLI_addtail(newnurb, newnu);
@@ -2282,7 +2281,7 @@ static void adduplicateflagNurb(
newnu->flagu &= ~CU_NURB_CYCLIC;
for (b = 0, bp1 = newnu->bp; b < newnu->pntsu; b++, bp1++) {
- select_bpoint(bp1, SELECT, flag, HIDDEN);
+ select_bpoint(bp1, true, flag, HIDDEN);
}
BLI_addtail(newnurb, newnu);
@@ -2502,7 +2501,7 @@ static void adduplicateflagNurb(
for (b = 0, bp1 = nu->bp; b < nu->pntsu * nu->pntsv; b++, bp1++) {
bp1->f1 &= ~SURF_SEEN;
if (!split) {
- select_bpoint(bp1, DESELECT, flag, HIDDEN);
+ select_bpoint(bp1, false, flag, HIDDEN);
}
}
}
@@ -3237,11 +3236,11 @@ static int hide_exec(bContext *C, wmOperator *op)
sel = 0;
while (a--) {
if (invert == 0 && BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
- select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, false, SELECT, HIDDEN);
bezt->hide = 1;
}
else if (invert && !BEZT_ISSEL_ANY_HIDDENHANDLES(v3d, bezt)) {
- select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, false, SELECT, HIDDEN);
bezt->hide = 1;
}
if (bezt->hide) {
@@ -3259,11 +3258,11 @@ static int hide_exec(bContext *C, wmOperator *op)
sel = 0;
while (a--) {
if (invert == 0 && (bp->f1 & SELECT)) {
- select_bpoint(bp, DESELECT, SELECT, HIDDEN);
+ select_bpoint(bp, false, SELECT, HIDDEN);
bp->hide = 1;
}
else if (invert && (bp->f1 & SELECT) == 0) {
- select_bpoint(bp, DESELECT, SELECT, HIDDEN);
+ select_bpoint(bp, false, SELECT, HIDDEN);
bp->hide = 1;
}
if (bp->hide) {
@@ -4353,7 +4352,7 @@ static bool merge_2_nurb(Curve *cu, ListBase *editnurb, Nurb *nu1, Nurb *nu2)
keyIndex_updateBP(cu->editnurb, bp1, bp, 1);
*bp = *bp1;
bp1++;
- select_bpoint(bp, SELECT, SELECT, HIDDEN);
+ select_bpoint(bp, true, SELECT, HIDDEN);
}
else {
keyIndex_updateBP(cu->editnurb, bp2, bp, 1);
@@ -4808,7 +4807,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
bezt->f2 |= SELECT;
}
else {
- select_beztriple(bezt, SELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, true, SELECT, HIDDEN);
}
}
else {
@@ -4822,7 +4821,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
BKE_curve_nurb_vert_active_set(cu, nu, bezt);
}
else {
- select_bpoint(bp, SELECT, SELECT, HIDDEN);
+ select_bpoint(bp, true, SELECT, HIDDEN);
BKE_curve_nurb_vert_active_set(cu, nu, bp);
}
break;
@@ -4834,7 +4833,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
bezt->f2 &= ~SELECT;
}
else {
- select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, false, SELECT, HIDDEN);
}
if (bezt == vert) {
cu->actvert = CU_ACT_NONE;
@@ -4848,7 +4847,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
}
}
else {
- select_bpoint(bp, DESELECT, SELECT, HIDDEN);
+ select_bpoint(bp, false, SELECT, HIDDEN);
if (bp == vert) {
cu->actvert = CU_ACT_NONE;
}
@@ -4863,7 +4862,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
bezt->f2 &= ~SELECT;
}
else {
- select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, false, SELECT, HIDDEN);
}
if (bezt == vert) {
cu->actvert = CU_ACT_NONE;
@@ -4874,7 +4873,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
bezt->f2 |= SELECT;
}
else {
- select_beztriple(bezt, SELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, true, SELECT, HIDDEN);
}
BKE_curve_nurb_vert_active_set(cu, nu, bezt);
}
@@ -4888,13 +4887,13 @@ bool ED_curve_editnurb_select_pick(bContext *C,
}
else {
if (bp->f1 & SELECT) {
- select_bpoint(bp, DESELECT, SELECT, HIDDEN);
+ select_bpoint(bp, false, SELECT, HIDDEN);
if (bp == vert) {
cu->actvert = CU_ACT_NONE;
}
}
else {
- select_bpoint(bp, SELECT, SELECT, HIDDEN);
+ select_bpoint(bp, true, SELECT, HIDDEN);
BKE_curve_nurb_vert_active_set(cu, nu, bp);
}
}
@@ -4910,7 +4909,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
bezt->f2 |= SELECT;
}
else {
- select_beztriple(bezt, SELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, true, SELECT, HIDDEN);
}
}
else {
@@ -4924,7 +4923,7 @@ bool ED_curve_editnurb_select_pick(bContext *C,
BKE_curve_nurb_vert_active_set(cu, nu, bezt);
}
else {
- select_bpoint(bp, SELECT, SELECT, HIDDEN);
+ select_bpoint(bp, true, SELECT, HIDDEN);
BKE_curve_nurb_vert_active_set(cu, nu, bp);
}
break;
@@ -6407,7 +6406,7 @@ static bool curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
if (split) {
/* deselect for split operator */
for (b = 0, bezt1 = nu->bezt; b < nu->pntsu; b++, bezt1++) {
- select_beztriple(bezt1, DESELECT, SELECT, true);
+ select_beztriple(bezt1, false, SELECT, true);
}
}
@@ -6417,7 +6416,7 @@ static bool curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
if (split) {
/* deselect for split operator */
for (b = 0, bp1 = nu->bp; b < nu->pntsu * nu->pntsv; b++, bp1++) {
- select_bpoint(bp1, DESELECT, SELECT, HIDDEN);
+ select_bpoint(bp1, false, SELECT, HIDDEN);
}
}
diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c
index 5a1777b7097..b7e6827c6df 100644
--- a/source/blender/editors/curve/editcurve_select.c
+++ b/source/blender/editors/curve/editcurve_select.c
@@ -30,7 +30,6 @@
#include "ED_object.h"
#include "ED_screen.h"
#include "ED_select_utils.h"
-#include "ED_types.h"
#include "ED_view3d.h"
#include "curve_intern.h"
@@ -47,7 +46,7 @@
bool select_beztriple(BezTriple *bezt, bool selstatus, uint8_t flag, eVisible_Types hidden)
{
if ((bezt->hide == 0) || (hidden == HIDDEN)) {
- if (selstatus == SELECT) { /* selects */
+ if (selstatus) { /* selects */
bezt->f1 |= flag;
bezt->f2 |= flag;
bezt->f3 |= flag;
@@ -66,7 +65,7 @@ bool select_beztriple(BezTriple *bezt, bool selstatus, uint8_t flag, eVisible_Ty
bool select_bpoint(BPoint *bp, bool selstatus, uint8_t flag, bool hidden)
{
if ((bp->hide == 0) || (hidden == 1)) {
- if (selstatus == SELECT) {
+ if (selstatus) {
bp->f1 |= flag;
return true;
}
@@ -80,17 +79,17 @@ bool select_bpoint(BPoint *bp, bool selstatus, uint8_t flag, bool hidden)
static bool swap_selection_beztriple(BezTriple *bezt)
{
if (bezt->f2 & SELECT) {
- return select_beztriple(bezt, DESELECT, SELECT, VISIBLE);
+ return select_beztriple(bezt, false, SELECT, VISIBLE);
}
- return select_beztriple(bezt, SELECT, SELECT, VISIBLE);
+ return select_beztriple(bezt, true, SELECT, VISIBLE);
}
static bool swap_selection_bpoint(BPoint *bp)
{
if (bp->f1 & SELECT) {
- return select_bpoint(bp, DESELECT, SELECT, VISIBLE);
+ return select_bpoint(bp, false, SELECT, VISIBLE);
}
- return select_bpoint(bp, SELECT, SELECT, VISIBLE);
+ return select_bpoint(bp, true, SELECT, VISIBLE);
}
bool ED_curve_nurb_select_check(const View3D *v3d, const Nurb *nu)
@@ -336,9 +335,9 @@ static void select_adjacent_cp(ListBase *editnurb,
break;
}
if ((lastsel == false) && (bezt->hide == 0) &&
- ((bezt->f2 & SELECT) || (selstatus == DESELECT))) {
+ ((bezt->f2 & SELECT) || (selstatus == false))) {
bezt += next;
- if (!(bezt->f2 & SELECT) || (selstatus == DESELECT)) {
+ if (!(bezt->f2 & SELECT) || (selstatus == false)) {
bool sel = select_beztriple(bezt, selstatus, SELECT, VISIBLE);
if (sel && !cont) {
lastsel = true;
@@ -363,10 +362,9 @@ static void select_adjacent_cp(ListBase *editnurb,
if (a - abs(next) < 0) {
break;
}
- if ((lastsel == false) && (bp->hide == 0) &&
- ((bp->f1 & SELECT) || (selstatus == DESELECT))) {
+ if ((lastsel == false) && (bp->hide == 0) && ((bp->f1 & SELECT) || (selstatus == false))) {
bp += next;
- if (!(bp->f1 & SELECT) || (selstatus == DESELECT)) {
+ if (!(bp->f1 & SELECT) || (selstatus == false)) {
bool sel = select_bpoint(bp, selstatus, SELECT, VISIBLE);
if (sel && !cont) {
lastsel = true;
@@ -477,7 +475,7 @@ static int de_select_first_exec(bContext *C, wmOperator *UNUSED(op))
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
- selectend_nurb(obedit, FIRST, true, DESELECT);
+ selectend_nurb(obedit, FIRST, true, false);
DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
BKE_curve_nurb_vert_active_validate(obedit->data);
@@ -510,7 +508,7 @@ static int de_select_last_exec(bContext *C, wmOperator *UNUSED(op))
for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
Object *obedit = objects[ob_index];
- selectend_nurb(obedit, LAST, true, DESELECT);
+ selectend_nurb(obedit, LAST, true, false);
DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
BKE_curve_nurb_vert_active_validate(obedit->data);
@@ -780,12 +778,12 @@ static int select_row_exec(bContext *C, wmOperator *UNUSED(op))
for (b = 0; b < nu->pntsu; b++, bp++) {
if (direction) {
if (a == v) {
- select_bpoint(bp, SELECT, SELECT, VISIBLE);
+ select_bpoint(bp, true, SELECT, VISIBLE);
}
}
else {
if (b == u) {
- select_bpoint(bp, SELECT, SELECT, VISIBLE);
+ select_bpoint(bp, true, SELECT, VISIBLE);
}
}
}
@@ -923,7 +921,7 @@ static void curve_select_more(Object *obedit)
if (a % nu->pntsu != 0) {
tempbp = bp - 1;
if (!(tempbp->f1 & SELECT)) {
- select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
+ select_bpoint(tempbp, true, SELECT, VISIBLE);
}
}
@@ -932,7 +930,7 @@ static void curve_select_more(Object *obedit)
sel = 0;
tempbp = bp + nu->pntsu;
if (!(tempbp->f1 & SELECT)) {
- sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
+ sel = select_bpoint(tempbp, true, SELECT, VISIBLE);
}
/* make sure selected bpoint is discarded */
if (sel == 1) {
@@ -944,7 +942,7 @@ static void curve_select_more(Object *obedit)
if (a + nu->pntsu < nu->pntsu * nu->pntsv) {
tempbp = bp - nu->pntsu;
if (!(tempbp->f1 & SELECT)) {
- select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
+ select_bpoint(tempbp, true, SELECT, VISIBLE);
}
}
@@ -953,7 +951,7 @@ static void curve_select_more(Object *obedit)
sel = 0;
tempbp = bp + 1;
if (!(tempbp->f1 & SELECT)) {
- sel = select_bpoint(tempbp, SELECT, SELECT, VISIBLE);
+ sel = select_bpoint(tempbp, true, SELECT, VISIBLE);
}
if (sel) {
bp++;
@@ -1080,7 +1078,7 @@ static void curve_select_less(Object *obedit)
}
if (sel != 4) {
- select_bpoint(bp, DESELECT, SELECT, VISIBLE);
+ select_bpoint(bp, false, SELECT, VISIBLE);
BLI_BITMAP_ENABLE(selbpoints, a);
}
}
@@ -1130,7 +1128,7 @@ static void curve_select_less(Object *obedit)
}
if (sel != 2) {
- select_beztriple(bezt, DESELECT, SELECT, VISIBLE);
+ select_beztriple(bezt, false, SELECT, VISIBLE);
lastsel = true;
}
else {
@@ -1175,7 +1173,7 @@ static void curve_select_less(Object *obedit)
}
if (sel != 2) {
- select_bpoint(bp, DESELECT, SELECT, VISIBLE);
+ select_bpoint(bp, false, SELECT, VISIBLE);
lastsel = true;
}
else {
@@ -1359,7 +1357,7 @@ static void select_nth_bezt(Nurb *nu, BezTriple *bezt, const struct CheckerInter
while (a--) {
const int depth = abs(start - a);
if (!WM_operator_properties_checker_interval_test(params, depth)) {
- select_beztriple(bezt, DESELECT, SELECT, HIDDEN);
+ select_beztriple(bezt, false, SELECT, HIDDEN);
}
bezt--;
@@ -1382,7 +1380,7 @@ static void select_nth_bp(Nurb *nu, BPoint *bp, const struct CheckerIntervalPara
while (a--) {
const int depth = abs(pnt - startpnt) + abs(row - startrow);
if (!WM_operator_properties_checker_interval_test(params, depth)) {
- select_bpoint(bp, DESELECT, SELECT, HIDDEN);
+ select_bpoint(bp, false, SELECT, HIDDEN);
}
pnt--;
@@ -1645,7 +1643,7 @@ static bool curve_nurb_select_similar_type(Object *ob,
}
if (select) {
- select_beztriple(bezt, SELECT, SELECT, VISIBLE);
+ select_beztriple(bezt, true, SELECT, VISIBLE);
changed = true;
}
}
@@ -1690,7 +1688,7 @@ static bool curve_nurb_select_similar_type(Object *ob,
}
if (select) {
- select_bpoint(bp, SELECT, SELECT, VISIBLE);
+ select_bpoint(bp, true, SELECT, VISIBLE);
changed = true;
}
}
@@ -1898,10 +1896,10 @@ static void curve_select_shortest_path_curve(Nurb *nu, int vert_src, int vert_ds
i = vert_src;
while (true) {
if (nu->type & CU_BEZIER) {
- select_beztriple(&nu->bezt[i], SELECT, SELECT, HIDDEN);
+ select_beztriple(&nu->bezt[i], true, SELECT, HIDDEN);
}
else {
- select_bpoint(&nu->bp[i], SELECT, SELECT, HIDDEN);
+ select_bpoint(&nu->bp[i], true, SELECT, HIDDEN);
}
if (i == vert_dst) {
@@ -1979,10 +1977,10 @@ static void curve_select_shortest_path_surf(Nurb *nu, int vert_src, int vert_dst
int i = 0;
while (vert_curr != vert_src && i++ < vert_num) {
if (nu->type == CU_BEZIER) {
- select_beztriple(&nu->bezt[vert_curr], SELECT, SELECT, HIDDEN);
+ select_beztriple(&nu->bezt[vert_curr], true, SELECT, HIDDEN);
}
else {
- select_bpoint(&nu->bp[vert_curr], SELECT, SELECT, HIDDEN);
+ select_bpoint(&nu->bp[vert_curr], true, SELECT, HIDDEN);
}
vert_curr = data[vert_curr].vert_prev;
}
diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc
index bf9f5acac04..2386fd1030d 100644
--- a/source/blender/editors/curves/intern/curves_ops.cc
+++ b/source/blender/editors/curves/intern/curves_ops.cc
@@ -548,7 +548,7 @@ static void snap_curves_to_surface_exec_object(Object &curves_ob,
BKE_mesh_runtime_looptri_len(&surface_mesh)};
VArraySpan<float2> surface_uv_map;
if (curves_id.surface_uv_map != nullptr) {
- const bke::AttributeAccessor surface_attributes = bke::mesh_attributes(surface_mesh);
+ const bke::AttributeAccessor surface_attributes = surface_mesh.attributes();
surface_uv_map = surface_attributes
.lookup(curves_id.surface_uv_map, ATTR_DOMAIN_CORNER, CD_PROP_FLOAT2)
.typed<float2>();
diff --git a/source/blender/editors/geometry/geometry_attributes.cc b/source/blender/editors/geometry/geometry_attributes.cc
index eafe13f093d..14f2f8c6af5 100644
--- a/source/blender/editors/geometry/geometry_attributes.cc
+++ b/source/blender/editors/geometry/geometry_attributes.cc
@@ -282,7 +282,7 @@ static int geometry_attribute_convert_exec(bContext *C, wmOperator *op)
RNA_enum_get(op->ptr, "mode"));
Mesh *mesh = reinterpret_cast<Mesh *>(ob_data);
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
/* General conversion steps are always the same:
* 1. Convert old data to right domain and data type.
@@ -646,8 +646,7 @@ bool ED_geometry_attribute_convert(Mesh *mesh,
return false;
}
- blender::bke::MutableAttributeAccessor attributes = blender::bke::mesh_attributes_for_write(
- *mesh);
+ blender::bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
GVArray src_varray = attributes.lookup_or_default(name, new_domain, new_type);
diff --git a/source/blender/editors/include/ED_types.h b/source/blender/editors/include/ED_types.h
deleted file mode 100644
index eba93ed6744..00000000000
--- a/source/blender/editors/include/ED_types.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later
- * Copyright 2008 Blender Foundation. All rights reserved. */
-
-/** \file
- * \ingroup editors
- */
-
-#pragma once
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* **************** GENERAL EDITOR-WIDE TYPES AND DEFINES ************************** */
-
-/* old blender defines... should be deprecated? */
-#define DESELECT 0
-#define SELECT 1
-#define ACTIVE 2
-
-/* proposal = put scene pointers on function calls? */
-// #define BASACT (scene->basact)
-// #define OBACT (BASACT ? BASACT->object : NULL)
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc
index 26184acc8b4..f729db29b8c 100644
--- a/source/blender/editors/mesh/editface.cc
+++ b/source/blender/editors/mesh/editface.cc
@@ -67,11 +67,11 @@ void paintface_flush_flags(bContext *C,
return;
}
- bke::AttributeAccessor attributes_me = bke::mesh_attributes(*me);
+ bke::AttributeAccessor attributes_me = me->attributes();
Mesh *me_orig = (Mesh *)ob_eval->runtime.data_orig;
- bke::MutableAttributeAccessor attributes_orig = bke::mesh_attributes_for_write(*me_orig);
+ bke::MutableAttributeAccessor attributes_orig = me_orig->attributes_for_write();
Mesh *me_eval = (Mesh *)ob_eval->runtime.data_eval;
- bke::MutableAttributeAccessor attributes_eval = bke::mesh_attributes_for_write(*me_eval);
+ bke::MutableAttributeAccessor attributes_eval = me_eval->attributes_for_write();
bool updated = false;
const Span<MPoly> me_polys = me->polys();
@@ -142,7 +142,7 @@ void paintface_hide(bContext *C, Object *ob, const bool unselected)
}
MutableSpan<MPoly> polys = me->polys_for_write();
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
+ bke::MutableAttributeAccessor attributes = me->attributes_for_write();
bke::SpanAttributeWriter<bool> hide_poly = attributes.lookup_or_add_for_write_span<bool>(
".hide_poly", ATTR_DOMAIN_FACE);
@@ -175,7 +175,7 @@ void paintface_reveal(bContext *C, Object *ob, const bool select)
}
MutableSpan<MPoly> polys = me->polys_for_write();
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
+ bke::MutableAttributeAccessor attributes = me->attributes_for_write();
if (select) {
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
@@ -209,7 +209,7 @@ static void select_linked_tfaces_with_seams(Mesh *me, const uint index, const bo
const Span<MEdge> edges = me->edges();
MutableSpan<MPoly> polys = me->polys_for_write();
const Span<MLoop> loops = me->loops();
- bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ bke::AttributeAccessor attributes = me->attributes();
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
".hide_poly", ATTR_DOMAIN_FACE, false);
@@ -306,7 +306,7 @@ bool paintface_deselect_all_visible(bContext *C, Object *ob, int action, bool fl
}
MutableSpan<MPoly> polys = me->polys_for_write();
- bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ bke::AttributeAccessor attributes = me->attributes();
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
".hide_poly", ATTR_DOMAIN_FACE, false);
@@ -372,7 +372,7 @@ bool paintface_minmax(Object *ob, float r_min[3], float r_max[3])
const Span<MVert> verts = me->verts();
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();
- bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ bke::AttributeAccessor attributes = me->attributes();
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
".hide_poly", ATTR_DOMAIN_FACE, false);
@@ -410,7 +410,7 @@ bool paintface_mouse_select(bContext *C,
Mesh *me = BKE_mesh_from_object(ob);
MutableSpan<MPoly> polys = me->polys_for_write();
- bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ bke::AttributeAccessor attributes = me->attributes();
const VArray<bool> hide_poly = attributes.lookup_or_default<bool>(
".hide_poly", ATTR_DOMAIN_FACE, false);
@@ -494,21 +494,21 @@ void paintvert_flush_flags(Object *ob)
index_array = (const int *)CustomData_get_layer(&me_eval->vdata, CD_ORIGINDEX);
- const Span<MVert> vertices = me->verts_for_write();
- MutableSpan<MVert> vertices_eval = me_eval->verts_for_write();
+ const Span<MVert> verts = me->verts_for_write();
+ MutableSpan<MVert> verts_eval = me_eval->verts_for_write();
if (index_array) {
int orig_index;
- for (const int i : vertices_eval.index_range()) {
+ for (const int i : verts_eval.index_range()) {
orig_index = index_array[i];
if (orig_index != ORIGINDEX_NONE) {
- vertices_eval[i].flag = vertices[index_array[i]].flag;
+ verts_eval[i].flag = verts[index_array[i]].flag;
}
}
}
else {
- for (const int i : vertices_eval.index_range()) {
- vertices_eval[i].flag = vertices[i].flag;
+ for (const int i : verts_eval.index_range()) {
+ verts_eval[i].flag = verts[i].flag;
}
}
@@ -530,7 +530,7 @@ bool paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)
}
MutableSpan<MVert> verts = me->verts_for_write();
- bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ bke::AttributeAccessor attributes = me->attributes();
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
".hide_vert", ATTR_DOMAIN_POINT, false);
@@ -607,7 +607,7 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
}
MutableSpan<MVert> verts = me->verts_for_write();
- bke::AttributeAccessor attributes = bke::mesh_attributes(*me);
+ bke::AttributeAccessor attributes = me->attributes();
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
".hide_vert", ATTR_DOMAIN_POINT, false);
@@ -636,7 +636,7 @@ void paintvert_hide(bContext *C, Object *ob, const bool unselected)
}
MutableSpan<MVert> verts = me->verts_for_write();
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
+ bke::MutableAttributeAccessor attributes = me->attributes_for_write();
bke::SpanAttributeWriter<bool> hide_vert = attributes.lookup_or_add_for_write_span<bool>(
".hide_vert", ATTR_DOMAIN_POINT);
@@ -669,7 +669,7 @@ void paintvert_reveal(bContext *C, Object *ob, const bool select)
}
MutableSpan<MVert> verts = me->verts_for_write();
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
+ bke::MutableAttributeAccessor attributes = me->attributes_for_write();
const VArray<bool> hide_vert = attributes.lookup_or_default<bool>(
".hide_vert", ATTR_DOMAIN_POINT, false);
diff --git a/source/blender/editors/mesh/editmesh_extrude_screw.c b/source/blender/editors/mesh/editmesh_extrude_screw.c
index cc493cab0f9..5addd67ab58 100644
--- a/source/blender/editors/mesh/editmesh_extrude_screw.c
+++ b/source/blender/editors/mesh/editmesh_extrude_screw.c
@@ -41,7 +41,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
int valence;
uint objects_empty_len = 0;
uint failed_axis_len = 0;
- uint failed_vertices_len = 0;
+ uint failed_verts_len = 0;
turns = RNA_int_get(op->ptr, "turns");
steps = RNA_int_get(op->ptr, "steps");
@@ -97,7 +97,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
}
if (v1 == NULL || v2 == NULL) {
- failed_vertices_len++;
+ failed_verts_len++;
continue;
}
@@ -151,7 +151,7 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
if (failed_axis_len == objects_len - objects_empty_len) {
BKE_report(op->reports, RPT_ERROR, "Invalid/unset axis");
}
- else if (failed_vertices_len == objects_len - objects_empty_len) {
+ else if (failed_verts_len == objects_len - objects_empty_len) {
BKE_report(op->reports, RPT_ERROR, "You have to select a string of connected vertices too");
}
diff --git a/source/blender/editors/mesh/meshtools.cc b/source/blender/editors/mesh/meshtools.cc
index ad7f504c87b..d6713724e15 100644
--- a/source/blender/editors/mesh/meshtools.cc
+++ b/source/blender/editors/mesh/meshtools.cc
@@ -254,7 +254,7 @@ static void join_mesh_single(Depsgraph *depsgraph,
CustomData_copy_data_named(&me->pdata, pdata, 0, *polyofs, me->totpoly);
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");
if (material_indices) {
blender::MutableVArraySpan<int> material_indices_span(material_indices.varray);
for (const int i : material_indices_span.index_range()) {
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc
index 513ead708e3..1068da6816f 100644
--- a/source/blender/editors/object/object_add.cc
+++ b/source/blender/editors/object/object_add.cc
@@ -3158,7 +3158,7 @@ static int object_convert_exec(bContext *C, wmOperator *op)
}
/* Anonymous attributes shouldn't be available on the applied geometry. */
- blender::bke::mesh_attributes_for_write(*new_mesh).remove_anonymous();
+ new_mesh->attributes_for_write().remove_anonymous();
BKE_object_free_modifiers(newob, 0); /* after derivedmesh calls! */
}
diff --git a/source/blender/editors/object/object_modifier.cc b/source/blender/editors/object/object_modifier.cc
index 8bbceccab28..9bb82cc086c 100644
--- a/source/blender/editors/object/object_modifier.cc
+++ b/source/blender/editors/object/object_modifier.cc
@@ -766,7 +766,7 @@ static bool modifier_apply_obdata(
BKE_mesh_nomain_to_mesh(mesh_applied, me, ob, &CD_MASK_MESH, true);
/* Anonymous attributes shouldn't be available on the applied geometry. */
- blender::bke::mesh_attributes_for_write(*me).remove_anonymous();
+ me->attributes_for_write().remove_anonymous();
if (md_eval->type == eModifierType_Multires) {
multires_customdata_delete(me);
diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc
index c93d7dc3ee5..09489c50e9d 100644
--- a/source/blender/editors/object/object_remesh.cc
+++ b/source/blender/editors/object/object_remesh.cc
@@ -131,8 +131,8 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op)
}
/* Output mesh will be all smooth or all flat shading. */
- const Span<MPoly> polygons = mesh->polys();
- const bool smooth_normals = polygons.first().flag & ME_SMOOTH;
+ const Span<MPoly> polys = mesh->polys();
+ const bool smooth_normals = polys.first().flag & ME_SMOOTH;
float isovalue = 0.0f;
if (mesh->flag & ME_REMESH_REPROJECT_VOLUME) {
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
index d452d94d2f0..b5d739ae08e 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_add.cc
@@ -167,11 +167,10 @@ struct AddOperationExecutor {
/* Find UV map. */
VArraySpan<float2> surface_uv_map;
if (curves_id_orig_->surface_uv_map != nullptr) {
- surface_uv_map = bke::mesh_attributes(surface_orig)
- .lookup<float2>(curves_id_orig_->surface_uv_map, ATTR_DOMAIN_CORNER);
- surface_uv_map_eval_ = bke::mesh_attributes(*surface_eval_)
- .lookup<float2>(curves_id_orig_->surface_uv_map,
- ATTR_DOMAIN_CORNER);
+ surface_uv_map = surface_orig.attributes().lookup<float2>(curves_id_orig_->surface_uv_map,
+ ATTR_DOMAIN_CORNER);
+ surface_uv_map_eval_ = surface_eval_->attributes().lookup<float2>(
+ curves_id_orig_->surface_uv_map, ATTR_DOMAIN_CORNER);
}
if (surface_uv_map.is_empty()) {
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
index 2e03e907e34..c33ee5e0727 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_density.cc
@@ -137,9 +137,9 @@ struct DensityAddOperationExecutor {
/* Find UV map. */
VArraySpan<float2> surface_uv_map;
if (curves_id_orig_->surface_uv_map != nullptr) {
- surface_uv_map = bke::mesh_attributes(*surface_orig_)
+ surface_uv_map = surface_orig_->attributes()
.lookup<float2>(curves_id_orig_->surface_uv_map, ATTR_DOMAIN_CORNER);
- surface_uv_map_eval_ = bke::mesh_attributes(*surface_eval_)
+ surface_uv_map_eval_ = surface_eval_->attributes()
.lookup<float2>(curves_id_orig_->surface_uv_map,
ATTR_DOMAIN_CORNER);
}
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
index 833f00ae0d0..1108f5c72a9 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_slide.cc
@@ -180,8 +180,8 @@ struct SlideOperationExecutor {
}
surface_looptris_orig_ = {BKE_mesh_runtime_looptri_ensure(surface_orig_),
BKE_mesh_runtime_looptri_len(surface_orig_)};
- surface_uv_map_orig_ =
- bke::mesh_attributes(*surface_orig_).lookup<float2>(uv_map_name, ATTR_DOMAIN_CORNER);
+ surface_uv_map_orig_ = surface_orig_->attributes().lookup<float2>(uv_map_name,
+ ATTR_DOMAIN_CORNER);
if (surface_uv_map_orig_.is_empty()) {
report_missing_uv_map_on_original_surface(stroke_extension.reports);
return;
@@ -209,8 +209,8 @@ struct SlideOperationExecutor {
BKE_mesh_runtime_looptri_len(surface_eval_)};
surface_verts_eval_ = surface_eval_->verts();
surface_loops_eval_ = surface_eval_->loops();
- surface_uv_map_eval_ =
- bke::mesh_attributes(*surface_eval_).lookup<float2>(uv_map_name, ATTR_DOMAIN_CORNER);
+ surface_uv_map_eval_ = surface_eval_->attributes().lookup<float2>(uv_map_name,
+ ATTR_DOMAIN_CORNER);
if (surface_uv_map_eval_.is_empty()) {
report_missing_uv_map_on_evaluated_surface(stroke_extension.reports);
return;
diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
index 006ceb5f136..10ad4c2192f 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.cc
@@ -92,7 +92,7 @@ static bool vertex_paint_from_weight(Object *ob)
return false;
}
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*me);
+ bke::MutableAttributeAccessor attributes = me->attributes_for_write();
bke::GAttributeWriter color_attribute = attributes.lookup_for_write(active_color_layer->name);
if (!color_attribute) {
@@ -162,7 +162,7 @@ static IndexMask get_selected_indices(const Mesh &mesh,
const Span<MVert> verts = mesh.verts();
const Span<MPoly> polys = mesh.polys();
- bke::AttributeAccessor attributes = bke::mesh_attributes(mesh);
+ bke::AttributeAccessor attributes = mesh.attributes();
if (mesh.editflag & ME_EDIT_PAINT_FACE_SEL) {
const VArray<bool> selection = attributes.adapt_domain(
@@ -186,7 +186,7 @@ static IndexMask get_selected_indices(const Mesh &mesh,
return IndexMask(attributes.domain_size(domain));
}
-static void face_corner_color_equalize_vertices(Mesh &mesh, const IndexMask selection)
+static void face_corner_color_equalize_verts(Mesh &mesh, const IndexMask selection)
{
using namespace blender;
@@ -196,7 +196,7 @@ static void face_corner_color_equalize_vertices(Mesh &mesh, const IndexMask sele
return;
}
- bke::AttributeAccessor attributes = bke::mesh_attributes(mesh);
+ bke::AttributeAccessor attributes = mesh.attributes();
if (attributes.lookup_meta_data(active_color_layer->name)->domain == ATTR_DOMAIN_POINT) {
return;
@@ -221,7 +221,7 @@ static bool vertex_color_smooth(Object *ob)
Vector<int64_t> indices;
const IndexMask selection = get_selected_indices(*me, ATTR_DOMAIN_CORNER, indices);
- face_corner_color_equalize_vertices(*me, selection);
+ face_corner_color_equalize_verts(*me, selection);
tag_object_after_update(ob);
@@ -270,7 +270,7 @@ static bool transform_active_color(Mesh &mesh, const TransformFn &transform_fn)
return false;
}
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ bke::MutableAttributeAccessor attributes = mesh.attributes_for_write();
bke::GAttributeWriter color_attribute = attributes.lookup_for_write(active_color_layer->name);
if (!color_attribute) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 5a17d42468e..51ff064c58d 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -116,7 +116,7 @@ int SCULPT_vertex_count_get(SculptSession *ss)
case PBVH_BMESH:
return BM_mesh_elem_count(BKE_pbvh_get_bmesh(ss->pbvh), BM_VERT);
case PBVH_GRIDS:
- return BKE_pbvh_get_grid_num_vertices(ss->pbvh);
+ return BKE_pbvh_get_grid_num_verts(ss->pbvh);
}
return 0;
@@ -562,7 +562,7 @@ bool SCULPT_vertex_has_face_set(SculptSession *ss, PBVHVertRef vertex, int face_
return true;
}
-void SCULPT_visibility_sync_all_face_sets_to_vertices(Object *ob)
+void SCULPT_visibility_sync_all_face_sets_to_verts(Object *ob)
{
SculptSession *ss = ob->sculpt;
Mesh *mesh = BKE_object_get_original_mesh(ob);
@@ -1102,7 +1102,7 @@ void SCULPT_floodfill_init(SculptSession *ss, SculptFloodFill *flood)
SCULPT_vertex_random_access_ensure(ss);
flood->queue = BLI_gsqueue_new(sizeof(intptr_t));
- flood->visited_vertices = BLI_BITMAP_NEW(vertex_count, "visited vertices");
+ flood->visited_verts = BLI_BITMAP_NEW(vertex_count, "visited verts");
}
void SCULPT_floodfill_add_initial(SculptFloodFill *flood, PBVHVertRef vertex)
@@ -1113,7 +1113,7 @@ void SCULPT_floodfill_add_initial(SculptFloodFill *flood, PBVHVertRef vertex)
void SCULPT_floodfill_add_and_skip_initial(SculptFloodFill *flood, PBVHVertRef vertex)
{
BLI_gsqueue_push(flood->queue, &vertex);
- BLI_BITMAP_ENABLE(flood->visited_vertices, vertex.i);
+ BLI_BITMAP_ENABLE(flood->visited_verts, vertex.i);
}
void SCULPT_floodfill_add_initial_with_symmetry(Sculpt *sd,
@@ -1192,7 +1192,7 @@ void SCULPT_floodfill_execute(SculptSession *ss,
const PBVHVertRef to_v = ni.vertex;
int to_v_i = BKE_pbvh_vertex_to_index(ss->pbvh, to_v);
- if (BLI_BITMAP_TEST(flood->visited_vertices, to_v_i)) {
+ if (BLI_BITMAP_TEST(flood->visited_verts, to_v_i)) {
continue;
}
@@ -1200,7 +1200,7 @@ void SCULPT_floodfill_execute(SculptSession *ss,
continue;
}
- BLI_BITMAP_ENABLE(flood->visited_vertices, BKE_pbvh_vertex_to_index(ss->pbvh, to_v));
+ BLI_BITMAP_ENABLE(flood->visited_verts, BKE_pbvh_vertex_to_index(ss->pbvh, to_v));
if (func(ss, from_v, to_v, ni.is_duplicate, userdata)) {
BLI_gsqueue_push(flood->queue, &to_v);
@@ -1212,7 +1212,7 @@ void SCULPT_floodfill_execute(SculptSession *ss,
void SCULPT_floodfill_free(SculptFloodFill *flood)
{
- MEM_SAFE_FREE(flood->visited_vertices);
+ MEM_SAFE_FREE(flood->visited_verts);
BLI_gsqueue_free(flood->queue);
flood->queue = NULL;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c b/source/blender/editors/sculpt_paint/sculpt_boundary.c
index 93da767e3c5..005892b88a0 100644
--- a/source/blender/editors/sculpt_paint/sculpt_boundary.c
+++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c
@@ -128,22 +128,22 @@ static void sculpt_boundary_index_add(SculptBoundary *boundary,
const PBVHVertRef new_vertex,
const int new_index,
const float distance,
- GSet *included_vertices)
+ GSet *included_verts)
{
- boundary->vertices[boundary->num_vertices] = new_vertex;
+ boundary->verts[boundary->verts_num] = new_vertex;
if (boundary->distance) {
boundary->distance[new_index] = distance;
}
- if (included_vertices) {
- BLI_gset_add(included_vertices, POINTER_FROM_INT(new_index));
+ if (included_verts) {
+ BLI_gset_add(included_verts, POINTER_FROM_INT(new_index));
}
- boundary->num_vertices++;
- if (boundary->num_vertices >= boundary->vertices_capacity) {
- boundary->vertices_capacity += BOUNDARY_INDICES_BLOCK_SIZE;
- boundary->vertices = MEM_reallocN_id(
- boundary->vertices, boundary->vertices_capacity * sizeof(PBVHVertRef), "boundary indices");
+ boundary->verts_num++;
+ if (boundary->verts_num >= boundary->verts_capacity) {
+ boundary->verts_capacity += BOUNDARY_INDICES_BLOCK_SIZE;
+ boundary->verts = MEM_reallocN_id(
+ boundary->verts, boundary->verts_capacity * sizeof(PBVHVertRef), "boundary indices");
}
};
@@ -152,11 +152,11 @@ static void sculpt_boundary_preview_edge_add(SculptBoundary *boundary,
const PBVHVertRef v2)
{
- boundary->edges[boundary->num_edges].v1 = v1;
- boundary->edges[boundary->num_edges].v2 = v2;
- boundary->num_edges++;
+ boundary->edges[boundary->edges_num].v1 = v1;
+ boundary->edges[boundary->edges_num].v2 = v2;
+ boundary->edges_num++;
- if (boundary->num_edges >= boundary->edges_capacity) {
+ if (boundary->edges_num >= boundary->edges_capacity) {
boundary->edges_capacity += BOUNDARY_INDICES_BLOCK_SIZE;
boundary->edges = MEM_reallocN_id(boundary->edges,
boundary->edges_capacity * sizeof(SculptBoundaryPreviewEdge),
@@ -209,7 +209,7 @@ static bool sculpt_boundary_is_vertex_in_editable_boundary(SculptSession *ss,
typedef struct BoundaryFloodFillData {
SculptBoundary *boundary;
- GSet *included_vertices;
+ GSet *included_verts;
EdgeSet *preview_edges;
PBVHVertRef last_visited_vertex;
@@ -233,7 +233,7 @@ static bool boundary_floodfill_cb(
boundary->distance[from_v_i] + edge_len :
0.0f;
sculpt_boundary_index_add(
- boundary, to_v, to_v_i, distance_boundary_to_dst, data->included_vertices);
+ boundary, to_v, to_v_i, distance_boundary_to_dst, data->included_verts);
if (!is_duplicate) {
sculpt_boundary_preview_edge_add(boundary, from_v, to_v);
}
@@ -247,7 +247,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss,
{
const int totvert = SCULPT_vertex_count_get(ss);
- boundary->vertices = MEM_malloc_arrayN(
+ boundary->verts = MEM_malloc_arrayN(
BOUNDARY_INDICES_BLOCK_SIZE, sizeof(PBVHVertRef), "boundary indices");
if (init_boundary_distances) {
@@ -256,7 +256,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss,
boundary->edges = MEM_malloc_arrayN(
BOUNDARY_INDICES_BLOCK_SIZE, sizeof(SculptBoundaryPreviewEdge), "boundary edges");
- GSet *included_vertices = BLI_gset_int_new_ex("included vertices", BOUNDARY_INDICES_BLOCK_SIZE);
+ GSet *included_verts = BLI_gset_int_new_ex("included verts", BOUNDARY_INDICES_BLOCK_SIZE);
SculptFloodFill flood;
SCULPT_floodfill_init(ss, &flood);
@@ -268,12 +268,12 @@ static void sculpt_boundary_indices_init(SculptSession *ss,
copy_v3_v3(boundary->initial_vertex_position,
SCULPT_vertex_co_get(ss, boundary->initial_vertex));
sculpt_boundary_index_add(
- boundary, initial_boundary_vertex, initial_boundary_index, 0.0f, included_vertices);
+ boundary, initial_boundary_vertex, initial_boundary_index, 0.0f, included_verts);
SCULPT_floodfill_add_initial(&flood, boundary->initial_vertex);
BoundaryFloodFillData fdata = {
.boundary = boundary,
- .included_vertices = included_vertices,
+ .included_verts = included_verts,
.last_visited_vertex = {BOUNDARY_VERTEX_NONE},
};
@@ -286,7 +286,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss,
sculpt_boundary_is_vertex_in_editable_boundary(ss, fdata.last_visited_vertex)) {
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, fdata.last_visited_vertex, ni) {
- if (BLI_gset_haskey(included_vertices, POINTER_FROM_INT(ni.index)) &&
+ if (BLI_gset_haskey(included_verts, POINTER_FROM_INT(ni.index)) &&
sculpt_boundary_is_vertex_in_editable_boundary(ss, ni.vertex)) {
sculpt_boundary_preview_edge_add(boundary, fdata.last_visited_vertex, ni.vertex);
boundary->forms_loop = true;
@@ -295,7 +295,7 @@ static void sculpt_boundary_indices_init(SculptSession *ss,
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
}
- BLI_gset_free(included_vertices, NULL);
+ BLI_gset_free(included_verts, NULL);
}
/**
@@ -318,7 +318,7 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss,
for (int i = 0; i < totvert; i++) {
boundary->edit_info[i].original_vertex_i = BOUNDARY_VERTEX_NONE;
- boundary->edit_info[i].num_propagation_steps = BOUNDARY_STEPS_NONE;
+ boundary->edit_info[i].propagation_steps_num = BOUNDARY_STEPS_NONE;
}
GSQueue *current_iteration = BLI_gsqueue_new(sizeof(PBVHVertRef));
@@ -326,38 +326,38 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss,
/* Initialized the first iteration with the vertices already in the boundary. This is propagation
* step 0. */
- BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_vertices");
- for (int i = 0; i < boundary->num_vertices; i++) {
- int index = BKE_pbvh_vertex_to_index(ss->pbvh, boundary->vertices[i]);
+ BLI_bitmap *visited_verts = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_verts");
+ for (int i = 0; i < boundary->verts_num; i++) {
+ int index = BKE_pbvh_vertex_to_index(ss->pbvh, boundary->verts[i]);
boundary->edit_info[index].original_vertex_i = BKE_pbvh_vertex_to_index(ss->pbvh,
- boundary->vertices[i]);
- boundary->edit_info[index].num_propagation_steps = 0;
+ boundary->verts[i]);
+ boundary->edit_info[index].propagation_steps_num = 0;
/* This ensures that all duplicate vertices in the boundary have the same original_vertex
* index, so the deformation for them will be the same. */
if (has_duplicates) {
SculptVertexNeighborIter ni_duplis;
- SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, boundary->vertices[i], ni_duplis) {
+ SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, boundary->verts[i], ni_duplis) {
if (ni_duplis.is_duplicate) {
boundary->edit_info[ni_duplis.index].original_vertex_i = BKE_pbvh_vertex_to_index(
- ss->pbvh, boundary->vertices[i]);
+ ss->pbvh, boundary->verts[i]);
}
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni_duplis);
}
- BLI_gsqueue_push(current_iteration, &boundary->vertices[i]);
+ BLI_gsqueue_push(current_iteration, &boundary->verts[i]);
}
- int num_propagation_steps = 0;
+ int propagation_steps_num = 0;
float accum_distance = 0.0f;
while (true) {
/* Stop adding steps to edit info. This happens when a steps is further away from the boundary
* than the brush radius or when the entire mesh was already processed. */
if (accum_distance > radius || BLI_gsqueue_is_empty(current_iteration)) {
- boundary->max_propagation_steps = num_propagation_steps;
+ boundary->max_propagation_steps = propagation_steps_num;
break;
}
@@ -371,22 +371,22 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss,
SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) {
const bool is_visible = SCULPT_vertex_visible_get(ss, ni.vertex);
if (!is_visible ||
- boundary->edit_info[ni.index].num_propagation_steps != BOUNDARY_STEPS_NONE) {
+ boundary->edit_info[ni.index].propagation_steps_num != BOUNDARY_STEPS_NONE) {
continue;
}
boundary->edit_info[ni.index].original_vertex_i =
boundary->edit_info[from_v_i].original_vertex_i;
- BLI_BITMAP_ENABLE(visited_vertices, ni.index);
+ BLI_BITMAP_ENABLE(visited_verts, ni.index);
if (ni.is_duplicate) {
/* Grids duplicates handling. */
- boundary->edit_info[ni.index].num_propagation_steps =
- boundary->edit_info[from_v_i].num_propagation_steps;
+ boundary->edit_info[ni.index].propagation_steps_num =
+ boundary->edit_info[from_v_i].propagation_steps_num;
}
else {
- boundary->edit_info[ni.index].num_propagation_steps =
- boundary->edit_info[from_v_i].num_propagation_steps + 1;
+ boundary->edit_info[ni.index].propagation_steps_num =
+ boundary->edit_info[from_v_i].propagation_steps_num + 1;
BLI_gsqueue_push(next_iteration, &ni.vertex);
@@ -400,8 +400,8 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss,
if (ni_duplis.is_duplicate) {
boundary->edit_info[ni_duplis.index].original_vertex_i =
boundary->edit_info[from_v_i].original_vertex_i;
- boundary->edit_info[ni_duplis.index].num_propagation_steps =
- boundary->edit_info[from_v_i].num_propagation_steps + 1;
+ boundary->edit_info[ni_duplis.index].propagation_steps_num =
+ boundary->edit_info[from_v_i].propagation_steps_num + 1;
}
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni_duplis);
@@ -428,10 +428,10 @@ static void sculpt_boundary_edit_data_init(SculptSession *ss,
BLI_gsqueue_push(current_iteration, &next_v);
}
- num_propagation_steps++;
+ propagation_steps_num++;
}
- MEM_SAFE_FREE(visited_vertices);
+ MEM_SAFE_FREE(visited_verts);
BLI_gsqueue_free(current_iteration);
BLI_gsqueue_free(next_iteration);
@@ -449,9 +449,9 @@ static void sculpt_boundary_falloff_factor_init(SculptSession *ss,
BKE_curvemapping_init(brush->curve);
for (int i = 0; i < totvert; i++) {
- if (boundary->edit_info[i].num_propagation_steps != -1) {
+ if (boundary->edit_info[i].propagation_steps_num != -1) {
boundary->edit_info[i].strength_factor = BKE_brush_curve_strength(
- brush, boundary->edit_info[i].num_propagation_steps, boundary->max_propagation_steps);
+ brush, boundary->edit_info[i].propagation_steps_num, boundary->max_propagation_steps);
}
if (boundary->edit_info[i].original_vertex_i ==
@@ -542,7 +542,7 @@ SculptBoundary *SCULPT_boundary_data_init(Object *object,
void SCULPT_boundary_data_free(SculptBoundary *boundary)
{
- MEM_SAFE_FREE(boundary->vertices);
+ MEM_SAFE_FREE(boundary->verts);
MEM_SAFE_FREE(boundary->edges);
MEM_SAFE_FREE(boundary->distance);
MEM_SAFE_FREE(boundary->edit_info);
@@ -564,7 +564,7 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *bo
boundary->bend.pivot_positions = MEM_calloc_arrayN(totvert, sizeof(float[3]), "pivot positions");
for (int i = 0; i < totvert; i++) {
- if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) {
+ if (boundary->edit_info[i].propagation_steps_num != boundary->max_propagation_steps) {
continue;
}
@@ -586,7 +586,7 @@ static void sculpt_boundary_bend_data_init(SculptSession *ss, SculptBoundary *bo
}
for (int i = 0; i < totvert; i++) {
- if (boundary->edit_info[i].num_propagation_steps == BOUNDARY_STEPS_NONE) {
+ if (boundary->edit_info[i].propagation_steps_num == BOUNDARY_STEPS_NONE) {
continue;
}
copy_v3_v3(boundary->bend.pivot_positions[i],
@@ -602,7 +602,7 @@ static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *b
boundary->slide.directions = MEM_calloc_arrayN(totvert, sizeof(float[3]), "slide directions");
for (int i = 0; i < totvert; i++) {
- if (boundary->edit_info[i].num_propagation_steps != boundary->max_propagation_steps) {
+ if (boundary->edit_info[i].propagation_steps_num != boundary->max_propagation_steps) {
continue;
}
sub_v3_v3v3(
@@ -614,7 +614,7 @@ static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *b
}
for (int i = 0; i < totvert; i++) {
- if (boundary->edit_info[i].num_propagation_steps == BOUNDARY_STEPS_NONE) {
+ if (boundary->edit_info[i].propagation_steps_num == BOUNDARY_STEPS_NONE) {
continue;
}
copy_v3_v3(boundary->slide.directions[i],
@@ -625,15 +625,14 @@ static void sculpt_boundary_slide_data_init(SculptSession *ss, SculptBoundary *b
static void sculpt_boundary_twist_data_init(SculptSession *ss, SculptBoundary *boundary)
{
zero_v3(boundary->twist.pivot_position);
- float(*poly_verts)[3] = MEM_malloc_arrayN(
- boundary->num_vertices, sizeof(float[3]), "poly verts");
- for (int i = 0; i < boundary->num_vertices; i++) {
- add_v3_v3(boundary->twist.pivot_position, SCULPT_vertex_co_get(ss, boundary->vertices[i]));
- copy_v3_v3(poly_verts[i], SCULPT_vertex_co_get(ss, boundary->vertices[i]));
+ float(*poly_verts)[3] = MEM_malloc_arrayN(boundary->verts_num, sizeof(float[3]), "poly verts");
+ for (int i = 0; i < boundary->verts_num; i++) {
+ add_v3_v3(boundary->twist.pivot_position, SCULPT_vertex_co_get(ss, boundary->verts[i]));
+ copy_v3_v3(poly_verts[i], SCULPT_vertex_co_get(ss, boundary->verts[i]));
}
- mul_v3_fl(boundary->twist.pivot_position, 1.0f / boundary->num_vertices);
+ mul_v3_fl(boundary->twist.pivot_position, 1.0f / boundary->verts_num);
if (boundary->forms_loop) {
- normal_poly_v3(boundary->twist.rotation_axis, poly_verts, boundary->num_vertices);
+ normal_poly_v3(boundary->twist.rotation_axis, poly_verts, boundary->verts_num);
}
else {
sub_v3_v3v3(boundary->twist.rotation_axis,
@@ -684,7 +683,7 @@ static void do_boundary_brush_bend_task_cb_ex(void *__restrict userdata,
const float angle = angle_factor * M_PI;
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
- if (boundary->edit_info[vd.index].num_propagation_steps == -1) {
+ if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
@@ -732,7 +731,7 @@ static void do_boundary_brush_slide_task_cb_ex(void *__restrict userdata,
const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary);
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
- if (boundary->edit_info[vd.index].num_propagation_steps == -1) {
+ if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
@@ -778,7 +777,7 @@ static void do_boundary_brush_inflate_task_cb_ex(void *__restrict userdata,
const float disp = sculpt_boundary_displacement_from_grab_delta_get(ss, boundary);
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
- if (boundary->edit_info[vd.index].num_propagation_steps == -1) {
+ if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
@@ -822,7 +821,7 @@ static void do_boundary_brush_grab_task_cb_ex(void *__restrict userdata,
SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n], SCULPT_UNDO_COORDS);
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
- if (boundary->edit_info[vd.index].num_propagation_steps == -1) {
+ if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
@@ -873,7 +872,7 @@ static void do_boundary_brush_twist_task_cb_ex(void *__restrict userdata,
const float angle = angle_factor * M_PI;
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
- if (boundary->edit_info[vd.index].num_propagation_steps == -1) {
+ if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
@@ -919,7 +918,7 @@ static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata,
SCULPT_orig_vert_data_init(&orig_data, data->ob, data->nodes[n], SCULPT_UNDO_COORDS);
BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) {
- if (boundary->edit_info[vd.index].num_propagation_steps == -1) {
+ if (boundary->edit_info[vd.index].propagation_steps_num == -1) {
continue;
}
@@ -931,10 +930,10 @@ static void do_boundary_brush_smooth_task_cb_ex(void *__restrict userdata,
float coord_accum[3] = {0.0f, 0.0f, 0.0f};
int total_neighbors = 0;
- const int current_propagation_steps = boundary->edit_info[vd.index].num_propagation_steps;
+ const int current_propagation_steps = boundary->edit_info[vd.index].propagation_steps_num;
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.vertex, ni) {
- if (current_propagation_steps == boundary->edit_info[ni.index].num_propagation_steps) {
+ if (current_propagation_steps == boundary->edit_info[ni.index].propagation_steps_num) {
add_v3_v3(coord_accum, SCULPT_vertex_co_get(ss, ni.vertex));
total_neighbors++;
}
@@ -1053,8 +1052,8 @@ void SCULPT_boundary_edges_preview_draw(const uint gpuattr,
}
immUniformColor3fvAlpha(outline_col, outline_alpha);
GPU_line_width(2.0f);
- immBegin(GPU_PRIM_LINES, ss->boundary_preview->num_edges * 2);
- for (int i = 0; i < ss->boundary_preview->num_edges; i++) {
+ immBegin(GPU_PRIM_LINES, ss->boundary_preview->edges_num * 2);
+ for (int i = 0; i < ss->boundary_preview->edges_num; i++) {
immVertex3fv(gpuattr, SCULPT_vertex_co_get(ss, ss->boundary_preview->edges[i].v1));
immVertex3fv(gpuattr, SCULPT_vertex_co_get(ss, ss->boundary_preview->edges[i].v2));
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 7c4c47261b3..4aafeacfbff 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -351,13 +351,13 @@ static float sculpt_expand_gradient_value_get(SculptSession *ss,
static BLI_bitmap *sculpt_expand_bitmap_from_enabled(SculptSession *ss, ExpandCache *expand_cache)
{
const int totvert = SCULPT_vertex_count_get(ss);
- BLI_bitmap *enabled_vertices = BLI_BITMAP_NEW(totvert, "enabled vertices");
+ BLI_bitmap *enabled_verts = BLI_BITMAP_NEW(totvert, "enabled verts");
for (int i = 0; i < totvert; i++) {
const bool enabled = sculpt_expand_state_get(
ss, expand_cache, BKE_pbvh_index_to_vertex(ss->pbvh, i));
- BLI_BITMAP_SET(enabled_vertices, i, enabled);
+ BLI_BITMAP_SET(enabled_verts, i, enabled);
}
- return enabled_vertices;
+ return enabled_verts;
}
/**
@@ -366,13 +366,13 @@ static BLI_bitmap *sculpt_expand_bitmap_from_enabled(SculptSession *ss, ExpandCa
* vertex that is not enabled.
*/
static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss,
- const BLI_bitmap *enabled_vertices,
+ const BLI_bitmap *enabled_verts,
const bool use_mesh_boundary)
{
const int totvert = SCULPT_vertex_count_get(ss);
- BLI_bitmap *boundary_vertices = BLI_BITMAP_NEW(totvert, "boundary vertices");
+ BLI_bitmap *boundary_verts = BLI_BITMAP_NEW(totvert, "boundary verts");
for (int i = 0; i < totvert; i++) {
- if (!BLI_BITMAP_TEST(enabled_vertices, i)) {
+ if (!BLI_BITMAP_TEST(enabled_verts, i)) {
continue;
}
@@ -381,7 +381,7 @@ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss,
bool is_expand_boundary = false;
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) {
- if (!BLI_BITMAP_TEST(enabled_vertices, ni.index)) {
+ if (!BLI_BITMAP_TEST(enabled_verts, ni.index)) {
is_expand_boundary = true;
}
}
@@ -391,10 +391,10 @@ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss,
is_expand_boundary = true;
}
- BLI_BITMAP_SET(boundary_vertices, i, is_expand_boundary);
+ BLI_BITMAP_SET(boundary_verts, i, is_expand_boundary);
}
- return boundary_vertices;
+ return boundary_verts;
}
/* Functions implementing different algorithms for initializing falloff values. */
@@ -596,7 +596,7 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P
SculptSession *ss = ob->sculpt;
const int totvert = SCULPT_vertex_count_get(ss);
float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "spherical dist");
- BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices");
+ BLI_bitmap *visited_verts = BLI_BITMAP_NEW(totvert, "visited verts");
GSQueue *queue = BLI_gsqueue_new(sizeof(PBVHVertRef));
/* Search and initialize a boundary per symmetry pass, then mark those vertices as visited. */
@@ -614,9 +614,9 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P
continue;
}
- for (int i = 0; i < boundary->num_vertices; i++) {
- BLI_gsqueue_push(queue, &boundary->vertices[i]);
- BLI_BITMAP_ENABLE(visited_vertices, boundary->vertices_i[i]);
+ for (int i = 0; i < boundary->verts_num; i++) {
+ BLI_gsqueue_push(queue, &boundary->verts[i]);
+ BLI_BITMAP_ENABLE(visited_verts, boundary->verts_i[i]);
}
SCULPT_boundary_data_free(boundary);
}
@@ -635,18 +635,18 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, v_next, ni) {
- if (BLI_BITMAP_TEST(visited_vertices, ni.index)) {
+ if (BLI_BITMAP_TEST(visited_verts, ni.index)) {
continue;
}
dists[ni.index] = dists[v_next_i] + 1.0f;
- BLI_BITMAP_ENABLE(visited_vertices, ni.index);
+ BLI_BITMAP_ENABLE(visited_verts, ni.index);
BLI_gsqueue_push(queue, &ni.vertex);
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
}
BLI_gsqueue_free(queue);
- MEM_freeN(visited_vertices);
+ MEM_freeN(visited_verts);
return dists;
}
@@ -669,7 +669,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR
}
/* Search and mask as visited the initial vertices using the enabled symmetry passes. */
- BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices");
+ BLI_bitmap *visited_verts = BLI_BITMAP_NEW(totvert, "visited verts");
GSQueue *queue = BLI_gsqueue_new(sizeof(PBVHVertRef));
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
for (char symm_it = 0; symm_it <= symm; symm_it++) {
@@ -682,7 +682,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR
int symm_vertex_i = BKE_pbvh_vertex_to_index(ss->pbvh, symm_vertex);
BLI_gsqueue_push(queue, &symm_vertex);
- BLI_BITMAP_ENABLE(visited_vertices, symm_vertex_i);
+ BLI_BITMAP_ENABLE(visited_verts, symm_vertex_i);
}
if (BLI_gsqueue_is_empty(queue)) {
@@ -700,18 +700,18 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR
const MPoly *p = &ss->mpoly[ss->pmap[v_next_i].indices[j]];
for (int l = 0; l < p->totloop; l++) {
const PBVHVertRef neighbor_v = BKE_pbvh_make_vref(ss->mloop[p->loopstart + l].v);
- if (BLI_BITMAP_TEST(visited_vertices, neighbor_v.i)) {
+ if (BLI_BITMAP_TEST(visited_verts, neighbor_v.i)) {
continue;
}
dists[neighbor_v.i] = dists[v_next_i] + 1.0f;
- BLI_BITMAP_ENABLE(visited_vertices, neighbor_v.i);
+ BLI_BITMAP_ENABLE(visited_verts, neighbor_v.i);
BLI_gsqueue_push(queue, &neighbor_v);
}
}
}
BLI_gsqueue_free(queue);
- MEM_freeN(visited_vertices);
+ MEM_freeN(visited_verts);
return dists;
}
@@ -842,27 +842,27 @@ static void sculpt_expand_mesh_face_falloff_from_vertex_falloff(SculptSession *s
*/
static void sculpt_expand_geodesics_from_state_boundary(Object *ob,
ExpandCache *expand_cache,
- BLI_bitmap *enabled_vertices)
+ BLI_bitmap *enabled_verts)
{
SculptSession *ss = ob->sculpt;
BLI_assert(BKE_pbvh_type(ss->pbvh) == PBVH_FACES);
- GSet *initial_vertices = BLI_gset_int_new("initial_vertices");
- BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(ss, enabled_vertices, false);
+ GSet *initial_verts = BLI_gset_int_new("initial_verts");
+ BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(ss, enabled_verts, false);
const int totvert = SCULPT_vertex_count_get(ss);
for (int i = 0; i < totvert; i++) {
- if (!BLI_BITMAP_TEST(boundary_vertices, i)) {
+ if (!BLI_BITMAP_TEST(boundary_verts, i)) {
continue;
}
- BLI_gset_add(initial_vertices, POINTER_FROM_INT(i));
+ BLI_gset_add(initial_verts, POINTER_FROM_INT(i));
}
- MEM_freeN(boundary_vertices);
+ MEM_freeN(boundary_verts);
MEM_SAFE_FREE(expand_cache->vert_falloff);
MEM_SAFE_FREE(expand_cache->face_falloff);
- expand_cache->vert_falloff = SCULPT_geodesic_distances_create(ob, initial_vertices, FLT_MAX);
- BLI_gset_free(initial_vertices, NULL);
+ expand_cache->vert_falloff = SCULPT_geodesic_distances_create(ob, initial_verts, FLT_MAX);
+ BLI_gset_free(initial_verts, NULL);
}
/**
@@ -871,7 +871,7 @@ static void sculpt_expand_geodesics_from_state_boundary(Object *ob,
*/
static void sculpt_expand_topology_from_state_boundary(Object *ob,
ExpandCache *expand_cache,
- BLI_bitmap *enabled_vertices)
+ BLI_bitmap *enabled_verts)
{
MEM_SAFE_FREE(expand_cache->vert_falloff);
MEM_SAFE_FREE(expand_cache->face_falloff);
@@ -880,19 +880,19 @@ static void sculpt_expand_topology_from_state_boundary(Object *ob,
const int totvert = SCULPT_vertex_count_get(ss);
float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "topology dist");
- BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(ss, enabled_vertices, false);
+ BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(ss, enabled_verts, false);
SculptFloodFill flood;
SCULPT_floodfill_init(ss, &flood);
for (int i = 0; i < totvert; i++) {
- if (!BLI_BITMAP_TEST(boundary_vertices, i)) {
+ if (!BLI_BITMAP_TEST(boundary_verts, i)) {
continue;
}
PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i);
SCULPT_floodfill_add_and_skip_initial(&flood, vertex);
}
- MEM_freeN(boundary_vertices);
+ MEM_freeN(boundary_verts);
ExpandFloodFillData fdata;
fdata.dists = dists;
@@ -914,7 +914,7 @@ static void sculpt_expand_resursion_step_add(Object *ob,
return;
}
- BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
+ BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
/* Each time a new recursion step is created, reset the distortion strength. This is the expected
* result from the recursion, as otherwise the new falloff will render with undesired distortion
@@ -923,10 +923,10 @@ static void sculpt_expand_resursion_step_add(Object *ob,
switch (recursion_type) {
case SCULPT_EXPAND_RECURSION_GEODESICS:
- sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_verts);
break;
case SCULPT_EXPAND_RECURSION_TOPOLOGY:
- sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_verts);
break;
}
@@ -936,7 +936,7 @@ static void sculpt_expand_resursion_step_add(Object *ob,
sculpt_expand_update_max_face_falloff_factor(ss, expand_cache);
}
- MEM_freeN(enabled_vertices);
+ MEM_freeN(enabled_verts);
}
/* Face Set Boundary falloff. */
@@ -953,7 +953,7 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob,
SculptSession *ss = ob->sculpt;
const int totvert = SCULPT_vertex_count_get(ss);
- BLI_bitmap *enabled_vertices = BLI_BITMAP_NEW(totvert, "enabled vertices");
+ BLI_bitmap *enabled_verts = BLI_BITMAP_NEW(totvert, "enabled verts");
for (int i = 0; i < totvert; i++) {
PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i);
@@ -963,17 +963,17 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob,
if (!SCULPT_vertex_has_face_set(ss, vertex, active_face_set)) {
continue;
}
- BLI_BITMAP_ENABLE(enabled_vertices, i);
+ BLI_BITMAP_ENABLE(enabled_verts, i);
}
if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
- sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_verts);
}
else {
- sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_verts);
}
- MEM_freeN(enabled_vertices);
+ MEM_freeN(enabled_verts);
if (internal_falloff) {
for (int i = 0; i < totvert; i++) {
@@ -1086,7 +1086,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
expand_cache->snap = false;
expand_cache->invert = false;
- BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
+ BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
const int totface = ss->totfaces;
for (int i = 0; i < totface; i++) {
@@ -1099,7 +1099,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
bool any_disabled = false;
for (int l = 0; l < poly->totloop; l++) {
const MLoop *loop = &ss->mloop[l + poly->loopstart];
- if (!BLI_BITMAP_TEST(enabled_vertices, loop->v)) {
+ if (!BLI_BITMAP_TEST(enabled_verts, loop->v)) {
any_disabled = true;
break;
}
@@ -1110,7 +1110,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
}
}
- MEM_freeN(enabled_vertices);
+ MEM_freeN(enabled_verts);
expand_cache->snap = prev_snap_state;
expand_cache->invert = prev_invert_state;
}
@@ -1514,7 +1514,7 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
const bool initial_invert_state = expand_cache->invert;
expand_cache->invert = false;
- BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
+ BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
/* For boundary topology, position the pivot using only the boundary of the enabled vertices,
* without taking mesh boundary into account. This allows to create deformations like bending the
@@ -1522,8 +1522,8 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
const float use_mesh_boundary = expand_cache->falloff_type !=
SCULPT_EXPAND_FALLOFF_BOUNDARY_TOPOLOGY;
- BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(
- ss, enabled_vertices, use_mesh_boundary);
+ BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(
+ ss, enabled_verts, use_mesh_boundary);
/* Ignore invert state, as this is the expected behavior in most cases and mask are created in
* inverted state by default. */
@@ -1537,7 +1537,7 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
for (int i = 0; i < totvert; i++) {
PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i);
- if (!BLI_BITMAP_TEST(boundary_vertices, i)) {
+ if (!BLI_BITMAP_TEST(boundary_verts, i)) {
continue;
}
@@ -1555,8 +1555,8 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
total++;
}
- MEM_freeN(enabled_vertices);
- MEM_freeN(boundary_vertices);
+ MEM_freeN(enabled_verts);
+ MEM_freeN(boundary_verts);
if (total > 0) {
mul_v3_v3fl(ss->pivot_pos, avg, 1.0f / total);
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index b89944628da..64bc6188bbc 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -746,7 +746,7 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op)
SCULPT_undo_push_end(ob);
/* Sync face sets visibility and vertex visibility as now all Face Sets are visible. */
- SCULPT_visibility_sync_all_face_sets_to_vertices(ob);
+ SCULPT_visibility_sync_all_face_sets_to_verts(ob);
for (int i = 0; i < totnode; i++) {
BKE_pbvh_node_mark_update_visibility(nodes[i]);
@@ -933,7 +933,7 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op)
}
/* Sync face sets visibility and vertex visibility. */
- SCULPT_visibility_sync_all_face_sets_to_vertices(ob);
+ SCULPT_visibility_sync_all_face_sets_to_verts(ob);
SCULPT_undo_push_end(ob);
@@ -1233,21 +1233,21 @@ static void sculpt_face_set_edit_fair_face_set(Object *ob,
const int totvert = SCULPT_vertex_count_get(ss);
Mesh *mesh = ob->data;
- bool *fair_vertices = MEM_malloc_arrayN(totvert, sizeof(bool), "fair vertices");
+ bool *fair_verts = MEM_malloc_arrayN(totvert, sizeof(bool), "fair vertices");
SCULPT_boundary_info_ensure(ob);
for (int i = 0; i < totvert; i++) {
PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i);
- fair_vertices[i] = !SCULPT_vertex_is_boundary(ss, vertex) &&
- SCULPT_vertex_has_face_set(ss, vertex, active_face_set_id) &&
- SCULPT_vertex_has_unique_face_set(ss, vertex);
+ fair_verts[i] = !SCULPT_vertex_is_boundary(ss, vertex) &&
+ SCULPT_vertex_has_face_set(ss, vertex, active_face_set_id) &&
+ SCULPT_vertex_has_unique_face_set(ss, vertex);
}
MVert *mvert = SCULPT_mesh_deformed_mverts_get(ss);
- BKE_mesh_prefair_and_fair_vertices(mesh, mvert, fair_vertices, fair_order);
- MEM_freeN(fair_vertices);
+ BKE_mesh_prefair_and_fair_verts(mesh, mvert, fair_verts, fair_order);
+ MEM_freeN(fair_verts);
}
static void sculpt_face_set_apply_edit(Object *ob,
@@ -1339,7 +1339,7 @@ static void face_set_edit_do_post_visibility_updates(Object *ob, PBVHNode **node
PBVH *pbvh = ss->pbvh;
/* Sync face sets visibility and vertex visibility as now all Face Sets are visible. */
- SCULPT_visibility_sync_all_face_sets_to_vertices(ob);
+ SCULPT_visibility_sync_all_face_sets_to_verts(ob);
for (int i = 0; i < totnode; i++) {
BKE_pbvh_node_mark_update_visibility(nodes[i]);
diff --git a/source/blender/editors/sculpt_paint/sculpt_geodesic.c b/source/blender/editors/sculpt_paint/sculpt_geodesic.c
index c07c6126405..a5885092ee3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_geodesic.c
+++ b/source/blender/editors/sculpt_paint/sculpt_geodesic.c
@@ -61,9 +61,9 @@
/* Propagate distance from v1 and v2 to v0. */
static bool sculpt_geodesic_mesh_test_dist_add(
- MVert *mvert, const int v0, const int v1, const int v2, float *dists, GSet *initial_vertices)
+ MVert *mvert, const int v0, const int v1, const int v2, float *dists, GSet *initial_verts)
{
- if (BLI_gset_haskey(initial_vertices, POINTER_FROM_INT(v0))) {
+ if (BLI_gset_haskey(initial_verts, POINTER_FROM_INT(v0))) {
return false;
}
@@ -96,7 +96,7 @@ static bool sculpt_geodesic_mesh_test_dist_add(
}
static float *SCULPT_geodesic_mesh_create(Object *ob,
- GSet *initial_vertices,
+ GSet *initial_verts,
const float limit_radius)
{
SculptSession *ss = ob->sculpt;
@@ -137,7 +137,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob,
BLI_LINKSTACK_INIT(queue_next);
for (int i = 0; i < totvert; i++) {
- if (BLI_gset_haskey(initial_vertices, POINTER_FROM_INT(i))) {
+ if (BLI_gset_haskey(initial_verts, POINTER_FROM_INT(i))) {
dists[i] = 0.0f;
}
else {
@@ -159,7 +159,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob,
/* This is an O(n^2) loop used to limit the geodesic distance calculation to a radius. When
* this optimization is needed, it is expected for the tool to request the distance to a low
* number of vertices (usually just 1 or 2). */
- GSET_ITER (gs_iter, initial_vertices) {
+ GSET_ITER (gs_iter, initial_verts) {
const int v = POINTER_AS_INT(BLI_gsetIterator_getKey(&gs_iter));
float *v_co = verts[v].co;
for (int i = 0; i < totvert; i++) {
@@ -193,7 +193,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob,
SWAP(int, v1, v2);
}
sculpt_geodesic_mesh_test_dist_add(
- verts, v2, v1, SCULPT_GEODESIC_VERTEX_NONE, dists, initial_vertices);
+ verts, v2, v1, SCULPT_GEODESIC_VERTEX_NONE, dists, initial_verts);
}
if (ss->epmap[e].count != 0) {
@@ -210,8 +210,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob,
if (ELEM(v_other, v1, v2)) {
continue;
}
- if (sculpt_geodesic_mesh_test_dist_add(
- verts, v_other, v1, v2, dists, initial_vertices)) {
+ if (sculpt_geodesic_mesh_test_dist_add(verts, v_other, v1, v2, dists, initial_verts)) {
for (int edge_map_index = 0; edge_map_index < ss->vemap[v_other].count;
edge_map_index++) {
const int e_other = ss->vemap[v_other].indices[edge_map_index];
@@ -258,7 +257,7 @@ static float *SCULPT_geodesic_mesh_create(Object *ob,
/* For sculpt mesh data that does not support a geodesic distances algorithm, fallback to the
* distance to each vertex. In this case, only one of the initial vertices will be used to
* calculate the distance. */
-static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_vertices)
+static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_verts)
{
SculptSession *ss = ob->sculpt;
@@ -267,7 +266,7 @@ static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_vertices
float *dists = MEM_malloc_arrayN(totvert, sizeof(float), "distances");
int first_affected = SCULPT_GEODESIC_VERTEX_NONE;
GSetIterator gs_iter;
- GSET_ITER (gs_iter, initial_vertices) {
+ GSET_ITER (gs_iter, initial_verts) {
first_affected = POINTER_AS_INT(BLI_gsetIterator_getKey(&gs_iter));
break;
}
@@ -290,17 +289,15 @@ static float *SCULPT_geodesic_fallback_create(Object *ob, GSet *initial_vertices
return dists;
}
-float *SCULPT_geodesic_distances_create(Object *ob,
- GSet *initial_vertices,
- const float limit_radius)
+float *SCULPT_geodesic_distances_create(Object *ob, GSet *initial_verts, const float limit_radius)
{
SculptSession *ss = ob->sculpt;
switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_FACES:
- return SCULPT_geodesic_mesh_create(ob, initial_vertices, limit_radius);
+ return SCULPT_geodesic_mesh_create(ob, initial_verts, limit_radius);
case PBVH_BMESH:
case PBVH_GRIDS:
- return SCULPT_geodesic_fallback_create(ob, initial_vertices);
+ return SCULPT_geodesic_fallback_create(ob, initial_verts);
}
BLI_assert(false);
return NULL;
@@ -312,7 +309,7 @@ float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd,
const float limit_radius)
{
SculptSession *ss = ob->sculpt;
- GSet *initial_vertices = BLI_gset_int_new("initial_vertices");
+ GSet *initial_verts = BLI_gset_int_new("initial_verts");
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
for (char i = 0; i <= symm; ++i) {
@@ -328,22 +325,22 @@ float *SCULPT_geodesic_from_vertex_and_symm(Sculpt *sd,
v = SCULPT_nearest_vertex_get(sd, ob, location, FLT_MAX, false);
}
if (v.i != PBVH_REF_NONE) {
- BLI_gset_add(initial_vertices, POINTER_FROM_INT(BKE_pbvh_vertex_to_index(ss->pbvh, v)));
+ BLI_gset_add(initial_verts, POINTER_FROM_INT(BKE_pbvh_vertex_to_index(ss->pbvh, v)));
}
}
}
- float *dists = SCULPT_geodesic_distances_create(ob, initial_vertices, limit_radius);
- BLI_gset_free(initial_vertices, NULL);
+ float *dists = SCULPT_geodesic_distances_create(ob, initial_verts, limit_radius);
+ BLI_gset_free(initial_verts, NULL);
return dists;
}
float *SCULPT_geodesic_from_vertex(Object *ob, const PBVHVertRef vertex, const float limit_radius)
{
- GSet *initial_vertices = BLI_gset_int_new("initial_vertices");
- BLI_gset_add(initial_vertices,
+ GSet *initial_verts = BLI_gset_int_new("initial_verts");
+ BLI_gset_add(initial_verts,
POINTER_FROM_INT(BKE_pbvh_vertex_to_index(ob->sculpt->pbvh, vertex)));
- float *dists = SCULPT_geodesic_distances_create(ob, initial_vertices, limit_radius);
- BLI_gset_free(initial_vertices, NULL);
+ float *dists = SCULPT_geodesic_distances_create(ob, initial_verts, limit_radius);
+ BLI_gset_free(initial_verts, NULL);
return dists;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index e4bba135518..4bc06d68a02 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -97,7 +97,7 @@ typedef struct {
/* Flood Fill. */
typedef struct {
GSQueue *queue;
- BLI_bitmap *visited_vertices;
+ BLI_bitmap *visited_verts;
} SculptFloodFill;
typedef enum eBoundaryAutomaskMode {
@@ -1005,7 +1005,7 @@ void SCULPT_connected_components_ensure(Object *ob);
void SCULPT_vertex_visible_set(SculptSession *ss, PBVHVertRef vertex, bool visible);
bool SCULPT_vertex_visible_get(SculptSession *ss, PBVHVertRef vertex);
-void SCULPT_visibility_sync_all_face_sets_to_vertices(struct Object *ob);
+void SCULPT_visibility_sync_all_face_sets_to_verts(struct Object *ob);
void SCULPT_visibility_sync_all_vertex_to_face_sets(struct SculptSession *ss);
/** \} */
diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c
index 97c1f331498..10a2ece73de 100644
--- a/source/blender/editors/sculpt_paint/sculpt_ops.c
+++ b/source/blender/editors/sculpt_paint/sculpt_ops.c
@@ -571,49 +571,48 @@ void SCULPT_geometry_preview_lines_update(bContext *C, SculptSession *ss, float
float brush_co[3];
copy_v3_v3(brush_co, SCULPT_active_vertex_co_get(ss));
- BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_vertices");
+ BLI_bitmap *visited_verts = BLI_BITMAP_NEW(SCULPT_vertex_count_get(ss), "visited_verts");
/* Assuming an average of 6 edges per vertex in a triangulated mesh. */
- const int max_preview_vertices = SCULPT_vertex_count_get(ss) * 3 * 2;
+ const int max_preview_verts = SCULPT_vertex_count_get(ss) * 3 * 2;
if (ss->preview_vert_list == NULL) {
- ss->preview_vert_list = MEM_callocN(max_preview_vertices * sizeof(PBVHVertRef),
- "preview lines");
+ ss->preview_vert_list = MEM_callocN(max_preview_verts * sizeof(PBVHVertRef), "preview lines");
}
- GSQueue *not_visited_vertices = BLI_gsqueue_new(sizeof(PBVHVertRef));
+ GSQueue *non_visited_verts = BLI_gsqueue_new(sizeof(PBVHVertRef));
PBVHVertRef active_v = SCULPT_active_vertex_get(ss);
- BLI_gsqueue_push(not_visited_vertices, &active_v);
+ BLI_gsqueue_push(non_visited_verts, &active_v);
- while (!BLI_gsqueue_is_empty(not_visited_vertices)) {
+ while (!BLI_gsqueue_is_empty(non_visited_verts)) {
PBVHVertRef from_v;
- BLI_gsqueue_pop(not_visited_vertices, &from_v);
+ BLI_gsqueue_pop(non_visited_verts, &from_v);
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) {
- if (totpoints + (ni.size * 2) < max_preview_vertices) {
+ if (totpoints + (ni.size * 2) < max_preview_verts) {
PBVHVertRef to_v = ni.vertex;
int to_v_i = ni.index;
ss->preview_vert_list[totpoints] = from_v;
totpoints++;
ss->preview_vert_list[totpoints] = to_v;
totpoints++;
- if (BLI_BITMAP_TEST(visited_vertices, to_v_i)) {
+ if (BLI_BITMAP_TEST(visited_verts, to_v_i)) {
continue;
}
- BLI_BITMAP_ENABLE(visited_vertices, to_v_i);
+ BLI_BITMAP_ENABLE(visited_verts, to_v_i);
const float *co = SCULPT_vertex_co_for_grab_active_get(ss, to_v);
if (len_squared_v3v3(brush_co, co) < radius * radius) {
- BLI_gsqueue_push(not_visited_vertices, &to_v);
+ BLI_gsqueue_push(non_visited_verts, &to_v);
}
}
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
}
- BLI_gsqueue_free(not_visited_vertices);
+ BLI_gsqueue_free(non_visited_verts);
- MEM_freeN(visited_vertices);
+ MEM_freeN(visited_verts);
ss->preview_vert_count = totpoints;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 2fc49a24cc4..a31be07d8af 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -168,9 +168,9 @@ struct PartialUpdateData {
PBVH *pbvh;
bool rebuild;
char *modified_grids;
- bool *modified_hidden_vertices;
- bool *modified_mask_vertices;
- bool *modified_color_vertices;
+ bool *modified_hidden_verts;
+ bool *modified_mask_verts;
+ bool *modified_color_verts;
};
/**
@@ -201,25 +201,25 @@ static void update_cb_partial(PBVHNode *node, void *userdata)
const int *vert_indices;
BKE_pbvh_node_num_verts(data->pbvh, node, NULL, &verts_num);
BKE_pbvh_node_get_verts(data->pbvh, node, &vert_indices, NULL);
- if (data->modified_mask_vertices != NULL) {
+ if (data->modified_mask_verts != NULL) {
for (int i = 0; i < verts_num; i++) {
- if (data->modified_mask_vertices[vert_indices[i]]) {
+ if (data->modified_mask_verts[vert_indices[i]]) {
BKE_pbvh_node_mark_update_mask(node);
break;
}
}
}
- if (data->modified_color_vertices != NULL) {
+ if (data->modified_color_verts != NULL) {
for (int i = 0; i < verts_num; i++) {
- if (data->modified_color_vertices[vert_indices[i]]) {
+ if (data->modified_color_verts[vert_indices[i]]) {
BKE_pbvh_node_mark_update_color(node);
break;
}
}
}
- if (data->modified_hidden_vertices != NULL) {
+ if (data->modified_hidden_verts != NULL) {
for (int i = 0; i < verts_num; i++) {
- if (data->modified_hidden_vertices[vert_indices[i]]) {
+ if (data->modified_hidden_verts[vert_indices[i]]) {
if (data->rebuild) {
BKE_pbvh_node_mark_update_visibility(node);
}
@@ -755,7 +755,7 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
BKE_sculpt_update_object_for_edit(depsgraph, ob, true, need_mask, false);
- SCULPT_visibility_sync_all_face_sets_to_vertices(ob);
+ SCULPT_visibility_sync_all_face_sets_to_verts(ob);
BKE_pbvh_update_vertex_data(ss->pbvh, PBVH_UpdateVisibility);
@@ -790,9 +790,9 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
/* The PBVH already keeps track of which vertices need updated normals, but it doesn't keep track
* of other updated. In order to tell the corresponding PBVH nodes to update, keep track of which
* elements were updated for specific layers. */
- bool *modified_hidden_vertices = NULL;
- bool *modified_mask_vertices = NULL;
- bool *modified_color_vertices = NULL;
+ bool *modified_hidden_verts = NULL;
+ bool *modified_mask_verts = NULL;
+ bool *modified_color_verts = NULL;
char *undo_modified_grids = NULL;
bool use_multires_undo = false;
@@ -825,19 +825,19 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
}
break;
case SCULPT_UNDO_HIDDEN:
- if (modified_hidden_vertices == NULL) {
- modified_hidden_vertices = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__);
+ if (modified_hidden_verts == NULL) {
+ modified_hidden_verts = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__);
}
- if (sculpt_undo_restore_hidden(C, unode, modified_hidden_vertices)) {
+ if (sculpt_undo_restore_hidden(C, unode, modified_hidden_verts)) {
rebuild = true;
update_visibility = true;
}
break;
case SCULPT_UNDO_MASK:
- if (modified_mask_vertices == NULL) {
- modified_mask_vertices = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__);
+ if (modified_mask_verts == NULL) {
+ modified_mask_verts = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__);
}
- if (sculpt_undo_restore_mask(C, unode, modified_mask_vertices)) {
+ if (sculpt_undo_restore_mask(C, unode, modified_mask_verts)) {
update = true;
update_mask = true;
}
@@ -845,10 +845,10 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
case SCULPT_UNDO_FACE_SETS:
break;
case SCULPT_UNDO_COLOR:
- if (modified_color_vertices == NULL) {
- modified_color_vertices = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__);
+ if (modified_color_verts == NULL) {
+ modified_color_verts = MEM_calloc_arrayN(ss->totvert, sizeof(bool), __func__);
}
- if (sculpt_undo_restore_color(C, unode, modified_color_vertices)) {
+ if (sculpt_undo_restore_color(C, unode, modified_color_verts)) {
update = true;
}
@@ -899,9 +899,9 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
.rebuild = rebuild,
.pbvh = ss->pbvh,
.modified_grids = undo_modified_grids,
- .modified_hidden_vertices = modified_hidden_vertices,
- .modified_mask_vertices = modified_mask_vertices,
- .modified_color_vertices = modified_color_vertices,
+ .modified_hidden_verts = modified_hidden_verts,
+ .modified_mask_verts = modified_mask_verts,
+ .modified_color_verts = modified_color_verts,
};
BKE_pbvh_search_callback(ss->pbvh, NULL, NULL, update_cb_partial, &data);
BKE_pbvh_update_bounds(ss->pbvh, PBVH_UpdateBB | PBVH_UpdateOriginalBB | PBVH_UpdateRedraw);
@@ -947,9 +947,9 @@ static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase
}
}
- MEM_SAFE_FREE(modified_hidden_vertices);
- MEM_SAFE_FREE(modified_mask_vertices);
- MEM_SAFE_FREE(modified_color_vertices);
+ MEM_SAFE_FREE(modified_hidden_verts);
+ MEM_SAFE_FREE(modified_mask_verts);
+ MEM_SAFE_FREE(modified_color_verts);
MEM_SAFE_FREE(undo_modified_grids);
}
diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc
index 0f872d0a02e..a796ed5a817 100644
--- a/source/blender/editors/space_info/info_stats.cc
+++ b/source/blender/editors/space_info/info_stats.cc
@@ -345,7 +345,7 @@ static void stats_object_sculpt(const Object *ob, SceneStats *stats)
stats->tottri = ob->sculpt->bm->totface;
break;
case PBVH_GRIDS:
- stats->totvertsculpt = BKE_pbvh_get_grid_num_vertices(ss->pbvh);
+ stats->totvertsculpt = BKE_pbvh_get_grid_num_verts(ss->pbvh);
stats->totfacesculpt = BKE_pbvh_get_grid_num_faces(ss->pbvh);
break;
}
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 61782186402..3290c0ddd87 100644
--- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
+++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc
@@ -276,7 +276,7 @@ IndexMask GeometryDataSource::apply_selection_filter(Vector<int64_t> &indices) c
BLI_assert(object_eval_->mode == OB_MODE_EDIT);
Object *object_orig = DEG_get_original_object(object_eval_);
const Mesh *mesh_eval = geometry_set_.get_mesh_for_read();
- const bke::AttributeAccessor attributes_eval = bke::mesh_attributes(*mesh_eval);
+ const bke::AttributeAccessor attributes_eval = mesh_eval->attributes();
Mesh *mesh_orig = (Mesh *)object_orig->data;
BMesh *bm = mesh_orig->edit_mesh->bm;
BM_mesh_elem_table_ensure(bm, BM_VERT);
diff --git a/source/blender/editors/space_view3d/view3d_select.cc b/source/blender/editors/space_view3d/view3d_select.cc
index 2424ea5b5d7..ad816f420fe 100644
--- a/source/blender/editors/space_view3d/view3d_select.cc
+++ b/source/blender/editors/space_view3d/view3d_select.cc
@@ -364,22 +364,22 @@ static bool edbm_backbuf_check_and_select_faces_obmode(Mesh *me,
EditSelectBuf_Cache *esel,
const eSelectOp sel_op)
{
- MPoly *polygons = BKE_mesh_polys_for_write(me);
+ MPoly *polys = BKE_mesh_polys_for_write(me);
bool changed = false;
const BLI_bitmap *select_bitmap = esel->select_bitmap;
- if (polygons) {
+ if (polys) {
const bool *hide_poly = (const bool *)CustomData_get_layer_named(
&me->vdata, CD_PROP_BOOL, ".hide_poly");
for (int index = 0; index < me->totpoly; index++) {
if (!(hide_poly && hide_poly[index])) {
- const bool is_select = polygons[index].flag & ME_FACE_SEL;
+ const bool is_select = polys[index].flag & ME_FACE_SEL;
const bool is_inside = BLI_BITMAP_TEST_BOOL(select_bitmap, index);
const int sel_op_result = ED_select_op_action_deselected(sel_op, is_select, is_inside);
if (sel_op_result != -1) {
- SET_FLAG_FROM_TEST(polygons[index].flag, sel_op_result, ME_FACE_SEL);
+ SET_FLAG_FROM_TEST(polys[index].flag, sel_op_result, ME_FACE_SEL);
changed = true;
}
}
@@ -3434,7 +3434,8 @@ static bool do_mesh_box_select(ViewContext *vc,
}
if (ts->selectmode & SCE_SELECT_EDGE) {
/* Does both use_zbuf and non-use_zbuf versions (need screen cos for both) */
- struct BoxSelectUserData_ForMeshEdge cb_data {};
+ struct BoxSelectUserData_ForMeshEdge cb_data {
+ };
cb_data.data = &data;
cb_data.esel = use_zbuf ? esel : nullptr;
cb_data.backbuf_offset = use_zbuf ? DRW_select_buffer_context_offset_for_object_elem(
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 640e89a3966..a9e6adc6e60 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -82,7 +82,6 @@ set(SRC
../include/ED_transform.h
../include/ED_transform_snap_object_context.h
../include/ED_transverts.h
- ../include/ED_types.h
../include/ED_undo.h
../include/ED_userpref.h
../include/ED_util.h
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index b01c04471ae..c4a633e920e 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -505,9 +505,8 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
FrsMaterial tmpMat;
- const blender::VArray<int> material_indices =
- blender::bke::mesh_attributes(*me).lookup_or_default<int>(
- "material_index", ATTR_DOMAIN_FACE, 0);
+ const blender::VArray<int> material_indices = me->attributes().lookup_or_default<int>(
+ "material_index", ATTR_DOMAIN_FACE, 0);
// We parse the vlak nodes again and import meshes while applying the clipping
// by the near and far view planes.
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index 0b035a08433..d2fc5a698bc 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -576,7 +576,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
mesh->totloop = group->totloop;
mesh->totcol = group->materials.size();
- MVert *vertices = (MVert *)CustomData_add_layer(
+ MVert *verts = (MVert *)CustomData_add_layer(
&mesh->vdata, CD_MVERT, CD_SET_DEFAULT, nullptr, mesh->totvert);
MEdge *edges = (MEdge *)CustomData_add_layer(
&mesh->edata, CD_MEDGE, CD_SET_DEFAULT, nullptr, mesh->totedge);
@@ -663,19 +663,19 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
else {
if (!visible) {
// first vertex
- vertices->co[0] = svRep[0]->point2d()[0];
- vertices->co[1] = svRep[0]->point2d()[1];
- vertices->co[2] = get_stroke_vertex_z();
+ verts->co[0] = svRep[0]->point2d()[0];
+ verts->co[1] = svRep[0]->point2d()[1];
+ verts->co[2] = get_stroke_vertex_z();
- ++vertices;
+ ++verts;
++vertex_index;
// second vertex
- vertices->co[0] = svRep[1]->point2d()[0];
- vertices->co[1] = svRep[1]->point2d()[1];
- vertices->co[2] = get_stroke_vertex_z();
+ verts->co[0] = svRep[1]->point2d()[0];
+ verts->co[1] = svRep[1]->point2d()[1];
+ verts->co[2] = get_stroke_vertex_z();
- ++vertices;
+ ++verts;
++vertex_index;
// first edge
@@ -687,10 +687,10 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
visible = true;
// vertex
- vertices->co[0] = svRep[2]->point2d()[0];
- vertices->co[1] = svRep[2]->point2d()[1];
- vertices->co[2] = get_stroke_vertex_z();
- ++vertices;
+ verts->co[0] = svRep[2]->point2d()[0];
+ verts->co[1] = svRep[2]->point2d()[1];
+ verts->co[2] = get_stroke_vertex_z();
+ ++verts;
++vertex_index;
// edges
diff --git a/source/blender/geometry/intern/mesh_primitive_cuboid.cc b/source/blender/geometry/intern/mesh_primitive_cuboid.cc
index 528a9e72e9e..39571f2931e 100644
--- a/source/blender/geometry/intern/mesh_primitive_cuboid.cc
+++ b/source/blender/geometry/intern/mesh_primitive_cuboid.cc
@@ -54,7 +54,7 @@ struct CuboidConfig {
}
};
-static void calculate_vertices(const CuboidConfig &config, MutableSpan<MVert> verts)
+static void calculate_verts(const CuboidConfig &config, MutableSpan<MVert> verts)
{
const float z_bottom = -config.size.z / 2.0f;
const float z_delta = config.size.z / config.edges_z;
@@ -321,7 +321,7 @@ static void calculate_polys(const CuboidConfig &config,
static void calculate_uvs(const CuboidConfig &config, Mesh *mesh, const bke::AttributeIDRef &uv_id)
{
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
bke::SpanAttributeWriter<float2> uv_attribute =
attributes.lookup_or_add_for_write_only_span<float2>(uv_id, ATTR_DOMAIN_CORNER);
MutableSpan<float2> uvs = uv_attribute.span;
@@ -409,7 +409,7 @@ Mesh *create_cuboid_mesh(const float3 &size,
MutableSpan<MPoly> polys = mesh->polys_for_write();
MutableSpan<MLoop> loops = mesh->loops_for_write();
- calculate_vertices(config, verts);
+ calculate_verts(config, verts);
calculate_polys(config, polys, loops);
BKE_mesh_calc_edges(mesh, false, false);
diff --git a/source/blender/geometry/intern/mesh_to_curve_convert.cc b/source/blender/geometry/intern/mesh_to_curve_convert.cc
index dab373f475b..22961504015 100644
--- a/source/blender/geometry/intern/mesh_to_curve_convert.cc
+++ b/source/blender/geometry/intern/mesh_to_curve_convert.cc
@@ -44,7 +44,7 @@ bke::CurvesGeometry create_curve_from_vert_indices(const Mesh &mesh,
curves.cyclic_for_write().fill(false);
curves.cyclic_for_write().slice(cyclic_curves).fill(true);
- const bke::AttributeAccessor mesh_attributes = bke::mesh_attributes(mesh);
+ const bke::AttributeAccessor mesh_attributes = mesh.attributes();
bke::MutableAttributeAccessor curves_attributes = curves.attributes_for_write();
Set<bke::AttributeIDRef> source_attribute_ids = mesh_attributes.all_ids();
diff --git a/source/blender/geometry/intern/mesh_to_volume.cc b/source/blender/geometry/intern/mesh_to_volume.cc
index 0c0d550fc99..b1c7be38609 100644
--- a/source/blender/geometry/intern/mesh_to_volume.cc
+++ b/source/blender/geometry/intern/mesh_to_volume.cc
@@ -16,7 +16,7 @@ namespace blender::geometry {
/* This class follows the MeshDataAdapter interface from openvdb. */
class OpenVDBMeshAdapter {
private:
- Span<MVert> vertices_;
+ Span<MVert> verts_;
Span<MLoop> loops_;
Span<MLoopTri> looptris_;
float4x4 transform_;
@@ -30,7 +30,7 @@ class OpenVDBMeshAdapter {
};
OpenVDBMeshAdapter::OpenVDBMeshAdapter(const Mesh &mesh, float4x4 transform)
- : vertices_(mesh.verts()), loops_(mesh.loops()), transform_(transform)
+ : verts_(mesh.verts()), loops_(mesh.loops()), transform_(transform)
{
/* This only updates a cache and can be considered to be logically const. */
const MLoopTri *looptris = BKE_mesh_runtime_looptri_ensure(&mesh);
@@ -45,7 +45,7 @@ size_t OpenVDBMeshAdapter::polygonCount() const
size_t OpenVDBMeshAdapter::pointCount() const
{
- return static_cast<size_t>(vertices_.size());
+ return static_cast<size_t>(verts_.size());
}
size_t OpenVDBMeshAdapter::vertexCount(size_t UNUSED(polygon_index)) const
@@ -59,7 +59,7 @@ void OpenVDBMeshAdapter::getIndexSpacePoint(size_t polygon_index,
openvdb::Vec3d &pos) const
{
const MLoopTri &looptri = looptris_[polygon_index];
- const MVert &vertex = vertices_[loops_[looptri.tri[vertex_index]].v];
+ const MVert &vertex = verts_[loops_[looptri.tri[vertex_index]].v];
const float3 transformed_co = transform_ * float3(vertex.co);
pos = &transformed_co.x;
}
diff --git a/source/blender/geometry/intern/point_merge_by_distance.cc b/source/blender/geometry/intern/point_merge_by_distance.cc
index 42fac849667..81f57f785a3 100644
--- a/source/blender/geometry/intern/point_merge_by_distance.cc
+++ b/source/blender/geometry/intern/point_merge_by_distance.cc
@@ -17,7 +17,7 @@ PointCloud *point_merge_by_distance(const PointCloud &src_points,
const float merge_distance,
const IndexMask selection)
{
- const bke::AttributeAccessor src_attributes = bke::pointcloud_attributes(src_points);
+ const bke::AttributeAccessor src_attributes = src_points.attributes();
VArraySpan<float3> positions = src_attributes.lookup_or_default<float3>(
"position", ATTR_DOMAIN_POINT, float3(0));
const int src_size = positions.size();
@@ -41,8 +41,7 @@ PointCloud *point_merge_by_distance(const PointCloud &src_points,
/* Create the new point cloud and add it to a temporary component for the attribute API. */
const int dst_size = src_size - duplicate_count;
PointCloud *dst_pointcloud = BKE_pointcloud_new_nomain(dst_size);
- bke::MutableAttributeAccessor dst_attributes = bke::pointcloud_attributes_for_write(
- *dst_pointcloud);
+ bke::MutableAttributeAccessor dst_attributes = dst_pointcloud->attributes_for_write();
/* By default, every point is just "merged" with itself. Then fill in the results of the merge
* finding, converting from indices into the selection to indices into the full input point
diff --git a/source/blender/geometry/intern/realize_instances.cc b/source/blender/geometry/intern/realize_instances.cc
index b230b938ee9..29a9f51c0a7 100644
--- a/source/blender/geometry/intern/realize_instances.cc
+++ b/source/blender/geometry/intern/realize_instances.cc
@@ -668,7 +668,7 @@ static AllPointCloudsInfo preprocess_pointclouds(const GeometrySet &geometry_set
pointcloud_info.pointcloud = pointcloud;
/* Access attributes. */
- bke::AttributeAccessor attributes = bke::pointcloud_attributes(*pointcloud);
+ bke::AttributeAccessor attributes = pointcloud->attributes();
pointcloud_info.attributes.reinitialize(info.attributes.size());
for (const int attribute_index : info.attributes.index_range()) {
const AttributeIDRef &attribute_id = info.attributes.ids[attribute_index];
@@ -744,8 +744,7 @@ static void execute_realize_pointcloud_tasks(const RealizeInstancesOptions &opti
PointCloudComponent &dst_component =
r_realized_geometry.get_component_for_write<PointCloudComponent>();
dst_component.replace(dst_pointcloud);
- bke::MutableAttributeAccessor dst_attributes = bke::pointcloud_attributes_for_write(
- *dst_pointcloud);
+ bke::MutableAttributeAccessor dst_attributes = dst_pointcloud->attributes_for_write();
SpanAttributeWriter<float3> positions = dst_attributes.lookup_or_add_for_write_only_span<float3>(
"position", ATTR_DOMAIN_POINT);
@@ -883,7 +882,7 @@ static AllMeshesInfo preprocess_meshes(const GeometrySet &geometry_set,
}
/* Access attributes. */
- bke::AttributeAccessor attributes = bke::mesh_attributes(*mesh);
+ bke::AttributeAccessor attributes = mesh->attributes();
mesh_info.attributes.reinitialize(info.attributes.size());
for (const int attribute_index : info.attributes.index_range()) {
const AttributeIDRef &attribute_id = info.attributes.ids[attribute_index];
@@ -1045,7 +1044,7 @@ static void execute_realize_mesh_tasks(const RealizeInstancesOptions &options,
Mesh *dst_mesh = BKE_mesh_new_nomain(tot_vertices, tot_edges, 0, tot_loops, tot_poly);
MeshComponent &dst_component = r_realized_geometry.get_component_for_write<MeshComponent>();
dst_component.replace(dst_mesh);
- bke::MutableAttributeAccessor dst_attributes = bke::mesh_attributes_for_write(*dst_mesh);
+ bke::MutableAttributeAccessor dst_attributes = dst_mesh->attributes_for_write();
MutableSpan<MVert> dst_verts = dst_mesh->verts_for_write();
MutableSpan<MEdge> dst_edges = dst_mesh->edges_for_write();
MutableSpan<MPoly> dst_polys = dst_mesh->polys_for_write();
diff --git a/source/blender/io/alembic/exporter/abc_writer_mesh.cc b/source/blender/io/alembic/exporter/abc_writer_mesh.cc
index 52c11d32933..7d38cd1ec88 100644
--- a/source/blender/io/alembic/exporter/abc_writer_mesh.cc
+++ b/source/blender/io/alembic/exporter/abc_writer_mesh.cc
@@ -391,7 +391,7 @@ void ABCGenericMeshWriter::get_geo_groups(Object *object,
struct Mesh *mesh,
std::map<std::string, std::vector<int32_t>> &geo_groups)
{
- const bke::AttributeAccessor attributes = bke::mesh_attributes(*mesh);
+ const bke::AttributeAccessor attributes = mesh->attributes();
const VArraySpan<int> material_indices = attributes.lookup_or_default<int>(
"material_index", ATTR_DOMAIN_FACE, 0);
diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
index 64f1087a5de..5494bfaa6e8 100644
--- a/source/blender/io/alembic/intern/abc_customdata.cc
+++ b/source/blender/io/alembic/intern/abc_customdata.cc
@@ -57,7 +57,7 @@ static void get_uvs(const CDStreamConfig &config,
}
const int num_poly = config.totpoly;
- MPoly *polygons = config.mpoly;
+ MPoly *mpoly = config.mpoly;
MLoop *mloop = config.mloop;
if (!config.pack_uvs) {
@@ -67,7 +67,7 @@ static void get_uvs(const CDStreamConfig &config,
/* Iterate in reverse order to match exported polygons. */
for (int i = 0; i < num_poly; i++) {
- MPoly &current_poly = polygons[i];
+ MPoly &current_poly = mpoly[i];
const MLoopUV *loopuv = mloopuv_array + current_poly.loopstart + current_poly.totloop;
for (int j = 0; j < current_poly.totloop; j++, count++) {
@@ -85,7 +85,7 @@ static void get_uvs(const CDStreamConfig &config,
int idx_count = 0;
for (int i = 0; i < num_poly; i++) {
- MPoly &current_poly = polygons[i];
+ MPoly &current_poly = mpoly[i];
MLoop *looppoly = mloop + current_poly.loopstart + current_poly.totloop;
const MLoopUV *loopuv = mloopuv_array + current_poly.loopstart + current_poly.totloop;
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc
index 7274a41a3eb..a849e091bd1 100644
--- a/source/blender/io/alembic/intern/abc_reader_mesh.cc
+++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc
@@ -306,7 +306,7 @@ static void process_vertex_normals(CDStreamConfig &config,
}
config.mesh->flag |= ME_AUTOSMOOTH;
- BKE_mesh_set_custom_normals_from_vertices(config.mesh, vnors);
+ BKE_mesh_set_custom_normals_from_verts(config.mesh, vnors);
MEM_freeN(vnors);
}
@@ -765,7 +765,7 @@ Mesh *AbcMeshReader::read_mesh(Mesh *existing_mesh,
size_t num_polys = new_mesh->totpoly;
if (num_polys > 0) {
std::map<std::string, int> mat_map;
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*new_mesh);
+ bke::MutableAttributeAccessor attributes = new_mesh->attributes_for_write();
bke::SpanAttributeWriter<int> material_indices =
attributes.lookup_or_add_for_write_only_span<int>("material_index", ATTR_DOMAIN_FACE);
assign_facesets_to_material_indices(sample_sel, material_indices.span, mat_map);
@@ -826,7 +826,7 @@ void AbcMeshReader::assign_facesets_to_material_indices(const ISampleSelector &s
void AbcMeshReader::readFaceSetsSample(Main *bmain, Mesh *mesh, const ISampleSelector &sample_sel)
{
std::map<std::string, int> mat_map;
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
bke::SpanAttributeWriter<int> material_indices =
attributes.lookup_or_add_for_write_only_span<int>("material_index", ATTR_DOMAIN_FACE);
assign_facesets_to_material_indices(sample_sel, material_indices.span, mat_map);
diff --git a/source/blender/io/collada/GeometryExporter.cpp b/source/blender/io/collada/GeometryExporter.cpp
index 3728bbd34c3..e60900ccdb6 100644
--- a/source/blender/io/collada/GeometryExporter.cpp
+++ b/source/blender/io/collada/GeometryExporter.cpp
@@ -288,7 +288,7 @@ static bool collect_vertex_counts_per_poly(Mesh *me,
std::vector<unsigned long> &vcount_list)
{
const Span<MPoly> polys = me->polys();
- const blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*me);
+ const blender::bke::AttributeAccessor attributes = me->attributes();
const blender::VArray<int> material_indices = attributes.lookup_or_default<int>(
"material_index", ATTR_DOMAIN_FACE, 0);
bool is_triangulated = true;
@@ -399,7 +399,7 @@ void GeometryExporter::create_mesh_primitive_list(short material_index,
/* performs the actual writing */
prepareToAppendValues(is_triangulated, *primitive_list, vcount_list);
- const blender::bke::AttributeAccessor attributes = blender::bke::mesh_attributes(*me);
+ const blender::bke::AttributeAccessor attributes = me->attributes();
const blender::VArray<int> material_indices = attributes.lookup_or_default<int>(
"material_index", ATTR_DOMAIN_FACE, 0);
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index 259b52ed435..0b96cd8ce90 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -807,7 +807,7 @@ void USDMeshReader::readFaceSetsSample(Main *bmain, Mesh *mesh, const double mot
std::map<pxr::SdfPath, int> mat_map;
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ bke::MutableAttributeAccessor attributes = mesh->attributes_for_write();
bke::SpanAttributeWriter<int> material_indices =
attributes.lookup_or_add_for_write_only_span<int>("material_index", ATTR_DOMAIN_FACE);
this->assign_facesets_to_material_indices(motionSampleTime, material_indices.span, &mat_map);
@@ -916,7 +916,7 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
MutableSpan<MPoly> polys = active_mesh->polys_for_write();
if (!polys.is_empty() && import_params_.import_materials) {
std::map<pxr::SdfPath, int> mat_map;
- bke::MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*active_mesh);
+ bke::MutableAttributeAccessor attributes = active_mesh->attributes_for_write();
bke::SpanAttributeWriter<int> material_indices =
attributes.lookup_or_add_for_write_only_span<int>("material_index", ATTR_DOMAIN_FACE);
assign_facesets_to_material_indices(motionSampleTime, material_indices.span, &mat_map);
diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc
index 9f8e38c4dfd..a39f74c6420 100644
--- a/source/blender/io/usd/intern/usd_writer_mesh.cc
+++ b/source/blender/io/usd/intern/usd_writer_mesh.cc
@@ -256,7 +256,7 @@ static void get_loops_polys(const Mesh *mesh, USDMeshData &usd_mesh_data)
{
/* Only construct face groups (a.k.a. geometry subsets) when we need them for material
* assignments. */
- const bke::AttributeAccessor attributes = bke::mesh_attributes(*mesh);
+ const bke::AttributeAccessor attributes = mesh->attributes();
const VArray<int> material_indices = attributes.lookup_or_default<int>(
"material_index", ATTR_DOMAIN_FACE, 0);
if (!material_indices.is_single() && mesh->totcol > 1) {
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
index 902f801ee5b..4d934960010 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.cc
@@ -255,7 +255,7 @@ void OBJWriter::write_vertex_coords(FormatHandler &fh,
colors_layer = BKE_id_attributes_active_color_get(&mesh->id);
}
if (write_colors && (colors_layer != nullptr)) {
- const bke::AttributeAccessor attributes = bke::mesh_attributes(*mesh);
+ const bke::AttributeAccessor attributes = mesh->attributes();
const VArray<ColorGeometry4f> attribute = attributes.lookup_or_default<ColorGeometry4f>(
colors_layer->name, ATTR_DOMAIN_POINT, {0.0f, 0.0f, 0.0f, 0.0f});
@@ -374,7 +374,7 @@ void OBJWriter::write_poly_elements(FormatHandler &fh,
}
}
- const bke::AttributeAccessor attributes = bke::mesh_attributes(*obj_mesh_data.get_mesh());
+ const bke::AttributeAccessor attributes = obj_mesh_data.get_mesh()->attributes();
const VArray<int> material_indices = attributes.lookup_or_default<int>(
"material_index", ATTR_DOMAIN_FACE, 0);
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index cd724152b05..10880b016fb 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -203,7 +203,7 @@ void OBJMesh::calc_smooth_groups(const bool use_bitflags)
void OBJMesh::calc_poly_order()
{
- const bke::AttributeAccessor attributes = bke::mesh_attributes(*export_mesh_eval_);
+ const bke::AttributeAccessor attributes = export_mesh_eval_->attributes();
const VArray<int> material_indices = attributes.lookup_or_default<int>(
"material_index", ATTR_DOMAIN_FACE, 0);
if (material_indices.is_single() && material_indices.get_internal_single() == 0) {
@@ -242,8 +242,8 @@ const Material *OBJMesh::get_object_material(const int16_t mat_nr) const
bool OBJMesh::is_ith_poly_smooth(const int poly_index) const
{
- const Span<MPoly> polygons = export_mesh_eval_->polys();
- return polygons[poly_index].flag & ME_SMOOTH;
+ const Span<MPoly> polys = export_mesh_eval_->polys();
+ return polys[poly_index].flag & ME_SMOOTH;
}
const char *OBJMesh::get_object_name() const
@@ -317,7 +317,7 @@ void OBJMesh::store_uv_coords_and_indices()
if (uv_vert->separate) {
tot_uv_vertices_ += 1;
}
- const int vertices_in_poly = polys[uv_vert->poly_index].totloop;
+ const int verts_in_poly = polys[uv_vert->poly_index].totloop;
/* Store UV vertex coordinates. */
uv_coords_.resize(tot_uv_vertices_);
@@ -326,7 +326,7 @@ void OBJMesh::store_uv_coords_and_indices()
uv_coords_[tot_uv_vertices_ - 1] = float2(vert_uv_coords[0], vert_uv_coords[1]);
/* Store UV vertex indices. */
- uv_indices_[uv_vert->poly_index].resize(vertices_in_poly);
+ uv_indices_[uv_vert->poly_index].resize(verts_in_poly);
/* Keep indices zero-based and let the writer handle the "+ 1" as per OBJ spec. */
uv_indices_[uv_vert->poly_index][uv_vert->loop_of_poly_index] = tot_uv_vertices_ - 1;
}
diff --git a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
index 84f1c6dd6b0..b1a2c7834f4 100644
--- a/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
+++ b/source/blender/io/wavefront_obj/importer/obj_import_mesh.cc
@@ -188,8 +188,8 @@ void MeshFromGeometry::create_polys_loops(Mesh *mesh, bool use_vertex_groups)
MutableSpan<MPoly> polys = mesh->polys_for_write();
MutableSpan<MLoop> loops = mesh->loops_for_write();
bke::SpanAttributeWriter<int> material_indices =
- bke::mesh_attributes_for_write(*mesh).lookup_or_add_for_write_only_span<int>(
- "material_index", ATTR_DOMAIN_FACE);
+ mesh->attributes_for_write().lookup_or_add_for_write_only_span<int>("material_index",
+ ATTR_DOMAIN_FACE);
const int64_t tot_face_elems{mesh->totpoly};
int tot_loop_idx = 0;
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index e2b58cefef6..0ab14988e40 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -1160,6 +1160,9 @@ typedef struct IdAdtTemplate {
AnimData *adt;
} IdAdtTemplate;
+/* From: `DNA_object_types.h`, see it's doc-string there. */
+#define SELECT 1
+
/* ************************************************ */
#ifdef __cplusplus
diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h
index 6e18d442ee2..5862c3a6707 100644
--- a/source/blender/makesdna/DNA_curve_types.h
+++ b/source/blender/makesdna/DNA_curve_types.h
@@ -439,9 +439,9 @@ enum {
/* *************** BEZTRIPLE **************** */
-/* BezTriple.f1,2,3 */
+/** #BezTriple.f1, #BezTriple.f2, #BezTriple.f3. */
typedef enum eBezTriple_Flag {
- /* SELECT */
+ /* `SELECT = (1 << 0)` */
BEZT_FLAG_TEMP_TAG = (1 << 1), /* always clear. */
/* Can be used to ignore keyframe points for certain operations. */
BEZT_FLAG_IGNORE_TAG = (1 << 2),
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index dd3ea5f2304..d335b36950c 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -18,6 +18,10 @@
namespace blender {
template<typename T> class Span;
template<typename T> class MutableSpan;
+namespace bke {
+class AttributeAccessor;
+class MutableAttributeAccessor;
+} // namespace bke
} // namespace blender
#endif
@@ -346,6 +350,9 @@ typedef struct Mesh {
/** Write access to loop data. */
blender::MutableSpan<MLoop> loops_for_write();
+ blender::bke::AttributeAccessor attributes() const;
+ blender::bke::MutableAttributeAccessor attributes_for_write();
+
/**
* Vertex group data, encoded as an array of indices and weights for every vertex.
* \warning: May be empty.
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index ac9e61e03e8..add11d61db8 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -477,7 +477,13 @@ typedef struct ObHook {
/* **************** OBJECT ********************* */
-/* used many places, should be specialized. */
+/**
+ * This is used as a flag for many kinds of data that use selections, examples include:
+ * - #BezTriple.f1, #BezTriple.f2, #BezTriple.f3
+ * - #bNote.flag
+ * - #MovieTrackingTrack.flag
+ * And more, ideally this would have a generic location.
+ */
#define SELECT 1
/** #Object.type */
diff --git a/source/blender/makesdna/DNA_pointcloud_types.h b/source/blender/makesdna/DNA_pointcloud_types.h
index ee829ebcf6e..34c5d153165 100644
--- a/source/blender/makesdna/DNA_pointcloud_types.h
+++ b/source/blender/makesdna/DNA_pointcloud_types.h
@@ -10,6 +10,13 @@
#include "DNA_customdata_types.h"
#ifdef __cplusplus
+namespace blender::bke {
+class AttributeAccessor;
+class MutableAttributeAccessor;
+} // namespace blender::bke
+#endif
+
+#ifdef __cplusplus
extern "C" {
#endif
@@ -32,6 +39,11 @@ typedef struct PointCloud {
short totcol;
short _pad3[3];
+#ifdef __cplusplus
+ blender::bke::AttributeAccessor attributes() const;
+ blender::bke::MutableAttributeAccessor attributes_for_write();
+#endif
+
/* Draw Cache */
void *batch_cache;
} PointCloud;
diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h
index a46d737ba9d..b436b33cfb3 100644
--- a/source/blender/makesdna/DNA_sequence_types.h
+++ b/source/blender/makesdna/DNA_sequence_types.h
@@ -522,8 +522,6 @@ typedef struct SequencerScopes {
#define MAXSEQ 128
-#define SELECT 1
-
/** #Editor.overlay_frame_flag */
#define SEQ_EDIT_OVERLAY_FRAME_SHOW 1
#define SEQ_EDIT_OVERLAY_FRAME_ABS 2
@@ -549,9 +547,12 @@ typedef struct SequencerScopes {
#define SEQ_NAME_MAXSTR 64
+/* From: `DNA_object_types.h`, see it's doc-string there. */
+#define SELECT 1
+
/** #Sequence.flag */
enum {
- /* SELECT */
+ /* `SELECT = (1 << 0)` */
SEQ_LEFTSEL = (1 << 1),
SEQ_RIGHTSEL = (1 << 2),
SEQ_OVERLAP = (1 << 3),
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index 3635759ad4d..7551f9d7096 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -102,10 +102,10 @@ static void rna_Mesh_calc_smooth_groups(
static void rna_Mesh_normals_split_custom_do(Mesh *mesh,
float (*custom_loopnors)[3],
- const bool use_vertices)
+ const bool use_verts)
{
- if (use_vertices) {
- BKE_mesh_set_custom_normals_from_vertices(mesh, custom_loopnors);
+ if (use_verts) {
+ BKE_mesh_set_custom_normals_from_verts(mesh, custom_loopnors);
}
else {
BKE_mesh_set_custom_normals(mesh, custom_loopnors);
@@ -165,7 +165,7 @@ static void rna_Mesh_transform(Mesh *mesh, float mat[16], bool shape_keys)
static void rna_Mesh_flip_normals(Mesh *mesh)
{
- BKE_mesh_polygons_flip(
+ BKE_mesh_polys_flip(
BKE_mesh_polys(mesh), BKE_mesh_loops_for_write(mesh), &mesh->ldata, mesh->totpoly);
BKE_mesh_tessface_clear(mesh);
BKE_mesh_normals_tag_dirty(mesh);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index cd2434ff5be..40e7f6e65c2 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -212,10 +212,10 @@ static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *valu
if (pa) {
Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
- const MVert *vertices = BKE_mesh_verts(hair_mesh);
+ const MVert *verts = BKE_mesh_verts(hair_mesh);
if (hair_mesh) {
- const MVert *mvert = &vertices[pa->hair_index + (hkey - pa->hair)];
- copy_v3_v3(values, mvert->co);
+ const MVert *mv = &verts[pa->hair_index + (hkey - pa->hair)];
+ copy_v3_v3(values, mv->co);
}
else {
float hairmat[4][4];
@@ -279,9 +279,9 @@ static void hair_key_location_object_set(HairKey *hair_key,
if (hair_key_index == -1) {
return;
}
- MVert *vertices = BKE_mesh_verts_for_write(hair_mesh);
- MVert *mvert = &vertices[particle->hair_index + (hair_key_index)];
- copy_v3_v3(mvert->co, src_co);
+ MVert *verts = BKE_mesh_verts_for_write(hair_mesh);
+ MVert *mv = &verts[particle->hair_index + (hair_key_index)];
+ copy_v3_v3(mv->co, src_co);
return;
}
@@ -324,9 +324,9 @@ static void rna_ParticleHairKey_co_object(HairKey *hairkey,
NULL;
if (particle) {
if (hair_mesh) {
- const MVert *vertices = BKE_mesh_verts(hair_mesh);
- const MVert *mvert = &vertices[particle->hair_index + (hairkey - particle->hair)];
- copy_v3_v3(n_co, mvert->co);
+ const MVert *verts = BKE_mesh_verts(hair_mesh);
+ const MVert *mv = &verts[particle->hair_index + (hairkey - particle->hair)];
+ copy_v3_v3(n_co, mv->co);
}
else {
float hairmat[4][4];
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index e5e10d2ff33..20f3379b6dc 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -482,7 +482,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
}
/* About 67 million vertices max seems a decent limit for now. */
- const size_t max_vertices_num = 1 << 26;
+ const size_t max_verts_num = 1 << 26;
/* calculate the maximum number of copies which will fit within the
* prescribed length */
@@ -500,7 +500,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
* vertices.
*/
if (((size_t)count * (size_t)chunk_nverts + (size_t)start_cap_nverts +
- (size_t)end_cap_nverts) > max_vertices_num) {
+ (size_t)end_cap_nverts) > max_verts_num) {
count = 1;
offset_is_too_small = true;
}
@@ -522,7 +522,7 @@ static Mesh *arrayModifier_doArray(ArrayModifierData *amd,
* vertices.
*/
else if (((size_t)count * (size_t)chunk_nverts + (size_t)start_cap_nverts +
- (size_t)end_cap_nverts) > max_vertices_num) {
+ (size_t)end_cap_nverts) > max_verts_num) {
count = 1;
BKE_modifier_set_error(ctx->object,
&amd->modifier,
diff --git a/source/blender/modifiers/intern/MOD_mask.cc b/source/blender/modifiers/intern/MOD_mask.cc
index e0428042caa..b3ee6a1f4ca 100644
--- a/source/blender/modifiers/intern/MOD_mask.cc
+++ b/source/blender/modifiers/intern/MOD_mask.cc
@@ -143,9 +143,9 @@ static void invert_boolean_array(MutableSpan<bool> array)
}
}
-static void compute_masked_vertices(Span<bool> vertex_mask,
- MutableSpan<int> r_vertex_map,
- uint *r_verts_masked_num)
+static void compute_masked_verts(Span<bool> vertex_mask,
+ MutableSpan<int> r_vertex_map,
+ uint *r_verts_masked_num)
{
BLI_assert(vertex_mask.size() == r_vertex_map.size());
@@ -223,12 +223,12 @@ static void computed_masked_edges_smooth(const Mesh *mesh,
*r_verts_add_num = verts_add_num;
}
-static void computed_masked_polygons(const Mesh *mesh,
- Span<bool> vertex_mask,
- Vector<int> &r_masked_poly_indices,
- Vector<int> &r_loop_starts,
- uint *r_polys_masked_num,
- uint *r_loops_masked_num)
+static void computed_masked_polys(const Mesh *mesh,
+ Span<bool> vertex_mask,
+ Vector<int> &r_masked_poly_indices,
+ Vector<int> &r_loop_starts,
+ uint *r_polys_masked_num,
+ uint *r_loops_masked_num)
{
BLI_assert(mesh->totvert == vertex_mask.size());
const Span<MPoly> polys = mesh->polys();
@@ -261,15 +261,15 @@ static void computed_masked_polygons(const Mesh *mesh,
*r_loops_masked_num = loops_masked_num;
}
-static void compute_interpolated_polygons(const Mesh *mesh,
- Span<bool> vertex_mask,
- uint verts_add_num,
- uint loops_masked_num,
- Vector<int> &r_masked_poly_indices,
- Vector<int> &r_loop_starts,
- uint *r_edges_add_num,
- uint *r_polys_add_num,
- uint *r_loops_add_num)
+static void compute_interpolated_polys(const Mesh *mesh,
+ Span<bool> vertex_mask,
+ uint verts_add_num,
+ uint loops_masked_num,
+ Vector<int> &r_masked_poly_indices,
+ Vector<int> &r_loop_starts,
+ uint *r_edges_add_num,
+ uint *r_polys_add_num,
+ uint *r_loops_add_num)
{
BLI_assert(mesh->totvert == vertex_mask.size());
@@ -333,9 +333,9 @@ static void compute_interpolated_polygons(const Mesh *mesh,
*r_loops_add_num = loops_add_num;
}
-static void copy_masked_vertices_to_new_mesh(const Mesh &src_mesh,
- Mesh &dst_mesh,
- Span<int> vertex_map)
+static void copy_masked_verts_to_new_mesh(const Mesh &src_mesh,
+ Mesh &dst_mesh,
+ Span<int> vertex_map)
{
BLI_assert(src_mesh.totvert == vertex_map.size());
const Span<MVert> src_verts = src_mesh.verts();
@@ -692,7 +692,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
Array<int> vertex_map(mesh->totvert);
uint verts_masked_num;
- compute_masked_vertices(vertex_mask, vertex_map, &verts_masked_num);
+ compute_masked_verts(vertex_mask, vertex_map, &verts_masked_num);
Array<int> edge_map(mesh->totedge);
uint edges_masked_num;
@@ -709,26 +709,26 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
Vector<int> new_loop_starts;
uint polys_masked_num;
uint loops_masked_num;
- computed_masked_polygons(mesh,
- vertex_mask,
- masked_poly_indices,
- new_loop_starts,
- &polys_masked_num,
- &loops_masked_num);
+ computed_masked_polys(mesh,
+ vertex_mask,
+ masked_poly_indices,
+ new_loop_starts,
+ &polys_masked_num,
+ &loops_masked_num);
uint edges_add_num = 0;
uint polys_add_num = 0;
uint loops_add_num = 0;
if (use_interpolation) {
- compute_interpolated_polygons(mesh,
- vertex_mask,
- verts_add_num,
- loops_masked_num,
- masked_poly_indices,
- new_loop_starts,
- &edges_add_num,
- &polys_add_num,
- &loops_add_num);
+ compute_interpolated_polys(mesh,
+ vertex_mask,
+ verts_add_num,
+ loops_masked_num,
+ masked_poly_indices,
+ new_loop_starts,
+ &edges_add_num,
+ &polys_add_num,
+ &loops_add_num);
}
Mesh *result = BKE_mesh_new_nomain_from_template(mesh,
@@ -738,7 +738,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
loops_masked_num + loops_add_num,
polys_masked_num + polys_add_num);
- copy_masked_vertices_to_new_mesh(*mesh, *result, vertex_map);
+ copy_masked_verts_to_new_mesh(*mesh, *result, vertex_map);
if (use_interpolation) {
add_interp_verts_copy_edges_to_new_mesh(*mesh,
*result,
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.cc b/source/blender/modifiers/intern/MOD_meshsequencecache.cc
index 1a41fa4cd3b..f30e6a95787 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.cc
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.cc
@@ -181,15 +181,15 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *
const Span<MVert> mesh_verts = mesh->verts();
const Span<MEdge> mesh_edges = mesh->edges();
const Span<MPoly> mesh_polys = mesh->polys();
- const Span<MVert> me_vertices = me->verts();
+ const Span<MVert> me_verts = me->verts();
const Span<MEdge> me_edges = me->edges();
- const Span<MPoly> me_polygons = me->polys();
+ const Span<MPoly> me_polys = me->polys();
/* TODO(sybren+bastien): possibly check relevant custom data layers (UV/color depending on
* flags) and duplicate those too.
* XXX(Hans): This probably isn't true anymore with various CoW improvements, etc. */
- if ((me_vertices.data() == mesh_verts.data()) || (me_edges.data() == mesh_edges.data()) ||
- (me_polygons.data() == mesh_polys.data())) {
+ if ((me_verts.data() == mesh_verts.data()) || (me_edges.data() == mesh_edges.data()) ||
+ (me_polys.data() == mesh_polys.data())) {
/* We need to duplicate data here, otherwise we'll modify org mesh, see T51701. */
mesh = reinterpret_cast<Mesh *>(
BKE_id_copy_ex(nullptr,
diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c
index 9c6f7ff4069..d3b02659380 100644
--- a/source/blender/modifiers/intern/MOD_ocean.c
+++ b/source/blender/modifiers/intern/MOD_ocean.c
@@ -169,9 +169,9 @@ typedef struct GenerateOceanGeometryData {
float ix, iy;
} GenerateOceanGeometryData;
-static void generate_ocean_geometry_vertices(void *__restrict userdata,
- const int y,
- const TaskParallelTLS *__restrict UNUSED(tls))
+static void generate_ocean_geometry_verts(void *__restrict userdata,
+ const int y,
+ const TaskParallelTLS *__restrict UNUSED(tls))
{
GenerateOceanGeometryData *gogd = userdata;
int x;
@@ -185,9 +185,9 @@ static void generate_ocean_geometry_vertices(void *__restrict userdata,
}
}
-static void generate_ocean_geometry_polygons(void *__restrict userdata,
- const int y,
- const TaskParallelTLS *__restrict UNUSED(tls))
+static void generate_ocean_geometry_polys(void *__restrict userdata,
+ const int y,
+ const TaskParallelTLS *__restrict UNUSED(tls))
{
GenerateOceanGeometryData *gogd = userdata;
int x;
@@ -282,10 +282,10 @@ static Mesh *generate_ocean_geometry(OceanModifierData *omd, Mesh *mesh_orig, co
settings.use_threading = use_threading;
/* create vertices */
- BLI_task_parallel_range(0, gogd.res_y + 1, &gogd, generate_ocean_geometry_vertices, &settings);
+ BLI_task_parallel_range(0, gogd.res_y + 1, &gogd, generate_ocean_geometry_verts, &settings);
/* create faces */
- BLI_task_parallel_range(0, gogd.res_y, &gogd, generate_ocean_geometry_polygons, &settings);
+ BLI_task_parallel_range(0, gogd.res_y, &gogd, generate_ocean_geometry_polys, &settings);
BKE_mesh_calc_edges(result, false, false);
diff --git a/source/blender/modifiers/intern/MOD_weighted_normal.c b/source/blender/modifiers/intern/MOD_weighted_normal.c
index 05c6eea9f8b..ba441581770 100644
--- a/source/blender/modifiers/intern/MOD_weighted_normal.c
+++ b/source/blender/modifiers/intern/MOD_weighted_normal.c
@@ -362,7 +362,7 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
clnors);
}
else {
- /* TODO: Ideally, we could add an option to BKE_mesh_normals_loop_custom_[from_vertices_]set()
+ /* TODO: Ideally, we could add an option to `BKE_mesh_normals_loop_custom_[from_verts_]set()`
* to keep current clnors instead of resetting them to default auto-computed ones,
* when given new custom normal is zero-vec.
* But this is not exactly trivial change, better to keep this optimization for later...
@@ -379,18 +379,18 @@ static void apply_weights_vertex_normal(WeightedNormalModifierData *wnmd,
copy_v3_v3(vert_normals[mv_index], items_data[mv_index].normal);
}
- BKE_mesh_normals_loop_custom_from_vertices_set(mvert,
- wn_data->vert_normals,
- vert_normals,
- verts_num,
- medge,
- edges_num,
- mloop,
- loops_num,
- mpoly,
- polynors,
- polys_num,
- clnors);
+ BKE_mesh_normals_loop_custom_from_verts_set(mvert,
+ wn_data->vert_normals,
+ vert_normals,
+ verts_num,
+ medge,
+ edges_num,
+ mloop,
+ loops_num,
+ mpoly,
+ polynors,
+ polys_num,
+ clnors);
MEM_freeN(vert_normals);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
index 69938f3e447..a6af74645b6 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_boolean.cc
@@ -154,7 +154,7 @@ static void node_geo_exec(GeoNodeExecParams params)
/* Store intersecting edges in attribute. */
if (attribute_outputs.intersecting_edges_id) {
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*result);
+ MutableAttributeAccessor attributes = result->attributes_for_write();
SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_only_span<bool>(
attribute_outputs.intersecting_edges_id.get(), ATTR_DOMAIN_EDGE);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
index e8dbfbde401..3f6155460ed 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_deform_curves_on_surface.cc
@@ -270,8 +270,8 @@ static void node_geo_exec(GeoNodeExecParams params)
BKE_mesh_wrapper_ensure_mdata(surface_mesh_eval);
- const AttributeAccessor mesh_attributes_eval = bke::mesh_attributes(*surface_mesh_eval);
- const AttributeAccessor mesh_attributes_orig = bke::mesh_attributes(*surface_mesh_orig);
+ const AttributeAccessor mesh_attributes_eval = surface_mesh_eval->attributes();
+ const AttributeAccessor mesh_attributes_orig = surface_mesh_orig->attributes();
Curves &curves_id = *curves_geometry.get_curves_for_write();
CurvesGeometry &curves = CurvesGeometry::wrap(curves_id.geometry);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
index 1c8a34dab1f..851ca622d6b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc
@@ -176,9 +176,9 @@ static void copy_face_corner_attributes(const Map<AttributeIDRef, AttributeKind>
attributes, src_attributes, dst_attributes, ATTR_DOMAIN_CORNER, IndexMask(indices));
}
-static void copy_masked_vertices_to_new_mesh(const Mesh &src_mesh,
- Mesh &dst_mesh,
- Span<int> vertex_map)
+static void copy_masked_verts_to_new_mesh(const Mesh &src_mesh,
+ Mesh &dst_mesh,
+ Span<int> vertex_map)
{
BLI_assert(src_mesh.totvert == vertex_map.size());
const Span<MVert> src_verts = src_mesh.verts();
@@ -239,16 +239,16 @@ static void copy_masked_polys_to_new_mesh(const Mesh &src_mesh,
Span<int> masked_poly_indices,
Span<int> new_loop_starts)
{
- const Span<MPoly> src_polygons = src_mesh.polys();
+ const Span<MPoly> src_polys = src_mesh.polys();
const Span<MLoop> src_loops = src_mesh.loops();
- MutableSpan<MPoly> dst_polygons = dst_mesh.polys_for_write();
+ MutableSpan<MPoly> dst_polys = dst_mesh.polys_for_write();
MutableSpan<MLoop> dst_loops = dst_mesh.loops_for_write();
for (const int i_dst : masked_poly_indices.index_range()) {
const int i_src = masked_poly_indices[i_dst];
- const MPoly &mp_src = src_polygons[i_src];
- MPoly &mp_dst = dst_polygons[i_dst];
+ const MPoly &mp_src = src_polys[i_src];
+ MPoly &mp_dst = dst_polys[i_dst];
const int i_ml_src = mp_src.loopstart;
const int i_ml_dst = new_loop_starts[i_dst];
@@ -270,16 +270,16 @@ static void copy_masked_polys_to_new_mesh(const Mesh &src_mesh,
Span<int> masked_poly_indices,
Span<int> new_loop_starts)
{
- const Span<MPoly> src_polygons = src_mesh.polys();
+ const Span<MPoly> src_polys = src_mesh.polys();
const Span<MLoop> src_loops = src_mesh.loops();
- MutableSpan<MPoly> dst_polygons = dst_mesh.polys_for_write();
+ MutableSpan<MPoly> dst_polys = dst_mesh.polys_for_write();
MutableSpan<MLoop> dst_loops = dst_mesh.loops_for_write();
for (const int i_dst : masked_poly_indices.index_range()) {
const int i_src = masked_poly_indices[i_dst];
- const MPoly &mp_src = src_polygons[i_src];
- MPoly &mp_dst = dst_polygons[i_dst];
+ const MPoly &mp_src = src_polys[i_src];
+ MPoly &mp_dst = dst_polys[i_dst];
const int i_ml_src = mp_src.loopstart;
const int i_ml_dst = new_loop_starts[i_dst];
@@ -302,16 +302,16 @@ static void copy_masked_polys_to_new_mesh(const Mesh &src_mesh,
Span<int> masked_poly_indices,
Span<int> new_loop_starts)
{
- const Span<MPoly> src_polygons = src_mesh.polys();
+ const Span<MPoly> src_polys = src_mesh.polys();
const Span<MLoop> src_loops = src_mesh.loops();
- MutableSpan<MPoly> dst_polygons = dst_mesh.polys_for_write();
+ MutableSpan<MPoly> dst_polys = dst_mesh.polys_for_write();
MutableSpan<MLoop> dst_loops = dst_mesh.loops_for_write();
for (const int i_dst : masked_poly_indices.index_range()) {
const int i_src = masked_poly_indices[i_dst];
- const MPoly &mp_src = src_polygons[i_src];
- MPoly &mp_dst = dst_polygons[i_dst];
+ const MPoly &mp_src = src_polys[i_src];
+ MPoly &mp_dst = dst_polys[i_dst];
const int i_ml_src = mp_src.loopstart;
const int i_ml_dst = new_loop_starts[i_dst];
@@ -382,8 +382,8 @@ static void separate_point_cloud_selection(GeometrySet &geometry_set,
{GEO_COMPONENT_TYPE_POINT_CLOUD}, GEO_COMPONENT_TYPE_POINT_CLOUD, false, attributes);
copy_attributes_based_on_mask(attributes,
- bke::pointcloud_attributes(src_pointcloud),
- bke::pointcloud_attributes_for_write(*pointcloud),
+ src_pointcloud.attributes(),
+ pointcloud->attributes_for_write(),
ATTR_DOMAIN_POINT,
selection);
geometry_set.replace_pointcloud(pointcloud);
@@ -407,9 +407,9 @@ static void delete_selected_instances(GeometrySet &geometry_set,
instances.remove_instances(selection);
}
-static void compute_selected_vertices_from_vertex_selection(const Span<bool> vertex_selection,
- MutableSpan<int> r_vertex_map,
- int *r_selected_vertices_num)
+static void compute_selected_verts_from_vertex_selection(const Span<bool> vertex_selection,
+ MutableSpan<int> r_vertex_map,
+ int *r_selected_verts_num)
{
BLI_assert(vertex_selection.size() == r_vertex_map.size());
@@ -424,7 +424,7 @@ static void compute_selected_vertices_from_vertex_selection(const Span<bool> ver
}
}
- *r_selected_vertices_num = selected_verts_num;
+ *r_selected_verts_num = selected_verts_num;
}
static void compute_selected_edges_from_vertex_selection(const Mesh &mesh,
@@ -452,12 +452,12 @@ static void compute_selected_edges_from_vertex_selection(const Mesh &mesh,
*r_selected_edges_num = selected_edges_num;
}
-static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh,
- const Span<bool> vertex_selection,
- Vector<int> &r_selected_poly_indices,
- Vector<int> &r_loop_starts,
- int *r_selected_polys_num,
- int *r_selected_loops_num)
+static void compute_selected_polys_from_vertex_selection(const Mesh &mesh,
+ const Span<bool> vertex_selection,
+ Vector<int> &r_selected_poly_indices,
+ Vector<int> &r_loop_starts,
+ int *r_selected_polys_num,
+ int *r_selected_loops_num)
{
BLI_assert(mesh.totvert == vertex_selection.size());
const Span<MPoly> polys = mesh.polys();
@@ -494,13 +494,12 @@ static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh,
* Checks for every edge if it is in `edge_selection`. If it is, then the two vertices of the
* edge are kept along with the edge.
*/
-static void compute_selected_vertices_and_edges_from_edge_selection(
- const Mesh &mesh,
- const Span<bool> edge_selection,
- MutableSpan<int> r_vertex_map,
- MutableSpan<int> r_edge_map,
- int *r_selected_vertices_num,
- int *r_selected_edges_num)
+static void compute_selected_verts_and_edges_from_edge_selection(const Mesh &mesh,
+ const Span<bool> edge_selection,
+ MutableSpan<int> r_vertex_map,
+ MutableSpan<int> r_edge_map,
+ int *r_selected_verts_num,
+ int *r_selected_edges_num)
{
BLI_assert(mesh.totedge == edge_selection.size());
const Span<MEdge> edges = mesh.edges();
@@ -526,7 +525,7 @@ static void compute_selected_vertices_and_edges_from_edge_selection(
}
}
- *r_selected_vertices_num = selected_verts_num;
+ *r_selected_verts_num = selected_verts_num;
*r_selected_edges_num = selected_edges_num;
}
@@ -558,12 +557,12 @@ static void compute_selected_edges_from_edge_selection(const Mesh &mesh,
* Checks for every polygon if all the edges are in `edge_selection`. If they are, then that
* polygon is kept.
*/
-static void compute_selected_polygons_from_edge_selection(const Mesh &mesh,
- const Span<bool> edge_selection,
- Vector<int> &r_selected_poly_indices,
- Vector<int> &r_loop_starts,
- int *r_selected_polys_num,
- int *r_selected_loops_num)
+static void compute_selected_polys_from_edge_selection(const Mesh &mesh,
+ const Span<bool> edge_selection,
+ Vector<int> &r_selected_poly_indices,
+ Vector<int> &r_loop_starts,
+ int *r_selected_polys_num,
+ int *r_selected_loops_num)
{
const Span<MPoly> polys = mesh.polys();
const Span<MLoop> loops = mesh.loops();
@@ -612,12 +611,12 @@ static void compute_selected_mesh_data_from_vertex_selection_edge_face(
compute_selected_edges_from_vertex_selection(
mesh, vertex_selection, r_edge_map, r_selected_edges_num);
- compute_selected_polygons_from_vertex_selection(mesh,
- vertex_selection,
- r_selected_poly_indices,
- r_loop_starts,
- r_selected_polys_num,
- r_selected_loops_num);
+ compute_selected_polys_from_vertex_selection(mesh,
+ vertex_selection,
+ r_selected_poly_indices,
+ r_loop_starts,
+ r_selected_polys_num,
+ r_selected_loops_num);
}
/**
@@ -630,23 +629,23 @@ static void compute_selected_mesh_data_from_vertex_selection(const Mesh &mesh,
MutableSpan<int> r_edge_map,
Vector<int> &r_selected_poly_indices,
Vector<int> &r_loop_starts,
- int *r_selected_vertices_num,
+ int *r_selected_verts_num,
int *r_selected_edges_num,
int *r_selected_polys_num,
int *r_selected_loops_num)
{
- compute_selected_vertices_from_vertex_selection(
- vertex_selection, r_vertex_map, r_selected_vertices_num);
+ compute_selected_verts_from_vertex_selection(
+ vertex_selection, r_vertex_map, r_selected_verts_num);
compute_selected_edges_from_vertex_selection(
mesh, vertex_selection, r_edge_map, r_selected_edges_num);
- compute_selected_polygons_from_vertex_selection(mesh,
- vertex_selection,
- r_selected_poly_indices,
- r_loop_starts,
- r_selected_polys_num,
- r_selected_loops_num);
+ compute_selected_polys_from_vertex_selection(mesh,
+ vertex_selection,
+ r_selected_poly_indices,
+ r_loop_starts,
+ r_selected_polys_num,
+ r_selected_loops_num);
}
/**
@@ -665,12 +664,12 @@ static void compute_selected_mesh_data_from_edge_selection_edge_face(
{
compute_selected_edges_from_edge_selection(
mesh, edge_selection, r_edge_map, r_selected_edges_num);
- compute_selected_polygons_from_edge_selection(mesh,
- edge_selection,
- r_selected_poly_indices,
- r_loop_starts,
- r_selected_polys_num,
- r_selected_loops_num);
+ compute_selected_polys_from_edge_selection(mesh,
+ edge_selection,
+ r_selected_poly_indices,
+ r_loop_starts,
+ r_selected_polys_num,
+ r_selected_loops_num);
}
/**
@@ -683,35 +682,31 @@ static void compute_selected_mesh_data_from_edge_selection(const Mesh &mesh,
MutableSpan<int> r_edge_map,
Vector<int> &r_selected_poly_indices,
Vector<int> &r_loop_starts,
- int *r_selected_vertices_num,
+ int *r_selected_verts_num,
int *r_selected_edges_num,
int *r_selected_polys_num,
int *r_selected_loops_num)
{
r_vertex_map.fill(-1);
- compute_selected_vertices_and_edges_from_edge_selection(mesh,
- edge_selection,
- r_vertex_map,
- r_edge_map,
- r_selected_vertices_num,
- r_selected_edges_num);
- compute_selected_polygons_from_edge_selection(mesh,
- edge_selection,
- r_selected_poly_indices,
- r_loop_starts,
- r_selected_polys_num,
- r_selected_loops_num);
+ compute_selected_verts_and_edges_from_edge_selection(
+ mesh, edge_selection, r_vertex_map, r_edge_map, r_selected_verts_num, r_selected_edges_num);
+ compute_selected_polys_from_edge_selection(mesh,
+ edge_selection,
+ r_selected_poly_indices,
+ r_loop_starts,
+ r_selected_polys_num,
+ r_selected_loops_num);
}
/**
* Checks for every polygon if it is in `poly_selection`.
*/
-static void compute_selected_polygons_from_poly_selection(const Mesh &mesh,
- const Span<bool> poly_selection,
- Vector<int> &r_selected_poly_indices,
- Vector<int> &r_loop_starts,
- int *r_selected_polys_num,
- int *r_selected_loops_num)
+static void compute_selected_polys_from_poly_selection(const Mesh &mesh,
+ const Span<bool> poly_selection,
+ Vector<int> &r_selected_poly_indices,
+ Vector<int> &r_loop_starts,
+ int *r_selected_polys_num,
+ int *r_selected_loops_num)
{
BLI_assert(mesh.totpoly == poly_selection.size());
const Span<MPoly> polys = mesh.polys();
@@ -792,7 +787,7 @@ static void compute_selected_mesh_data_from_poly_selection(const Mesh &mesh,
MutableSpan<int> r_edge_map,
Vector<int> &r_selected_poly_indices,
Vector<int> &r_loop_starts,
- int *r_selected_vertices_num,
+ int *r_selected_verts_num,
int *r_selected_edges_num,
int *r_selected_polys_num,
int *r_selected_loops_num)
@@ -834,7 +829,7 @@ static void compute_selected_mesh_data_from_poly_selection(const Mesh &mesh,
}
}
}
- *r_selected_vertices_num = selected_verts_num;
+ *r_selected_verts_num = selected_verts_num;
*r_selected_edges_num = selected_edges_num;
*r_selected_polys_num = r_selected_poly_indices.size();
*r_selected_loops_num = selected_loops_num;
@@ -919,30 +914,30 @@ static void do_mesh_separation(GeometrySet &geometry_set,
selected_polys_num);
/* Copy the selected parts of the mesh over to the new mesh. */
- copy_masked_vertices_to_new_mesh(mesh_in, *mesh_out, vertex_map);
+ copy_masked_verts_to_new_mesh(mesh_in, *mesh_out, vertex_map);
copy_masked_edges_to_new_mesh(mesh_in, *mesh_out, vertex_map, edge_map);
copy_masked_polys_to_new_mesh(
mesh_in, *mesh_out, vertex_map, edge_map, selected_poly_indices, new_loop_starts);
/* Copy attributes. */
copy_attributes_based_on_map(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
ATTR_DOMAIN_POINT,
vertex_map);
copy_attributes_based_on_map(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
ATTR_DOMAIN_EDGE,
edge_map);
copy_attributes_based_on_mask(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
ATTR_DOMAIN_FACE,
IndexMask(Vector<int64_t>(selected_poly_indices.as_span())));
copy_face_corner_attributes(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
selected_loops_num,
selected_poly_indices,
mesh_in);
@@ -1002,23 +997,21 @@ static void do_mesh_separation(GeometrySet &geometry_set,
mesh_in, *mesh_out, edge_map, selected_poly_indices, new_loop_starts);
/* Copy attributes. */
- copy_attributes(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
- {ATTR_DOMAIN_POINT});
+ copy_attributes(
+ attributes, mesh_in.attributes(), mesh_out->attributes_for_write(), {ATTR_DOMAIN_POINT});
copy_attributes_based_on_map(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
ATTR_DOMAIN_EDGE,
edge_map);
copy_attributes_based_on_mask(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
ATTR_DOMAIN_FACE,
IndexMask(Vector<int64_t>(selected_poly_indices.as_span())));
copy_face_corner_attributes(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
selected_loops_num,
selected_poly_indices,
mesh_in);
@@ -1028,28 +1021,28 @@ static void do_mesh_separation(GeometrySet &geometry_set,
/* Fill all the maps based on the selection. */
switch (domain) {
case ATTR_DOMAIN_POINT:
- compute_selected_polygons_from_vertex_selection(mesh_in,
- selection,
- selected_poly_indices,
- new_loop_starts,
- &selected_polys_num,
- &selected_loops_num);
+ compute_selected_polys_from_vertex_selection(mesh_in,
+ selection,
+ selected_poly_indices,
+ new_loop_starts,
+ &selected_polys_num,
+ &selected_loops_num);
break;
case ATTR_DOMAIN_EDGE:
- compute_selected_polygons_from_edge_selection(mesh_in,
- selection,
- selected_poly_indices,
- new_loop_starts,
- &selected_polys_num,
- &selected_loops_num);
+ compute_selected_polys_from_edge_selection(mesh_in,
+ selection,
+ selected_poly_indices,
+ new_loop_starts,
+ &selected_polys_num,
+ &selected_loops_num);
break;
case ATTR_DOMAIN_FACE:
- compute_selected_polygons_from_poly_selection(mesh_in,
- selection,
- selected_poly_indices,
- new_loop_starts,
- &selected_polys_num,
- &selected_loops_num);
+ compute_selected_polys_from_poly_selection(mesh_in,
+ selection,
+ selected_poly_indices,
+ new_loop_starts,
+ &selected_polys_num,
+ &selected_loops_num);
break;
default:
BLI_assert_unreachable();
@@ -1065,17 +1058,17 @@ static void do_mesh_separation(GeometrySet &geometry_set,
/* Copy attributes. */
copy_attributes(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
{ATTR_DOMAIN_POINT, ATTR_DOMAIN_EDGE});
copy_attributes_based_on_mask(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
ATTR_DOMAIN_FACE,
IndexMask(Vector<int64_t>(selected_poly_indices.as_span())));
copy_face_corner_attributes(attributes,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out),
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write(),
selected_loops_num,
selected_poly_indices,
mesh_in);
@@ -1094,8 +1087,7 @@ static void separate_mesh_selection(GeometrySet &geometry_set,
{
const Mesh &src_mesh = *geometry_set.get_mesh_for_read();
bke::MeshFieldContext field_context{src_mesh, selection_domain};
- fn::FieldEvaluator evaluator{field_context,
- bke::mesh_attributes(src_mesh).domain_size(selection_domain)};
+ fn::FieldEvaluator evaluator{field_context, src_mesh.attributes().domain_size(selection_domain)};
evaluator.add(selection_field);
evaluator.evaluate();
const VArray<bool> selection = evaluator.get_evaluated<bool>(0);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
index aaab259fc51..b84ee33e26f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_distribute_points_on_faces.cc
@@ -291,8 +291,8 @@ BLI_NOINLINE static void propagate_existing_attributes(
const Span<float3> bary_coords,
const Span<int> looptri_indices)
{
- const AttributeAccessor mesh_attributes = bke::mesh_attributes(mesh);
- MutableAttributeAccessor point_attributes = bke::pointcloud_attributes_for_write(points);
+ const AttributeAccessor mesh_attributes = mesh.attributes();
+ MutableAttributeAccessor point_attributes = points.attributes_for_write();
for (Map<AttributeIDRef, AttributeKind>::Item entry : attributes.items()) {
const AttributeIDRef attribute_id = entry.key;
@@ -333,7 +333,7 @@ BLI_NOINLINE static void compute_attribute_outputs(const Mesh &mesh,
const Span<int> looptri_indices,
const AttributeOutputs &attribute_outputs)
{
- MutableAttributeAccessor point_attributes = bke::pointcloud_attributes_for_write(points);
+ MutableAttributeAccessor point_attributes = points.attributes_for_write();
SpanAttributeWriter<int> ids = point_attributes.lookup_or_add_for_write_only_span<int>(
"id", ATTR_DOMAIN_POINT);
@@ -396,7 +396,7 @@ static Array<float> calc_full_density_factors_with_selection(const Mesh &mesh,
const Field<bool> &selection_field)
{
const eAttrDomain domain = ATTR_DOMAIN_CORNER;
- const int domain_size = bke::mesh_attributes(mesh).domain_size(domain);
+ const int domain_size = mesh.attributes().domain_size(domain);
Array<float> densities(domain_size, 0.0f);
bke::MeshFieldContext field_context{mesh, domain};
@@ -491,8 +491,7 @@ static void point_distribution_calculate(GeometrySet &geometry_set,
}
PointCloud *pointcloud = BKE_pointcloud_new_nomain(positions.size());
- bke::MutableAttributeAccessor point_attributes = bke::pointcloud_attributes_for_write(
- *pointcloud);
+ bke::MutableAttributeAccessor point_attributes = pointcloud->attributes_for_write();
bke::SpanAttributeWriter<float3> point_positions =
point_attributes.lookup_or_add_for_write_only_span<float3>("position", ATTR_DOMAIN_POINT);
bke::SpanAttributeWriter<float> point_radii =
diff --git a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
index 7d81ee91a1c..84e63845b84 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_dual_mesh.cc
@@ -263,10 +263,10 @@ static void calc_boundaries(const Mesh &mesh,
static void create_vertex_poly_map(const Mesh &mesh,
MutableSpan<Vector<int>> r_vertex_poly_indices)
{
- const Span<MPoly> polygons = mesh.polys();
+ const Span<MPoly> polys = mesh.polys();
const Span<MLoop> loops = mesh.loops();
- for (const int i : polygons.index_range()) {
- const MPoly &poly = polygons[i];
+ for (const int i : polys.index_range()) {
+ const MPoly &poly = polys[i];
const Span<MLoop> poly_loops = loops.slice(poly.loopstart, poly.totloop);
for (const MLoop &loop : poly_loops) {
r_vertex_poly_indices[loop.v].append(i);
@@ -335,18 +335,18 @@ static bool sort_vertex_polys(const Span<MEdge> edges,
const int vertex_index,
const bool boundary_vertex,
const Span<EdgeType> edge_types,
- MutableSpan<int> connected_polygons,
+ MutableSpan<int> connected_polys,
MutableSpan<int> r_shared_edges,
MutableSpan<int> r_sorted_corners)
{
- if (connected_polygons.size() <= 2 && (!boundary_vertex || connected_polygons.size() == 0)) {
+ if (connected_polys.size() <= 2 && (!boundary_vertex || connected_polys.size() == 0)) {
return true;
}
/* For each polygon store the two corners whose edge contains the vertex. */
- Array<std::pair<int, int>> poly_vertex_corners(connected_polygons.size());
- for (const int i : connected_polygons.index_range()) {
- const MPoly &poly = polys[connected_polygons[i]];
+ Array<std::pair<int, int>> poly_vertex_corners(connected_polys.size());
+ for (const int i : connected_polys.index_range()) {
+ const MPoly &poly = polys[connected_polys[i]];
bool first_edge_done = false;
for (const int loop_index : IndexRange(poly.loopstart, poly.totloop)) {
const MLoop &loop = loops[loop_index];
@@ -369,20 +369,20 @@ static bool sort_vertex_polys(const Span<MEdge> edges,
* the loop to determine the 'average' orientation. */
if (boundary_vertex) {
/* Our first polygon needs to be one which has a boundary edge. */
- for (const int i : connected_polygons.index_range()) {
+ for (const int i : connected_polys.index_range()) {
const MLoop &first_loop = loops[poly_vertex_corners[i].first];
const MLoop &second_loop = loops[poly_vertex_corners[i].second];
if (edge_types[first_loop.e] == EdgeType::Boundary && first_loop.v == vertex_index) {
shared_edge_i = second_loop.e;
r_sorted_corners[0] = poly_vertex_corners[i].first;
- std::swap(connected_polygons[i], connected_polygons[0]);
+ std::swap(connected_polys[i], connected_polys[0]);
std::swap(poly_vertex_corners[i], poly_vertex_corners[0]);
break;
}
if (edge_types[second_loop.e] == EdgeType::Boundary && second_loop.v == vertex_index) {
shared_edge_i = first_loop.e;
r_sorted_corners[0] = poly_vertex_corners[i].second;
- std::swap(connected_polygons[i], connected_polygons[0]);
+ std::swap(connected_polys[i], connected_polys[0]);
std::swap(poly_vertex_corners[i], poly_vertex_corners[0]);
break;
}
@@ -390,20 +390,20 @@ static bool sort_vertex_polys(const Span<MEdge> edges,
if (shared_edge_i == -1) {
/* The rotation is inconsistent between the two polygons on the boundary. Just choose one
* of the polygon's orientation. */
- for (const int i : connected_polygons.index_range()) {
+ for (const int i : connected_polys.index_range()) {
const MLoop &first_loop = loops[poly_vertex_corners[i].first];
const MLoop &second_loop = loops[poly_vertex_corners[i].second];
if (edge_types[first_loop.e] == EdgeType::Boundary) {
shared_edge_i = second_loop.e;
r_sorted_corners[0] = poly_vertex_corners[i].first;
- std::swap(connected_polygons[i], connected_polygons[0]);
+ std::swap(connected_polys[i], connected_polys[0]);
std::swap(poly_vertex_corners[i], poly_vertex_corners[0]);
break;
}
if (edge_types[second_loop.e] == EdgeType::Boundary) {
shared_edge_i = first_loop.e;
r_sorted_corners[0] = poly_vertex_corners[i].second;
- std::swap(connected_polygons[i], connected_polygons[0]);
+ std::swap(connected_polys[i], connected_polys[0]);
std::swap(poly_vertex_corners[i], poly_vertex_corners[0]);
break;
}
@@ -425,12 +425,12 @@ static bool sort_vertex_polys(const Span<MEdge> edges,
}
BLI_assert(shared_edge_i != -1);
- for (const int i : IndexRange(connected_polygons.size() - 1)) {
+ for (const int i : IndexRange(connected_polys.size() - 1)) {
r_shared_edges[i] = shared_edge_i;
/* Look at the other polys to see if it has this shared edge. */
int j = i + 1;
- for (; j < connected_polygons.size(); ++j) {
+ for (; j < connected_polys.size(); ++j) {
const MLoop &first_loop = loops[poly_vertex_corners[j].first];
const MLoop &second_loop = loops[poly_vertex_corners[j].second];
if (first_loop.e == shared_edge_i) {
@@ -444,13 +444,13 @@ static bool sort_vertex_polys(const Span<MEdge> edges,
break;
}
}
- if (j == connected_polygons.size()) {
+ if (j == connected_polys.size()) {
/* The vertex is not manifold because the polygons around the vertex don't form a loop, and
* hence can't be sorted. */
return false;
}
- std::swap(connected_polygons[i + 1], connected_polygons[j]);
+ std::swap(connected_polys[i + 1], connected_polys[j]);
std::swap(poly_vertex_corners[i + 1], poly_vertex_corners[j]);
}
@@ -918,8 +918,8 @@ static void calc_dual_mesh(GeometrySet &geometry_set,
new_to_old_edges_map,
new_to_old_face_corners_map,
boundary_vertex_to_relevant_face_map,
- bke::mesh_attributes(mesh_in),
- bke::mesh_attributes_for_write(*mesh_out));
+ mesh_in.attributes(),
+ mesh_out->attributes_for_write());
MutableSpan<MVert> dst_verts = mesh_out->verts_for_write();
MutableSpan<MEdge> dst_edges = mesh_out->edges_for_write();
diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
index f0018e91478..d2a3c339301 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc
@@ -593,22 +593,15 @@ static void duplicate_faces(GeometrySet &geometry_set,
loop_mapping,
offsets,
selection,
- bke::mesh_attributes(mesh),
- bke::mesh_attributes_for_write(*new_mesh));
+ mesh.attributes(),
+ new_mesh->attributes_for_write());
- copy_stable_id_faces(mesh,
- selection,
- offsets,
- vert_mapping,
- bke::mesh_attributes(mesh),
- bke::mesh_attributes_for_write(*new_mesh));
+ copy_stable_id_faces(
+ mesh, selection, offsets, vert_mapping, mesh.attributes(), new_mesh->attributes_for_write());
if (attribute_outputs.duplicate_index) {
- create_duplicate_index_attribute(bke::mesh_attributes_for_write(*new_mesh),
- ATTR_DOMAIN_FACE,
- selection,
- attribute_outputs,
- offsets);
+ create_duplicate_index_attribute(
+ new_mesh->attributes_for_write(), ATTR_DOMAIN_FACE, selection, attribute_outputs, offsets);
}
geometry_set.replace_mesh(new_mesh);
@@ -769,17 +762,14 @@ static void duplicate_edges(GeometrySet &geometry_set,
vert_orig_indices,
edge_offsets,
selection,
- bke::mesh_attributes(mesh),
- bke::mesh_attributes_for_write(*new_mesh));
+ mesh.attributes(),
+ new_mesh->attributes_for_write());
- copy_stable_id_edges(mesh,
- selection,
- edge_offsets,
- bke::mesh_attributes(mesh),
- bke::mesh_attributes_for_write(*new_mesh));
+ copy_stable_id_edges(
+ mesh, selection, edge_offsets, mesh.attributes(), new_mesh->attributes_for_write());
if (attribute_outputs.duplicate_index) {
- create_duplicate_index_attribute(bke::mesh_attributes_for_write(*new_mesh),
+ create_duplicate_index_attribute(new_mesh->attributes_for_write(),
ATTR_DOMAIN_EDGE,
selection,
attribute_outputs,
@@ -926,14 +916,13 @@ static void duplicate_points_mesh(GeometrySet &geometry_set,
ATTR_DOMAIN_POINT,
offsets,
selection,
- bke::mesh_attributes(mesh),
- bke::mesh_attributes_for_write(*new_mesh));
+ mesh.attributes(),
+ new_mesh->attributes_for_write());
- copy_stable_id_point(
- offsets, bke::mesh_attributes(mesh), bke::mesh_attributes_for_write(*new_mesh));
+ copy_stable_id_point(offsets, mesh.attributes(), new_mesh->attributes_for_write());
if (attribute_outputs.duplicate_index) {
- create_duplicate_index_attribute(bke::mesh_attributes_for_write(*new_mesh),
+ create_duplicate_index_attribute(new_mesh->attributes_for_write(),
ATTR_DOMAIN_POINT,
selection,
attribute_outputs,
@@ -973,15 +962,13 @@ static void duplicate_points_pointcloud(GeometrySet &geometry_set,
ATTR_DOMAIN_POINT,
offsets,
selection,
- bke::pointcloud_attributes(src_points),
- bke::pointcloud_attributes_for_write(*pointcloud));
+ src_points.attributes(),
+ pointcloud->attributes_for_write());
- copy_stable_id_point(offsets,
- bke::pointcloud_attributes(src_points),
- bke::pointcloud_attributes_for_write(*pointcloud));
+ copy_stable_id_point(offsets, src_points.attributes(), pointcloud->attributes_for_write());
if (attribute_outputs.duplicate_index) {
- create_duplicate_index_attribute(bke::pointcloud_attributes_for_write(*pointcloud),
+ create_duplicate_index_attribute(pointcloud->attributes_for_write(),
ATTR_DOMAIN_POINT,
selection,
attribute_outputs,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc
index ac66e3906a7..9ef9ee8ad6e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_edge_paths_to_selection.cc
@@ -59,9 +59,9 @@ class PathToEdgeSelectionFieldInput final : public bke::MeshFieldInput {
Field<int> next_vertex_;
public:
- PathToEdgeSelectionFieldInput(Field<bool> start_vertices, Field<int> next_vertex)
+ PathToEdgeSelectionFieldInput(Field<bool> start_verts, Field<int> next_vertex)
: bke::MeshFieldInput(CPPType::get<bool>(), "Edge Selection"),
- start_vertices_(start_vertices),
+ start_vertices_(start_verts),
next_vertex_(next_vertex)
{
category_ = Category::Generated;
@@ -88,7 +88,7 @@ class PathToEdgeSelectionFieldInput final : public bke::MeshFieldInput {
edge_paths_to_selection(mesh, start_verts, next_vert, selection_span);
- return bke::mesh_attributes(mesh).adapt_domain<bool>(
+ return mesh.attributes().adapt_domain<bool>(
VArray<bool>::ForContainer(std::move(selection)), ATTR_DOMAIN_EDGE, domain);
}
@@ -110,10 +110,10 @@ class PathToEdgeSelectionFieldInput final : public bke::MeshFieldInput {
static void node_geo_exec(GeoNodeExecParams params)
{
- Field<bool> start_vertices = params.extract_input<Field<bool>>("Start Vertices");
+ Field<bool> start_verts = params.extract_input<Field<bool>>("Start Vertices");
Field<int> next_vertex = params.extract_input<Field<int>>("Next Vertex Index");
Field<bool> selection_field{
- std::make_shared<PathToEdgeSelectionFieldInput>(start_vertices, next_vertex)};
+ std::make_shared<PathToEdgeSelectionFieldInput>(start_verts, next_vertex)};
params.set_output("Selection", std::move(selection_field));
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
index d335a162776..9224e9d55f3 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc
@@ -66,7 +66,7 @@ static void save_selection_as_attribute(Mesh &mesh,
const eAttrDomain domain,
const IndexMask selection)
{
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
BLI_assert(!attributes.contains(id));
SpanAttributeWriter<bool> attribute = attributes.lookup_or_add_for_write_span<bool>(id, domain);
@@ -138,7 +138,7 @@ static CustomData &get_customdata(Mesh &mesh, const eAttrDomain domain)
static MutableSpan<int> get_orig_index_layer(Mesh &mesh, const eAttrDomain domain)
{
- const bke::AttributeAccessor attributes = bke::mesh_attributes(mesh);
+ const bke::AttributeAccessor attributes = mesh.attributes();
CustomData &custom_data = get_customdata(mesh, domain);
if (int *orig_indices = static_cast<int *>(CustomData_get_layer(&custom_data, CD_ORIGINDEX))) {
return {orig_indices, attributes.domain_size(domain)};
@@ -252,7 +252,7 @@ static void extrude_mesh_vertices(Mesh &mesh,
new_edges[i_selection] = new_loose_edge(selection[i_selection], new_vert_range[i_selection]);
}
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
attributes.for_all([&](const AttributeIDRef &id, const AttributeMetaData meta_data) {
if (!ELEM(meta_data.domain, ATTR_DOMAIN_POINT, ATTR_DOMAIN_EDGE)) {
@@ -498,7 +498,7 @@ static void extrude_mesh_edges(Mesh &mesh,
const Array<Vector<int>> new_vert_to_duplicate_edge_map = create_vert_to_edge_map(
new_vert_range.size(), duplicate_edges, orig_vert_size);
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
attributes.for_all([&](const AttributeIDRef &id, const AttributeMetaData meta_data) {
GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span(
@@ -878,7 +878,7 @@ static void extrude_mesh_face_regions(Mesh &mesh,
const Array<Vector<int>> new_vert_to_duplicate_edge_map = create_vert_to_edge_map(
new_vert_range.size(), boundary_edges, orig_vert_size);
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
attributes.for_all([&](const AttributeIDRef &id, const AttributeMetaData meta_data) {
GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span(
@@ -1132,7 +1132,7 @@ static void extrude_individual_mesh_faces(Mesh &mesh,
}
});
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
attributes.for_all([&](const AttributeIDRef &id, const AttributeMetaData meta_data) {
GSpanAttributeWriter attribute = attributes.lookup_or_add_for_write_span(
diff --git a/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc b/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc
index fc9c9870c5c..613425716d4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_flip_faces.cc
@@ -44,7 +44,7 @@ static void mesh_flip_faces(Mesh &mesh, const Field<bool> &selection_field)
}
}
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
attributes.for_all(
[&](const bke::AttributeIDRef &attribute_id, const AttributeMetaData &meta_data) {
if (meta_data.domain == ATTR_DOMAIN_CORNER) {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc
index f2304849cbc..f2e7379b3a2 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_angle.cc
@@ -82,8 +82,7 @@ class AngleFieldInput final : public bke::MeshFieldInput {
};
VArray<float> angles = VArray<float>::ForFunc(mesh.totedge, angle_fn);
- return bke::mesh_attributes(mesh).adapt_domain<float>(
- std::move(angles), ATTR_DOMAIN_EDGE, domain);
+ return mesh.attributes().adapt_domain<float>(std::move(angles), ATTR_DOMAIN_EDGE, domain);
}
uint64_t hash() const override
@@ -150,8 +149,7 @@ class SignedAngleFieldInput final : public bke::MeshFieldInput {
};
VArray<float> angles = VArray<float>::ForFunc(mesh.totedge, angle_fn);
- return bke::mesh_attributes(mesh).adapt_domain<float>(
- std::move(angles), ATTR_DOMAIN_EDGE, domain);
+ return mesh.attributes().adapt_domain<float>(std::move(angles), ATTR_DOMAIN_EDGE, domain);
}
uint64_t hash() const override
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc
index 716cbf589d9..bfe8753c039 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_neighbors.cc
@@ -34,7 +34,7 @@ class EdgeNeighborCountFieldInput final : public bke::MeshFieldInput {
face_count[loop.e]++;
}
- return bke::mesh_attributes(mesh).adapt_domain<int>(
+ return mesh.attributes().adapt_domain<int>(
VArray<int>::ForContainer(std::move(face_count)), ATTR_DOMAIN_EDGE, domain);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc
index 50ebf78e58f..c8ceae239a4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_edge_vertices.cc
@@ -27,9 +27,9 @@ static void node_declare(NodeDeclarationBuilder &b)
enum VertexNumber { VERTEX_ONE, VERTEX_TWO };
-static VArray<int> construct_edge_vertices_gvarray(const Mesh &mesh,
- const VertexNumber vertex,
- const eAttrDomain domain)
+static VArray<int> construct_edge_verts_gvarray(const Mesh &mesh,
+ const VertexNumber vertex,
+ const eAttrDomain domain)
{
const Span<MEdge> edges = mesh.edges();
if (domain == ATTR_DOMAIN_EDGE) {
@@ -57,7 +57,7 @@ class EdgeVerticesFieldInput final : public bke::MeshFieldInput {
const eAttrDomain domain,
IndexMask UNUSED(mask)) const final
{
- return construct_edge_vertices_gvarray(mesh, vertex_, domain);
+ return construct_edge_verts_gvarray(mesh, vertex_, domain);
}
uint64_t hash() const override
@@ -83,13 +83,13 @@ static VArray<float3> construct_edge_positions_gvarray(const Mesh &mesh,
const Span<MEdge> edges = mesh.edges();
if (vertex == VERTEX_ONE) {
- return bke::mesh_attributes(mesh).adapt_domain<float3>(
+ return mesh.attributes().adapt_domain<float3>(
VArray<float3>::ForFunc(edges.size(),
[verts, edges](const int i) { return verts[edges[i].v1].co; }),
ATTR_DOMAIN_EDGE,
domain);
}
- return bke::mesh_attributes(mesh).adapt_domain<float3>(
+ return mesh.attributes().adapt_domain<float3>(
VArray<float3>::ForFunc(edges.size(),
[verts, edges](const int i) { return verts[edges[i].v2].co; }),
ATTR_DOMAIN_EDGE,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc
index c4d792c6c9a..be921c1f1c5 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_area.cc
@@ -27,7 +27,7 @@ static VArray<float> construct_face_area_varray(const Mesh &mesh, const eAttrDom
return BKE_mesh_calc_poly_area(&poly, &loops[poly.loopstart], verts.data());
};
- return bke::mesh_attributes(mesh).adapt_domain<float>(
+ return mesh.attributes().adapt_domain<float>(
VArray<float>::ForFunc(polys.size(), area_fn), ATTR_DOMAIN_FACE, domain);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
index 040b243a868..72c45de7b0f 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_is_planar.cc
@@ -72,7 +72,7 @@ class PlanarFieldInput final : public bke::MeshFieldInput {
return max - min < thresholds[i] / 2.0f;
};
- return bke::mesh_attributes(mesh).adapt_domain<bool>(
+ return mesh.attributes().adapt_domain<bool>(
VArray<bool>::ForFunc(polys.size(), planar_fn), ATTR_DOMAIN_FACE, domain);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc
index cd58a0ad428..9e85eae3a31 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_face_neighbors.cc
@@ -37,7 +37,7 @@ static VArray<int> construct_neighbor_count_varray(const Mesh &mesh, const eAttr
}
}
- return bke::mesh_attributes(mesh).adapt_domain<int>(
+ return mesh.attributes().adapt_domain<int>(
VArray<int>::ForContainer(std::move(poly_count)), ATTR_DOMAIN_FACE, domain);
}
@@ -71,7 +71,7 @@ class FaceNeighborCountFieldInput final : public bke::MeshFieldInput {
static VArray<int> construct_vertex_count_varray(const Mesh &mesh, const eAttrDomain domain)
{
const Span<MPoly> polys = mesh.polys();
- return bke::mesh_attributes(mesh).adapt_domain<int>(
+ return mesh.attributes().adapt_domain<int>(
VArray<int>::ForFunc(polys.size(),
[polys](const int i) -> float { return polys[i].totloop; }),
ATTR_DOMAIN_FACE,
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc
index 53cb3d0a19f..9d7735e707d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_mesh_island.cc
@@ -47,7 +47,7 @@ class IslandFieldInput final : public bke::MeshFieldInput {
output[i] = ordered_roots.index_of_or_add(root);
}
- return bke::mesh_attributes(mesh).adapt_domain<int>(
+ return mesh.attributes().adapt_domain<int>(
VArray<int>::ForContainer(std::move(output)), ATTR_DOMAIN_POINT, domain);
}
@@ -87,8 +87,7 @@ class IslandCountFieldInput final : public bke::MeshFieldInput {
island_list.add(root);
}
- return VArray<int>::ForSingle(island_list.size(),
- bke::mesh_attributes(mesh).domain_size(domain));
+ return VArray<int>::ForSingle(island_list.size(), mesh.attributes().domain_size(domain));
}
uint64_t hash() const override
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc b/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
index e13edc8f979..a54daabde3b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_shortest_edge_paths.cc
@@ -125,7 +125,7 @@ class ShortestEdgePathsNextVertFieldInput final : public bke::MeshFieldInput {
}
}
});
- return bke::mesh_attributes(mesh).adapt_domain<int>(
+ return mesh.attributes().adapt_domain<int>(
VArray<int>::ForContainer(std::move(next_index)), ATTR_DOMAIN_POINT, domain);
}
@@ -189,7 +189,7 @@ class ShortestEdgePathsCostFieldInput final : public bke::MeshFieldInput {
}
}
});
- return bke::mesh_attributes(mesh).adapt_domain<float>(
+ return mesh.attributes().adapt_domain<float>(
VArray<float>::ForContainer(std::move(cost)), ATTR_DOMAIN_POINT, domain);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc
index 2a80d7d855a..ec2f1b00e6c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc
@@ -45,8 +45,7 @@ static void convert_instances_to_points(GeometrySet &geometry_set,
PointCloud *pointcloud = BKE_pointcloud_new_nomain(selection.size());
geometry_set.replace_pointcloud(pointcloud);
- bke::MutableAttributeAccessor point_attributes = bke::pointcloud_attributes_for_write(
- *pointcloud);
+ bke::MutableAttributeAccessor point_attributes = pointcloud->attributes_for_write();
bke::SpanAttributeWriter<float3> point_positions =
point_attributes.lookup_or_add_for_write_only_span<float3>("position", ATTR_DOMAIN_POINT);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
index 9822e0ea0d6..628688f3b47 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_material_selection.cc
@@ -32,7 +32,7 @@ static void select_mesh_by_material(const Mesh &mesh,
slots.append(i);
}
}
- const AttributeAccessor attributes = bke::mesh_attributes(mesh);
+ const AttributeAccessor attributes = mesh.attributes();
const VArray<int> material_indices = attributes.lookup_or_default<int>(
"material_index", ATTR_DOMAIN_FACE, 0);
if (material != nullptr && material_indices.is_single() &&
@@ -81,7 +81,7 @@ class MaterialSelectionFieldInput final : public bke::GeometryFieldInput {
Array<bool> selection(mesh->totpoly);
select_mesh_by_material(*mesh, material_, IndexMask(mesh->totpoly), selection);
- return bke::mesh_attributes(*mesh).adapt_domain<bool>(
+ return mesh->attributes().adapt_domain<bool>(
VArray<bool>::ForContainer(std::move(selection)), ATTR_DOMAIN_FACE, domain);
return nullptr;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
index 93ecc96337e..edf14f664c5 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cone.cc
@@ -255,7 +255,7 @@ int ConeConfig::calculate_total_corners()
return corner_total;
}
-static void calculate_cone_vertices(const MutableSpan<MVert> &verts, const ConeConfig &config)
+static void calculate_cone_verts(const MutableSpan<MVert> &verts, const ConeConfig &config)
{
Array<float2> circle(config.circle_segments);
const float angle_delta = 2.0f * (M_PI / static_cast<float>(config.circle_segments));
@@ -480,7 +480,7 @@ static void calculate_selection_outputs(Mesh *mesh,
const ConeConfig &config,
ConeAttributeOutputs &attribute_outputs)
{
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ MutableAttributeAccessor attributes = mesh->attributes_for_write();
/* Populate "Top" selection output. */
if (attribute_outputs.top_id) {
@@ -536,7 +536,7 @@ static void calculate_selection_outputs(Mesh *mesh,
*/
static void calculate_cone_uvs(Mesh *mesh, const ConeConfig &config)
{
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ MutableAttributeAccessor attributes = mesh->attributes_for_write();
SpanAttributeWriter<float2> uv_attribute = attributes.lookup_or_add_for_write_only_span<float2>(
"uv_map", ATTR_DOMAIN_CORNER);
@@ -694,7 +694,7 @@ Mesh *create_cylinder_or_cone_mesh(const float radius_top,
MutableSpan<MPoly> polys = mesh->polys_for_write();
MutableSpan<MLoop> loops = mesh->loops_for_write();
- calculate_cone_vertices(verts, config);
+ calculate_cone_verts(verts, config);
calculate_cone_edges(edges, config);
calculate_cone_faces(loops, polys, config);
calculate_cone_uvs(mesh, config);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
index d8a4db43b27..6f0b8283b72 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_grid.cc
@@ -18,7 +18,7 @@ namespace blender::nodes {
static void calculate_uvs(
Mesh *mesh, Span<MVert> verts, Span<MLoop> loops, const float size_x, const float size_y)
{
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ MutableAttributeAccessor attributes = mesh->attributes_for_write();
SpanAttributeWriter<float2> uv_attribute = attributes.lookup_or_add_for_write_only_span<float2>(
"uv_map", ATTR_DOMAIN_CORNER);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
index b2f629806cd..4fd6399f4eb 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_line.cc
@@ -179,15 +179,15 @@ Mesh *create_line_mesh(const float3 start, const float3 delta, const int count)
Mesh *mesh = BKE_mesh_new_nomain(count, count - 1, 0, 0, 0);
BKE_id_material_eval_ensure_default_slot(&mesh->id);
- MutableSpan<MVert> vertices = mesh->verts_for_write();
+ MutableSpan<MVert> verts = mesh->verts_for_write();
MutableSpan<MEdge> edges = mesh->edges_for_write();
threading::parallel_invoke(
1024 < count,
[&]() {
- threading::parallel_for(vertices.index_range(), 4096, [&](IndexRange range) {
+ threading::parallel_for(verts.index_range(), 4096, [&](IndexRange range) {
for (const int i : range) {
- copy_v3_v3(vertices[i].co, start + delta * i);
+ copy_v3_v3(verts[i].co, start + delta * i);
}
});
},
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
index 017132b1a43..d39e72b7f0a 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_uv_sphere.cc
@@ -254,7 +254,7 @@ BLI_NOINLINE static void calculate_sphere_corners(MutableSpan<MLoop> loops,
BLI_NOINLINE static void calculate_sphere_uvs(Mesh *mesh, const float segments, const float rings)
{
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(*mesh);
+ MutableAttributeAccessor attributes = mesh->attributes_for_write();
SpanAttributeWriter<float2> uv_attribute = attributes.lookup_or_add_for_write_only_span<float2>(
"uv_map", ATTR_DOMAIN_CORNER);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
index d5c7fec4ce7..a1d6695b33b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc
@@ -2,6 +2,7 @@
#include "BLI_task.hh"
+#include "DNA_mesh_types.h"
#include "DNA_pointcloud_types.h"
#include "BKE_attribute_math.hh"
@@ -65,7 +66,7 @@ static void geometry_set_mesh_to_points(GeometrySet &geometry_set,
geometry_set.remove_geometry_during_modify();
return;
}
- const int domain_size = bke::mesh_attributes(*mesh).domain_size(domain);
+ const int domain_size = mesh->attributes().domain_size(domain);
if (domain_size == 0) {
geometry_set.remove_geometry_during_modify();
return;
@@ -83,7 +84,7 @@ static void geometry_set_mesh_to_points(GeometrySet &geometry_set,
PointCloud *pointcloud = BKE_pointcloud_new_nomain(selection.size());
geometry_set.replace_pointcloud(pointcloud);
- MutableAttributeAccessor dst_attributes = bke::pointcloud_attributes_for_write(*pointcloud);
+ MutableAttributeAccessor dst_attributes = pointcloud->attributes_for_write();
GSpanAttributeWriter position = dst_attributes.lookup_or_add_for_write_only_span(
"position", ATTR_DOMAIN_POINT, CD_PROP_FLOAT3);
@@ -102,7 +103,7 @@ static void geometry_set_mesh_to_points(GeometrySet &geometry_set,
{GEO_COMPONENT_TYPE_MESH}, GEO_COMPONENT_TYPE_POINT_CLOUD, false, attributes);
attributes.remove("position");
- const AttributeAccessor src_attributes = bke::mesh_attributes(*mesh);
+ const AttributeAccessor src_attributes = mesh->attributes();
for (Map<AttributeIDRef, AttributeKind>::Item entry : attributes.items()) {
const AttributeIDRef attribute_id = entry.key;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_points.cc b/source/blender/nodes/geometry/nodes/node_geo_points.cc
index e0ba1f1c810..4a294076834 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points.cc
@@ -1,6 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "BKE_pointcloud.h"
+#include "DNA_pointcloud_types.h"
#include "BLI_task.hh"
@@ -70,7 +71,7 @@ static void node_geo_exec(GeoNodeExecParams params)
Field<float> radius_field = params.extract_input<Field<float>>("Radius");
PointCloud *points = BKE_pointcloud_new_nomain(count);
- MutableAttributeAccessor attributes = bke::pointcloud_attributes_for_write(*points);
+ MutableAttributeAccessor attributes = points->attributes_for_write();
AttributeWriter<float3> output_position = attributes.lookup_or_add_for_write<float3>(
"position", ATTR_DOMAIN_POINT);
AttributeWriter<float> output_radii = attributes.lookup_or_add_for_write<float>(
diff --git a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc
index 1f6ffca0303..4ac3bf712f7 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_points_to_vertices.cc
@@ -47,8 +47,8 @@ static void geometry_set_points_to_vertices(GeometrySet &geometry_set,
Mesh *mesh = BKE_mesh_new_nomain(selection.size(), 0, 0, 0, 0);
geometry_set.replace_mesh(mesh);
- const AttributeAccessor src_attributes = bke::pointcloud_attributes(*points);
- MutableAttributeAccessor dst_attributes = bke::mesh_attributes_for_write(*mesh);
+ const AttributeAccessor src_attributes = points->attributes();
+ MutableAttributeAccessor dst_attributes = mesh->attributes_for_write();
for (Map<AttributeIDRef, AttributeKind>::Item entry : attributes.items()) {
const AttributeIDRef attribute_id = entry.key;
diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
index 5c2ec74b59e..f657b128c51 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc
@@ -312,7 +312,7 @@ class RaycastFunction : public fn::MultiFunction {
}
const Mesh &mesh = *target_.get_mesh_for_read();
target_context_.emplace(bke::MeshFieldContext{mesh, domain_});
- const int domain_size = bke::mesh_attributes(mesh).domain_size(domain_);
+ const int domain_size = mesh.attributes().domain_size(domain_);
target_evaluator_ = std::make_unique<FieldEvaluator>(*target_context_, domain_size);
target_evaluator_->add(std::move(src_field));
target_evaluator_->evaluate();
diff --git a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc
index 8fd05e70ed3..2ebbf88b8ad 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc
@@ -282,11 +282,11 @@ static Vector<ElementIsland> prepare_face_islands(const Mesh &mesh, const IndexM
return islands;
}
-static void get_face_vertices(const Span<MEdge> /*edges*/,
- const Span<MPoly> polys,
- const Span<MLoop> loops,
- int face_index,
- VectorSet<int> &r_vertex_indices)
+static void get_face_verts(const Span<MEdge> /*edges*/,
+ const Span<MPoly> polys,
+ const Span<MLoop> loops,
+ int face_index,
+ VectorSet<int> &r_vertex_indices)
{
const MPoly &poly = polys[face_index];
const Span<MLoop> poly_loops = loops.slice(poly.loopstart, poly.totloop);
@@ -315,7 +315,7 @@ static void scale_faces_on_axis(Mesh &mesh, const AxisScaleFields &fields)
AxisScaleParams params = evaluate_axis_scale_fields(evaluator, fields);
Vector<ElementIsland> island = prepare_face_islands(mesh, params.selection);
- scale_vertex_islands_on_axis(mesh, island, params, get_face_vertices);
+ scale_vertex_islands_on_axis(mesh, island, params, get_face_verts);
}
static UniformScaleParams evaluate_uniform_scale_fields(FieldEvaluator &evaluator,
@@ -337,7 +337,7 @@ static void scale_faces_uniformly(Mesh &mesh, const UniformScaleFields &fields)
UniformScaleParams params = evaluate_uniform_scale_fields(evaluator, fields);
Vector<ElementIsland> island = prepare_face_islands(mesh, params.selection);
- scale_vertex_islands_uniformly(mesh, island, params, get_face_vertices);
+ scale_vertex_islands_uniformly(mesh, island, params, get_face_verts);
}
static Vector<ElementIsland> prepare_edge_islands(const Mesh &mesh, const IndexMask edge_selection)
@@ -371,11 +371,11 @@ static Vector<ElementIsland> prepare_edge_islands(const Mesh &mesh, const IndexM
return islands;
}
-static void get_edge_vertices(const Span<MEdge> edges,
- const Span<MPoly> /*polygons*/,
- const Span<MLoop> /*loops*/,
- int edge_index,
- VectorSet<int> &r_vertex_indices)
+static void get_edge_verts(const Span<MEdge> edges,
+ const Span<MPoly> /*polys*/,
+ const Span<MLoop> /*loops*/,
+ int edge_index,
+ VectorSet<int> &r_vertex_indices)
{
const MEdge &edge = edges[edge_index];
r_vertex_indices.add(edge.v1);
@@ -389,7 +389,7 @@ static void scale_edges_uniformly(Mesh &mesh, const UniformScaleFields &fields)
UniformScaleParams params = evaluate_uniform_scale_fields(evaluator, fields);
Vector<ElementIsland> island = prepare_edge_islands(mesh, params.selection);
- scale_vertex_islands_uniformly(mesh, island, params, get_edge_vertices);
+ scale_vertex_islands_uniformly(mesh, island, params, get_edge_verts);
}
static void scale_edges_on_axis(Mesh &mesh, const AxisScaleFields &fields)
@@ -399,7 +399,7 @@ static void scale_edges_on_axis(Mesh &mesh, const AxisScaleFields &fields)
AxisScaleParams params = evaluate_axis_scale_fields(evaluator, fields);
Vector<ElementIsland> island = prepare_edge_islands(mesh, params.selection);
- scale_vertex_islands_on_axis(mesh, island, params, get_edge_vertices);
+ scale_vertex_islands_on_axis(mesh, island, params, get_edge_verts);
}
static void node_geo_exec(GeoNodeExecParams params)
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
index 3aee25b0693..8d00d82664b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_material.cc
@@ -50,7 +50,7 @@ static void assign_material_to_faces(Mesh &mesh, const IndexMask selection, Mate
BKE_id_material_eval_assign(&mesh.id, new_material_index + 1, material);
}
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
SpanAttributeWriter<int> material_indices = attributes.lookup_or_add_for_write_span<int>(
"material_index", ATTR_DOMAIN_FACE);
material_indices.span.fill_indices(selection, new_material_index);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc b/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc
index f1ac6e7f14c..28d07b31218 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_point_radius.cc
@@ -25,7 +25,7 @@ static void set_radius_in_component(PointCloud &pointcloud,
if (pointcloud.totpoint == 0) {
return;
}
- MutableAttributeAccessor attributes = bke::pointcloud_attributes_for_write(pointcloud);
+ MutableAttributeAccessor attributes = pointcloud.attributes_for_write();
AttributeWriter<float> radii = attributes.lookup_or_add_for_write<float>("radius",
ATTR_DOMAIN_POINT);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc b/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc
index fa4d3eb6ac9..0df51e49827 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_set_shade_smooth.cc
@@ -22,7 +22,7 @@ static void set_smooth(Mesh &mesh,
return;
}
- MutableAttributeAccessor attributes = bke::mesh_attributes_for_write(mesh);
+ MutableAttributeAccessor attributes = mesh.attributes_for_write();
AttributeWriter<bool> smooth = attributes.lookup_or_add_for_write<bool>("shade_smooth",
ATTR_DOMAIN_FACE);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
index 13bfe78fbe5..afc492c40e4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_transfer_attribute.cc
@@ -235,12 +235,12 @@ static void get_closest_mesh_looptris(const Mesh &mesh,
free_bvhtree_from_mesh(&tree_data);
}
-static void get_closest_mesh_polygons(const Mesh &mesh,
- const VArray<float3> &positions,
- const IndexMask mask,
- const MutableSpan<int> r_poly_indices,
- const MutableSpan<float> r_distances_sq,
- const MutableSpan<float3> r_positions)
+static void get_closest_mesh_polys(const Mesh &mesh,
+ const VArray<float3> &positions,
+ const IndexMask mask,
+ const MutableSpan<int> r_poly_indices,
+ const MutableSpan<float> r_distances_sq,
+ const MutableSpan<float3> r_positions)
{
BLI_assert(mesh.totpoly > 0);
@@ -270,7 +270,7 @@ static void get_closest_mesh_corners(const Mesh &mesh,
BLI_assert(mesh.totloop > 0);
Array<int> poly_indices(positions.size());
- get_closest_mesh_polygons(mesh, positions, mask, poly_indices, {}, {});
+ get_closest_mesh_polys(mesh, positions, mask, poly_indices, {}, {});
for (const int i : mask) {
const float3 position = positions[i];
@@ -438,7 +438,7 @@ class NearestInterpolatedTransferFunction : public fn::MultiFunction {
{
const Mesh &mesh = *source_.get_mesh_for_read();
source_context_.emplace(bke::MeshFieldContext{mesh, domain_});
- const int domain_size = bke::mesh_attributes(mesh).domain_size(domain_);
+ const int domain_size = mesh.attributes().domain_size(domain_);
source_evaluator_ = std::make_unique<FieldEvaluator>(*source_context_, domain_size);
source_evaluator_->add(src_field_);
source_evaluator_->evaluate();
@@ -540,7 +540,7 @@ class NearestTransferFunction : public fn::MultiFunction {
break;
}
case ATTR_DOMAIN_FACE: {
- get_closest_mesh_polygons(*mesh, positions, mask, mesh_indices, mesh_distances, {});
+ get_closest_mesh_polys(*mesh, positions, mask, mesh_indices, mesh_distances, {});
break;
}
case ATTR_DOMAIN_CORNER: {
@@ -583,7 +583,7 @@ class NearestTransferFunction : public fn::MultiFunction {
{
if (use_mesh_) {
const Mesh &mesh = *source_.get_mesh_for_read();
- const int domain_size = bke::mesh_attributes(mesh).domain_size(domain_);
+ const int domain_size = mesh.attributes().domain_size(domain_);
mesh_context_.emplace(bke::MeshFieldContext(mesh, domain_));
mesh_evaluator_ = std::make_unique<FieldEvaluator>(*mesh_context_, domain_size);
mesh_evaluator_->add(src_field_);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_transform.cc b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
index 0a36f58ba09..4130cad3bda 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_transform.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_transform.cc
@@ -47,7 +47,7 @@ static void transform_mesh(Mesh &mesh, const float4x4 &transform)
static void translate_pointcloud(PointCloud &pointcloud, const float3 translation)
{
- MutableAttributeAccessor attributes = bke::pointcloud_attributes_for_write(pointcloud);
+ MutableAttributeAccessor attributes = pointcloud.attributes_for_write();
SpanAttributeWriter position = attributes.lookup_or_add_for_write_span<float3>(
"position", ATTR_DOMAIN_POINT);
for (const int i : position.span.index_range()) {
@@ -58,7 +58,7 @@ static void translate_pointcloud(PointCloud &pointcloud, const float3 translatio
static void transform_pointcloud(PointCloud &pointcloud, const float4x4 &transform)
{
- MutableAttributeAccessor attributes = bke::pointcloud_attributes_for_write(pointcloud);
+ MutableAttributeAccessor attributes = pointcloud.attributes_for_write();
SpanAttributeWriter position = attributes.lookup_or_add_for_write_span<float3>(
"position", ATTR_DOMAIN_POINT);
for (const int i : position.span.index_range()) {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc b/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc
index 4953a0aa8d0..ccb489f6e29 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_uv_pack_islands.cc
@@ -87,7 +87,7 @@ static VArray<float3> construct_uv_gvarray(const Mesh &mesh,
GEO_uv_parametrizer_flush(handle);
GEO_uv_parametrizer_delete(handle);
- return bke::mesh_attributes(mesh).adapt_domain<float3>(
+ return mesh.attributes().adapt_domain<float3>(
VArray<float3>::ForContainer(std::move(uv)), ATTR_DOMAIN_CORNER, domain);
}
diff --git a/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc b/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc
index 513b9534c55..801bc3f4642 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_uv_unwrap.cc
@@ -126,7 +126,7 @@ static VArray<float3> construct_uv_gvarray(const Mesh &mesh,
GEO_uv_parametrizer_flush(handle);
GEO_uv_parametrizer_delete(handle);
- return bke::mesh_attributes(mesh).adapt_domain<float3>(
+ return mesh.attributes().adapt_domain<float3>(
VArray<float3>::ForContainer(std::move(uv)), ATTR_DOMAIN_CORNER, domain);
}
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 0393be93bb5..775b62e7d39 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -861,7 +861,7 @@ void WM_operator_properties_select_action(struct wmOperatorType *ot,
int default_action,
bool hide_gui);
/**
- * Only #SELECT / #DESELECT.
+ * Only for select/de-select.
*/
void WM_operator_properties_select_action_simple(struct wmOperatorType *ot,
int default_action,