[Bf-blender-cvs] [67066b03ec6] builtin-simulation-nodes: add Set Particle Attribute node ui

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


Commit: 67066b03ec6c27572684fb4effd25c6950167855
Author: Jacques Lucke
Date:   Mon Mar 2 17:15:12 2020 +0100
Branches: builtin-simulation-nodes
https://developer.blender.org/rB67066b03ec6c27572684fb4effd25c6950167855

add Set Particle Attribute 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_set_particle_attribute.cc

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

diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index 0a471d10229..273b64dee15 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -481,6 +481,9 @@ simulation_node_categories = [
     SimulationNodeCategory("FORCE", "Force", items=[
         NodeItem("SimulationNodeCustomForce"),
     ]),
+    SimulationNodeCategory("EXECUTE", "Execute", items=[
+        NodeItem("SimulationNodeSetParticleAttribute"),
+    ]),
 ]
 
 
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index a2143113d07..3d713316125 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -1011,6 +1011,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
 
 /* 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 70fdc689a45..07cf1cfeed1 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -4125,6 +4125,7 @@ static void registerSimulationNodes(void)
 
   register_node_type_sim_particle_simulation();
   register_node_type_sim_custom_force();
+  register_node_type_set_particle_attribute();
 }
 
 void init_nodesystem(void)
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 104d240cb8a..927a1b85a4d 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -224,6 +224,7 @@ set(SRC
   simulation/nodes/node_sim_common.cc
   simulation/nodes/node_sim_custom_force.cc
   simulation/nodes/node_sim_particle_simulation.cc
+  simulation/nodes/node_sim_set_particle_attribute.cc
   simulation/node_sim_tree.cc
   simulation/node_sim_util.cc
 
diff --git a/source/blender/nodes/NOD_simulation.h b/source/blender/nodes/NOD_simulation.h
index dcf4b358ca7..09d2d5b2ece 100644
--- a/source/blender/nodes/NOD_simulation.h
+++ b/source/blender/nodes/NOD_simulation.h
@@ -13,6 +13,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);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h
index 671228a169c..95b8708183d 100644
--- a/source/blender/nodes/NOD_static_types.h
+++ b/source/blender/nodes/NOD_static_types.h
@@ -260,6 +260,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", "")
 
 /* undefine macros */
 #undef DefNode
diff --git a/source/blender/nodes/simulation/nodes/node_sim_set_particle_attribute.cc b/source/blender/nodes/simulation/nodes/node_sim_set_particle_attribute.cc
new file mode 100644
index 00000000000..9d3d5c7ea20
--- /dev/null
+++ b/source/blender/nodes/simulation/nodes/node_sim_set_particle_attribute.cc
@@ -0,0 +1,22 @@
+#include "node_sim_util.h"
+
+static bNodeSocketTemplate sim_node_set_particle_attribute_in[] = {
+    {SOCK_STRING, 1, N_("Name")},
+    {SOCK_FLOAT, 1, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f},
+    {-1, 0, ""},
+};
+
+static bNodeSocketTemplate sim_node_set_particle_attribute_out[] = {
+    {SOCK_CONTROL_FLOW, 0, N_("Execute")},
+    {-1, 0, ""},
+};
+
+void register_node_type_set_particle_attribute()
+{
+  static bNodeType ntype;
+
+  sim_node_type_base(&ntype, SIM_NODE_SET_PARTICLE_ATTRIBUTE, "Set Particle Attribute", 0, 0);
+  node_type_socket_templates(
+      &ntype, sim_node_set_particle_attribute_in, sim_node_set_particle_attribute_out);
+  nodeRegisterType(&ntype);
+}



More information about the Bf-blender-cvs mailing list