From eae36be372a6b16ee3e76eff0485a47da4f3c230 Mon Sep 17 00:00:00 2001 From: Joseph Eagar Date: Tue, 5 Apr 2022 11:42:55 -0700 Subject: Refactor: Unify vertex and sculpt colors into new color attribute system. This commit removes sculpt colors from experimental status and unifies it with vertex colors. It introduces the concept of "color attributes", which are any attributes that represents colors. Color attributes can be represented with byte or floating-point numbers and can be stored in either vertices or face corners. Color attributes share a common namespace (so you can no longer have a floating-point sculpt color attribute and a byte vertex color attribute with the same name). Note: this commit does not include vertex paint mode, which is a separate patch, see: https://developer.blender.org/D14179 Differential Revision: https://developer.blender.org/D12587 Ref D12587 --- source/blender/blenkernel/BKE_data_transfer.h | 41 ++++++++++++++++++++------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'source/blender/blenkernel/BKE_data_transfer.h') diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h index fcf84edeb23..1b6c1dc4205 100644 --- a/source/blender/blenkernel/BKE_data_transfer.h +++ b/source/blender/blenkernel/BKE_data_transfer.h @@ -8,6 +8,7 @@ #pragma once #include "BKE_customdata.h" +#include "BLI_compiler_compat.h" #ifdef __cplusplus extern "C" { @@ -32,18 +33,23 @@ enum { DT_TYPE_BWEIGHT_EDGE = 1 << 11, DT_TYPE_FREESTYLE_EDGE = 1 << 12, - DT_TYPE_VCOL = 1 << 16, + DT_TYPE_MPROPCOL_VERT = 1 << 16, DT_TYPE_LNOR = 1 << 17, DT_TYPE_UV = 1 << 24, DT_TYPE_SHARP_FACE = 1 << 25, DT_TYPE_FREESTYLE_FACE = 1 << 26, -#define DT_TYPE_MAX 27 - - DT_TYPE_VERT_ALL = DT_TYPE_MDEFORMVERT | DT_TYPE_SHAPEKEY | DT_TYPE_SKIN | DT_TYPE_BWEIGHT_VERT, + DT_TYPE_MLOOPCOL_VERT = 1 << 27, + DT_TYPE_MPROPCOL_LOOP = 1 << 28, + DT_TYPE_MLOOPCOL_LOOP = 1 << 29, + DT_TYPE_VCOL_ALL = (1 << 16) | (1 << 27) | (1 << 28) | (1 << 29), +#define DT_TYPE_MAX 30 + + DT_TYPE_VERT_ALL = DT_TYPE_MDEFORMVERT | DT_TYPE_SHAPEKEY | DT_TYPE_SKIN | DT_TYPE_BWEIGHT_VERT | + DT_TYPE_MPROPCOL_VERT | DT_TYPE_MLOOPCOL_VERT, DT_TYPE_EDGE_ALL = DT_TYPE_SHARP_EDGE | DT_TYPE_SEAM | DT_TYPE_CREASE | DT_TYPE_BWEIGHT_EDGE | DT_TYPE_FREESTYLE_EDGE, - DT_TYPE_LOOP_ALL = DT_TYPE_VCOL | DT_TYPE_LNOR | DT_TYPE_UV, + DT_TYPE_LOOP_ALL = DT_TYPE_LNOR | DT_TYPE_UV | DT_TYPE_MPROPCOL_LOOP | DT_TYPE_MLOOPCOL_LOOP, DT_TYPE_POLY_ALL = DT_TYPE_UV | DT_TYPE_SHARP_FACE | DT_TYPE_FREESTYLE_FACE, }; @@ -62,7 +68,13 @@ int BKE_object_data_transfer_dttype_to_cdtype(int dtdata_type); int BKE_object_data_transfer_dttype_to_srcdst_index(int dtdata_type); #define DT_DATATYPE_IS_VERT(_dt) \ - ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_SKIN, DT_TYPE_BWEIGHT_VERT) + ELEM(_dt, \ + DT_TYPE_MDEFORMVERT, \ + DT_TYPE_SHAPEKEY, \ + DT_TYPE_SKIN, \ + DT_TYPE_BWEIGHT_VERT, \ + DT_TYPE_MLOOPCOL_VERT, \ + DT_TYPE_MPROPCOL_VERT) #define DT_DATATYPE_IS_EDGE(_dt) \ ELEM(_dt, \ DT_TYPE_CREASE, \ @@ -70,19 +82,28 @@ int BKE_object_data_transfer_dttype_to_srcdst_index(int dtdata_type); DT_TYPE_SEAM, \ DT_TYPE_BWEIGHT_EDGE, \ DT_TYPE_FREESTYLE_EDGE) -#define DT_DATATYPE_IS_LOOP(_dt) ELEM(_dt, DT_TYPE_UV, DT_TYPE_VCOL, DT_TYPE_LNOR) +#define DT_DATATYPE_IS_LOOP(_dt) \ + ELEM(_dt, DT_TYPE_UV, DT_TYPE_LNOR, DT_TYPE_MLOOPCOL_LOOP, DT_TYPE_MPROPCOL_LOOP) #define DT_DATATYPE_IS_POLY(_dt) ELEM(_dt, DT_TYPE_UV, DT_TYPE_SHARP_FACE, DT_TYPE_FREESTYLE_FACE) #define DT_DATATYPE_IS_MULTILAYERS(_dt) \ - ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_VCOL, DT_TYPE_UV) + ELEM(_dt, \ + DT_TYPE_MDEFORMVERT, \ + DT_TYPE_SHAPEKEY, \ + DT_TYPE_MPROPCOL_VERT, \ + DT_TYPE_MLOOPCOL_VERT, \ + DT_TYPE_MPROPCOL_LOOP, \ + DT_TYPE_MLOOPCOL_LOOP, \ + DT_TYPE_UV) enum { DT_MULTILAYER_INDEX_INVALID = -1, DT_MULTILAYER_INDEX_MDEFORMVERT = 0, DT_MULTILAYER_INDEX_SHAPEKEY = 1, - DT_MULTILAYER_INDEX_VCOL = 2, + DT_MULTILAYER_INDEX_VCOL_LOOP = 2, DT_MULTILAYER_INDEX_UV = 3, - DT_MULTILAYER_INDEX_MAX = 4, + DT_MULTILAYER_INDEX_VCOL_VERT = 4, + DT_MULTILAYER_INDEX_MAX = 5, }; /* Below we keep positive values for real layers idx (generated dynamically). */ -- cgit v1.2.3