[Bf-blender-cvs] [e6ef82180f4] functions: add execute input to point emitter

Jacques Lucke noreply at git.blender.org
Mon Sep 16 17:00:50 CEST 2019


Commit: e6ef82180f4a7b97bb2a15805771cd7d1bb59636
Author: Jacques Lucke
Date:   Mon Sep 16 17:00:37 2019 +0200
Branches: functions
https://developer.blender.org/rBe6ef82180f4a7b97bb2a15805771cd7d1bb59636

add execute input to point emitter

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

M	release/scripts/startup/nodes/bparticle_nodes/point_emitter.py
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/release/scripts/startup/nodes/bparticle_nodes/point_emitter.py b/release/scripts/startup/nodes/bparticle_nodes/point_emitter.py
index 010b9c44b4d..a5aa0b5169f 100644
--- a/release/scripts/startup/nodes/bparticle_nodes/point_emitter.py
+++ b/release/scripts/startup/nodes/bparticle_nodes/point_emitter.py
@@ -7,8 +7,11 @@ class PointEmitterNode(bpy.types.Node, BParticlesNode):
     bl_idname = "bp_PointEmitterNode"
     bl_label = "Point Emitter"
 
+    execute_on_birth__prop: NodeBuilder.ExecuteInputProperty()
+
     def declaration(self, builder: NodeBuilder):
         builder.fixed_input("position", "Position", "Vector")
         builder.fixed_input("velocity", "Velocity", "Vector", default=(1, 0, 0))
         builder.fixed_input("size", "Size", "Float", default=0.01)
+        builder.execute_input("execute_on_birth", "Execute on Birth", "execute_on_birth__prop")
         builder.influences_output("emitter", "Emitter")
diff --git a/source/blender/simulations/bparticles/emitters.cpp b/source/blender/simulations/bparticles/emitters.cpp
index 588fc4342e4..e1acc998770 100644
--- a/source/blender/simulations/bparticles/emitters.cpp
+++ b/source/blender/simulations/bparticles/emitters.cpp
@@ -48,6 +48,8 @@ void PointEmitter::emit(EmitterInterface &interface)
     new_particles.set<float3>("Velocity", new_velocities);
     new_particles.set<float>("Size", new_sizes);
     new_particles.set<float>("Birth Time", birth_times);
+
+    m_action->execute_from_emitter(new_particles, interface);
   }
 }
 
diff --git a/source/blender/simulations/bparticles/emitters.hpp b/source/blender/simulations/bparticles/emitters.hpp
index adb03f8d1c6..dd56939f82e 100644
--- a/source/blender/simulations/bparticles/emitters.hpp
+++ b/source/blender/simulations/bparticles/emitters.hpp
@@ -47,16 +47,19 @@ class PointEmitter : public Emitter {
   VaryingFloat3 m_position;
   VaryingFloat3 m_velocity;
   VaryingFloat m_size;
+  Action *m_action;
 
  public:
   PointEmitter(ArrayRef<std::string> systems_to_emit,
                VaryingFloat3 position,
                VaryingFloat3 velocity,
-               VaryingFloat size)
+               VaryingFloat size,
+               Action *action)
       : m_systems_to_emit(systems_to_emit),
         m_position(position),
         m_velocity(velocity),
-        m_size(size)
+        m_size(size),
+        m_action(action)
   {
   }
 
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index 979750239b3..89e3fe7b7ad 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -370,6 +370,8 @@ static void PARSE_point_emitter(InfluencesCollector &collector,
     return;
   }
 
+  Action *action = vtree_data.build_action_list(vnode, "Execute on Birth");
+
   ArrayRef<std::string> system_names = vtree_data.find_target_system_names(
       vnode->output(0, "Emitter"));
   std::string name = vnode->name();
@@ -380,7 +382,7 @@ static void PARSE_point_emitter(InfluencesCollector &collector,
       name, "Velocity", inputs->get<float3>(1, "Velocity"));
   VaryingFloat size = world_transition.update_float(name, "Size", inputs->get<float>(2, "Size"));
 
-  Emitter *emitter = new PointEmitter(std::move(system_names), position, velocity, size);
+  Emitter *emitter = new PointEmitter(std::move(system_names), position, velocity, size, action);
   collector.m_emitters.append(emitter);
 }



More information about the Bf-blender-cvs mailing list