[Bf-blender-cvs] [81eecb252a1] functions: cleanup naming

Jacques Lucke noreply at git.blender.org
Mon Jun 10 12:05:48 CEST 2019


Commit: 81eecb252a1c28aed903db536cf7375e4374a74b
Author: Jacques Lucke
Date:   Mon Jun 10 12:04:16 2019 +0200
Branches: functions
https://developer.blender.org/rB81eecb252a1c28aed903db536cf7375e4374a74b

cleanup naming

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

M	source/blender/simulations/bparticles/c_wrapper.cpp
M	source/blender/simulations/bparticles/core.hpp
M	source/blender/simulations/bparticles/playground_solver.cpp

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

diff --git a/source/blender/simulations/bparticles/c_wrapper.cpp b/source/blender/simulations/bparticles/c_wrapper.cpp
index 335b1ccd4ca..c15974b55c6 100644
--- a/source/blender/simulations/bparticles/c_wrapper.cpp
+++ b/source/blender/simulations/bparticles/c_wrapper.cpp
@@ -73,8 +73,8 @@ class TestEmitter : public BParticles::Emitter {
  public:
   void info(EmitterInfoBuilder &builder) const override
   {
-    builder.inits_vec3_attribute("Position");
-    builder.inits_vec3_attribute("Velocity");
+    builder.inits_float3_attribute("Position");
+    builder.inits_float3_attribute("Velocity");
   }
 
   void emit(std::function<EmitterBuffers &()> request_buffers) override
diff --git a/source/blender/simulations/bparticles/core.hpp b/source/blender/simulations/bparticles/core.hpp
index 7ddb83a4c9d..f30dfb904ff 100644
--- a/source/blender/simulations/bparticles/core.hpp
+++ b/source/blender/simulations/bparticles/core.hpp
@@ -80,7 +80,7 @@ class EmitterInfo {
 
   Emitter *m_emitter;
   SmallSetVector<std::string> m_used_float_attributes;
-  SmallSetVector<std::string> m_used_vec3_attributes;
+  SmallSetVector<std::string> m_used_float3_attributes;
   SmallSetVector<std::string> m_used_byte_attributes;
 
   friend EmitterInfoBuilder;
@@ -96,9 +96,9 @@ class EmitterInfo {
     return m_used_float_attributes.values();
   }
 
-  ArrayRef<std::string> used_vec3_attributes()
+  ArrayRef<std::string> used_float3_attributes()
   {
-    return m_used_vec3_attributes.values();
+    return m_used_float3_attributes.values();
   }
 
   ArrayRef<std::string> used_byte_attributes()
@@ -111,9 +111,14 @@ class EmitterInfo {
     return m_used_float_attributes.contains(name.to_std_string());
   }
 
-  bool uses_vec3_attribute(StringRef name)
+  bool uses_float3_attribute(StringRef name)
   {
-    return m_used_vec3_attributes.contains(name.to_std_string());
+    return m_used_float3_attributes.contains(name.to_std_string());
+  }
+
+  bool uses_byte_attribute(StringRef name)
+  {
+    return m_used_byte_attributes.contains(name.to_std_string());
   }
 };
 
@@ -121,7 +126,7 @@ class EmitterInfoBuilder {
  private:
   Emitter *m_emitter;
   SmallSetVector<std::string> m_used_float_attributes;
-  SmallSetVector<std::string> m_used_vec3_attributes;
+  SmallSetVector<std::string> m_used_float3_attributes;
 
  public:
   EmitterInfoBuilder(Emitter *emitter) : m_emitter(emitter)
@@ -132,9 +137,9 @@ class EmitterInfoBuilder {
   {
     m_used_float_attributes.add(name.to_std_string());
   }
-  void inits_vec3_attribute(StringRef name)
+  void inits_float3_attribute(StringRef name)
   {
-    m_used_vec3_attributes.add(name.to_std_string());
+    m_used_float3_attributes.add(name.to_std_string());
   }
 
   EmitterInfo build()
@@ -142,7 +147,7 @@ class EmitterInfoBuilder {
     EmitterInfo info;
     info.m_emitter = m_emitter;
     info.m_used_float_attributes = m_used_float_attributes;
-    info.m_used_vec3_attributes = m_used_vec3_attributes;
+    info.m_used_float3_attributes = m_used_float3_attributes;
     return info;
   }
 };
diff --git a/source/blender/simulations/bparticles/playground_solver.cpp b/source/blender/simulations/bparticles/playground_solver.cpp
index 505db9efc77..cfcc1bb230e 100644
--- a/source/blender/simulations/bparticles/playground_solver.cpp
+++ b/source/blender/simulations/bparticles/playground_solver.cpp
@@ -38,7 +38,7 @@ class SimpleSolver : public Solver {
 
     for (EmitterInfo &emitter : m_emitter_infos) {
       float_attributes.add_multiple(emitter.used_float_attributes());
-      vec3_attributes.add_multiple(emitter.used_vec3_attributes());
+      vec3_attributes.add_multiple(emitter.used_float3_attributes());
       byte_attributes.add_multiple(emitter.used_byte_attributes());
     }
 
@@ -150,10 +150,15 @@ class SimpleSolver : public Solver {
         }
       }
       for (auto &name : state.particles->vec3_attribute_names()) {
-        if (!emitter.uses_vec3_attribute(name)) {
+        if (!emitter.uses_float3_attribute(name)) {
           emitted_data.get_float3(name).fill(float3{0, 0, 0});
         }
       }
+      for (auto &name : state.particles->byte_attribute_names()) {
+        if (!emitter.uses_byte_attribute(name)) {
+          emitted_data.get_byte(name).fill(0);
+        }
+      }
 
       auto birth_times = emitted_data.get_float("Birth Time");
       for (float &birth_time : birth_times) {



More information about the Bf-blender-cvs mailing list