Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Matthews <guitargeek>2021-09-02 06:53:52 +0300
committerHans Goudey <h.goudey@me.com>2021-09-02 06:53:52 +0300
commit0ccbf5069431aaa323ca9c7f09cb62a0ea35ae86 (patch)
tree043a3e5da7c01c85aea9784f28af124b4cd7d287 /source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
parent4170668776fc447c2204298ccb6928eeed0e4f55 (diff)
Cleanup: Convert geometry nodes socket list to use new API
The new API introduced in rB1e69a25043120c provides a shorted, more flexibly way to declare node socket inputs and outputs. This commit updates all geometry nodes to use the `NodeSocketBuilder` API, except the four nodes that need `SOCK_HIDE_VALUE` or `SOCK_MULTI_INPUT`. Differential Revisions: D12377, D12376, D12374, D12373, D12372
Diffstat (limited to 'source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc30
1 files changed, 12 insertions, 18 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
index b40cb478b03..ed701c921ca 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cylinder.cc
@@ -25,17 +25,15 @@
#include "node_geometry_util.hh"
-static bNodeSocketTemplate geo_node_mesh_primitive_cylinder_in[] = {
- {SOCK_INT, N_("Vertices"), 32, 0.0f, 0.0f, 0.0f, 3, 4096},
- {SOCK_FLOAT, N_("Radius"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX, PROP_DISTANCE},
- {SOCK_FLOAT, N_("Depth"), 2.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX, PROP_DISTANCE},
- {-1, ""},
-};
-
-static bNodeSocketTemplate geo_node_mesh_primitive_cylinder_out[] = {
- {SOCK_GEOMETRY, N_("Geometry")},
- {-1, ""},
-};
+namespace blender::nodes {
+
+static void geo_node_mesh_primitive_cylinder_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Int>("Vertices").default_value(32).min(3).max(4096);
+ b.add_input<decl::Float>("Radius").default_value(1.0f).min(0.0f).subtype(PROP_DISTANCE);
+ b.add_input<decl::Float>("Depth").default_value(2.0f).min(0.0f).subtype(PROP_DISTANCE);
+ b.add_output<decl::Geometry>("Geometry");
+}
static void geo_node_mesh_primitive_cylinder_layout(uiLayout *layout,
bContext *UNUSED(C),
@@ -56,8 +54,6 @@ static void geo_node_mesh_primitive_cylinder_init(bNodeTree *UNUSED(ntree), bNod
node->storage = node_storage;
}
-namespace blender::nodes {
-
static void geo_node_mesh_primitive_cylinder_exec(GeoNodeExecParams params)
{
const bNode &node = params.node();
@@ -86,14 +82,12 @@ static void geo_node_mesh_primitive_cylinder_exec(GeoNodeExecParams params)
void register_node_type_geo_mesh_primitive_cylinder()
{
static bNodeType ntype;
-
geo_node_type_base(&ntype, GEO_NODE_MESH_PRIMITIVE_CYLINDER, "Cylinder", NODE_CLASS_GEOMETRY, 0);
- node_type_socket_templates(
- &ntype, geo_node_mesh_primitive_cylinder_in, geo_node_mesh_primitive_cylinder_out);
- node_type_init(&ntype, geo_node_mesh_primitive_cylinder_init);
+ node_type_init(&ntype, blender::nodes::geo_node_mesh_primitive_cylinder_init);
node_type_storage(
&ntype, "NodeGeometryMeshCylinder", node_free_standard_storage, node_copy_standard_storage);
+ ntype.declare = blender::nodes::geo_node_mesh_primitive_cylinder_declare;
ntype.geometry_node_execute = blender::nodes::geo_node_mesh_primitive_cylinder_exec;
- ntype.draw_buttons = geo_node_mesh_primitive_cylinder_layout;
+ ntype.draw_buttons = blender::nodes::geo_node_mesh_primitive_cylinder_layout;
nodeRegisterType(&ntype);
}