diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-25 13:16:42 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-25 16:07:30 +0300 |
commit | deaff945d0b965d1e588cdecd084080b07db2e1f (patch) | |
tree | f17eba23acfefea04ecacc3386cd582eea2db77f /source/blender/makesdna/DNA_mesh_types.h | |
parent | df8cbdc69645589b3d4371e3a44b06fc42d81eee (diff) |
Mesh: skip conversion from edit-mesh to mesh in edit-mode
This resolves a performance regression in 2.8x where every edit-mode
update performed an edit-mesh to mesh conversion.
Now the conversion will be lazily initialized if/when it's required.
New BKE_mesh_wrapper_* functions abstract over mesh data access.
Currently only edit-mesh and regular meshes are supported.
In the future sub-surface meshes may be supported too.
Diffstat (limited to 'source/blender/makesdna/DNA_mesh_types.h')
-rw-r--r-- | source/blender/makesdna/DNA_mesh_types.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index dc1a2b5ff1d..029352f3d85 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -112,7 +112,20 @@ typedef struct Mesh_Runtime { * In the future we may leave the mesh-data empty * since its not needed if we can use edit-mesh data. */ char is_original; - char _pad[6]; + + /** #eMeshWrapperType and others. */ + char wrapper_type; + /** + * A type mask from wrapper_type, + * in case there are differences in finalizing logic between types. + */ + char wrapper_type_finalize; + + char _pad[4]; + + /** Needed in case we need to lazily initialize the mesh. */ + CustomData_MeshMasks cd_mask_extra; + } Mesh_Runtime; typedef struct Mesh { @@ -228,6 +241,15 @@ typedef struct TFace { /* **************** MESH ********************* */ +/** #Mesh_Runtime.wrapper_type */ +typedef enum eMeshWrapperType { + /** Use mesh data (#Mesh.mvert,#Mesh.medge, #Mesh.mloop, #Mesh.mpoly). */ + ME_WRAPPER_TYPE_MDATA = 0, + /** Use edit-mesh data (#Mesh.#edit_mesh, #Mesh_Runtime.edit_data). */ + ME_WRAPPER_TYPE_BMESH = 1, + /* ME_WRAPPER_TYPE_SUBD = 2, */ /* TODO */ +} eMeshWrapperType; + /* texflag */ enum { ME_AUTOSPACE = 1, |