diff options
author | Jacques Lucke <mail@jlucke.com> | 2020-01-02 17:22:20 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2020-01-02 17:22:20 +0300 |
commit | 30b50638a03ff29b342d9d42c28c94fba5fe422b (patch) | |
tree | a5e07125b31b657a8379358d9dd97408feaf6d24 /source | |
parent | 25fc970f445f7e4407a9f1568f74a6348157e3ff (diff) |
rename index_iterator to index_range
Diffstat (limited to 'source')
23 files changed, 51 insertions, 51 deletions
diff --git a/source/blender/blenlib/BLI_array_cxx.h b/source/blender/blenlib/BLI_array_cxx.h index 7292c94616b..e5ee9412a19 100644 --- a/source/blender/blenlib/BLI_array_cxx.h +++ b/source/blender/blenlib/BLI_array_cxx.h @@ -195,7 +195,7 @@ template<typename T, uint N = 4, typename Allocator = GuardedAllocator> class Ar return m_data + m_size; } - IndexRange index_iterator() const + IndexRange index_range() const { return IndexRange(m_size); } diff --git a/source/blender/blenlib/BLI_array_ref.h b/source/blender/blenlib/BLI_array_ref.h index 5428bba6e70..265e75a2bf9 100644 --- a/source/blender/blenlib/BLI_array_ref.h +++ b/source/blender/blenlib/BLI_array_ref.h @@ -324,7 +324,7 @@ template<typename T> class ArrayRef { * Utility to make it more convenient to iterate over all indices that can be used with this * array. */ - IndexRange index_iterator() const + IndexRange index_range() const { return IndexRange(m_size); } @@ -494,7 +494,7 @@ template<typename T> class MutableArrayRef { return ArrayRef<T>(m_start, m_size); } - IndexRange index_iterator() const + IndexRange index_range() const { return IndexRange(m_size); } diff --git a/source/blender/blenlib/BLI_float_interval.h b/source/blender/blenlib/BLI_float_interval.h index 53e3a181ec7..3ad3a56a412 100644 --- a/source/blender/blenlib/BLI_float_interval.h +++ b/source/blender/blenlib/BLI_float_interval.h @@ -39,7 +39,7 @@ class FloatInterval { void value_at(ArrayRef<float> factors, MutableArrayRef<float> r_values) { BLI_assert(factors.size() == r_values.size()); - for (uint i : factors.index_iterator()) { + for (uint i : factors.index_range()) { r_values[i] = this->value_at(factors[i]); } } @@ -52,7 +52,7 @@ class FloatInterval { if (r_values.size() == 1) { r_values[0] = this->value_at(0.5f); } - for (uint i : r_values.index_iterator()) { + for (uint i : r_values.index_range()) { float factor = (i - 1) / (float)r_values.size(); r_values[i] = this->value_at(factor); } diff --git a/source/blender/blenlib/BLI_index_mask.h b/source/blender/blenlib/BLI_index_mask.h index f80c85a2556..85cb3025fae 100644 --- a/source/blender/blenlib/BLI_index_mask.h +++ b/source/blender/blenlib/BLI_index_mask.h @@ -102,9 +102,9 @@ class IndexMask { } } - IndexRange index_iterator() const + IndexRange index_range() const { - return m_indices.index_iterator(); + return m_indices.index_range(); } uint last() const diff --git a/source/blender/blenlib/BLI_vector.h b/source/blender/blenlib/BLI_vector.h index e65ce287be1..8c1ac4380c1 100644 --- a/source/blender/blenlib/BLI_vector.h +++ b/source/blender/blenlib/BLI_vector.h @@ -559,7 +559,7 @@ template<typename T, uint N = 4, typename Allocator = GuardedAllocator> class Ve return (uint)(m_capacity_end - m_begin); } - IndexRange index_iterator() const + IndexRange index_range() const { return IndexRange(this->size()); } diff --git a/source/blender/blenlib/BLI_virtual_list_ref.h b/source/blender/blenlib/BLI_virtual_list_ref.h index 7826181a509..3f9cfab1f4d 100644 --- a/source/blender/blenlib/BLI_virtual_list_ref.h +++ b/source/blender/blenlib/BLI_virtual_list_ref.h @@ -176,7 +176,7 @@ template<typename T> class VirtualListRef { return false; } - IndexRange index_iterator() const + IndexRange index_range() const { return IndexRange(m_virtual_size); } diff --git a/source/blender/functions/FN_multi_function_context.h b/source/blender/functions/FN_multi_function_context.h index b32e869ec17..fd17d335b9b 100644 --- a/source/blender/functions/FN_multi_function_context.h +++ b/source/blender/functions/FN_multi_function_context.h @@ -60,7 +60,7 @@ class MFElementContexts { template<typename T> Optional<TypedContext<T>> try_find() const { BLI::class_id_t context_id = BLI::get_class_id<T>(); - for (uint i : m_contexts.index_iterator()) { + for (uint i : m_contexts.index_range()) { if (m_ids[i] == context_id) { const T *context = (const T *)m_contexts[i]; return TypedContext<T>{context, m_indices[i]}; @@ -83,7 +83,7 @@ class MFGlobalContexts { template<typename T> const T *try_find() const { BLI::class_id_t context_id = BLI::get_class_id<T>(); - for (uint i : m_contexts.index_iterator()) { + for (uint i : m_contexts.index_range()) { if (m_ids[i] == context_id) { const T *context = (const T *)m_contexts[i]; return context; @@ -154,7 +154,7 @@ inline void MFContextBuilder::add_global_contexts(const MFContext &other) { const MFGlobalContexts &global_contexts = other.m_builder->m_global_contexts; - for (uint i : global_contexts.m_ids.index_iterator()) { + for (uint i : global_contexts.m_ids.index_range()) { BLI::class_id_t id = other.m_builder->m_global_contexts.m_ids[i]; const void *context = other.m_builder->m_global_contexts.m_contexts[i]; diff --git a/source/blender/functions/FN_node_tree_multi_function_network.h b/source/blender/functions/FN_node_tree_multi_function_network.h index 4316068349e..4ef35342df2 100644 --- a/source/blender/functions/FN_node_tree_multi_function_network.h +++ b/source/blender/functions/FN_node_tree_multi_function_network.h @@ -167,7 +167,7 @@ class FunctionTreeMFNetwork { MutableArrayRef<const MFOutputSocket *> r_result) const { BLI_assert(fsockets.size() == r_result.size()); - for (uint i : fsockets.index_iterator()) { + for (uint i : fsockets.index_range()) { r_result[i] = &this->lookup_socket(*fsockets[i]); } } @@ -176,7 +176,7 @@ class FunctionTreeMFNetwork { MutableArrayRef<const MFInputSocket *> r_result) const { BLI_assert(fsockets.size() == r_result.size()); - for (uint i : fsockets.index_iterator()) { + for (uint i : fsockets.index_range()) { r_result[i] = &this->lookup_dummy_socket(*fsockets[i]); } } diff --git a/source/blender/functions/intern/attributes_ref.cc b/source/blender/functions/intern/attributes_ref.cc index 93c54a407ac..9571a58a19f 100644 --- a/source/blender/functions/intern/attributes_ref.cc +++ b/source/blender/functions/intern/attributes_ref.cc @@ -63,7 +63,7 @@ void MutableAttributesRef::destruct_and_reorder(IndexMask index_mask) array.destruct_indices(index_mask); - for (uint i : index_mask.index_iterator()) { + for (uint i : index_mask.index_range()) { uint last_index = m_range.size() - 1 - i; uint index_to_remove = index_mask[index_mask.size() - 1 - i]; if (index_to_remove == last_index) { diff --git a/source/blender/functions/intern/multi_function_network.cc b/source/blender/functions/intern/multi_function_network.cc index 8e5ffc97f63..a8171bc2d3b 100644 --- a/source/blender/functions/intern/multi_function_network.cc +++ b/source/blender/functions/intern/multi_function_network.cc @@ -66,7 +66,7 @@ MFBuilderFunctionNode &MFNetworkBuilder::add_function(const MultiFunction &funct node.m_output_param_indices = output_param_indices; node.m_id = m_node_by_id.size(); - for (uint i : input_param_indices.index_iterator()) { + for (uint i : input_param_indices.index_range()) { uint param_index = input_param_indices[i]; MFParamType param = function.param_type(param_index); BLI_assert(param.is_input_or_mutable()); @@ -82,7 +82,7 @@ MFBuilderFunctionNode &MFNetworkBuilder::add_function(const MultiFunction &funct m_input_sockets.append(&input_socket); } - for (uint i : output_param_indices.index_iterator()) { + for (uint i : output_param_indices.index_range()) { uint param_index = output_param_indices[i]; MFParamType param = function.param_type(param_index); BLI_assert(param.is_output_or_mutable()); @@ -116,7 +116,7 @@ MFBuilderDummyNode &MFNetworkBuilder::add_dummy(StringRef name, node.m_id = m_node_by_id.size(); node.m_name = m_allocator.copy_string(name); - for (uint i : input_types.index_iterator()) { + for (uint i : input_types.index_range()) { auto &input_socket = *m_allocator.construct<MFBuilderInputSocket>().release(); input_socket.m_data_type = input_types[i]; input_socket.m_node = &node; @@ -128,7 +128,7 @@ MFBuilderDummyNode &MFNetworkBuilder::add_dummy(StringRef name, m_socket_by_id.append(&input_socket); m_input_sockets.append(&input_socket); } - for (uint i : output_types.index_iterator()) { + for (uint i : output_types.index_range()) { auto &output_socket = *m_allocator.construct<MFBuilderOutputSocket>().release(); output_socket.m_data_type = output_types[i]; output_socket.m_node = &node; diff --git a/source/blender/functions/intern/multi_functions/mixed.cc b/source/blender/functions/intern/multi_functions/mixed.cc index fb229a66680..93b3659be4e 100644 --- a/source/blender/functions/intern/multi_functions/mixed.cc +++ b/source/blender/functions/intern/multi_functions/mixed.cc @@ -847,7 +847,7 @@ static BLI_NOINLINE Vector<int> find_non_close_indices(VirtualListRef<float3> po BLI_kdtree_3d_free(kdtree); Vector<int> indices; - for (uint i : keep_index.index_iterator()) { + for (uint i : keep_index.index_range()) { if (keep_index[i]) { indices.append(i); } @@ -885,7 +885,7 @@ void MF_JoinTextList::call(IndexMask mask, MFParams params, MFContext UNUSED(con for (uint index : mask.indices()) { VirtualListRef<std::string> texts = text_lists[index]; std::string r_text = ""; - for (uint i : texts.index_iterator()) { + for (uint i : texts.index_range()) { r_text += texts[i]; } new (&r_texts[index]) std::string(std::move(r_text)); diff --git a/source/blender/functions/intern/multi_functions/network.cc b/source/blender/functions/intern/multi_functions/network.cc index 12fcba390a1..96afd293f54 100644 --- a/source/blender/functions/intern/multi_functions/network.cc +++ b/source/blender/functions/intern/multi_functions/network.cc @@ -257,7 +257,7 @@ void MF_EvaluateNetwork::call(IndexMask mask, MFParams params, MFContext context BLI_NOINLINE void MF_EvaluateNetwork::copy_inputs_to_storage(MFParams params, Storage &storage) const { - for (uint input_index : m_inputs.index_iterator()) { + for (uint input_index : m_inputs.index_range()) { const MFOutputSocket &socket = *m_inputs[input_index]; switch (socket.data_type().category()) { case MFDataType::Single: { @@ -665,7 +665,7 @@ BLI_NOINLINE void MF_EvaluateNetwork::copy_computed_values_to_outputs(MFParams p { uint array_size = storage.mask().min_array_size(); - for (uint output_index : m_outputs.index_iterator()) { + for (uint output_index : m_outputs.index_range()) { uint global_param_index = m_inputs.size() + output_index; const MFInputSocket &socket = *m_outputs[output_index]; switch (socket.data_type().category()) { diff --git a/source/blender/functions/intern/multi_functions/sampling_util.cc b/source/blender/functions/intern/multi_functions/sampling_util.cc index c7fac9e74ee..29c0d52c00c 100644 --- a/source/blender/functions/intern/multi_functions/sampling_util.cc +++ b/source/blender/functions/intern/multi_functions/sampling_util.cc @@ -12,7 +12,7 @@ float compute_cumulative_distribution(ArrayRef<float> weights, BLI_assert(weights.size() + 1 == r_cumulative_weights.size()); r_cumulative_weights[0] = 0; - for (uint i : weights.index_iterator()) { + for (uint i : weights.index_range()) { r_cumulative_weights[i + 1] = r_cumulative_weights[i] + weights[i]; } diff --git a/source/blender/functions/intern/multi_functions/surface_hook.cc b/source/blender/functions/intern/multi_functions/surface_hook.cc index 2c9ab2f2e34..0a24b8edb28 100644 --- a/source/blender/functions/intern/multi_functions/surface_hook.cc +++ b/source/blender/functions/intern/multi_functions/surface_hook.cc @@ -465,7 +465,7 @@ static BLI_NOINLINE void compute_triangle_areas(Mesh *mesh, { BLI_assert(triangles.size() == r_areas.size()); - for (uint i : triangles.index_iterator()) { + for (uint i : triangles.index_range()) { const MLoopTri &triangle = triangles[i]; float3 v1 = mesh->mvert[mesh->mloop[triangle.tri[0]].v].co; @@ -511,7 +511,7 @@ static BLI_NOINLINE bool get_vertex_weights(Object *object, return false; } - for (uint i : r_vertex_weights.index_iterator()) { + for (uint i : r_vertex_weights.index_range()) { r_vertex_weights[i] = defvert_find_weight(vertices + i, group_index); } return true; @@ -526,7 +526,7 @@ static BLI_NOINLINE void vertex_weights_to_triangle_weights( BLI_assert(r_triangle_weights.size() == triangles.size()); BLI_assert(mesh->totvert == vertex_weights.size()); - for (uint triangle_index : triangles.index_iterator()) { + for (uint triangle_index : triangles.index_range()) { const MLoopTri &looptri = triangles[triangle_index]; float triangle_weight = 0.0f; for (uint i = 0; i < 3; i++) { @@ -590,7 +590,7 @@ void MF_SampleObjectSurface::call(IndexMask mask, MFParams params, MFContext con vertex_weights_to_triangle_weights( mesh, triangles, vertex_weights, vertex_weights_for_triangles); - for (uint i : triangle_weights.index_iterator()) { + for (uint i : triangle_weights.index_range()) { triangle_weights[i] *= vertex_weights_for_triangles[i]; } } diff --git a/source/blender/functions/intern/multi_functions/util.h b/source/blender/functions/intern/multi_functions/util.h index baa4305c0aa..14292d21536 100644 --- a/source/blender/functions/intern/multi_functions/util.h +++ b/source/blender/functions/intern/multi_functions/util.h @@ -24,7 +24,7 @@ void group_indices_by_same_value(IndexMask indices, ScopedVector<T> seen_values; - for (uint i : indices.index_iterator()) { + for (uint i : indices.index_range()) { uint index = indices[i]; const T &value = values[index]; diff --git a/source/blender/functions/intern/node_tree.cc b/source/blender/functions/intern/node_tree.cc index a3d2a6d8cab..115d881ba33 100644 --- a/source/blender/functions/intern/node_tree.cc +++ b/source/blender/functions/intern/node_tree.cc @@ -185,7 +185,7 @@ BLI_NOINLINE void FunctionNodeTree::expand_group__relink_inputs(const VirtualNod { Vector<const VOutputSocket *> group_inputs = get_group_inputs(vtree); - for (uint input_index : group_inputs.index_iterator()) { + for (uint input_index : group_inputs.index_range()) { const VOutputSocket *inside_interface_vsocket = group_inputs[input_index]; const VNode &inside_interface_vnode = inside_interface_vsocket->node(); FNode *inside_interface_fnode = new_fnodes_by_id[inside_interface_vnode.id()]; @@ -227,7 +227,7 @@ BLI_NOINLINE void FunctionNodeTree::expand_group__relink_outputs( { Vector<const VInputSocket *> group_outputs = get_group_outputs(vtree); - for (uint output_index : group_outputs.index_iterator()) { + for (uint output_index : group_outputs.index_range()) { const VInputSocket *inside_interface_vsocket = group_outputs[output_index]; const VNode &inside_interface_vnode = inside_interface_vsocket->node(); FNode *inside_interface_fnode = new_fnodes_by_id[inside_interface_vnode.id()]; @@ -344,7 +344,7 @@ BLI_NOINLINE void FunctionNodeTree::store_tree_in_this_and_init_ids( m_group_inputs = std::move(all_group_inputs); m_parent_nodes = std::move(all_parent_nodes); - for (uint node_index : m_node_by_id.index_iterator()) { + for (uint node_index : m_node_by_id.index_range()) { FNode *fnode = m_node_by_id[node_index]; fnode->m_id = node_index; diff --git a/source/blender/functions/intern/node_tree_multi_function_network/builder.cc b/source/blender/functions/intern/node_tree_multi_function_network/builder.cc index 4cfacb924b5..5691977cd05 100644 --- a/source/blender/functions/intern/node_tree_multi_function_network/builder.cc +++ b/source/blender/functions/intern/node_tree_multi_function_network/builder.cc @@ -206,7 +206,7 @@ std::unique_ptr<FunctionTreeMFNetwork> FunctionTreeMFNetworkBuilder::build() auto network = BLI::make_unique<MFNetwork>(std::move(m_builder)); Array<uint> fsocket_by_socket(network->socket_ids().size(), InlinedTreeMFSocketMap_UNMAPPED); - for (uint fsocket_id : m_single_socket_by_fsocket.index_iterator()) { + for (uint fsocket_id : m_single_socket_by_fsocket.index_range()) { switch (m_single_socket_by_fsocket[fsocket_id]) { case InlinedTreeMFSocketMap_UNMAPPED: { break; diff --git a/source/blender/functions/intern/node_tree_multi_function_network/builder.h b/source/blender/functions/intern/node_tree_multi_function_network/builder.h index f5c2f06c33a..7581eef06a7 100644 --- a/source/blender/functions/intern/node_tree_multi_function_network/builder.h +++ b/source/blender/functions/intern/node_tree_multi_function_network/builder.h @@ -183,7 +183,7 @@ class FunctionTreeMFNetworkBuilder : BLI::NonCopyable, BLI::NonMovable { ArrayRef<MFBuilderInputSocket *> sockets) { BLI_assert(fsockets.size() == sockets.size()); - for (uint i : fsockets.index_iterator()) { + for (uint i : fsockets.index_range()) { this->map_sockets(*fsockets[i], *sockets[i]); } } @@ -192,7 +192,7 @@ class FunctionTreeMFNetworkBuilder : BLI::NonCopyable, BLI::NonMovable { ArrayRef<MFBuilderOutputSocket *> sockets) { BLI_assert(fsockets.size() == sockets.size()); - for (uint i : fsockets.index_iterator()) { + for (uint i : fsockets.index_range()) { this->map_sockets(*fsockets[i], *sockets[i]); } } diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp b/source/blender/simulations/bparticles/c_wrapper.cpp index b48ecd90a2d..8b84e055a0f 100644 --- a/source/blender/simulations/bparticles/c_wrapper.cpp +++ b/source/blender/simulations/bparticles/c_wrapper.cpp @@ -310,7 +310,7 @@ void BParticles_modifier_cache_state(BParticlesModifierData *bpmd, cached_frame.particle_types = (BParticlesTypeCache *)MEM_calloc_arrayN( particle_sets.size(), sizeof(BParticlesTypeCache), __func__); - for (uint i : particle_sets.index_iterator()) { + for (uint i : particle_sets.index_range()) { ParticleSet &particles = *particle_sets[i]; BParticlesTypeCache &cached_type = cached_frame.particle_types[i]; diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp index 763dfb1da69..3f0004751fd 100644 --- a/source/blender/simulations/bparticles/emitters.cpp +++ b/source/blender/simulations/bparticles/emitters.cpp @@ -71,7 +71,7 @@ static BLI_NOINLINE void get_average_triangle_weights(const Mesh *mesh, ArrayRef<float> vertex_weights, MutableArrayRef<float> r_looptri_weights) { - for (uint triangle_index : looptris.index_iterator()) { + for (uint triangle_index : looptris.index_range()) { const MLoopTri &looptri = looptris[triangle_index]; float triangle_weight = 0.0f; for (uint i = 0; i < 3; i++) { @@ -93,7 +93,7 @@ static BLI_NOINLINE void compute_cumulative_distribution( BLI_assert(weights.size() + 1 == r_cumulative_weights.size()); r_cumulative_weights[0] = 0; - for (uint i : weights.index_iterator()) { + for (uint i : weights.index_range()) { r_cumulative_weights[i + 1] = r_cumulative_weights[i] + weights[i]; } } @@ -168,7 +168,7 @@ static BLI_NOINLINE void compute_triangle_areas(Mesh *mesh, { BLI_assert(triangles.size() == r_areas.size()); - for (uint i : triangles.index_iterator()) { + for (uint i : triangles.index_range()) { const MLoopTri &triangle = triangles[i]; float3 v1 = mesh->mvert[mesh->mloop[triangle.tri[0]].v].co; @@ -210,7 +210,7 @@ static BLI_NOINLINE void sample_looptris(Mesh *mesh, MLoop *loops = mesh->mloop; MVert *verts = mesh->mvert; - for (uint i : triangles_to_sample.index_iterator()) { + for (uint i : triangles_to_sample.index_range()) { uint triangle_index = triangles_to_sample[i]; const MLoopTri &triangle = triangles[triangle_index]; @@ -268,7 +268,7 @@ void SurfaceEmitter::emit(EmitterInterface &interface) LargeScopedArray<float> triangle_areas(triangles.size()); compute_triangle_areas(mesh, triangles, triangle_areas); - for (uint i : triangles.index_iterator()) { + for (uint i : triangles.index_range()) { triangle_weights[i] *= triangle_areas[i]; } diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp index 9b24ad2afa9..97a12ff393b 100644 --- a/source/blender/simulations/bparticles/node_frontend.cpp +++ b/source/blender/simulations/bparticles/node_frontend.cpp @@ -208,7 +208,7 @@ class FunctionTreeData { Optional<NamedGenericTupleRef> compute_all_data_inputs(const FNode &fnode) { ScopedVector<uint> data_input_indices; - for (uint i : fnode.inputs().index_iterator()) { + for (uint i : fnode.inputs().index_range()) { if (m_function_tree_data_graph.is_mapped(fnode.input(i))) { data_input_indices.append(i); } diff --git a/source/blender/simulations/bparticles/simulate.cpp b/source/blender/simulations/bparticles/simulate.cpp index 60146f4d095..2df31c3bb9e 100644 --- a/source/blender/simulations/bparticles/simulate.cpp +++ b/source/blender/simulations/bparticles/simulate.cpp @@ -27,7 +27,7 @@ BLI_NOINLINE static void find_next_event_per_particle( r_next_event_indices.fill_indices(mask, -1); r_time_factors_to_next_event.fill_indices(mask, 1.0f); - for (uint event_index : events.index_iterator()) { + for (uint event_index : events.index_range()) { Vector<uint> triggered_pindices; Vector<float> triggered_time_factors; @@ -36,7 +36,7 @@ BLI_NOINLINE static void find_next_event_per_particle( step_data, mask, r_time_factors_to_next_event, triggered_pindices, triggered_time_factors); event->filter(interface); - for (uint i : triggered_pindices.index_iterator()) { + for (uint i : triggered_pindices.index_range()) { uint pindex = triggered_pindices[i]; float time_factor = triggered_time_factors[i]; BLI_assert(time_factor <= r_time_factors_to_next_event[pindex]); @@ -153,7 +153,7 @@ BLI_NOINLINE static void execute_events(BlockStepData &step_data, { BLI_assert(events.size() == pindices_per_event.size()); - for (uint event_index : events.index_iterator()) { + for (uint event_index : events.index_range()) { Event *event = events[event_index]; ArrayRef<uint> pindices = pindices_per_event[event_index]; @@ -333,7 +333,7 @@ BLI_NOINLINE static void delete_tagged_particles_and_reorder(ParticleSet &partic auto kill_states = particles.attributes().get<bool>("Dead"); LargeScopedVector<uint> indices_to_delete; - for (uint i : kill_states.index_iterator()) { + for (uint i : kill_states.index_range()) { if (kill_states[i]) { indices_to_delete.append(i); } @@ -372,7 +372,7 @@ BLI_NOINLINE static void simulate_particles_from_birth_to_end_of_step( ArrayRef<float> birth_times = all_birth_times.slice(range); Array<float> remaining_durations(range.size()); - for (uint i : remaining_durations.index_iterator()) { + for (uint i : remaining_durations.index_range()) { remaining_durations[i] = end_time - birth_times[i]; } @@ -400,7 +400,7 @@ BLI_NOINLINE static void simulate_existing_particles( particles_vector.append(particles); }); - BLI::parallel_for(name_vector.index_iterator(), [&](uint index) { + BLI::parallel_for(name_vector.index_range(), [&](uint index) { ParticleSystemInfo *system_info = systems_to_simulate.lookup_ptr(name_vector[index]); ParticleSet *particles = particles_vector[index]; if (system_info == nullptr) { @@ -420,7 +420,7 @@ BLI_NOINLINE static void create_particles_from_emitters(SimulationState &simulat ArrayRef<Emitter *> emitters, FloatInterval time_span) { - BLI::parallel_for(emitters.index_iterator(), [&](uint emitter_index) { + BLI::parallel_for(emitters.index_range(), [&](uint emitter_index) { Emitter &emitter = *emitters[emitter_index]; EmitterInterface interface(simulation_state, particle_allocator, time_span); emitter.emit(interface); @@ -484,7 +484,7 @@ void simulate_particles(SimulationState &simulation_state, particle_sets_vector.append(new_particle_sets); }); - BLI::parallel_for(main_sets.index_iterator(), [&](uint index) { + BLI::parallel_for(main_sets.index_range(), [&](uint index) { ParticleSet &main_set = *main_sets[index]; ArrayRef<ParticleSet *> particle_sets = particle_sets_vector[index]; diff --git a/source/blender/simulations/bparticles/world_state.hpp b/source/blender/simulations/bparticles/world_state.hpp index 6b842700421..01b4c29d81b 100644 --- a/source/blender/simulations/bparticles/world_state.hpp +++ b/source/blender/simulations/bparticles/world_state.hpp @@ -50,7 +50,7 @@ struct VaryingFloat4x4 { MutableArrayRef<float4x4> r_results) const { BLI_assert(times.size() == r_results.size()); - for (uint i : times.index_iterator()) { + for (uint i : times.index_range()) { r_results[i] = this->interpolate(times[i] + time_offset); } } |