[Bf-blender-cvs] [933700d9027] soc-2021-porting-modifiers-to-nodes-remesh-blocks: Changes based on review by Jacques Lucke (JacquesLucke).

Fabian Schempp noreply at git.blender.org
Sun Feb 20 00:12:58 CET 2022


Commit: 933700d902700e56b60874aabaddc6989f8acde0
Author: Fabian Schempp
Date:   Sun Feb 20 00:12:38 2022 +0100
Branches: soc-2021-porting-modifiers-to-nodes-remesh-blocks
https://developer.blender.org/rB933700d902700e56b60874aabaddc6989f8acde0

Changes based on review by
Jacques Lucke (JacquesLucke).

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

M	CMakeLists.txt
M	release/scripts/startup/nodeitems_builtins.py
M	source/blender/geometry/GEO_mesh_remesh_blocks.h
M	source/blender/geometry/intern/remesh_blocks.c
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc

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

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c13e4749b9..7335fd91691 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -271,7 +271,7 @@ if(UNIX AND NOT APPLE)
 endif()
 
 # Geometry
-option(WITH_REMESH_DUALCON      "Enable Remesh Algorithm using Dualcon" ON)
+option(WITH_MOD_REMESH          "Enable Remesh Algorithm using Dualcon" ON)
 
 # Modifiers
 option(WITH_MOD_FLUID           "Enable Mantaflow Fluid Simulation Framework" ON)
diff --git a/release/scripts/startup/nodeitems_builtins.py b/release/scripts/startup/nodeitems_builtins.py
index 6e751715180..155a30bebf6 100644
--- a/release/scripts/startup/nodeitems_builtins.py
+++ b/release/scripts/startup/nodeitems_builtins.py
@@ -131,7 +131,7 @@ def mesh_node_items(context):
     yield NodeItem("GeometryNodeMeshBoolean")
     yield NodeItem("GeometryNodeMeshToCurve")
     yield NodeItem("GeometryNodeMeshToPoints")
-    yield NodeItem("GeometryNodeRemeshBlocks"),
+    yield NodeItem("GeometryNodeRemeshBlocks")
     yield NodeItem("GeometryNodeSplitEdges")
     yield NodeItem("GeometryNodeSubdivideMesh")
     yield NodeItem("GeometryNodeSubdivisionSurface")
diff --git a/source/blender/geometry/GEO_mesh_remesh_blocks.h b/source/blender/geometry/GEO_mesh_remesh_blocks.h
index 6e727871b67..74be72321dc 100644
--- a/source/blender/geometry/GEO_mesh_remesh_blocks.h
+++ b/source/blender/geometry/GEO_mesh_remesh_blocks.h
@@ -37,7 +37,7 @@ typedef enum eRemeshBlocksMode {
 
 struct Mesh *GEO_mesh_remesh_blocks(const struct Mesh *mesh,
                                     const char remesh_flag,
-                                    const char remesh_mode,
+                                    const eRemeshBlocksMode remesh_mode,
                                     const float threshold,
                                     const int hermite_num,
                                     const float scale,
diff --git a/source/blender/geometry/intern/remesh_blocks.c b/source/blender/geometry/intern/remesh_blocks.c
index 248def94779..9004bd292be 100644
--- a/source/blender/geometry/intern/remesh_blocks.c
+++ b/source/blender/geometry/intern/remesh_blocks.c
@@ -57,14 +57,14 @@ static void init_dualcon_mesh(DualConInput *input, const Mesh *mesh)
   BKE_mesh_minmax(mesh, input->min, input->max);
 }
 
-/* simple structure to hold the output: a CDDM and two counters to
- * keep track of the current elements */
+/* Simple structure to hold the output: a CDDM and two counters to
+ * keep track of the current elements. */
 typedef struct {
   Mesh *mesh;
   int curvert, curface;
 } DualConOutput;
 
-/* allocate and initialize a DualConOutput */
+/* Allocate and initialize a DualConOutput. */
 static void *dualcon_alloc_output(int totvert, int totquad)
 {
   DualConOutput *output;
@@ -112,7 +112,7 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4])
 
 Mesh *GEO_mesh_remesh_blocks(const Mesh *mesh,
                              const char remesh_flag,
-                             const char remesh_mode,
+                             const eRemeshBlocksMode remesh_mode,
                              const float threshold,
                              const int hermite_num,
                              const float scale,
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index a0e5fc282d2..55b6fdcbf0a 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -367,6 +367,7 @@ blender_include_dirs(
   ../../bmesh
   ../../depsgraph
   ../../draw
+  ../../geometry
   ../../gpu
   ../../ikplugin
   ../../imbuf
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 59a380eacdd..336297cd841 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -31,6 +31,8 @@
 #include "BKE_node_tree_update.h"
 #include "BKE_texture.h"
 
+#include "GEO_mesh_remesh_blocks.h"
+
 #include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_enum_types.h"
@@ -9563,9 +9565,13 @@ static void def_geo_subdivision_surface(StructRNA *srna)
 static void def_geo_remesh_blocks(StructRNA *srna)
 {
   static const EnumPropertyItem remesh_mode_items[] = {
-      {0, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"},
-      {1, "SMOOTH", 0, "Smooth", "Output a smooth surface with no sharp-features detection"},
-      {2,
+      {REMESH_BLOCKS_CENTROID, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"},
+      {REMESH_BLOCKS_MASS_POINT,
+       "SMOOTH",
+       0,
+       "Smooth",
+       "Output a smooth surface with no sharp-features detection"},
+      {REMESH_BLOCKS_SHARP_FEATURES,
        "SHARP",
        0,
        "Sharp",
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 03122cc7610..44622eff78e 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
@@ -31,9 +31,23 @@ 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_input<decl::Int>(N_("Depth"))
+      .description("Resolution of the octree. Higher values give finer details.")
+      .default_value(4)
+      .min(2)
+      .max(64);
+  b.add_input<decl::Float>(N_("Scale"))
+      .description("The ratio of the largest dimension of the model over the size of the grid")
+      .default_value(0.9f)
+      .min(0.0f)
+      .max(0.99f);
+  b.add_input<decl::Float>(N_("Threshold"))
+      .description(
+          "When removing disconnected pieces, minimum size of components to preserve as a ratio "
+          "of the number of polygons in the largest component")
+      .default_value(1.0f)
+      .min(0.01f)
+      .max(FLT_MAX);
   b.add_output<decl::Geometry>(N_("Mesh"));
 }
 
@@ -51,7 +65,7 @@ static void node_geo_exec(GeoNodeExecParams params)
 {
   GeometrySet geometry_set = params.extract_input<GeometrySet>("Mesh");
   const char flag = 0;
-  const char mode = params.node().custom1;
+  const eRemeshBlocksMode mode = static_cast<eRemeshBlocksMode>(params.node().custom1);
   const int hermite_num = 1;
   const int depth = params.extract_input<int>("Depth");
   const float scale = min_ff(params.extract_input<float>("Scale"), 0.99f);



More information about the Bf-blender-cvs mailing list