[Bf-blender-cvs] [173f5f94ff7] temp_bmesh_multires: Sculpt dyntopo:

Joseph Eagar noreply at git.blender.org
Wed Sep 15 10:55:46 CEST 2021


Commit: 173f5f94ff71d18792da4f1a98f5d0ef5c39b169
Author: Joseph Eagar
Date:   Wed Sep 15 01:41:03 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rB173f5f94ff71d18792da4f1a98f5d0ef5c39b169

Sculpt dyntopo:

Seperate enabling PBVH_BMESH from enabling DynTopo:

* Created a new option to globally disabled
  DynTopo.
* The DynTopo panel header now reads "Dynamic Mode",
  to hopefully signal that turning on PBVH_BMESH is
  a seperate step from enabling or disabling DynTopo
  itself.
* The first checkbox in the panel is "DynTopo" so it
  should be clear enough (it's on by default, with multiple
  layers of file versioning checks).

PBVH_BMesh's undo system:

* CD_MESH_ID layers are now permanently saved once
  they are created (by default they are not).  This
  fixed a *lot* of bugs:

  Before this the undo system had to save maps between
  mesh indices and mesh IDs on transitioning
  between sculpt and global undo steps.  This was
  extremely error prone, and it simply wasn't possible
  to cover all of the corner cases

* Note that there is still an odd bug where the first
  global undo push after a sculpt step gets ignored,
  I dunno what's up with this.

* Dyntopo undo should be nearly (hopefully completely)
  bug-free after this commit.

C++20

* Made a few small changes to get blender to compile
  with c++20.  std::result_of was removed, had to
  replace a couple of usages of it with std::invoke_result.

* I'm planning to do some design studies on rewriting
  sculpt into C++.

* I strongly suspect we are going to need C++20'a new
  concepts feature if we move sculpt into C++.
  I'm planning to do some design studies on how
  that might work.

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

M	extern/Eigen3/Eigen/src/Core/util/Macros.h
M	extern/audaspace/include/util/ThreadPool.h
M	intern/guardedalloc/intern/mallocn_guarded_impl.c
M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenkernel/BKE_fcurve.h
M	source/blender/blenkernel/BKE_pbvh.h
M	source/blender/blenkernel/intern/brush.c
M	source/blender/blenkernel/intern/customdata.c
M	source/blender/blenkernel/intern/dyntopo.c
M	source/blender/blenkernel/intern/paint.c
M	source/blender/blenkernel/intern/pbvh_bmesh.c
M	source/blender/blenkernel/intern/pbvh_intern.h
M	source/blender/blenlib/BLI_asan.h
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/bmesh/bmesh_class.h
M	source/blender/bmesh/intern/bmesh_construct.c
M	source/blender/bmesh/intern/bmesh_log.c
M	source/blender/bmesh/intern/bmesh_mesh.c
M	source/blender/bmesh/intern/bmesh_mesh.h
M	source/blender/bmesh/intern/bmesh_mesh_convert.c
M	source/blender/bmesh/intern/bmesh_mesh_convert.h
M	source/blender/bmesh/intern/bmesh_structure.h
M	source/blender/editors/sculpt_paint/sculpt_detail.c
M	source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_sculpt_paint.c

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

diff --git a/extern/Eigen3/Eigen/src/Core/util/Macros.h b/extern/Eigen3/Eigen/src/Core/util/Macros.h
index aa054a0b7ff..217051cc41f 100644
--- a/extern/Eigen3/Eigen/src/Core/util/Macros.h
+++ b/extern/Eigen3/Eigen/src/Core/util/Macros.h
@@ -389,7 +389,7 @@
 
 // Does the compiler support result_of?
 #ifndef EIGEN_HAS_STD_RESULT_OF
-#if EIGEN_MAX_CPP_VER>=11 && ((__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L)))
+#if __cplusplus < 201703L && EIGEN_MAX_CPP_VER>=11 && ((__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L && __cplusplus)))
 #define EIGEN_HAS_STD_RESULT_OF 1
 #else
 #define EIGEN_HAS_STD_RESULT_OF 0
diff --git a/extern/audaspace/include/util/ThreadPool.h b/extern/audaspace/include/util/ThreadPool.h
index 24ec089d52c..7b526f10775 100644
--- a/extern/audaspace/include/util/ThreadPool.h
+++ b/extern/audaspace/include/util/ThreadPool.h
@@ -87,11 +87,17 @@ public:
 	* \param args The arguments of the task.
 	* \return A future of the same type as the return type of the task.
 	*/
+#if __cplusplus > 201703L
+	template<class T, class... Args>
+	std::future<typename std::invoke_result<T, Args...>::type> enqueue(T&& t, Args&&... args)
+	{
+		using pkgdTask = std::packaged_task<typename std::invoke_result<T, Args...>::type()>;
+#else
 	template<class T, class... Args>
 	std::future<typename std::result_of<T(Args...)>::type> enqueue(T&& t, Args&&... args)
 	{
 		using pkgdTask = std::packaged_task<typename std::result_of<T(Args...)>::type()>;
-
+#endif
 		std::shared_ptr<pkgdTask> task = std::make_shared<pkgdTask>(std::bind(std::forward<T>(t), std::forward<Args>(args)...));
 		auto result = task->get_future();
 
diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index 98a8553a3eb..2034f8a3874 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -409,7 +409,7 @@ static void print_memhead_backtrace(MemHead *memh)
   (void)memh; /* Ignored. */
 }
 #  endif /* defined(__linux__) || defined(__APPLE__) */
-#endif   /* DEBUG_BACKTRACE */
+#endif /* DEBUG_BACKTRACE */
 
 static void make_memhead_header(MemHead *memh, size_t len, const char *str)
 {
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 27920a9a57a..7f9918fd9b9 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -783,7 +783,7 @@ class VIEW3D_PT_sculpt_dyntopo_advanced(Panel, View3DPaintPanel):
         col.label(text="Local Brush Settings")
 
         row = col.row()
-        row.prop(brush.dyntopo, "disabled", text="Disable Dyntopo")
+        row.prop(brush.dyntopo, "disabled", text="Disable Dyntopo locally for this brush")
 
         col.label(text="Overrides")
         inherit_all = "ALL" in brush.dyntopo.inherit
@@ -825,7 +825,7 @@ class VIEW3D_PT_sculpt_dyntopo_advanced(Panel, View3DPaintPanel):
 # TODO, move to space_view3d.py
 class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
     bl_context = ".sculpt_mode"  # dot on purpose (access from topbar)
-    bl_label = "Dyntopo"
+    bl_label = "Dynamic Mode"
     bl_options = {'DEFAULT_CLOSED'}
     bl_ui_units_x = 12
 
@@ -857,6 +857,8 @@ class VIEW3D_PT_sculpt_dyntopo(Panel, View3DPaintPanel):
         col = layout.column()
         col.active = context.sculpt_object.use_dynamic_topology_sculpting
 
+        col.prop(sculpt, "use_dyntopo");
+
         sub = col.column()
         sub.active = (brush and brush.sculpt_tool != 'MASK')
         if sculpt.detail_type_method in {'CONSTANT', 'MANUAL'}:
diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index d71cb559911..63d6b9121d2 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -39,7 +39,7 @@ extern "C" {
 
 /* Blender file format version. */
 #define BLENDER_FILE_VERSION BLENDER_VERSION
-#define BLENDER_FILE_SUBVERSION 22
+#define BLENDER_FILE_SUBVERSION 23
 
 /* Minimum Blender version that supports reading file written with the current
  * version. Older Blender versions will test this and show a warning if the file
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index f494c2e30cc..ba0c9f53a69 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -78,8 +78,12 @@ typedef struct FModifierTypeInfo {
   short size;
   /** #eFMI_Action_Types. */
   short acttype;
+#ifdef __cplusplus
+  short requires_;
+#else
   /** #eFMI_Requirement_Flags. */
   short requires;
+#endif
   /** name of modifier in interface. */
   char name[64];
   /** name of struct for SDNA. */
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 72c48d21af7..663e7f8d7f7 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -301,6 +301,8 @@ void BKE_pbvh_update_offsets(PBVH *pbvh,
                              const int cd_face_areas);
 void BKE_pbvh_free(PBVH *pbvh);
 
+void BKE_pbvh_set_bm_log(PBVH *pbvh, struct BMLog *log);
+
 /** update original data, only data whose r_** parameters are passed in will be updated*/
 void BKE_pbvh_bmesh_update_origvert(
     PBVH *pbvh, struct BMVert *v, float **r_co, float **r_no, float **r_color, bool log_undo);
@@ -445,17 +447,19 @@ typedef enum {
 
 typedef float (*DyntopoMaskCB)(SculptVertRef vertex, void *userdata);
 
-bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh,
-                                    PBVHTopologyUpdateMode mode,
-                                    const float center[3],
-                                    const float view_normal[3],
-                                    float radius,
-                                    const bool use_frontface,
-                                    const bool use_projected,
-                                    int symaxis,
-                                    bool updatePBVH,
-                                    DyntopoMaskCB mask_cb,
-                                    void *mask_cb_data);
+bool BKE_pbvh_bmesh_update_topology(
+    PBVH *pbvh,
+    PBVHTopologyUpdateMode mode,
+    const float center[3],
+    const float view_normal[3],
+    float radius,
+    const bool use_frontface,
+    const bool use_projected,
+    int symaxis,
+    bool updatePBVH,
+    DyntopoMaskCB mask_cb,
+    void *mask_cb_data,
+    int custom_max_steps);  // if 0, will use defaul hueristics for max steps
 
 bool BKE_pbvh_bmesh_update_topology_nodes(PBVH *pbvh,
                                           bool (*searchcb)(PBVHNode *node, void *data),
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 2e2f89ea8a2..78fbe439ac9 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -2671,6 +2671,10 @@ void BKE_brush_get_dyntopo(Brush *brush, Sculpt *sd, DynTopoSettings *out)
     inherit = 0x7FFFFFFF;
   }
 
+  if (!(sd->flags & SCULPT_DYNTOPO_ENABLED)) {
+    out->flag |= DYNTOPO_DISABLED;
+  }
+
   if (inherit & DYNTOPO_INHERIT_MODE) {
     if (sd->flags & SCULPT_DYNTOPO_DETAIL_CONSTANT) {
       out->mode = DYNTOPO_DETAIL_CONSTANT;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index b53ed71070c..7e7ecbf101e 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -2045,60 +2045,62 @@ static const char *LAYERTYPENAMES[CD_NUMTYPES] = {
     "CDDyntopoVert"};
 
 const CustomData_MeshMasks CD_MASK_BAREMESH = {
-    .vmask = CD_MASK_MVERT | CD_MASK_BWEIGHT,
-    .emask = CD_MASK_MEDGE | CD_MASK_BWEIGHT,
+    .vmask = CD_MASK_MVERT | CD_MASK_BWEIGHT | CD_MASK_MESH_ID,
+    .emask = CD_MASK_MEDGE | CD_MASK_BWEIGHT | CD_MASK_MESH_ID,
     .fmask = 0,
-    .lmask = CD_MASK_MLOOP,
-    .pmask = CD_MASK_MPOLY | CD_MASK_FACEMAP,
+    .lmask = CD_MASK_MLOOP | CD_MASK_MESH_ID,
+    .pmask = CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_MESH_ID,
 };
 const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX = {
-    .vmask = CD_MASK_MVERT | CD_MASK_BWEIGHT | CD_MASK_ORIGINDEX,
-    .emask = CD_MASK_MEDGE | CD_MASK_BWEIGHT | CD_MASK_ORIGINDEX,
+    .vmask = CD_MASK_MVERT | CD_MASK_BWEIGHT | CD_MASK_ORIGINDEX | CD_MASK_MESH_ID,
+    .emask = CD_MASK_MEDGE | CD_MASK_BWEIGHT | CD_MASK_ORIGINDEX | CD_MASK_MESH_ID,
     .fmask = 0,
-    .lmask = CD_MASK_MLOOP,
-    .pmask = CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_ORIGINDEX,
+    .lmask = CD_MASK_MLOOP | CD_MASK_MESH_ID,
+    .pmask = CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_ORIGINDEX | CD_MASK_MESH_ID,
 };
 const CustomData_MeshMasks CD_MASK_MESH = {
     .vmask = (CD_MASK_MVERT | CD_MASK_MDEFORMVERT | CD_MASK_MVERT_SKIN | CD_MASK_PAINT_MASK |
-              CD_MASK_PROP_ALL | CD_MASK_PROP_COLOR),
-    .emask = (CD_MASK_MEDGE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL),
+              CD_MASK_PROP_ALL | CD_MASK_PROP_COLOR | CD_MASK_MESH_ID),
+    .emask = (CD_MASK_MEDGE | CD_MASK_FREESTYLE_EDGE | CD_MASK_PROP_ALL | CD_MASK_MESH_ID),
     .fmask = 0,
     .lmask = (CD_MASK_MLOOP | CD_MASK_MDISPS | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL |
-              CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL),
+              CD_MASK_CUSTOMLOOPNORMAL | CD_MASK_GRID_PAINT_MASK | CD_MASK_PROP_ALL |
+              CD_MASK_MESH_ID),
     .pmask = (CD_MASK_MPOLY | CD_MASK_FACEMAP | CD_MASK_FREESTYLE_FACE | CD_MASK_PROP_ALL |
-              CD_MASK_SCULPT_FACE_SETS),
+              CD_MASK_SCULPT_FACE_SETS | CD_MASK_MESH_ID),
 };
 const CustomData_MeshMasks CD_MASK_EDITMESH = {
     .vmask = (CD_MASK_MDEFORMVERT | CD_MASK_PAINT_MASK | CD_MASK_MVERT_SKIN | CD_MASK_SHAPEKEY |
-              CD_MASK_SHAPE_KEYINDEX | CD_MASK_PROP_ALL | CD_MASK_PROP_COLOR),
-    .emask = (CD_MASK_PROP_ALL),
+              CD_MASK_SHAPE_KEYINDEX | CD_MASK_PROP_ALL | CD_MASK_PROP_COLOR | CD_MASK_MESH_ID),
+    .emask = (CD_MASK_PROP_ALL | CD_MASK_MESH_ID),
     .fmask = 0,
     .lmask = (CD

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list