From 2480b55f216c31373a84bc5c5d2b0cc158497c44 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 11 Aug 2022 12:54:24 -0400 Subject: Mesh: Move hide flags to generic attributes This commit moves the hide status of mesh vertices, edges, and faces from the `ME_FLAG` to optional generic boolean attributes. Storing this data as generic attributes can significantly simplify and improve code, as described in T95965. The attributes are called `.hide_vert`, `.hide_edge`, and `.hide_poly`, using the attribute name semantics discussed in T97452. The `.` prefix means they are "UI attributes", so they still contain original data edited by users, but they aren't meant to be accessed procedurally by the user in arbitrary situations. They are also be hidden in the spreadsheet and the attribute list by default, Until 4.0, the attributes are still written to and read from the mesh in the old way, so neither forward nor backward compatibility are affected. This means memory requirements will be increased by one byte per element when the hide status is used. When the flags are removed completely, requirements will decrease when hiding is unused. Further notes: * Some code can be further simplified to skip some processing when the hide attributes don't exist. * The data is still stored in flags for `BMesh`, necessitating some complexity in the conversion to and from `Mesh`. * Access to the "hide" property of mesh elements in RNA is slower. The separate boolean arrays should be used where possible. Ref T95965 Differential Revision: https://developer.blender.org/D14685 --- source/blender/makesdna/DNA_meshdata_types.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index 4090c45a753..abef90495c5 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -30,10 +30,13 @@ typedef struct MVert { } MVert; /** #MVert.flag */ + +#ifdef DNA_DEPRECATED_ALLOW enum { /* SELECT = (1 << 0), */ ME_HIDE = (1 << 4), }; +#endif /** * Mesh Edges. @@ -351,7 +354,7 @@ typedef struct MDisps { /** * Used for hiding parts of a multires mesh. - * Essentially the multires equivalent of #MVert.flag's ME_HIDE bit. + * Essentially the multires equivalent of the mesh ".hide_vert" boolean layer. * * \note This is a bitmap, keep in sync with type used in BLI_bitmap.h */ -- cgit v1.2.3