[Bf-blender-cvs] [17b7cbe9751] soc-2021-porting-modifiers-to-nodes-remesh-blocks: - changes based on Review by Jacques Lucke (JacquesLucke)

Fabian Schempp noreply at git.blender.org
Sun Aug 15 09:05:05 CEST 2021


Commit: 17b7cbe97514d66aeebc88c8b8c966812b7991fa
Author: Fabian Schempp
Date:   Fri Jul 30 23:51:31 2021 +0200
Branches: soc-2021-porting-modifiers-to-nodes-remesh-blocks
https://developer.blender.org/rB17b7cbe97514d66aeebc88c8b8c966812b7991fa

- changes based on Review by Jacques Lucke (JacquesLucke)

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

M	build_files/cmake/config/blender_full.cmake
M	build_files/cmake/config/blender_lite.cmake
M	source/blender/blenkernel/BKE_mesh.h
M	source/blender/geometry/GEO_mesh_remesh_blocks.h
M	source/blender/geometry/intern/remesh_blocks.c
M	source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc

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

diff --git a/build_files/cmake/config/blender_full.cmake b/build_files/cmake/config/blender_full.cmake
index b58f16731f2..9b01305bde8 100644
--- a/build_files/cmake/config/blender_full.cmake
+++ b/build_files/cmake/config/blender_full.cmake
@@ -37,7 +37,7 @@ set(WITH_LZMA                ON  CACHE BOOL "" FORCE)
 set(WITH_LZO                 ON  CACHE BOOL "" FORCE)
 set(WITH_MOD_FLUID           ON  CACHE BOOL "" FORCE)
 set(WITH_MOD_OCEANSIM        ON  CACHE BOOL "" FORCE)
-set(WITH_REMESH_DUALCON          ON  CACHE BOOL "" FORCE)
+set(WITH_REMESH_DUALCON      ON  CACHE BOOL "" FORCE)
 set(WITH_NANOVDB             ON  CACHE BOOL "" FORCE)
 set(WITH_OPENAL              ON  CACHE BOOL "" FORCE)
 set(WITH_OPENCOLLADA         ON  CACHE BOOL "" FORCE)
diff --git a/build_files/cmake/config/blender_lite.cmake b/build_files/cmake/config/blender_lite.cmake
index f7281298768..cd4e14f8e0c 100644
--- a/build_files/cmake/config/blender_lite.cmake
+++ b/build_files/cmake/config/blender_lite.cmake
@@ -43,7 +43,7 @@ set(WITH_LZMA                OFF CACHE BOOL "" FORCE)
 set(WITH_LZO                 OFF CACHE BOOL "" FORCE)
 set(WITH_MOD_FLUID           OFF CACHE BOOL "" FORCE)
 set(WITH_MOD_OCEANSIM        OFF CACHE BOOL "" FORCE)
-set(WITH_REMESH_DUALCON          OFF CACHE BOOL "" FORCE)
+set(WITH_REMESH_DUALCON      OFF CACHE BOOL "" FORCE)
 set(WITH_NANOVDB             OFF CACHE BOOL "" FORCE)
 set(WITH_OPENAL              OFF CACHE BOOL "" FORCE)
 set(WITH_OPENCOLLADA         OFF CACHE BOOL "" FORCE)
diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 5ff782cff59..e3be9cd8ef8 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -24,7 +24,6 @@
 
 #include "BKE_mesh_types.h"
 #include "BLI_utildefines.h"
-#include "DNA_customdata_types.h"
 
 struct BLI_Stack;
 struct BMesh;
diff --git a/source/blender/geometry/GEO_mesh_remesh_blocks.h b/source/blender/geometry/GEO_mesh_remesh_blocks.h
index cd28cb25893..6e727871b67 100644
--- a/source/blender/geometry/GEO_mesh_remesh_blocks.h
+++ b/source/blender/geometry/GEO_mesh_remesh_blocks.h
@@ -27,21 +27,21 @@ extern "C" {
 struct Mesh;
 
 typedef enum eRemeshBlocksMode {
-  /* blocky */
+  /* Blocks. */
   REMESH_BLOCKS_CENTROID = 0,
-  /* smooth */
+  /* Smooth. */
   REMESH_BLOCKS_MASS_POINT = 1,
-  /* keeps sharp edges */
+  /* Smooth with sharp edges. */
   REMESH_BLOCKS_SHARP_FEATURES = 2,
 } eRemeshBlocksMode;
 
-struct Mesh *GEO_mesh_remesh_blocks(struct Mesh *mesh,
-                                                   const char remesh_flag,
-                                                   const char remesh_mode,
-                                                   const float threshold,
-                                                   const int hermite_num,
-                                                   const float scale,
-                                                   const int depth);
+struct Mesh *GEO_mesh_remesh_blocks(const struct Mesh *mesh,
+                                    const char remesh_flag,
+                                    const char remesh_mode,
+                                    const float threshold,
+                                    const int hermite_num,
+                                    const float scale,
+                                    const int depth);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/geometry/intern/remesh_blocks.c b/source/blender/geometry/intern/remesh_blocks.c
index 0fdb60fd101..248def94779 100644
--- a/source/blender/geometry/intern/remesh_blocks.c
+++ b/source/blender/geometry/intern/remesh_blocks.c
@@ -18,16 +18,17 @@
  * \ingroup geo
  */
 
+#include "DNA_mesh_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_customdata_types.h"
+
 #include "BKE_mesh.h"
 #include "BKE_mesh_runtime.h"
 
 #include "BLI_math_vector.h"
 #include "BLI_threads.h"
 
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_modifier_types.h"
-
 #include "GEO_mesh_remesh_blocks.h" /* own include */
 
 #include "MEM_guardedalloc.h"
@@ -36,7 +37,7 @@
 #  include "dualcon.h"
 #endif
 
-static void init_dualcon_mesh(DualConInput *input, Mesh *mesh)
+static void init_dualcon_mesh(DualConInput *input, const Mesh *mesh)
 {
   memset(input, 0, sizeof(DualConInput));
 
@@ -109,13 +110,13 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4])
   output->curface++;
 }
 
-Mesh *GEO_mesh_remesh_blocks(Mesh *mesh,
-                                            const char remesh_flag,
-                                            const char remesh_mode,
-                                            const float threshold,
-                                            const int hermite_num,
-                                            const float scale,
-                                            const int depth)
+Mesh *GEO_mesh_remesh_blocks(const Mesh *mesh,
+                             const char remesh_flag,
+                             const char remesh_mode,
+                             const float threshold,
+                             const int hermite_num,
+                             const float scale,
+                             const int depth)
 {
 #ifdef WITH_REMESH_DUALCON
 
@@ -165,6 +166,6 @@ Mesh *GEO_mesh_remesh_blocks(Mesh *mesh,
 
   return result;
 #else
-  return mesh;
+  return BKE_mesh_new_nomain(0,0,0,0,0);
 #endif
 }
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 b5a2f781891..48c4fc7cf37 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_remesh_blocks.cc
@@ -58,11 +58,11 @@ static void geo_node_remesh_blocks_exec(GeoNodeExecParams params)
   const char mode = params.node().custom1;
   const int hermite_num = 1;
   const int depth = params.extract_input<int>("Depth");
-  const float scale = params.extract_input<float>("Scale");
+  const float scale = min_ff(params.extract_input<float>("Scale"), 0.99f);
   const float threshold = params.extract_input<float>("Threshold");
 
   if (geometry_set.has_mesh()) {
-    Mesh *input_mesh = geometry_set.get_mesh_for_write();
+    const Mesh *input_mesh = geometry_set.get_mesh_for_read();
 
     Mesh *output_mesh = GEO_mesh_remesh_blocks(
         input_mesh, flag, mode, threshold, hermite_num, scale, depth);



More information about the Bf-blender-cvs mailing list