[Bf-blender-cvs] [af0d378177c] master: Cleanup: Move multires reshape header to C++

Hans Goudey noreply at git.blender.org
Fri Feb 3 14:48:28 CET 2023


Commit: af0d378177c0c8c5d9d2dc5c8f8b21abf13347dc
Author: Hans Goudey
Date:   Fri Feb 3 08:48:00 2023 -0500
Branches: master
https://developer.blender.org/rBaf0d378177c0c8c5d9d2dc5c8f8b21abf13347dc

Cleanup: Move multires reshape header to C++

For continued refactoring of the Mesh data structure. See T103343.

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

M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/multires.cc
M	source/blender/blenkernel/intern/multires_reshape.cc
R085	source/blender/blenkernel/intern/multires_reshape.h	source/blender/blenkernel/intern/multires_reshape.hh
M	source/blender/blenkernel/intern/multires_reshape_apply_base.cc
M	source/blender/blenkernel/intern/multires_reshape_ccg.cc
M	source/blender/blenkernel/intern/multires_reshape_smooth.cc
M	source/blender/blenkernel/intern/multires_reshape_subdivide.cc
M	source/blender/blenkernel/intern/multires_reshape_util.cc
M	source/blender/blenkernel/intern/multires_reshape_vertcos.cc
M	source/blender/blenkernel/intern/multires_unsubdivide.cc
M	source/blender/blenkernel/intern/multires_versioning.cc

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

diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 7052f362fc4..c5d3f6eb3ab 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -502,7 +502,7 @@ set(SRC
   intern/data_transfer_intern.h
   intern/lib_intern.h
   intern/multires_inline.h
-  intern/multires_reshape.h
+  intern/multires_reshape.hh
   intern/multires_unsubdivide.h
   intern/ocean_intern.h
   intern/pbvh_intern.h
diff --git a/source/blender/blenkernel/intern/multires.cc b/source/blender/blenkernel/intern/multires.cc
index 2c5c7ba72ee..aaa35e02747 100644
--- a/source/blender/blenkernel/intern/multires.cc
+++ b/source/blender/blenkernel/intern/multires.cc
@@ -41,7 +41,7 @@
 
 #include "DEG_depsgraph_query.h"
 
-#include "multires_reshape.h"
+#include "multires_reshape.hh"
 
 #include <cmath>
 #include <cstring>
diff --git a/source/blender/blenkernel/intern/multires_reshape.cc b/source/blender/blenkernel/intern/multires_reshape.cc
index 536dade7463..d4e842dc10c 100644
--- a/source/blender/blenkernel/intern/multires_reshape.cc
+++ b/source/blender/blenkernel/intern/multires_reshape.cc
@@ -24,7 +24,7 @@
 
 #include "DEG_depsgraph_query.h"
 
-#include "multires_reshape.h"
+#include "multires_reshape.hh"
 
 /* -------------------------------------------------------------------- */
 /** \name Reshape from object
diff --git a/source/blender/blenkernel/intern/multires_reshape.h b/source/blender/blenkernel/intern/multires_reshape.hh
similarity index 85%
rename from source/blender/blenkernel/intern/multires_reshape.h
rename to source/blender/blenkernel/intern/multires_reshape.hh
index 1aa20cb7f48..8e112f18d7b 100644
--- a/source/blender/blenkernel/intern/multires_reshape.h
+++ b/source/blender/blenkernel/intern/multires_reshape.hh
@@ -23,26 +23,26 @@ struct Object;
 struct Subdiv;
 struct SubdivCCG;
 
-typedef struct MultiresReshapeContext {
+struct MultiresReshapeContext {
   /* NOTE: Only available when context is initialized from object. */
-  struct Depsgraph *depsgraph;
-  struct Object *object;
+  Depsgraph *depsgraph;
+  Object *object;
 
-  struct MultiresModifierData *mmd;
+  MultiresModifierData *mmd;
 
   /* Base mesh from original object.
    * NOTE: Does NOT include any leading modifiers in it. */
-  struct Mesh *base_mesh;
+  Mesh *base_mesh;
   const float (*base_positions)[3];
-  const struct MEdge *base_edges;
-  const struct MPoly *base_polys;
-  const struct MLoop *base_loops;
+  const MEdge *base_edges;
+  const MPoly *base_polys;
+  const MLoop *base_loops;
 
   /* Subdivision surface created for multires modifier.
    *
    * The coarse mesh of this subdivision surface is a base mesh with all deformation modifiers
    * leading multires applied on it. */
-  struct Subdiv *subdiv;
+  Subdiv *subdiv;
   bool need_free_subdiv;
 
   struct {
@@ -65,8 +65,8 @@ typedef struct MultiresReshapeContext {
 
   struct {
     /* Copy of original displacement and painting masks. */
-    struct MDisps *mdisps;
-    struct GridPaintMask *grid_paint_masks;
+    MDisps *mdisps;
+    GridPaintMask *grid_paint_masks;
   } orig;
 
   /* Number of grids which are required for base_mesh. */
@@ -74,8 +74,8 @@ typedef struct MultiresReshapeContext {
 
   /* Destination displacement and mask.
    * Points to a custom data on a destination mesh. */
-  struct MDisps *mdisps;
-  struct GridPaintMask *grid_paint_masks;
+  MDisps *mdisps;
+  GridPaintMask *grid_paint_masks;
 
   /* Indexed by face index, gives first grid index of the face. */
   int *face_start_grid_index;
@@ -102,38 +102,38 @@ typedef struct MultiresReshapeContext {
   const float *cd_vertex_crease;
   /* Edge crease custom data layer, null if none is present. */
   const float *cd_edge_crease;
-} MultiresReshapeContext;
+};
 
 /**
  * Coordinate which identifies element of a grid.
  * This is directly related on how #CD_MDISPS stores displacement.
  */
-typedef struct GridCoord {
+struct GridCoord {
   int grid_index;
   float u, v;
-} GridCoord;
+};
 
 /**
  * Coordinate within ptex, which is what OpenSubdiv API operates on.
  */
-typedef struct PTexCoord {
+struct PTexCoord {
   int ptex_face_index;
   float u, v;
-} PTexCoord;
+};
 
 /**
  * Element of a grid data stored in the destination mesh.
  * This is where reshaped coordinates and mask values will be written to.
  */
-typedef struct ReshapeGridElement {
+struct ReshapeGridElement {
   float *displacement;
   float *mask;
-} ReshapeGridElement;
+};
 
-typedef struct ReshapeConstGridElement {
+struct ReshapeConstGridElement {
   float displacement[3];
   float mask;
-} ReshapeConstGridElement;
+};
 
 /* --------------------------------------------------------------------
  * Construct/destruct reshape context.
@@ -143,9 +143,9 @@ typedef struct ReshapeConstGridElement {
  * Create subdivision surface descriptor which is configured for surface evaluation at a given
  * multi-res modifier.
  */
-struct Subdiv *multires_reshape_create_subdiv(struct Depsgraph *depsgraph,
-                                              struct Object *object,
-                                              const struct MultiresModifierData *mmd);
+Subdiv *multires_reshape_create_subdiv(Depsgraph *depsgraph,
+                                       Object *object,
+                                       const MultiresModifierData *mmd);
 
 /**
  * \note Initialized base mesh to object's mesh, the Subdivision is created from the deformed
@@ -153,29 +153,29 @@ struct Subdiv *multires_reshape_create_subdiv(struct Depsgraph *depsgraph,
  * then Subdivision is created from base mesh (without any deformation applied).
  */
 bool multires_reshape_context_create_from_object(MultiresReshapeContext *reshape_context,
-                                                 struct Depsgraph *depsgraph,
-                                                 struct Object *object,
-                                                 struct MultiresModifierData *mmd);
+                                                 Depsgraph *depsgraph,
+                                                 Object *object,
+                                                 MultiresModifierData *mmd);
 
 bool multires_reshape_context_create_from_base_mesh(MultiresReshapeContext *reshape_context,
-                                                    struct Depsgraph *depsgraph,
-                                                    struct Object *object,
-                                                    struct MultiresModifierData *mmd);
+                                                    Depsgraph *depsgraph,
+                                                    Object *object,
+                                                    MultiresModifierData *mmd);
 
 bool multires_reshape_context_create_from_ccg(MultiresReshapeContext *reshape_context,
-                                              struct SubdivCCG *subdiv_ccg,
-                                              struct Mesh *base_mesh,
+                                              SubdivCCG *subdiv_ccg,
+                                              Mesh *base_mesh,
                                               int top_level);
 
 bool multires_reshape_context_create_from_modifier(MultiresReshapeContext *reshape_context,
-                                                   struct Object *object,
-                                                   struct MultiresModifierData *mmd,
+                                                   Object *object,
+                                                   MultiresModifierData *mmd,
                                                    int top_level);
 
 bool multires_reshape_context_create_from_subdiv(MultiresReshapeContext *reshape_context,
-                                                 struct Object *object,
-                                                 struct MultiresModifierData *mmd,
-                                                 struct Subdiv *subdiv,
+                                                 Object *object,
+                                                 MultiresModifierData *mmd,
+                                                 Subdiv *subdiv,
                                                  int top_level);
 
 void multires_reshape_free_original_grids(MultiresReshapeContext *reshape_context);
@@ -262,7 +262,7 @@ void multires_reshape_evaluate_limit_at_grid(const MultiresReshapeContext *resha
 /**
  * Make sure custom data is allocated for the given level.
  */
-void multires_reshape_ensure_grids(struct Mesh *mesh, int level);
+void multires_reshape_ensure_grids(Mesh *mesh, int level);
 
 /* --------------------------------------------------------------------
  * Functions specific to reshaping from a set of vertices in a object position.
@@ -295,7 +295,7 @@ bool multires_reshape_assign_final_coords_from_vertcos(
  * \return truth if all coordinates have been updated.
  */
 bool multires_reshape_assign_final_coords_from_ccg(const MultiresReshapeContext *reshape_context,
-                                                   struct SubdivCCG *subdiv_ccg);
+                                                   SubdivCCG *subdiv_ccg);
 
 /* --------------------------------------------------------------------
  * Functions specific to reshaping from MDISPS.
diff --git a/source/blender/blenkernel/intern/multires_reshape_apply_base.cc b/source/blender/blenkernel/intern/multires_reshape_apply_base.cc
index d491f30a1ad..f2c2df9d7ce 100644
--- a/source/blender/blenkernel/intern/multires_reshape_apply_base.cc
+++ b/source/blender/blenkernel/intern/multires_reshape_apply_base.cc
@@ -5,7 +5,7 @@
  * \ingroup bke
  */
 
-#include "multires_reshape.h"
+#include "multires_reshape.hh"
 
 #include "MEM_guardedalloc.h"
 
diff --git a/source/blender/blenkernel/intern/multires_reshape_ccg.cc b/source/blender/blenkernel/intern/multires_reshape_ccg.cc
index d9723b7e684..6f63c336abb 100644
--- a/source/blender/blenkernel/intern/multires_reshape_ccg.cc
+++ b/source/blender/blenkernel/intern/multires_reshape_ccg.cc
@@ -5,7 +5,7 @@
  * \ingroup bke
  */
 
-#include "multires_reshape.h"
+#include "multires_reshape.hh"
 
 #include <cstring>
 
diff --git a/source

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list