diff options
Diffstat (limited to 'source/blender/blenkernel/BKE_customdata.h')
-rw-r--r-- | source/blender/blenkernel/BKE_customdata.h | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index fec376fd415..44a4f4b5395 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -11,7 +11,9 @@ #include "BLI_sys_types.h" #include "BLI_utildefines.h" #ifdef __cplusplus +# include "BLI_set.hh" # include "BLI_span.hh" +# include "BLI_string_ref.hh" # include "BLI_vector.hh" #endif @@ -53,14 +55,17 @@ extern const CustomData_MeshMasks CD_MASK_EVERYTHING; typedef enum eCDAllocType { /** Use the data pointer. */ CD_ASSIGN = 0, - /** Allocate blank memory. */ - CD_CALLOC = 1, - /** Allocate and set to default. */ - CD_DEFAULT = 2, + /** Allocate and set to default, which is usually just zeroed memory. */ + CD_SET_DEFAULT = 2, /** Use data pointers, set layer flag NOFREE. */ CD_REFERENCE = 3, /** Do a full copy of all layers, only allowed if source has same number of elements. */ CD_DUPLICATE = 4, + /** + * Default construct new layer values. Does nothing for trivial types. This should be used + * if all layer values will be set by the caller after creating the layer. + */ + CD_CONSTRUCT = 5, } eCDAllocType; #define CD_TYPE_AS_MASK(_type) (eCustomDataMask)((eCustomDataMask)1 << (eCustomDataMask)(_type)) @@ -141,6 +146,15 @@ void CustomData_copy(const struct CustomData *source, eCDAllocType alloctype, int totelem); +/** + * Like #CustomData_copy but skips copying layers that are stored as flags on #BMesh. + */ +void CustomData_copy_mesh_to_bmesh(const struct CustomData *source, + struct CustomData *dest, + eCustomDataMask mask, + eCDAllocType alloctype, + int totelem); + /* BMESH_TODO, not really a public function but readfile.c needs it */ void CustomData_update_typemap(struct CustomData *data); @@ -155,6 +169,15 @@ bool CustomData_merge(const struct CustomData *source, int totelem); /** + * Like #CustomData_copy but skips copying layers that are stored as flags on #BMesh. + */ +bool CustomData_merge_mesh_to_bmesh(const struct CustomData *source, + struct CustomData *dest, + eCustomDataMask mask, + eCDAllocType alloctype, + int totelem); + +/** * Reallocate custom data to a new element count. * Only affects on data layers which are owned by the CustomData itself, * referenced data is kept unchanged, @@ -397,7 +420,7 @@ void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int typ */ void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n); -bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name); +bool CustomData_set_layer_name(struct CustomData *data, int type, int n, const char *name); const char *CustomData_get_layer_name(const struct CustomData *data, int type, int n); /** @@ -431,6 +454,12 @@ int CustomData_get_stencil_layer(const struct CustomData *data, int type); const char *CustomData_get_active_layer_name(const struct CustomData *data, int type); /** + * Returns name of the default layer of the given type or NULL + * if no such active layer is defined. + */ +const char *CustomData_get_render_layer_name(const struct CustomData *data, int type); + +/** * Copies the data from source to the data element at index in the first layer of type * no effect if there is no layer of type. */ @@ -697,7 +726,8 @@ void CustomData_data_transfer(const struct MeshPairRemap *me_remap, * the struct. */ void CustomData_blend_write_prepare(CustomData &data, - blender::Vector<CustomDataLayer, 16> &layers_to_write); + blender::Vector<CustomDataLayer, 16> &layers_to_write, + const blender::Set<std::string> &skip_names = {}); /** * \param layers_to_write: Layers created by #CustomData_blend_write_prepare. |