Nodes: add Combine Strings and Group Instance ID node UIs
authorJacques Lucke <jacques@blender.org>
Mon, 4 May 2020 10:49:25 +0000 (12:49 +0200)
committerJacques Lucke <jacques@blender.org>
Mon, 4 May 2020 10:49:25 +0000 (12:49 +0200)
Reviewers: brecht

Differential Revision: https://developer.blender.org/D7494

release/scripts/startup/nodeitems_builtins.py
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/intern/node.c
source/blender/nodes/CMakeLists.txt
source/blender/nodes/NOD_function.h
source/blender/nodes/NOD_static_types.h
source/blender/nodes/function/nodes/node_fn_combine_strings.cc [new file with mode: 0644]
source/blender/nodes/function/nodes/node_fn_group_instance_id.cc [new file with mode: 0644]

index 48df4ae8b900efbf43d08377f109facafaded1c6..2dc6c6cd409eba13076f48671d227a4f66bb1f2a 100644 (file)
@@ -483,6 +483,7 @@ simulation_node_categories = [
     SimulationNodeCategory("SIM_INPUTS", "Input", items=[
         NodeItem("SimulationNodeTime"),
         NodeItem("SimulationNodeParticleAttribute"),
+        NodeItem("FunctionNodeGroupInstanceID"),
     ]),
     SimulationNodeCategory("SIM_EMITTERS", "Emitters", items=[
         NodeItem("SimulationNodeParticleMeshEmitter"),
@@ -527,6 +528,7 @@ simulation_node_categories = [
         NodeItem("FunctionNodeBooleanMath"),
         NodeItem("FunctionNodeFloatCompare"),
         NodeItem("FunctionNodeSwitch"),
+        NodeItem("FunctionNodeCombineStrings"),
     ]),
     SimulationNodeCategory("SIM_GROUP", "Group", items=node_group_items),
     SimulationNodeCategory("SIM_LAYOUT", "Layout", items=[
index 7c77d57bc695b0a5818969f3f29df6748c0f5ce2..536d04f8bd36e9354a75814c3f88c0c871a6796a 100644 (file)
@@ -1309,6 +1309,8 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
 #define FN_NODE_BOOLEAN_MATH 1200
 #define FN_NODE_SWITCH 1201
 #define FN_NODE_FLOAT_COMPARE 1202
+#define FN_NODE_GROUP_INSTANCE_ID 1203
+#define FN_NODE_COMBINE_STRINGS 1204
 
 /** \} */
 
index f9477339b9be49bb5b6770f1174da8d9f82456b4..e6547012b881553efd8f7111d4c49af5ab60d7c5 100644 (file)
@@ -4248,6 +4248,8 @@ static void registerFunctionNodes(void)
   register_node_type_fn_boolean_math();
   register_node_type_fn_float_compare();
   register_node_type_fn_switch();
+  register_node_type_fn_group_instance_id();
+  register_node_type_fn_combine_strings();
 }
 
 void init_nodesystem(void)
index 469a230f4672345f36bd7ec1b8a7acd037908d3d..80bf0f7c5e2269d4417e7d44e163f62bc70ab433 100644 (file)
@@ -130,7 +130,9 @@ set(SRC
   composite/node_composite_util.c
 
   function/nodes/node_fn_boolean_math.cc
+  function/nodes/node_fn_combine_strings.cc
   function/nodes/node_fn_float_compare.cc
+  function/nodes/node_fn_group_instance_id.cc
   function/nodes/node_fn_switch.cc
   function/node_function_util.cc
 
index 58597b3d4108495e798dbfbe121f4f17167c9f60..377ae8bfb8424de9ffd51d293f48491941ebdf66 100644 (file)
@@ -24,6 +24,8 @@ extern "C" {
 void register_node_type_fn_boolean_math(void);
 void register_node_type_fn_float_compare(void);
 void register_node_type_fn_switch(void);
+void register_node_type_fn_group_instance_id(void);
+void register_node_type_fn_combine_strings(void);
 
 #ifdef __cplusplus
 }
index 354c87c554af76c25bab837a196b7088c502fd4b..91aa11566d38eb3e44e763cb216f4311d6d36898 100644 (file)
@@ -274,6 +274,8 @@ DefNode(SimulationNode, SIM_NODE_PARTICLE_ATTRIBUTE, def_sim_particle_attribute,
 DefNode(FunctionNode, FN_NODE_BOOLEAN_MATH,  def_boolean_math,  "BOOLEAN_MATH",  BooleanMath,  "Boolean Math", "")
 DefNode(FunctionNode, FN_NODE_FLOAT_COMPARE, def_float_compare, "FLOAT_COMPARE", FloatCompare, "Float Compare", "")
 DefNode(FunctionNode, FN_NODE_SWITCH,        def_fn_switch,     "SWITCH",        Switch,       "Switch", "")
+DefNode(FunctionNode, FN_NODE_GROUP_INSTANCE_ID, 0,             "GROUP_INSTANCE_ID", GroupInstanceID,  "Group Instance ID", "")
+DefNode(FunctionNode, FN_NODE_COMBINE_STRINGS, 0,               "COMBINE_STRINGS", CombineStrings, "Combine Strings", "")
 
 
 /* undefine macros */
diff --git a/source/blender/nodes/function/nodes/node_fn_combine_strings.cc b/source/blender/nodes/function/nodes/node_fn_combine_strings.cc
new file mode 100644 (file)
index 0000000..1b60914
--- /dev/null
@@ -0,0 +1,21 @@
+#include "node_function_util.h"
+
+static bNodeSocketTemplate fn_node_combine_strings_in[] = {
+    {SOCK_STRING, N_("A")},
+    {SOCK_STRING, N_("B")},
+    {-1, ""},
+};
+
+static bNodeSocketTemplate fn_node_combine_strings_out[] = {
+    {SOCK_STRING, N_("Result")},
+    {-1, ""},
+};
+
+void register_node_type_fn_combine_strings()
+{
+  static bNodeType ntype;
+
+  fn_node_type_base(&ntype, FN_NODE_COMBINE_STRINGS, "Combine Strings", 0, 0);
+  node_type_socket_templates(&ntype, fn_node_combine_strings_in, fn_node_combine_strings_out);
+  nodeRegisterType(&ntype);
+}
diff --git a/source/blender/nodes/function/nodes/node_fn_group_instance_id.cc b/source/blender/nodes/function/nodes/node_fn_group_instance_id.cc
new file mode 100644 (file)
index 0000000..2ac86ee
--- /dev/null
@@ -0,0 +1,15 @@
+#include "node_function_util.h"
+
+static bNodeSocketTemplate fn_node_group_instance_id_out[] = {
+    {SOCK_STRING, N_("Identifier")},
+    {-1, ""},
+};
+
+void register_node_type_fn_group_instance_id()
+{
+  static bNodeType ntype;
+
+  fn_node_type_base(&ntype, FN_NODE_GROUP_INSTANCE_ID, "Group Instance ID", 0, 0);
+  node_type_socket_templates(&ntype, nullptr, fn_node_group_instance_id_out);
+  nodeRegisterType(&ntype);
+}