[Bf-blender-cvs] [d2c1f7b9ca3] functions: initial particles block id

Jacques Lucke noreply at git.blender.org
Mon Jul 29 17:57:39 CEST 2019


Commit: d2c1f7b9ca32ff63eaea315e1678e0523a03ab1d
Author: Jacques Lucke
Date:   Mon Jul 29 15:16:21 2019 +0200
Branches: functions
https://developer.blender.org/rBd2c1f7b9ca32ff63eaea315e1678e0523a03ab1d

initial particles block id

===================================================================

M	source/blender/simulations/bparticles/particles_container.cpp
M	source/blender/simulations/bparticles/particles_container.hpp

===================================================================

diff --git a/source/blender/simulations/bparticles/particles_container.cpp b/source/blender/simulations/bparticles/particles_container.cpp
index dbf685c3d09..5f2a4dc0775 100644
--- a/source/blender/simulations/bparticles/particles_container.cpp
+++ b/source/blender/simulations/bparticles/particles_container.cpp
@@ -6,8 +6,10 @@
 
 namespace BParticles {
 
-ParticlesBlock::ParticlesBlock(ParticlesContainer &container, AttributeArraysCore &attributes_core)
-    : m_container(container), m_attributes_core(attributes_core)
+ParticlesBlock::ParticlesBlock(ParticlesContainer &container,
+                               AttributeArraysCore &attributes_core,
+                               uint id)
+    : m_container(container), m_attributes_core(attributes_core), m_id(id)
 {
 }
 
@@ -64,7 +66,7 @@ ParticlesBlock *ParticlesContainer::allocate_block()
 {
   AttributeArraysCore attributes_core = AttributeArraysCore::NewWithSeparateAllocations(
       m_attributes_info, m_block_size);
-  ParticlesBlock *block = new ParticlesBlock(*this, attributes_core);
+  ParticlesBlock *block = new ParticlesBlock(*this, attributes_core, m_next_block_id++);
   return block;
 }
 
diff --git a/source/blender/simulations/bparticles/particles_container.hpp b/source/blender/simulations/bparticles/particles_container.hpp
index 8181dbd9fe6..767218e3420 100644
--- a/source/blender/simulations/bparticles/particles_container.hpp
+++ b/source/blender/simulations/bparticles/particles_container.hpp
@@ -31,6 +31,7 @@ class ParticlesContainer {
   Stack<ParticlesBlock *> m_cached_blocks;
   uint m_block_size;
   std::mutex m_blocks_mutex;
+  uint m_next_block_id = 0;
 
  public:
   ParticlesContainer(AttributesInfo attributes, uint block_size);
@@ -103,11 +104,12 @@ class ParticlesBlock {
   ParticlesContainer &m_container;
   AttributeArraysCore m_attributes_core;
   uint m_active_amount = 0;
+  uint m_id;
 
   friend ParticlesContainer;
 
  public:
-  ParticlesBlock(ParticlesContainer &container, AttributeArraysCore &attributes_core);
+  ParticlesBlock(ParticlesContainer &container, AttributeArraysCore &attributes_core, uint id);
 
   /**
    * Get the range of attribute indices that contain active particles.



More information about the Bf-blender-cvs mailing list