[Bf-blender-cvs] [104df5f5f24] functions: support color in Custom Emitter node

Jacques Lucke noreply at git.blender.org
Thu Aug 1 18:23:13 CEST 2019


Commit: 104df5f5f2477e3b6b2a1563c4a70e6644a1664d
Author: Jacques Lucke
Date:   Thu Aug 1 14:16:12 2019 +0200
Branches: functions
https://developer.blender.org/rB104df5f5f2477e3b6b2a1563c4a70e6644a1664d

support color in Custom Emitter node

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

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

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

diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp
index e1e8e64f05f..2dc9957c61b 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -16,6 +16,7 @@ namespace BParticles {
 
 using FN::Types::SharedFloat3List;
 using FN::Types::SharedFloatList;
+using FN::Types::SharedFloatRGBAList;
 using FN::Types::SharedInt32List;
 
 static float random_float()
@@ -142,9 +143,11 @@ void CustomFunctionEmitter::emit(EmitterInterface &interface)
   auto &float_list_type = FN::Types::GET_TYPE_float_list();
   auto &float3_list_type = FN::Types::GET_TYPE_float3_list();
   auto &int32_list_type = FN::Types::GET_TYPE_int32_list();
+  auto &rgba_f_list_type = FN::Types::GET_TYPE_rgba_f_list();
   auto &float_type = FN::Types::GET_TYPE_float();
   auto &float3_type = FN::Types::GET_TYPE_float3();
   auto &int32_type = FN::Types::GET_TYPE_int32();
+  auto &rgba_f_type = FN::Types::GET_TYPE_rgba_f();
 
   uint new_particle_amount = 0;
   for (uint i = 0; i < m_function->output_amount(); i++) {
@@ -185,6 +188,10 @@ void CustomFunctionEmitter::emit(EmitterInterface &interface)
       auto list = fn_out.relocate_out<SharedInt32List>(i);
       new_particles.set_repeated<int32_t>(attribute_index, *list.ptr());
     }
+    else if (type == rgba_f_list_type) {
+      auto list = fn_out.relocate_out<SharedFloatRGBAList>(i);
+      new_particles.set_repeated<rgba_f>(attribute_index, *list.ptr());
+    }
     else if (type == float_type) {
       new_particles.fill<float>(attribute_index, fn_out.get<float>(i));
     }
@@ -194,6 +201,9 @@ void CustomFunctionEmitter::emit(EmitterInterface &interface)
     else if (type == int32_type) {
       new_particles.fill<int32_t>(attribute_index, fn_out.get<int32_t>(i));
     }
+    else if (type == rgba_f_type) {
+      new_particles.fill<rgba_f>(attribute_index, fn_out.get<rgba_f>(i));
+    }
   }
 }



More information about the Bf-blender-cvs mailing list