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-04-07 00:30:27 +0300
committerHans Goudey <h.goudey@me.com>2022-04-07 00:30:27 +0300
commit8551e890687de7185388eed9e77171b0df7943a3 (patch)
tree7833056784792f3a46ac8fb6bd9776f3ced33367 /source/blender/editors/curves
parent8b04308953adae983562026a2aa7bbd38e74174d (diff)
Curves: Name mutable data retrieval functions explicitly
Add "for_write" on function names that retrieve mutable data arrays. Though this makes function names longer, it's likely worth it because it allows more easily using the const functions in a non-const context, and reduces cases of mistakenly retrieving with edit access. In the long term, this situation might change more if we implement attributes storage that is accessible directly on `CurvesGeometry` without duplicating the attribute API on geometry components, which is currently the rough plan. Differential Revision: https://developer.blender.org/D14562
Diffstat (limited to 'source/blender/editors/curves')
-rw-r--r--source/blender/editors/curves/intern/curves_add.cc4
-rw-r--r--source/blender/editors/curves/intern/curves_ops.cc2
2 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/editors/curves/intern/curves_add.cc b/source/blender/editors/curves/intern/curves_add.cc
index 17108619a4d..7d9e663c444 100644
--- a/source/blender/editors/curves/intern/curves_add.cc
+++ b/source/blender/editors/curves/intern/curves_add.cc
@@ -16,8 +16,8 @@ bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int poi
{
bke::CurvesGeometry curves(points_per_curve * curves_size, curves_size);
- MutableSpan<int> offsets = curves.offsets();
- MutableSpan<float3> positions = curves.positions();
+ MutableSpan<int> offsets = curves.offsets_for_write();
+ MutableSpan<float3> positions = curves.positions_for_write();
float *radius_data = (float *)CustomData_add_layer_named(
&curves.point_data, CD_PROP_FLOAT, CD_DEFAULT, nullptr, curves.point_size, "radius");
diff --git a/source/blender/editors/curves/intern/curves_ops.cc b/source/blender/editors/curves/intern/curves_ops.cc
index 07dd650d433..c6dd4508b5a 100644
--- a/source/blender/editors/curves/intern/curves_ops.cc
+++ b/source/blender/editors/curves/intern/curves_ops.cc
@@ -134,7 +134,7 @@ static int curves_convert_to_particle_system_exec(bContext *C, wmOperator *UNUSE
Mesh &surface_me = *static_cast<Mesh *>(surface_ob.data);
const Span<float3> positions_cu = curves.positions();
- const VArray<int> looptri_indices = std::as_const(curves).surface_triangle_indices();
+ const VArray<int> looptri_indices = curves.surface_triangle_indices();
const Span<MLoopTri> looptris{BKE_mesh_runtime_looptri_ensure(&surface_me),
BKE_mesh_runtime_looptri_len(&surface_me)};