From f7c0f1b8b83ac475755b633abf59cf9f447b2d49 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 9 Jun 2020 11:58:47 +0200 Subject: BLI: rename ArrayRef to Span This also renames `MutableArrayRef` to `MutableSpan`. The name "Span" works better, because `std::span` will provide similar functionality in C++20. Furthermore, a shorter, more concise name for a common data structure is nice. --- source/blender/blenkernel/intern/simulation.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source/blender/blenkernel/intern/simulation.cc') diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc index 8f08665ab8a..20a23ab8b38 100644 --- a/source/blender/blenkernel/intern/simulation.cc +++ b/source/blender/blenkernel/intern/simulation.cc @@ -27,11 +27,11 @@ #include "DNA_scene_types.h" #include "DNA_simulation_types.h" -#include "BLI_array_ref.hh" #include "BLI_compiler_compat.h" #include "BLI_float3.hh" #include "BLI_listbase.h" #include "BLI_math.h" +#include "BLI_span.hh" #include "BLI_string.h" #include "BLI_utildefines.h" @@ -54,9 +54,9 @@ #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" -using blender::ArrayRef; using blender::float3; -using blender::MutableArrayRef; +using blender::MutableSpan; +using blender::Span; static void simulation_init_data(ID *id) { @@ -168,9 +168,9 @@ void *BKE_simulation_add(Main *bmain, const char *name) return simulation; } -static MutableArrayRef get_particle_positions(ParticleSimulationState *state) +static MutableSpan get_particle_positions(ParticleSimulationState *state) { - return MutableArrayRef( + return MutableSpan( (float3 *)CustomData_get_layer_named(&state->attributes, CD_LOCATION, "Position"), state->tot_particles); } @@ -239,7 +239,7 @@ void BKE_simulation_data_update(Depsgraph *depsgraph, Scene *scene, Simulation * CustomData_realloc(&state_orig->attributes, state_orig->tot_particles); ensure_attributes_exist(state_orig); - MutableArrayRef positions = get_particle_positions(state_orig); + MutableSpan positions = get_particle_positions(state_orig); for (uint i : positions.index_range()) { positions[i] = {i / 10.0f, 0, 0}; } @@ -250,7 +250,7 @@ void BKE_simulation_data_update(Depsgraph *depsgraph, Scene *scene, Simulation * else if (current_frame == state_orig->current_frame + 1) { state_orig->current_frame = current_frame; ensure_attributes_exist(state_orig); - MutableArrayRef positions = get_particle_positions(state_orig); + MutableSpan positions = get_particle_positions(state_orig); for (float3 &position : positions) { position.z += 0.1f; } -- cgit v1.2.3