Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-23 17:02:05 +0300
committerHans Goudey <h.goudey@me.com>2022-09-23 17:02:28 +0300
commita8a454287a27d408668f8adc6fe1b3aa988de1ac (patch)
treea0c55182e620598bb92542562d2fc134091a2c08 /source/blender/makesdna
parentb197cd5821f1dfaa5168d31984dd8014f5252456 (diff)
Mesh: Move edge crease out of MEdge
This is very similar to D14077. There are two differences though. First is that vertex creases are already stored in a separate layer, and second is that we can now completely remove use of `Mesh.cd_flag`, since that information is now inherent to whether the layers exist. There are two functional differences here: * Operators are used to add and remove layers instead of a property. * The "crease" attribute can be created and removed by geometry nodes. The second change should make various geometry nodes slightly faster, since the "crease" attribute was always processed before. Creases are now interpolated generically in the CustomData API too, which should help maintain the values across edits better. Meshes get an `edge_creases` RNA property like the existing vertex property, to provide more efficient access to the data in Cycles. One test failure is expected, where different rounding between float the old char storage means that 5 additional points are scattered in a geometry nodes test. Differential Revision: https://developer.blender.org/D15927
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_customdata_types.h7
-rw-r--r--source/blender/makesdna/DNA_mesh_types.h23
-rw-r--r--source/blender/makesdna/DNA_meshdata_types.h3
-rw-r--r--source/blender/makesdna/intern/dna_rename_defs.h1
4 files changed, 15 insertions, 19 deletions
diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h
index 5d13d01898d..287a9e2f3b9 100644
--- a/source/blender/makesdna/DNA_customdata_types.h
+++ b/source/blender/makesdna/DNA_customdata_types.h
@@ -127,12 +127,7 @@ typedef enum eCustomDataType {
CD_SHAPE_KEYINDEX = 27,
CD_SHAPEKEY = 28,
CD_BWEIGHT = 29,
- /**
- * Usage of #CD_CREASE depends on where on the Mesh the layer is added:
- * - For vertex creasing, this is persistent data across all modes and is stored in the file.
- * - For edge creasing, it is runtime data which is only used in edit-mode before being copied
- * to #MEdge when exiting edit-mode.
- */
+ /** Subdivision sharpness data per edge or per vertex. */
CD_CREASE = 30,
CD_ORIGSPACE_MLOOP = 31,
CD_PREVIEW_MLOOPCOL = 32,
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h
index cbefbf021a9..ecf716d23ea 100644
--- a/source/blender/makesdna/DNA_mesh_types.h
+++ b/source/blender/makesdna/DNA_mesh_types.h
@@ -254,24 +254,23 @@ typedef struct Mesh {
float smoothresh;
/**
- * Flag for choosing whether or not so store bevel weight and crease as custom data layers in the
- * edit mesh (they are always stored in #MVert and #MEdge currently). In the future, this data
- * may be stored as generic named attributes (see T89054 and T93602).
- */
- char cd_flag;
-
- /**
* User-defined symmetry flag (#eMeshSymmetryType) that causes editing operations to maintain
* symmetrical geometry. Supported by operations such as transform and weight-painting.
*/
char symmetry;
- /** The length of the #mat array. */
- short totcol;
-
/** Choice between different remesh methods in the UI. */
char remesh_mode;
+ /** The length of the #mat array. */
+ short totcol;
+
+ /**
+ * Deprecated flag for choosing whether to store specific custom data that was built into #Mesh
+ * structs in edit mode. Replaced by separating that data to separate layers. Kept for forward
+ * and backwards compatibility.
+ */
+ char cd_flag DNA_DEPRECATED;
char subdiv DNA_DEPRECATED;
char subdivr DNA_DEPRECATED;
char subsurftype DNA_DEPRECATED;
@@ -438,15 +437,15 @@ enum {
ME_REMESH_REPROJECT_SCULPT_FACE_SETS = 1 << 15,
};
+#ifdef DNA_DEPRECATED_ALLOW
/** #Mesh.cd_flag */
enum {
-#ifdef DNA_DEPRECATED_ALLOW
ME_CDFLAG_VERT_BWEIGHT = 1 << 0,
ME_CDFLAG_EDGE_BWEIGHT = 1 << 1,
-#endif
ME_CDFLAG_EDGE_CREASE = 1 << 2,
ME_CDFLAG_VERT_CREASE = 1 << 3,
};
+#endif
/** #Mesh.remesh_mode */
enum {
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 77cb27083ab..f7e6714d495 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -51,7 +51,8 @@ enum {
typedef struct MEdge {
/** Un-ordered vertex indices (cannot match). */
unsigned int v1, v2;
- char crease;
+ /** Deprecated edge crease, now located in #CD_CREASE, except for file read and write. */
+ char crease_legacy;
/**
* Deprecated bevel weight storage, now located in #CD_BWEIGHT, except for file read and write.
*/
diff --git a/source/blender/makesdna/intern/dna_rename_defs.h b/source/blender/makesdna/intern/dna_rename_defs.h
index facf6199dce..bcda2a330de 100644
--- a/source/blender/makesdna/intern/dna_rename_defs.h
+++ b/source/blender/makesdna/intern/dna_rename_defs.h
@@ -98,6 +98,7 @@ DNA_STRUCT_RENAME_ELEM(Object, restrictflag, visibility_flag)
DNA_STRUCT_RENAME_ELEM(Object, size, scale)
DNA_STRUCT_RENAME_ELEM(Object_Runtime, crazyspace_num_verts, crazyspace_verts_num)
DNA_STRUCT_RENAME_ELEM(MEdge, bweight, bweight_legacy)
+DNA_STRUCT_RENAME_ELEM(MEdge, crease, crease_legacy)
DNA_STRUCT_RENAME_ELEM(MPoly, mat_nr, mat_nr_legacy)
DNA_STRUCT_RENAME_ELEM(MVert, bweight, bweight_legacy)
DNA_STRUCT_RENAME_ELEM(ParticleSettings, child_nbr, child_percent)