2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2008-07-04 19:59:16 +02:00
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup DNA
|
2013-03-02 08:27:19 +01:00
|
|
|
*
|
|
|
|
* Used for custom mesh data types (stored per vert/edge/loop/face)
|
2011-02-17 06:57:18 +01:00
|
|
|
*/
|
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#pragma once
|
2006-11-11 17:38:37 +01:00
|
|
|
|
2020-05-08 18:16:39 +02:00
|
|
|
#include "DNA_defs.h"
|
|
|
|
|
2023-04-13 14:57:57 +02:00
|
|
|
#include "BLI_implicit_sharing.h"
|
|
|
|
|
2023-01-05 14:05:30 +01:00
|
|
|
/** Workaround to forward-declare C++ type in C header. */
|
|
|
|
#ifdef __cplusplus
|
|
|
|
namespace blender::bke {
|
|
|
|
class AnonymousAttributeID;
|
|
|
|
} // namespace blender::bke
|
|
|
|
using AnonymousAttributeIDHandle = blender::bke::AnonymousAttributeID;
|
|
|
|
#else
|
|
|
|
typedef struct AnonymousAttributeIDHandle AnonymousAttributeIDHandle;
|
|
|
|
#endif
|
2021-09-09 12:54:20 +02:00
|
|
|
|
2019-11-24 15:14:39 +01:00
|
|
|
/** Descriptor and storage for a custom data layer. */
|
2006-11-11 17:38:37 +01:00
|
|
|
typedef struct CustomDataLayer {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Type of data in layer. */
|
|
|
|
int type;
|
|
|
|
/** In editmode, offset of layer in block. */
|
|
|
|
int offset;
|
|
|
|
/** General purpose flag. */
|
|
|
|
int flag;
|
|
|
|
/** Number of the active layer of this type. */
|
|
|
|
int active;
|
2019-08-01 05:53:25 +02:00
|
|
|
/** Number of the layer to render. */
|
2019-01-07 12:19:13 +01:00
|
|
|
int active_rnd;
|
2019-08-01 05:53:25 +02:00
|
|
|
/** Number of the layer to render. */
|
2019-01-07 12:19:13 +01:00
|
|
|
int active_clone;
|
2019-08-01 05:53:25 +02:00
|
|
|
/** Number of the layer to render. */
|
2019-01-07 12:19:13 +01:00
|
|
|
int active_mask;
|
2023-03-22 02:22:05 +01:00
|
|
|
/** Shape key-block unique id reference. */
|
2019-01-07 12:19:13 +01:00
|
|
|
int uid;
|
|
|
|
/** Layer name, MAX_CUSTOMDATA_LAYER_NAME. */
|
Mesh: Move UV layers to generic attributes
Currently the `MLoopUV` struct stores UV coordinates and flags related
to editing UV maps in the UV editor. This patch changes the coordinates
to use the generic 2D vector type, and moves the flags into three
separate boolean attributes. This follows the design in T95965, with
the ultimate intention of simplifying code and improving performance.
Importantly, the change allows exporters and renderers to use UVs
"touched" by geometry nodes, which only creates generic attributes.
It also allows geometry nodes to create "proper" UV maps from scratch,
though only with the Store Named Attribute node for now.
The new design considers any 2D vector attribute on the corner domain
to be a UV map. In the future, they might be distinguished from regular
2D vectors with attribute metadata, which may be helpful because they
are often interpolated differently.
Most of the code changes deal with passing around UV BMesh custom data
offsets and tracking the boolean "sublayers". The boolean layers are
use the following prefixes for attribute names: vert selection: `.vs.`,
edge selection: `.es.`, pinning: `.pn.`. Currently these are short to
avoid using up the maximum length of attribute names. To accommodate
for these 4 extra characters, the name length limit is enlarged to 68
bytes, while the maximum user settable name length is still 64 bytes.
Unfortunately Python/RNA API access to the UV flag data becomes slower.
Accessing the boolean layers directly is be better for performance in
general.
Like the other mesh SoA refactors, backward and forward compatibility
aren't affected, and won't be changed until 4.0. We pay for that by
making mesh reading and writing more expensive with conversions.
Resolves T85962
Differential Revision: https://developer.blender.org/D14365
2023-01-10 06:47:04 +01:00
|
|
|
char name[68];
|
|
|
|
char _pad1[4];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Layer data. */
|
|
|
|
void *data;
|
2021-09-09 12:54:20 +02:00
|
|
|
/**
|
2023-01-05 14:05:30 +01:00
|
|
|
* Run-time identifier for this layer. Can be used to retrieve information about where this
|
|
|
|
* attribute was created.
|
2021-09-09 12:54:20 +02:00
|
|
|
*/
|
2023-01-05 14:05:30 +01:00
|
|
|
const AnonymousAttributeIDHandle *anonymous_id;
|
2023-04-13 14:57:57 +02:00
|
|
|
/**
|
|
|
|
* Run-time data that allows sharing `data` with other entities (mostly custom data layers on
|
|
|
|
* other geometries).
|
|
|
|
*/
|
|
|
|
const ImplicitSharingInfoHandle *sharing_info;
|
2006-11-11 17:38:37 +01:00
|
|
|
} CustomDataLayer;
|
|
|
|
|
Mesh: Move UV layers to generic attributes
Currently the `MLoopUV` struct stores UV coordinates and flags related
to editing UV maps in the UV editor. This patch changes the coordinates
to use the generic 2D vector type, and moves the flags into three
separate boolean attributes. This follows the design in T95965, with
the ultimate intention of simplifying code and improving performance.
Importantly, the change allows exporters and renderers to use UVs
"touched" by geometry nodes, which only creates generic attributes.
It also allows geometry nodes to create "proper" UV maps from scratch,
though only with the Store Named Attribute node for now.
The new design considers any 2D vector attribute on the corner domain
to be a UV map. In the future, they might be distinguished from regular
2D vectors with attribute metadata, which may be helpful because they
are often interpolated differently.
Most of the code changes deal with passing around UV BMesh custom data
offsets and tracking the boolean "sublayers". The boolean layers are
use the following prefixes for attribute names: vert selection: `.vs.`,
edge selection: `.es.`, pinning: `.pn.`. Currently these are short to
avoid using up the maximum length of attribute names. To accommodate
for these 4 extra characters, the name length limit is enlarged to 68
bytes, while the maximum user settable name length is still 64 bytes.
Unfortunately Python/RNA API access to the UV flag data becomes slower.
Accessing the boolean layers directly is be better for performance in
general.
Like the other mesh SoA refactors, backward and forward compatibility
aren't affected, and won't be changed until 4.0. We pay for that by
making mesh reading and writing more expensive with conversions.
Resolves T85962
Differential Revision: https://developer.blender.org/D14365
2023-01-10 06:47:04 +01:00
|
|
|
#define MAX_CUSTOMDATA_LAYER_NAME 68
|
|
|
|
#define MAX_CUSTOMDATA_LAYER_NAME_NO_PREFIX 64
|
2012-01-11 09:51:06 +01:00
|
|
|
|
2009-11-25 15:27:50 +01:00
|
|
|
typedef struct CustomDataExternal {
|
2019-01-07 12:19:13 +01:00
|
|
|
/** FILE_MAX. */
|
2022-03-25 02:04:22 +01:00
|
|
|
char filepath[1024];
|
2009-11-25 15:27:50 +01:00
|
|
|
} CustomDataExternal;
|
|
|
|
|
2019-11-24 15:14:39 +01:00
|
|
|
/**
|
2023-12-26 22:11:29 +01:00
|
|
|
* #CustomData stores an arbitrary number of typed data "layers" for multiple elements.
|
|
|
|
* The layers are typically geometry attributes, and the elements are typically geometry
|
|
|
|
* elements like vertices, edges, or curves.
|
|
|
|
*
|
|
|
|
* Each layer has a type, often with certain semantics beyond the type of the raw data. However,
|
|
|
|
* a subset of the layer types are exposed as attributes and accessed with a higher level API
|
|
|
|
* built around #AttributeAccessor.
|
|
|
|
*
|
|
|
|
* For #BMesh, #CustomData is adapted to store the data from all layers in a single "block" which
|
|
|
|
* is allocated for each element. Each layer's data is stored at a certain offset into every
|
|
|
|
* block's data.
|
2019-11-24 15:14:39 +01:00
|
|
|
*/
|
2006-11-11 17:38:37 +01:00
|
|
|
typedef struct CustomData {
|
2023-12-26 22:11:29 +01:00
|
|
|
/** Layers ordered by type. */
|
2019-01-07 12:19:13 +01:00
|
|
|
CustomDataLayer *layers;
|
|
|
|
/**
|
2023-12-26 22:11:29 +01:00
|
|
|
* Runtime only map from types to indices of first layer of that type,
|
|
|
|
* Correct size of #CD_NUMTYPES is ensured by CustomData_update_typemap.
|
2019-01-07 12:19:13 +01:00
|
|
|
*/
|
2023-06-12 15:49:50 +02:00
|
|
|
int typemap[53];
|
2019-01-07 12:19:13 +01:00
|
|
|
/** Number of layers, size of layers array. */
|
|
|
|
int totlayer, maxlayer;
|
|
|
|
/** In editmode, total size of all data layers. */
|
|
|
|
int totsize;
|
|
|
|
/** (BMesh Only): Memory pool for allocation of blocks. */
|
|
|
|
struct BLI_mempool *pool;
|
2023-03-22 02:22:05 +01:00
|
|
|
/** External file storing custom-data layers. */
|
2019-01-07 12:19:13 +01:00
|
|
|
CustomDataExternal *external;
|
2006-11-11 17:38:37 +01:00
|
|
|
} CustomData;
|
|
|
|
|
2023-12-26 22:11:29 +01:00
|
|
|
/** #CustomDataLayer.type */
|
2022-06-01 06:38:06 +02:00
|
|
|
typedef enum eCustomDataType {
|
2023-12-26 22:11:29 +01:00
|
|
|
/**
|
|
|
|
* Used by GPU attributes in the cases when we don't know which layer
|
|
|
|
* we are addressing in advance.
|
2016-05-22 18:24:53 +02:00
|
|
|
*/
|
|
|
|
CD_AUTO_FROM_NAME = -1,
|
|
|
|
|
2019-12-16 23:42:12 +01:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2023-04-14 15:59:53 +02:00
|
|
|
CD_MVERT = 0,
|
|
|
|
CD_MSTICKY = 1,
|
2015-07-10 08:47:39 +02:00
|
|
|
#endif
|
2023-12-26 22:11:29 +01:00
|
|
|
CD_MDEFORMVERT = 2, /* Array of #MDeformVert. */
|
Mesh: Move edges to a generic attribute
Implements #95966, as the final step of #95965.
This commit changes the storage of mesh edge vertex indices from the
`MEdge` type to the generic `int2` attribute type. This follows the
general design for geometry and the attribute system, where the data
storage type and the usage semantics are separated.
The main benefit of the change is reduced memory usage-- the
requirements of storing mesh edges is reduced by 1/3. For example,
this saves 8MB on a 1 million vertex grid. This also gives performance
benefits to any memory-bound mesh processing algorithm that uses edges.
Another benefit is that all of the edge's vertex indices are
contiguous. In a few cases, it's helpful to process all of them as
`Span<int>` rather than `Span<int2>`. Similarly, the type is more
likely to match a generic format used by a library, or code that
shouldn't know about specific Blender `Mesh` types.
Various Notes:
- The `.edge_verts` name is used to reflect a mapping between domains,
similar to `.corner_verts`, etc. The period means that it the data
shouldn't change arbitrarily by the user or procedural operations.
- `edge[0]` is now used instead of `edge.v1`
- Signed integers are used instead of unsigned to reduce the mixing
of signed-ness, which can be error prone.
- All of the previously used core mesh data types (`MVert`, `MEdge`,
`MLoop`, `MPoly` are now deprecated. Only generic types are used).
- The `vec2i` DNA type is used in the few C files where necessary.
Pull Request: https://projects.blender.org/blender/blender/pulls/106638
2023-04-17 13:47:41 +02:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_MEDGE = 3,
|
Mesh: Move edges to a generic attribute
Implements #95966, as the final step of #95965.
This commit changes the storage of mesh edge vertex indices from the
`MEdge` type to the generic `int2` attribute type. This follows the
general design for geometry and the attribute system, where the data
storage type and the usage semantics are separated.
The main benefit of the change is reduced memory usage-- the
requirements of storing mesh edges is reduced by 1/3. For example,
this saves 8MB on a 1 million vertex grid. This also gives performance
benefits to any memory-bound mesh processing algorithm that uses edges.
Another benefit is that all of the edge's vertex indices are
contiguous. In a few cases, it's helpful to process all of them as
`Span<int>` rather than `Span<int2>`. Similarly, the type is more
likely to match a generic format used by a library, or code that
shouldn't know about specific Blender `Mesh` types.
Various Notes:
- The `.edge_verts` name is used to reflect a mapping between domains,
similar to `.corner_verts`, etc. The period means that it the data
shouldn't change arbitrarily by the user or procedural operations.
- `edge[0]` is now used instead of `edge.v1`
- Signed integers are used instead of unsigned to reduce the mixing
of signed-ness, which can be error prone.
- All of the previously used core mesh data types (`MVert`, `MEdge`,
`MLoop`, `MPoly` are now deprecated. Only generic types are used).
- The `vec2i` DNA type is used in the few C files where necessary.
Pull Request: https://projects.blender.org/blender/blender/pulls/106638
2023-04-17 13:47:41 +02:00
|
|
|
#endif
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_MFACE = 4,
|
|
|
|
CD_MTFACE = 5,
|
|
|
|
CD_MCOL = 6,
|
|
|
|
CD_ORIGINDEX = 7,
|
2022-02-22 18:43:53 +01:00
|
|
|
/**
|
2023-12-26 22:11:29 +01:00
|
|
|
* Used as temporary storage for some areas that support interpolating custom normals.
|
|
|
|
* Using a separate type from generic 3D vectors is a simple way of keeping values normalized.
|
2022-02-22 18:43:53 +01:00
|
|
|
*/
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_NORMAL = 8,
|
2023-06-09 13:54:52 +02:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
|
|
|
CD_FACEMAP = 9,
|
|
|
|
#endif
|
2020-06-10 15:47:31 +02:00
|
|
|
CD_PROP_FLOAT = 10,
|
|
|
|
CD_PROP_INT32 = 11,
|
|
|
|
CD_PROP_STRING = 12,
|
2019-07-03 15:43:05 +02:00
|
|
|
CD_ORIGSPACE = 13, /* for modifier stack face location mapping */
|
|
|
|
CD_ORCO = 14, /* undeformed vertex coordinates, normalized to 0..1 range */
|
2019-12-16 23:42:12 +01:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2023-04-14 15:59:53 +02:00
|
|
|
CD_MTEXPOLY = 15,
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_MLOOPUV = 16,
|
2023-04-14 15:59:53 +02:00
|
|
|
#endif
|
2022-04-20 16:10:10 +02:00
|
|
|
CD_PROP_BYTE_COLOR = 17,
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_TANGENT = 18,
|
|
|
|
CD_MDISPS = 19,
|
2024-02-13 18:59:36 +01:00
|
|
|
CD_PROP_FLOAT4X4 = 20,
|
2023-12-05 15:30:13 +01:00
|
|
|
/* CD_ID_MCOL = 21, */
|
2020-02-20 00:21:23 +01:00
|
|
|
/* CD_TEXTURE_MLOOPCOL = 22, */ /* UNUSED */
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_CLOTH_ORCO = 23,
|
2023-05-24 02:58:54 +02:00
|
|
|
/* CD_RECAST = 24, */ /* UNUSED */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-04-14 15:59:53 +02:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2023-05-24 02:58:54 +02:00
|
|
|
CD_MPOLY = 25,
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_MLOOP = 26,
|
2023-04-14 15:59:53 +02:00
|
|
|
#endif
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_SHAPE_KEYINDEX = 27,
|
|
|
|
CD_SHAPEKEY = 28,
|
2023-05-24 02:58:54 +02:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_BWEIGHT = 29,
|
|
|
|
CD_CREASE = 30,
|
2023-06-13 20:23:39 +02:00
|
|
|
#endif
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_ORIGSPACE_MLOOP = 31,
|
2023-12-05 15:30:13 +01:00
|
|
|
/* CD_PREVIEW_MLOOPCOL = 32, */ /* UNUSED */
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_BM_ELEM_PYPTR = 33,
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2023-11-20 17:42:01 +01:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_PAINT_MASK = 34,
|
2023-11-20 17:42:01 +01:00
|
|
|
#endif
|
2013-09-10 15:13:04 +02:00
|
|
|
CD_GRID_PAINT_MASK = 35,
|
|
|
|
CD_MVERT_SKIN = 36,
|
|
|
|
CD_FREESTYLE_EDGE = 37,
|
|
|
|
CD_FREESTYLE_FACE = 38,
|
2014-01-11 11:31:44 +01:00
|
|
|
CD_MLOOPTANGENT = 39,
|
2014-04-13 12:18:51 +02:00
|
|
|
CD_TESSLOOPNORMAL = 40,
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
CD_CUSTOMLOOPNORMAL = 41,
|
2023-04-14 15:59:53 +02:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2020-03-05 14:53:23 +01:00
|
|
|
CD_SCULPT_FACE_SETS = 42,
|
2023-04-14 15:59:53 +02:00
|
|
|
#endif
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2022-02-04 17:29:11 +01:00
|
|
|
/* CD_LOCATION = 43, */ /* UNUSED */
|
|
|
|
/* CD_RADIUS = 44, */ /* UNUSED */
|
|
|
|
CD_PROP_INT8 = 45,
|
2023-04-14 16:08:05 +02:00
|
|
|
/* Two 32-bit signed integers. */
|
|
|
|
CD_PROP_INT32_2D = 46,
|
2020-03-17 14:41:48 +01:00
|
|
|
|
2020-05-27 20:04:09 +02:00
|
|
|
CD_PROP_COLOR = 47,
|
2020-07-15 16:42:17 +02:00
|
|
|
CD_PROP_FLOAT3 = 48,
|
|
|
|
CD_PROP_FLOAT2 = 49,
|
2020-12-16 19:33:13 +01:00
|
|
|
CD_PROP_BOOL = 50,
|
|
|
|
|
2023-06-28 17:17:31 +02:00
|
|
|
/* CD_HAIRLENGTH = 51, */ /* UNUSED */
|
|
|
|
|
2023-06-12 15:49:50 +02:00
|
|
|
CD_PROP_QUATERNION = 52,
|
2021-09-24 07:42:36 +02:00
|
|
|
|
2023-06-12 15:49:50 +02:00
|
|
|
CD_NUMTYPES = 53,
|
2022-06-01 06:38:06 +02:00
|
|
|
} eCustomDataType;
|
Added custom vertex/edge/face data for meshes:
All data layers, including MVert/MEdge/MFace, are now managed as custom
data layers. The pointers like Mesh.mvert, Mesh.dvert or Mesh.mcol are
still used of course, but allocating, copying or freeing these arrays
should be done through the CustomData API.
Work in progress documentation on this is here:
http://mediawiki.blender.org/index.php/BlenderDev/BlenderArchitecture/CustomData
Replaced TFace by MTFace:
This is the same struct, except that it does not contain color, that now
always stays separated in MCol. This was not a good design decision to
begin with, and it is needed for adding multiple color layers later. Note
that this does mean older Blender versions will not be able to read UV
coordinates from the next release, due to an SDNA limitation.
Removed DispListMesh:
This now fully replaced by DerivedMesh. To provide access to arrays of
vertices, edges and faces, like DispListMesh does. The semantics of the
DerivedMesh.getVertArray() and similar functions were changed to return
a pointer to an array if one exists, or otherwise allocate a temporary
one. On releasing the DerivedMesh, this temporary array will be removed
automatically.
Removed ssDM and meshDM DerivedMesh backends:
The ssDM backend was for DispListMesh, so that became obsolete automatically.
The meshDM backend was replaced by the custom data backend, that now figures
out which layers need to be modified, and only duplicates those.
This changes code in many places, and overall removes 2514 lines of code.
So, there's a good chance this might break some stuff, although I've been
testing it for a few days now. The good news is, adding multiple color and
uv layers should now become easy.
2006-11-20 05:28:02 +01:00
|
|
|
|
2023-12-27 05:21:19 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
using eCustomDataMask = uint64_t;
|
|
|
|
#endif
|
|
|
|
|
2022-06-01 06:38:06 +02:00
|
|
|
/* Bits for eCustomDataMask */
|
2013-09-12 22:43:29 +02:00
|
|
|
#define CD_MASK_MDEFORMVERT (1 << CD_MDEFORMVERT)
|
|
|
|
#define CD_MASK_MFACE (1 << CD_MFACE)
|
|
|
|
#define CD_MASK_MTFACE (1 << CD_MTFACE)
|
|
|
|
#define CD_MASK_MCOL (1 << CD_MCOL)
|
|
|
|
#define CD_MASK_ORIGINDEX (1 << CD_ORIGINDEX)
|
|
|
|
#define CD_MASK_NORMAL (1 << CD_NORMAL)
|
2020-06-10 15:47:31 +02:00
|
|
|
#define CD_MASK_PROP_FLOAT (1 << CD_PROP_FLOAT)
|
|
|
|
#define CD_MASK_PROP_INT32 (1 << CD_PROP_INT32)
|
|
|
|
#define CD_MASK_PROP_STRING (1 << CD_PROP_STRING)
|
2013-09-12 22:43:29 +02:00
|
|
|
#define CD_MASK_ORIGSPACE (1 << CD_ORIGSPACE)
|
|
|
|
#define CD_MASK_ORCO (1 << CD_ORCO)
|
2022-04-20 16:10:10 +02:00
|
|
|
#define CD_MASK_PROP_BYTE_COLOR (1 << CD_PROP_BYTE_COLOR)
|
2013-09-12 22:43:29 +02:00
|
|
|
#define CD_MASK_TANGENT (1 << CD_TANGENT)
|
|
|
|
#define CD_MASK_MDISPS (1 << CD_MDISPS)
|
|
|
|
#define CD_MASK_CLOTH_ORCO (1 << CD_CLOTH_ORCO)
|
2011-12-28 14:11:46 +01:00
|
|
|
|
2013-09-12 22:43:29 +02:00
|
|
|
#define CD_MASK_SHAPE_KEYINDEX (1 << CD_SHAPE_KEYINDEX)
|
|
|
|
#define CD_MASK_SHAPEKEY (1 << CD_SHAPEKEY)
|
|
|
|
#define CD_MASK_ORIGSPACE_MLOOP (1LL << CD_ORIGSPACE_MLOOP)
|
|
|
|
#define CD_MASK_BM_ELEM_PYPTR (1LL << CD_BM_ELEM_PYPTR)
|
2006-12-05 18:42:03 +01:00
|
|
|
|
2013-09-12 22:43:29 +02:00
|
|
|
#define CD_MASK_GRID_PAINT_MASK (1LL << CD_GRID_PAINT_MASK)
|
|
|
|
#define CD_MASK_MVERT_SKIN (1LL << CD_MVERT_SKIN)
|
|
|
|
#define CD_MASK_FREESTYLE_EDGE (1LL << CD_FREESTYLE_EDGE)
|
|
|
|
#define CD_MASK_FREESTYLE_FACE (1LL << CD_FREESTYLE_FACE)
|
2014-04-13 12:18:51 +02:00
|
|
|
#define CD_MASK_MLOOPTANGENT (1LL << CD_MLOOPTANGENT)
|
|
|
|
#define CD_MASK_TESSLOOPNORMAL (1LL << CD_TESSLOOPNORMAL)
|
Add Custom Loop Normals.
This is the core code for it, tools (datatransfer and modifier) will come in next commits).
RNA api is already there, though.
See the code for details, but basically, we define, for each 'smooth fan'
(which is a set of adjacent loops around a same vertex that are smooth, i.e. have a single same normal),
a 'loop normal space' (or lnor space), using auto-computed normal and relevant edges, and store
custom normal as two angular factors inside that space. This allows to have custom normals
'following' deformations of the geometry, and to only save two shorts per loop in new clnor CDLayer.
Normal manipulation (editing, mixing, interpolating, etc.) shall always happen with plain 3D vectors normals,
and be converted back into storage format at the end.
Clnor computation has also been threaded (at least for Mesh case, not for BMesh), since the process can
be rather heavy with high poly meshes.
Also, bumping subversion, and fix mess in 2.70 versioning code.
2015-02-05 14:24:48 +01:00
|
|
|
#define CD_MASK_CUSTOMLOOPNORMAL (1LL << CD_CUSTOMLOOPNORMAL)
|
Sculpt Vertex Colors: Initial implementation
Sculpt Vertex Colors is a painting system that runs inside sculpt mode, reusing all its tools and optimizations. This provides much better performance, easier to maintain code and more advanced features (new brush engine, filters, symmetry options, masks and face sets compatibility...). This is also the initial step for future features like vertex painting in Multires and brushes that can sculpt and paint at the same time.
This commit includes:
- SCULPT_UNDO_COLOR for undo support in sculpt mode
- SCULPT_UPDATE_COLOR and PBVH flags and rendering
- Sculpt Color API functions
- Sculpt capability for sculpt tools (only enabled in the Paint Brush for now)
- Rendering support in workbench (default to Sculpt Vertex Colors except in Vertex Paint)
- Conversion operator between MPropCol (Sculpt Vertex Colors) and MLoopCol (Vertex Paint)
- Remesher reprojection in the Voxel Remehser
- Paint Brush and Smear Brush with color smoothing in alt-smooth mode
- Parameters for the new brush engine (density, opacity, flow, wet paint mixing, tip scale) implemented in Sculpt Vertex Colors
- Color Filter
- Color picker (uses S shortcut, replaces smooth)
- Color selector in the top bar
Reviewed By: brecht
Maniphest Tasks: T72866
Differential Revision: https://developer.blender.org/D5975
2020-06-22 20:05:28 +02:00
|
|
|
#define CD_MASK_PROP_COLOR (1ULL << CD_PROP_COLOR)
|
2020-07-15 16:42:17 +02:00
|
|
|
#define CD_MASK_PROP_FLOAT3 (1ULL << CD_PROP_FLOAT3)
|
|
|
|
#define CD_MASK_PROP_FLOAT2 (1ULL << CD_PROP_FLOAT2)
|
2020-12-16 19:33:13 +01:00
|
|
|
#define CD_MASK_PROP_BOOL (1ULL << CD_PROP_BOOL)
|
2022-02-04 17:29:11 +01:00
|
|
|
#define CD_MASK_PROP_INT8 (1ULL << CD_PROP_INT8)
|
2023-04-14 16:08:05 +02:00
|
|
|
#define CD_MASK_PROP_INT32_2D (1ULL << CD_PROP_INT32_2D)
|
2023-06-12 15:49:50 +02:00
|
|
|
#define CD_MASK_PROP_QUATERNION (1ULL << CD_PROP_QUATERNION)
|
2024-02-13 18:59:36 +01:00
|
|
|
#define CD_MASK_PROP_FLOAT4X4 (1ULL << CD_PROP_FLOAT4X4)
|
2012-05-10 22:33:24 +02:00
|
|
|
|
2022-11-01 02:24:06 +01:00
|
|
|
/** Multi-resolution loop data. */
|
2019-08-27 18:17:27 +02:00
|
|
|
#define CD_MASK_MULTIRES_GRIDS (CD_MASK_MDISPS | CD_GRID_PAINT_MASK)
|
|
|
|
|
2020-03-17 14:41:48 +01:00
|
|
|
/* All data layers. */
|
|
|
|
#define CD_MASK_ALL (~0LL)
|
|
|
|
|
2020-07-03 15:30:04 +02:00
|
|
|
/* All generic attributes. */
|
|
|
|
#define CD_MASK_PROP_ALL \
|
|
|
|
(CD_MASK_PROP_FLOAT | CD_MASK_PROP_FLOAT2 | CD_MASK_PROP_FLOAT3 | CD_MASK_PROP_INT32 | \
|
2022-04-20 16:10:10 +02:00
|
|
|
CD_MASK_PROP_COLOR | CD_MASK_PROP_STRING | CD_MASK_PROP_BYTE_COLOR | CD_MASK_PROP_BOOL | \
|
2024-02-13 18:59:36 +01:00
|
|
|
CD_MASK_PROP_INT8 | CD_MASK_PROP_INT32_2D | CD_MASK_PROP_QUATERNION | CD_MASK_PROP_FLOAT4X4)
|
2020-07-03 15:30:04 +02:00
|
|
|
|
2022-04-05 20:42:55 +02:00
|
|
|
/* All color attributes */
|
2022-04-20 16:10:10 +02:00
|
|
|
#define CD_MASK_COLOR_ALL (CD_MASK_PROP_COLOR | CD_MASK_PROP_BYTE_COLOR)
|
2022-04-05 20:42:55 +02:00
|
|
|
|
Refactor CDData masks, to have one mask per mesh elem type.
We already have different storages for cddata of verts, edges etc.,
'simply' do the same for the mask flags we use all around Blender code
to request some data, or limit some operation to some layers, etc.
Reason we need this is that some cddata types (like Normals) are
actually shared between verts/polys/loops, and we don’t want to generate
clnors everytime we request vnors!
As a side note, this also does final fix to T59338, which was the
trigger for this patch (need to request computed loop normals for
another mesh than evaluated one).
Reviewers: brecht, campbellbarton, sergey
Differential Revision: https://developer.blender.org/D4407
2019-03-07 11:13:40 +01:00
|
|
|
typedef struct CustomData_MeshMasks {
|
|
|
|
uint64_t vmask;
|
|
|
|
uint64_t emask;
|
|
|
|
uint64_t fmask;
|
|
|
|
uint64_t pmask;
|
|
|
|
uint64_t lmask;
|
|
|
|
} CustomData_MeshMasks;
|
|
|
|
|
2022-04-05 00:00:20 +02:00
|
|
|
/** #CustomData.flag */
|
2013-09-10 15:13:04 +02:00
|
|
|
enum {
|
|
|
|
/* Indicates layer should not be copied by CustomData_from_template or CustomData_copy_data */
|
|
|
|
CD_FLAG_NOCOPY = (1 << 0),
|
2023-04-13 14:57:57 +02:00
|
|
|
CD_FLAG_UNUSED = (1 << 1),
|
2013-09-10 15:13:04 +02:00
|
|
|
/* Indicates the layer is only temporary, also implies no copy */
|
|
|
|
CD_FLAG_TEMPORARY = ((1 << 2) | CD_FLAG_NOCOPY),
|
|
|
|
/* Indicates the layer is stored in an external file */
|
|
|
|
CD_FLAG_EXTERNAL = (1 << 3),
|
|
|
|
/* Indicates external data is read into memory */
|
|
|
|
CD_FLAG_IN_MEMORY = (1 << 4),
|
2022-12-15 21:18:57 +01:00
|
|
|
#ifdef DNA_DEPRECATED_ALLOW
|
2022-04-05 20:42:55 +02:00
|
|
|
CD_FLAG_COLOR_ACTIVE = (1 << 5),
|
|
|
|
CD_FLAG_COLOR_RENDER = (1 << 6)
|
2022-12-15 21:18:57 +01:00
|
|
|
#endif
|
2013-09-10 15:13:04 +02:00
|
|
|
};
|
2006-11-11 17:38:37 +01:00
|
|
|
|
2006-12-21 14:47:27 +01:00
|
|
|
/* Limits */
|
2013-09-10 15:13:04 +02:00
|
|
|
#define MAX_MTFACE 8
|
2006-12-21 14:47:27 +01:00
|
|
|
|
2014-04-16 04:31:02 +02:00
|
|
|
#define DYNTOPO_NODE_NONE -1
|