[Bf-blender-cvs] [a9044edce54] soc-2021-porting-modifiers-to-nodes-remesh-blocks: updated to fields workflow.

Fabian Schempp noreply at git.blender.org
Mon Jan 17 00:19:09 CET 2022


Commit: a9044edce541d51077a30571ed6b650bf7a8e932
Author: Fabian Schempp
Date:   Mon Jan 17 00:19:03 2022 +0100
Branches: soc-2021-porting-modifiers-to-nodes-remesh-blocks
https://developer.blender.org/rBa9044edce541d51077a30571ed6b650bf7a8e932

updated to fields workflow.

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

M	source/blender/geometry/CMakeLists.txt
M	source/blender/modifiers/intern/MOD_remesh.c
M	source/blender/nodes/geometry/CMakeLists.txt
M	source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc

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

diff --git a/source/blender/geometry/CMakeLists.txt b/source/blender/geometry/CMakeLists.txt
index 8f65a2ac63e..eba674be3f9 100644
--- a/source/blender/geometry/CMakeLists.txt
+++ b/source/blender/geometry/CMakeLists.txt
@@ -35,7 +35,6 @@ set(SRC
   intern/realize_instances.cc
 
   GEO_mesh_to_curve.hh
-  GEO_mesh_remesh_blocks.h
   GEO_realize_instances.hh
 )
 
@@ -54,6 +53,7 @@ if(WITH_TBB)
   list(APPEND LIB
     ${TBB_LIBRARIES}
   )
+endif()
 
 if(WITH_REMESH_DUALCON)
   list(APPEND INC
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index 5464ac1d9a8..12ec91322b1 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -96,6 +96,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *UNUSED(ctx)
 static void panel_draw(const bContext *UNUSED(C), Panel *panel)
 {
   uiLayout *layout = panel->layout;
+#ifdef WITH_MOD_REMESH
   uiLayout *row, *col;
 
   PointerRNA ob_ptr;
diff --git a/source/blender/nodes/geometry/CMakeLists.txt b/source/blender/nodes/geometry/CMakeLists.txt
index d692bd050c8..64d60f6c23f 100644
--- a/source/blender/nodes/geometry/CMakeLists.txt
+++ b/source/blender/nodes/geometry/CMakeLists.txt
@@ -162,6 +162,7 @@ set(SRC
   nodes/node_geo_points_to_volume.cc
   nodes/node_geo_proximity.cc
   nodes/node_geo_raycast.cc
+  nodes/node_geo_remesh_blocks.cc
   nodes/node_geo_realize_instances.cc
   nodes/node_geo_rotate_instances.cc
   nodes/node_geo_scale_instances.cc
diff --git a/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc b/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
index 25ae8ab3e9e..03122cc7610 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
@@ -27,20 +27,17 @@
 
 #include "node_geometry_util.hh"
 
-static bNodeSocketTemplate geo_node_remesh_blocks_in[] = {
-    {SOCK_GEOMETRY, N_("Geometry")},
-    {SOCK_INT, N_("Depth"), 4, 0, 0, 0, 2, 64},
-    {SOCK_FLOAT, N_("Scale"), 0.9f, 0, 0, 0, 0.0f, 0.99f},
-    {SOCK_FLOAT, N_("Threshold"), 1.0f, 0, 0, 0, 0.01f, FLT_MAX},
-    {-1, ""},
-};
-
-static bNodeSocketTemplate geo_node_remesh_blocks_out[] = {
-    {SOCK_GEOMETRY, N_("Geometry")},
-    {-1, ""},
-};
-
-static void geo_node_remesh_blocks_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+namespace blender::nodes::node_geo_remesh_cc {
+static void node_declare(NodeDeclarationBuilder &b)
+{
+  b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
+  b.add_input<decl::Int>(N_("Depth")).default_value(4).min(2).max(64);
+  b.add_input<decl::Float>(N_("Scale")).default_value(0.9f).min(0.0f).max(0.99f);
+  b.add_input<decl::Float>(N_("Threshold")).default_value(1.0f).min(0.01f).max(FLT_MAX);
+  b.add_output<decl::Geometry>(N_("Mesh"));
+}
+
+static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
 {
   uiItemR(layout, ptr, "remesh_blocks_mode", 0, "", ICON_NONE);
 }
@@ -50,10 +47,9 @@ static void geo_remesh_blocks_init(bNodeTree *UNUSED(ntree), bNode *node)
   node->custom1 = 0;
 }
 
-namespace blender::nodes {
-static void geo_node_remesh_blocks_exec(GeoNodeExecParams params)
+static void node_geo_exec(GeoNodeExecParams params)
 {
-  GeometrySet geometry_set = params.extract_input<GeometrySet>("Geometry");
+  GeometrySet geometry_set = params.extract_input<GeometrySet>("Mesh");
   const char flag = 0;
   const char mode = params.node().custom1;
   const int hermite_num = 1;
@@ -73,18 +69,21 @@ static void geo_node_remesh_blocks_exec(GeoNodeExecParams params)
 
     geometry_set.replace_mesh(output_mesh);
   }
-  params.set_output("Geometry", std::move(geometry_set));
+  params.set_output("Mesh", std::move(geometry_set));
 }
-}  // namespace blender::nodes
+}  // namespace blender::nodes::node_geo_remesh_cc
 
 void register_node_type_geo_remesh_blocks()
 {
+
+  namespace file_ns = blender::nodes::node_geo_remesh_cc;
+
   static bNodeType ntype;
 
-  geo_node_type_base(&ntype, GEO_NODE_REMESH_BLOCKS, "Remesh Blocks", NODE_CLASS_GEOMETRY, 0);
-  node_type_socket_templates(&ntype, geo_node_remesh_blocks_in, geo_node_remesh_blocks_out);
-  node_type_init(&ntype, geo_remesh_blocks_init);
-  ntype.geometry_node_execute = blender::nodes::geo_node_remesh_blocks_exec;
-  ntype.draw_buttons = geo_node_remesh_blocks_layout;
+  geo_node_type_base(&ntype, GEO_NODE_REMESH_BLOCKS, "Remesh Blocks", NODE_CLASS_GEOMETRY);
+  ntype.declare = file_ns::node_declare;
+  node_type_init(&ntype, file_ns::geo_remesh_blocks_init);
+  ntype.geometry_node_execute = file_ns::node_geo_exec;
+  ntype.draw_buttons = file_ns::node_layout;
   nodeRegisterType(&ntype);
 }



More information about the Bf-blender-cvs mailing list