[Bf-blender-cvs] [3d2fafcfcc2] builtin-simulation-nodes: add Particle Birth Event node ui

Jacques Lucke noreply at git.blender.org
Mon Mar 2 17:24:14 CET 2020


Commit: 3d2fafcfcc2bfd9fb7d952f5386b809d0870bf3e
Author: Jacques Lucke
Date:   Mon Mar 2 17:23:12 2020 +0100
Branches: builtin-simulation-nodes
https://developer.blender.org/rB3d2fafcfcc2bfd9fb7d952f5386b809d0870bf3e

add Particle Birth Event node ui

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

M	release/scripts/startup/nodeitems_builtins.py
M	source/blender/blenkernel/BKE_node.h
M	source/blender/blenkernel/intern/node.c
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_simulation.h
M	source/blender/nodes/NOD_static_types.h
A	source/blender/nodes/simulation/nodes/node_sim_particle_birth_event.cc

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

diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index 273b64dee15..f5d4ef20e4f 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -478,7 +478,10 @@ simulation_node_categories = [
     SimulationNodeCategory("SIM_OUTPUT", "Output", items=[
         NodeItem("SimulationNodeParticleSimulation"),
     ]),
-    SimulationNodeCategory("FORCE", "Force", items=[
+    SimulationNodeCategory("EVENTS", "Events", items=[
+        NodeItem("SimulationNodeParticleBirthEvent"),
+    ]),
+    SimulationNodeCategory("FORCES", "Forces", items=[
         NodeItem("SimulationNodeCustomForce"),
     ]),
     SimulationNodeCategory("EXECUTE", "Execute", items=[
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 3d713316125..b98ac6980b9 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1012,6 +1012,7 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree,
 #define SIM_NODE_PARTICLE_SIMULATION 1000
 #define SIM_NODE_CUSTOM_FORCE 1001
 #define SIM_NODE_SET_PARTICLE_ATTRIBUTE 1002
+#define SIM_NODE_PARTICLE_BIRTH_EVENT 1003
 
 /* custom defines options for Material node */
 // #define SH_NODE_MAT_DIFF 1
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 07cf1cfeed1..55a74bd8d6a 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -4126,6 +4126,7 @@ static void registerSimulationNodes(void)
   register_node_type_sim_particle_simulation();
   register_node_type_sim_custom_force();
   register_node_type_set_particle_attribute();
+  register_node_type_sim_particle_birth_event();
 }
 
 void init_nodesystem(void)
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 927a1b85a4d..767d912a3cf 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -223,6 +223,7 @@ set(SRC
 
   simulation/nodes/node_sim_common.cc
   simulation/nodes/node_sim_custom_force.cc
+  simulation/nodes/node_sim_particle_birth_event.cc
   simulation/nodes/node_sim_particle_simulation.cc
   simulation/nodes/node_sim_set_particle_attribute.cc
   simulation/node_sim_tree.cc
diff --git a/source/blender/nodes/NOD_simulation.h b/source/blender/nodes/NOD_simulation.h
index 09d2d5b2ece..c2b2170cb37 100644
--- a/source/blender/nodes/NOD_simulation.h
+++ b/source/blender/nodes/NOD_simulation.h
@@ -14,6 +14,7 @@ void register_node_type_sim_group(void);
 void register_node_type_sim_particle_simulation(void);
 void register_node_type_sim_custom_force(void);
 void register_node_type_set_particle_attribute(void);
+void register_node_type_sim_particle_birth_event(void);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 95b8708183d..3069d90033e 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -261,6 +261,7 @@ DefNode(TextureNode,    TEX_NODE_PROC+TEX_DISTNOISE, 0,                  "TEX_DI
 DefNode(SimulationNode, SIM_NODE_PARTICLE_SIMULATION, 0,                 "PARTICLE_SIMULATION", ParticleSimulation, "Particle Simulation", "")
 DefNode(SimulationNode, SIM_NODE_CUSTOM_FORCE,        0,                 "CUSTOM_FORCE",        CustomForce,        "Custom Force",        "")
 DefNode(SimulationNode, SIM_NODE_SET_PARTICLE_ATTRIBUTE, 0,              "SET_PARTICLE_ATTRIBUTE", SetParticleAttribute, "Set Particle Attribute", "")
+DefNode(SimulationNode, SIM_NODE_PARTICLE_BIRTH_EVENT,   0,               "PARTICLE_BIRTH_EVENT",   ParticleBirthEvent,   "Particle Birth Event",   "")
 
 /* undefine macros */
 #undef DefNode
diff --git a/source/blender/nodes/simulation/nodes/node_sim_particle_birth_event.cc b/source/blender/nodes/simulation/nodes/node_sim_particle_birth_event.cc
new file mode 100644
index 00000000000..ecb253b76e3
--- /dev/null
+++ b/source/blender/nodes/simulation/nodes/node_sim_particle_birth_event.cc
@@ -0,0 +1,21 @@
+#include "node_sim_util.h"
+
+static bNodeSocketTemplate sim_node_particle_birth_event_in[] = {
+    {SOCK_CONTROL_FLOW, 1, N_("Execute")},
+    {-1, 0, ""},
+};
+
+static bNodeSocketTemplate sim_node_particle_birth_event_out[] = {
+    {SOCK_EVENTS, 0, N_("Event")},
+    {-1, 0, ""},
+};
+
+void register_node_type_sim_particle_birth_event()
+{
+  static bNodeType ntype;
+
+  sim_node_type_base(&ntype, SIM_NODE_PARTICLE_BIRTH_EVENT, "Particle Birth Event", 0, 0);
+  node_type_socket_templates(
+      &ntype, sim_node_particle_birth_event_in, sim_node_particle_birth_event_out);
+  nodeRegisterType(&ntype);
+}



More information about the Bf-blender-cvs mailing list