[Bf-blender-cvs] [50f694c7def] master: Cleanup: Use new socket builder API

Aaron Carlisle noreply at git.blender.org
Wed Jan 5 21:47:38 CET 2022


Commit: 50f694c7def8bae73d33cb3c5e0fed3ad066820e
Author: Aaron Carlisle
Date:   Wed Jan 5 15:09:55 2022 -0500
Branches: master
https://developer.blender.org/rB50f694c7def8bae73d33cb3c5e0fed3ad066820e

Cleanup: Use new socket builder API

Also enables translation of socket names

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

M	source/blender/nodes/shader/nodes/node_shader_particle_info.cc

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

diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
index 40c5ff6db9b..163a5d6ebfe 100644
--- a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc
@@ -23,19 +23,19 @@
 
 namespace blender::nodes::node_shader_particle_info_cc {
 
-static bNodeSocketTemplate outputs[] = {
-    {SOCK_FLOAT, "Index"},
-    {SOCK_FLOAT, "Random"},
-    {SOCK_FLOAT, "Age"},
-    {SOCK_FLOAT, "Lifetime"},
-    {SOCK_VECTOR, "Location"},
+static void node_declare(NodeDeclarationBuilder &b)
+{
+  b.add_output<decl::Float>(N_("Index"));
+  b.add_output<decl::Float>(N_("Random"));
+  b.add_output<decl::Float>(N_("Age"));
+  b.add_output<decl::Float>(N_("Lifetime"));
+  b.add_output<decl::Vector>(N_("Location"));
 #if 0 /* quaternion sockets not yet supported */
-    {SOCK_QUATERNION, "Rotation"},
+  b.add_output<decl::Quaternion>(N_("Rotation"));
 #endif
-    {SOCK_FLOAT, "Size"},
-    {SOCK_VECTOR, "Velocity"},
-    {SOCK_VECTOR, "Angular Velocity"},
-    {-1, ""},
+  b.add_output<decl::Float>(N_("Size"));
+  b.add_output<decl::Vector>(N_("Velocity"));
+  b.add_output<decl::Vector>(N_("Angular Velocity"));
 };
 
 static int gpu_shader_particle_info(GPUMaterial *mat,
@@ -66,7 +66,7 @@ void register_node_type_sh_particle_info()
   static bNodeType ntype;
 
   sh_node_type_base(&ntype, SH_NODE_PARTICLE_INFO, "Particle Info", NODE_CLASS_INPUT);
-  node_type_socket_templates(&ntype, nullptr, file_ns::outputs);
+  ntype.declare = file_ns::node_declare;
   node_type_gpu(&ntype, file_ns::gpu_shader_particle_info);
 
   nodeRegisterType(&ntype);



More information about the Bf-blender-cvs mailing list