[Bf-blender-cvs] [560b55c4c82] functions: cleanup
Jacques Lucke
noreply at git.blender.org
Wed Sep 4 19:43:18 CEST 2019
Commit: 560b55c4c82851458bd8f70d899a3d7b1383ccff
Author: Jacques Lucke
Date: Wed Sep 4 12:19:47 2019 +0200
Branches: functions
https://developer.blender.org/rB560b55c4c82851458bd8f70d899a3d7b1383ccff
cleanup
===================================================================
M source/blender/blenlib/BLI_array.hpp
M source/blender/simulations/bparticles/emitters.cpp
===================================================================
diff --git a/source/blender/blenlib/BLI_array.hpp b/source/blender/blenlib/BLI_array.hpp
index 99fcc9a961e..d6ba3152d0d 100644
--- a/source/blender/blenlib/BLI_array.hpp
+++ b/source/blender/blenlib/BLI_array.hpp
@@ -118,6 +118,11 @@ template<typename T, typename Allocator = GuardedAllocator> class Array {
return MutableArrayRef<T>(m_data, m_size);
}
+ ArrayRef<T> as_ref() const
+ {
+ return *this;
+ }
+
T &operator[](uint index)
{
BLI_assert(index < m_size);
diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp
index 71a56c85827..4f8dfa7925f 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -311,11 +311,11 @@ void SurfaceEmitter::emit(EmitterInterface &interface)
m_on_birth_action->execute_from_emitter(
new_particles, interface, [&](Range<uint> range) -> MeshSurfaceContext {
return MeshSurfaceContext(m_object,
- ArrayRef<float4x4>(transforms_at_birth).slice(range),
- ArrayRef<float3>(local_positions).slice(range),
- ArrayRef<float3>(local_normals).slice(range),
- ArrayRef<float3>(world_normals).slice(range),
- ArrayRef<uint>(triangles_to_sample).slice(range));
+ transforms_at_birth.as_ref().slice(range),
+ local_positions.as_ref().slice(range),
+ local_normals.as_ref().slice(range),
+ world_normals.as_ref().slice(range),
+ triangles_to_sample.as_ref().slice(range));
});
}
}
More information about the Bf-blender-cvs
mailing list