[Bf-blender-cvs] [7afeb9775a1] functions: rename inactive to unused to avoid confusion
Jacques Lucke
noreply at git.blender.org
Mon Jul 1 15:37:12 CEST 2019
Commit: 7afeb9775a18cd81bc730c6c8a3d71c039f87850
Author: Jacques Lucke
Date: Mon Jul 1 15:25:09 2019 +0200
Branches: functions
https://developer.blender.org/rB7afeb9775a18cd81bc730c6c8a3d71c039f87850
rename inactive to unused to avoid confusion
===================================================================
M source/blender/simulations/bparticles/core.cpp
M source/blender/simulations/bparticles/particles_container.cpp
M source/blender/simulations/bparticles/particles_container.hpp
===================================================================
diff --git a/source/blender/simulations/bparticles/core.cpp b/source/blender/simulations/bparticles/core.cpp
index 758d21ed679..c80d6ddc76f 100644
--- a/source/blender/simulations/bparticles/core.cpp
+++ b/source/blender/simulations/bparticles/core.cpp
@@ -42,7 +42,7 @@ ParticlesBlock &BlockAllocator::get_non_full_block(uint particle_type_id)
uint index = 0;
while (index < m_non_full_cache.size()) {
- if (m_non_full_cache[index]->inactive_amount() == 0) {
+ if (m_non_full_cache[index]->unused_amount() == 0) {
m_non_full_cache.remove_and_reorder(index);
continue;
}
@@ -68,7 +68,7 @@ void BlockAllocator::allocate_block_ranges(uint particle_type_id,
while (remaining_size > 0) {
ParticlesBlock &block = this->get_non_full_block(particle_type_id);
- uint size_to_use = std::min(block.inactive_amount(), remaining_size);
+ uint size_to_use = std::min(block.unused_amount(), remaining_size);
Range<uint> range(block.active_amount(), block.active_amount() + size_to_use);
block.active_amount() += size_to_use;
diff --git a/source/blender/simulations/bparticles/particles_container.cpp b/source/blender/simulations/bparticles/particles_container.cpp
index fda84001b1e..54d2d45e70d 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -138,14 +138,15 @@ void ParticlesContainer::flatten_attribute_data(StringRef attribute_name, void *
void ParticlesBlock::MoveUntilFull(ParticlesBlock &from, ParticlesBlock &to)
{
BLI_assert(&from.container() == &to.container());
- uint move_amount = MIN2(from.active_amount(), to.inactive_amount());
- uint src_start = from.active_amount() - move_amount;
- uint dst_start = to.next_inactive_index();
+ uint move_amount = MIN2(from.active_amount(), to.unused_amount());
if (move_amount == 0) {
return;
}
+ uint src_start = from.active_amount() - move_amount;
+ uint dst_start = to.first_unused_index();
+
uint attribute_amount = from.container().attributes_info().amount();
for (uint i = 0; i < attribute_amount; i++) {
void *from_buffer = from.attributes_core().get_ptr(i);
diff --git a/source/blender/simulations/bparticles/particles_container.hpp b/source/blender/simulations/bparticles/particles_container.hpp
index 863b3244905..a7bcac3144b 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -98,10 +98,10 @@ class ParticlesBlock {
Range<uint> active_range();
uint &active_amount();
- uint inactive_amount();
+ uint unused_amount();
bool is_full();
bool is_empty();
- uint next_inactive_index();
+ uint first_unused_index();
uint size();
ParticlesContainer &container();
@@ -165,7 +165,7 @@ inline uint &ParticlesBlock::active_amount()
return m_active_amount;
}
-inline uint ParticlesBlock::inactive_amount()
+inline uint ParticlesBlock::unused_amount()
{
return this->size() - m_active_amount;
}
@@ -180,8 +180,9 @@ inline bool ParticlesBlock::is_empty()
return m_active_amount == 0;
}
-inline uint ParticlesBlock::next_inactive_index()
+inline uint ParticlesBlock::first_unused_index()
{
+ BLI_assert(!this->is_full());
return m_active_amount;
}
More information about the Bf-blender-cvs
mailing list