[Bf-blender-cvs] [5685b0a72ab] functions: support for accessing id data blocks from emitter function

Jacques Lucke noreply at git.blender.org
Tue Dec 10 23:32:24 CET 2019


Commit: 5685b0a72ab1990d791024704681c4c841314488
Author: Jacques Lucke
Date:   Tue Dec 10 23:26:45 2019 +0100
Branches: functions
https://developer.blender.org/rB5685b0a72ab1990d791024704681c4c841314488

support for accessing id data blocks from emitter function

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

M	source/blender/simulations/bparticles/emitters.cpp
M	source/blender/simulations/bparticles/emitters.hpp
M	source/blender/simulations/bparticles/node_frontend.cpp

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

diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp
index 989deb44411..ba34ea46ab3 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -388,7 +388,7 @@ void CustomEmitter::emit(EmitterInterface &interface)
     }
   }
 
-  FN::MFContextBuilder context_builder;
+  FN::MFContextBuilder context_builder(&m_id_handle_lookup);
   m_emitter_function.call({0}, params_builder, context_builder);
 
   int particle_count = -1;
diff --git a/source/blender/simulations/bparticles/emitters.hpp b/source/blender/simulations/bparticles/emitters.hpp
index e98b615fe04..dad77e0e1e3 100644
--- a/source/blender/simulations/bparticles/emitters.hpp
+++ b/source/blender/simulations/bparticles/emitters.hpp
@@ -113,18 +113,21 @@ class CustomEmitter : public Emitter {
   Vector<std::string> m_attribute_names;
   Action &m_action;
   BirthTimeModes::Enum m_birth_time_mode;
+  const BKE::IDHandleLookup &m_id_handle_lookup;
 
  public:
   CustomEmitter(ArrayRef<std::string> systems_to_emit,
                 const MultiFunction &emitter_function,
                 Vector<std::string> attribute_names,
                 Action &action,
-                BirthTimeModes::Enum birth_time_mode)
+                BirthTimeModes::Enum birth_time_mode,
+                const BKE::IDHandleLookup &id_handle_lookup)
       : m_systems_to_emit(systems_to_emit),
         m_emitter_function(emitter_function),
         m_attribute_names(std::move(attribute_names)),
         m_action(action),
-        m_birth_time_mode(birth_time_mode)
+        m_birth_time_mode(birth_time_mode),
+        m_id_handle_lookup(id_handle_lookup)
   {
   }
 
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index eb50f3622d8..b26a2838a88 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -763,8 +763,12 @@ static void PARSE_custom_emitter(XNodeInfluencesBuilder &builder)
   BirthTimeModes::Enum birth_time_mode = (BirthTimeModes::Enum)RNA_enum_get(builder.node_rna(),
                                                                             "birth_time_mode");
 
-  Emitter &emitter = builder.construct<CustomEmitter>(
-      system_names, *emitter_function, std::move(attribute_names), action, birth_time_mode);
+  Emitter &emitter = builder.construct<CustomEmitter>(system_names,
+                                                      *emitter_function,
+                                                      std::move(attribute_names),
+                                                      action,
+                                                      birth_time_mode,
+                                                      builder.id_handle_lookup());
   builder.add_emitter(emitter);
 }



More information about the Bf-blender-cvs mailing list