[Bf-blender-cvs] [f72a4ab0aff] functions: Remove Explode Particle node

Jacques Lucke noreply at git.blender.org
Wed Dec 18 15:03:22 CET 2019


Commit: f72a4ab0affac9dc78fc1ebbb2db5df99347edf2
Author: Jacques Lucke
Date:   Wed Dec 18 15:03:15 2019 +0100
Branches: functions
https://developer.blender.org/rBf72a4ab0affac9dc78fc1ebbb2db5df99347edf2

Remove Explode Particle node

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

D	release/scripts/startup/nodes/bparticle_nodes/explode_particle.py
M	release/scripts/startup/nodes/menu.py
M	source/blender/simulations/bparticles/actions.cpp
M	source/blender/simulations/bparticles/actions.hpp
M	source/blender/simulations/bparticles/node_frontend.cpp

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

diff --git a/release/scripts/startup/nodes/bparticle_nodes/explode_particle.py b/release/scripts/startup/nodes/bparticle_nodes/explode_particle.py
deleted file mode 100644
index 5dd271dc5b3..00000000000
--- a/release/scripts/startup/nodes/bparticle_nodes/explode_particle.py
+++ /dev/null
@@ -1,18 +0,0 @@
-import bpy
-from bpy.props import *
-from .. base import SimulationNode
-from .. node_builder import NodeBuilder
-
-class ExplodeParticleNode(bpy.types.Node, SimulationNode):
-    bl_idname = "fn_ExplodeParticleNode"
-    bl_label = "Explode Particle"
-
-    execute_on_birth__prop: NodeBuilder.ExecuteInputProperty()
-
-    def declaration(self, builder: NodeBuilder):
-        builder.fixed_input("amount", "Amount", "Integer", default=10)
-        builder.fixed_input("speed", "Speed", "Float", default=2)
-        builder.execute_input("execute_on_birth", "Execute on Birth", "execute_on_birth__prop")
-
-        builder.execute_output("execute", "Execute")
-        builder.influences_output("explode_system", "Explode System")
diff --git a/release/scripts/startup/nodes/menu.py b/release/scripts/startup/nodes/menu.py
index 6e80c966565..19fc6895b86 100644
--- a/release/scripts/startup/nodes/menu.py
+++ b/release/scripts/startup/nodes/menu.py
@@ -84,7 +84,6 @@ class ActionNodesMenu(bpy.types.Menu):
         insert_node(layout, "fn_ChangeParticleSizeNode", "Change Size")
         insert_node(layout, "fn_ChangeParticlePositionNode", "Change Position")
         layout.separator()
-        insert_node(layout, "fn_ExplodeParticleNode", "Explode Particle")
         insert_node(layout, "fn_KillParticleNode", "Kill Particle")
         insert_node(layout, "fn_ParticleConditionNode", "Condition")
 
diff --git a/source/blender/simulations/bparticles/actions.cpp b/source/blender/simulations/bparticles/actions.cpp
index 9d2a10aa4e2..33f182fe61a 100644
--- a/source/blender/simulations/bparticles/actions.cpp
+++ b/source/blender/simulations/bparticles/actions.cpp
@@ -125,41 +125,6 @@ void KillAction::execute(ActionInterface &interface)
   interface.kill(interface.pindices());
 }
 
-void ExplodeAction::execute(ActionInterface &interface)
-{
-  auto positions = interface.attributes().get<float3>("Position");
-
-  Vector<float3> new_positions;
-  Vector<float3> new_velocities;
-  Vector<float> new_birth_times;
-
-  auto inputs = ParticleFunctionResult::Compute(
-      *m_inputs_fn, interface.pindices(), interface.attributes());
-
-  for (uint pindex : interface.pindices()) {
-    uint parts_amount = std::max(0, inputs.get_single<int>("Amount", 0, pindex));
-    float speed = inputs.get_single<float>("Speed", 1, pindex);
-
-    new_positions.append_n_times(positions[pindex], parts_amount);
-    new_birth_times.append_n_times(interface.current_times()[pindex], parts_amount);
-
-    for (uint j = 0; j < parts_amount; j++) {
-      new_velocities.append(random_direction() * speed);
-    }
-  }
-
-  for (StringRef system_name : m_systems_to_emit) {
-    auto new_particles = interface.particle_allocator().request(system_name,
-                                                                new_birth_times.size());
-    new_particles.set<float3>("Position", new_positions);
-    new_particles.set<float3>("Velocity", new_velocities);
-    new_particles.fill<float>("Size", 0.1f);
-    new_particles.set<float>("Birth Time", new_birth_times);
-
-    m_on_birth_action.execute_for_new_particles(new_particles, interface);
-  }
-}
-
 void ConditionAction::execute(ActionInterface &interface)
 {
   auto inputs = ParticleFunctionResult::Compute(
diff --git a/source/blender/simulations/bparticles/actions.hpp b/source/blender/simulations/bparticles/actions.hpp
index e92f2a01a0b..494dc79e0d4 100644
--- a/source/blender/simulations/bparticles/actions.hpp
+++ b/source/blender/simulations/bparticles/actions.hpp
@@ -87,25 +87,6 @@ class ChangePositionAction : public Action {
   void execute(ActionInterface &interface) override;
 };
 
-class ExplodeAction : public Action {
- private:
-  ArrayRef<std::string> m_systems_to_emit;
-  ParticleFunction *m_inputs_fn;
-  Action &m_on_birth_action;
-
- public:
-  ExplodeAction(ArrayRef<std::string> systems_to_emit,
-                ParticleFunction *inputs_fn,
-                Action &on_birth_action)
-      : m_systems_to_emit(systems_to_emit),
-        m_inputs_fn(inputs_fn),
-        m_on_birth_action(on_birth_action)
-  {
-  }
-
-  void execute(ActionInterface &interface) override;
-};
-
 class ConditionAction : public Action {
  private:
   ParticleFunction *m_inputs_fn;
diff --git a/source/blender/simulations/bparticles/node_frontend.cpp b/source/blender/simulations/bparticles/node_frontend.cpp
index c1f5f27f76b..18a580c9c62 100644
--- a/source/blender/simulations/bparticles/node_frontend.cpp
+++ b/source/blender/simulations/bparticles/node_frontend.cpp
@@ -539,22 +539,6 @@ static void ACTION_change_velocity(XSocketActionBuilder &builder)
   }
 }
 
-static void ACTION_explode(XSocketActionBuilder &builder)
-{
-  ParticleFunction *inputs_fn = builder.particle_function_for_all_inputs();
-  if (inputs_fn == nullptr) {
-    return;
-  }
-
-  ArrayRef<std::string> system_names = builder.find_system_target_names(1, "Explode System");
-  if (builder.system_names().intersects__linear_search(system_names)) {
-    return;
-  }
-
-  Action &on_birth_action = builder.build_input_action_list("Execute on Birth", system_names);
-  builder.set_constructed<ExplodeAction>(system_names, inputs_fn, on_birth_action);
-}
-
 static void ACTION_spawn(XSocketActionBuilder &builder)
 {
   const XNode &xnode = builder.xsocket().node();
@@ -704,7 +688,6 @@ BLI_LAZY_INIT(StringMap<ActionParserCallback>, get_action_parsers)
   StringMap<ActionParserCallback> map;
   map.add_new("fn_KillParticleNode", ACTION_kill);
   map.add_new("fn_ChangeParticleVelocityNode", ACTION_change_velocity);
-  map.add_new("fn_ExplodeParticleNode", ACTION_explode);
   map.add_new("fn_SpawnParticlesNode", ACTION_spawn);
   map.add_new("fn_ParticleConditionNode", ACTION_condition);
   map.add_new("fn_ChangeParticleColorNode", ACTION_change_color);



More information about the Bf-blender-cvs mailing list