[Bf-blender-cvs] [6aa14c34331] sculpt-dev: Sculpt: fix compile error

Joseph Eagar noreply at git.blender.org
Tue Oct 26 11:35:58 CEST 2021


Commit: 6aa14c343313867aa9fe98f7b01c09cdf2307b6a
Author: Joseph Eagar
Date:   Tue Oct 26 02:35:26 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rB6aa14c343313867aa9fe98f7b01c09cdf2307b6a

Sculpt: fix compile error

Missing #ifdefs for instant meshes

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

M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/mesh_remesh_voxel.cc
M	source/blender/editors/object/CMakeLists.txt
M	source/blender/editors/object/object_ops.c

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

diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index d1495d56533..49802a17f35 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -767,7 +767,7 @@ if(WITH_INSTANT_MESHES)
   list(APPEND LIB
     bf_intern_instant_meshes
   )
-  add_definitions(-DWITH_QUADRIFLOW)
+  add_definitions(-DWITH_INSTANT_MESHES)
 endif()
 
 if(WITH_QUADRIFLOW)
diff --git a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
index 11fb4b245bd..9ce1220a09f 100644
--- a/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
+++ b/source/blender/blenkernel/intern/mesh_remesh_voxel.cc
@@ -66,7 +66,9 @@
 #  include "quadriflow_capi.hpp"
 #endif
 
-#include "instant_meshes_c_api.h"
+#ifdef WITH_INSTANT_MESHES
+#  include "instant_meshes_c_api.h"
+#endif
 
 using blender::Array;
 using blender::float3;
@@ -255,14 +257,13 @@ struct HashEdge {
 extern "C" int closest_vec_to_perp(
     float dir[3], float r_dir2[3], float no[3], float *buckets, float w);
 
-ATTR_NO_OPT Mesh *BKE_mesh_remesh_instant_meshes(const Mesh *input_mesh,
-                                                 int target_faces,
-                                                 int iterations,
-                                                 void (*update_cb)(void *,
-                                                                   float progress,
-                                                                   int *cancel),
-                                                 void *update_cb_data)
+Mesh *BKE_mesh_remesh_instant_meshes(const Mesh *input_mesh,
+                                     int target_faces,
+                                     int iterations,
+                                     void (*update_cb)(void *, float progress, int *cancel),
+                                     void *update_cb_data)
 {
+#ifdef WITH_INSTANT_MESHES
   /* Ensure that the triangulated mesh data is up to data */
   const MLoopTri *looptri = BKE_mesh_runtime_looptri_ensure(input_mesh);
   MeshElemMap *epmap = nullptr;
@@ -418,10 +419,10 @@ ATTR_NO_OPT Mesh *BKE_mesh_remesh_instant_meshes(const Mesh *input_mesh,
 
   Mesh *mesh = BKE_mesh_new_nomain(remesh.totoutvert, 0, 0, totloop, remesh.totoutface);
 
-#ifdef INSTANT_MESHES_VIS_COLOR
+#  ifdef INSTANT_MESHES_VIS_COLOR
   MPropCol *cols = (MPropCol *)CustomData_add_layer(
       &mesh->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, remesh.totoutvert);
-#endif
+#  endif
 
   for (int i : IndexRange(remesh.totoutvert)) {
     MVert *mv = mesh->mvert + i;
@@ -430,10 +431,10 @@ ATTR_NO_OPT Mesh *BKE_mesh_remesh_instant_meshes(const Mesh *input_mesh,
     copy_v3_v3(mv->co, v->co);
     normal_float_to_short_v3(mv->no, v->no);
 
-#ifdef INSTANT_MESHES_VIS_COLOR
+#  ifdef INSTANT_MESHES_VIS_COLOR
     copy_v3_v3(cols[i].color, v->viscolor);
     cols[i].color[3] = 1.0f;
-#endif
+#  endif
   }
 
   int li = 0;
@@ -466,7 +467,7 @@ ATTR_NO_OPT Mesh *BKE_mesh_remesh_instant_meshes(const Mesh *input_mesh,
   }
 
   return mesh;
-#if 0
+#  if 0
  
   /* Construct the new output mesh */
   Mesh *mesh = BKE_mesh_new_nomain(qrd.out_totverts, 0, 0, qrd.out_totfaces * 4, qrd.out_totfaces);
@@ -500,6 +501,7 @@ ATTR_NO_OPT Mesh *BKE_mesh_remesh_instant_meshes(const Mesh *input_mesh,
     MEM_freeN((void *)epmem);
   }
   return mesh;
+#  endif
 #endif
   return nullptr;
 }
diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 966a11a4b1b..a9683e277a4 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -90,6 +90,11 @@ if(WITH_INTERNATIONAL)
   add_definitions(-DWITH_INTERNATIONAL)
 endif()
 
+
+if(WITH_INSTANT_MESHES) 
+  add_definitions(-DWITH_INSTANT_MESHES)
+endif()
+
 if(WITH_EXPERIMENTAL_FEATURES)
   add_definitions(-DWITH_SIMULATION_DATABLOCK)
   add_definitions(-DWITH_POINT_CLOUD)
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index e61281e7969..a70e88e9122 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -285,7 +285,10 @@ void ED_operatortypes_object(void)
   WM_operatortype_append(OBJECT_OT_voxel_size_edit);
 
   WM_operatortype_append(OBJECT_OT_quadriflow_remesh);
+
+#ifdef OBJECT_OT_instant_meshes_remesh
   WM_operatortype_append(OBJECT_OT_instant_meshes_remesh);
+#endif
 }
 
 void ED_operatormacros_object(void)



More information about the Bf-blender-cvs mailing list