Blender  V2.93
BKE_customdata.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2006 Blender Foundation.
17  * All rights reserved.
18  */
19 
25 #pragma once
26 
27 #include "BLI_sys_types.h"
28 #include "BLI_utildefines.h"
29 
30 #include "DNA_customdata_types.h"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 struct BMesh;
37 struct BlendDataReader;
38 struct BlendWriter;
39 struct CustomData;
41 struct ID;
43 
44 /*a data type large enough to hold 1 element from any customdata layer type*/
45 typedef struct {
46  unsigned char data[64];
47 } CDBlockBytes;
48 
57 
58 /* for ORIGINDEX layer type, indicates no original index for this element */
59 #define ORIGINDEX_NONE -1
60 
61 /* initializes a CustomData object with the same layer setup as source and
62  * memory space for totelem elements. mask must be an array of length
63  * CD_NUMTYPES elements, that indicate if a layer can be copied. */
64 
66 typedef enum eCDAllocType {
68  CD_ASSIGN = 0,
70  CD_CALLOC = 1,
78 
79 #define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type))
80 
82 
83 typedef void (*cd_interp)(
84  const void **sources, const float *weights, const float *sub_weights, int count, void *dest);
85 typedef void (*cd_copy)(const void *source, void *dest, int count);
86 typedef bool (*cd_validate)(void *item, const uint totitems, const bool do_fixes);
87 
89  const CustomData_MeshMasks *mask_src);
91  const CustomData_MeshMasks *mask_required);
92 
97 bool CustomData_layer_has_math(const struct CustomData *data, int layer_n);
98 bool CustomData_layer_has_interp(const struct CustomData *data, int layer_n);
99 
103 bool CustomData_has_math(const struct CustomData *data);
104 bool CustomData_has_interp(const struct CustomData *data);
105 bool CustomData_bmesh_has_free(const struct CustomData *data);
106 
110 bool CustomData_has_referenced(const struct CustomData *data);
111 
112 /* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
113  * another, while not overwriting anything else (e.g. flags). probably only
114  * implemented for mloopuv/mloopcol, for now.*/
115 void CustomData_data_copy_value(int type, const void *source, void *dest);
116 
117 /* Same as above, but doing advanced mixing.
118  * Only available for a few types of data (like colors...). */
120  int type, const void *source, void *dest, const int mixmode, const float mixfactor);
121 
122 /* compares if data1 is equal to data2. type is a valid CustomData type
123  * enum (e.g. CD_MLOOPUV). the layer type's equal function is used to compare
124  * the data, if it exists, otherwise memcmp is used.*/
125 bool CustomData_data_equals(int type, const void *data1, const void *data2);
126 void CustomData_data_initminmax(int type, void *min, void *max);
127 void CustomData_data_dominmax(int type, const void *data, void *min, void *max);
128 void CustomData_data_multiply(int type, void *data, float fac);
129 void CustomData_data_add(int type, void *data1, const void *data2);
130 
131 /* initializes a CustomData object with the same layer setup as source.
132  * mask is a bitfield where (mask & (1 << (layer type))) indicates
133  * if a layer should be copied or not. alloctype must be one of the above. */
134 void CustomData_copy(const struct CustomData *source,
135  struct CustomData *dest,
137  eCDAllocType alloctype,
138  int totelem);
139 
140 /* BMESH_TODO, not really a public function but readfile.c needs it */
142 
143 /* same as the above, except that this will preserve existing layers, and only
144  * add the layers that were not there yet */
145 bool CustomData_merge(const struct CustomData *source,
146  struct CustomData *dest,
148  eCDAllocType alloctype,
149  int totelem);
150 
151 /* Reallocate custom data to a new element count.
152  * Only affects on data layers which are owned by the CustomData itself,
153  * referenced data is kept unchanged,
154  *
155  * NOTE: Take care of referenced layers by yourself!
156  */
157 void CustomData_realloc(struct CustomData *data, int totelem);
158 
159 /* bmesh version of CustomData_merge; merges the layouts of source and dest,
160  * then goes through the mesh and makes sure all the customdata blocks are
161  * consistent with the new layout.*/
162 bool CustomData_bmesh_merge(const struct CustomData *source,
163  struct CustomData *dest,
165  eCDAllocType alloctype,
166  struct BMesh *bm,
167  const char htype);
168 
170 void CustomData_reset(struct CustomData *data);
171 
175 void CustomData_free(struct CustomData *data, int totelem);
176 
177 /* same as above, but only frees layers which matches the given mask. */
178 void CustomData_free_typemask(struct CustomData *data, int totelem, CustomDataMask mask);
179 
180 /* frees all layers with CD_FLAG_TEMPORARY */
181 void CustomData_free_temporary(struct CustomData *data, int totelem);
182 
183 /* adds a data layer of the given type to the CustomData object, optionally
184  * backed by an external data array. the different allocation types are
185  * defined above. returns the data of the layer.
186  */
188  struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem);
189 /*same as above but accepts a name */
191  int type,
192  eCDAllocType alloctype,
193  void *layer,
194  int totelem,
195  const char *name);
196 
197 /* frees the active or first data layer with the give type.
198  * returns 1 on success, 0 if no layer with the given type is found
199  *
200  * in editmode, use EDBM_data_layer_free instead of this function
201  */
202 bool CustomData_free_layer(struct CustomData *data, int type, int totelem, int index);
203 
204 /* frees the layer index with the give type.
205  * returns 1 on success, 0 if no layer with the given type is found
206  *
207  * in editmode, use EDBM_data_layer_free instead of this function
208  */
209 bool CustomData_free_layer_active(struct CustomData *data, int type, int totelem);
210 
211 /* same as above, but free all layers with type */
212 void CustomData_free_layers(struct CustomData *data, int type, int totelem);
213 
214 /* returns 1 if a layer with the specified type exists */
215 bool CustomData_has_layer(const struct CustomData *data, int type);
216 
217 /* returns the number of layers with this type */
220 
221 /* duplicate data of a layer with flag NOFREE, and remove that flag.
222  * returns the layer data */
224  const int type,
225  const int totelem);
227  const int type,
228  const int n,
229  const int totelem);
231  const int type,
232  const char *name,
233  const int totelem);
235 
236 /* Duplicate all the layers with flag NOFREE, and remove the flag from duplicated layers. */
238 
239 /* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is
240  * zero for the layer type, so only layer types specified by the mask
241  * will be copied
242  */
244 
245 /* copies data from one CustomData object to another
246  * objects need not be compatible, each source layer is copied to the
247  * first dest layer of correct type (if there is none, the layer is skipped)
248  * return 1 on success, 0 on failure
249  */
250 void CustomData_copy_data(const struct CustomData *source,
251  struct CustomData *dest,
252  int source_index,
253  int dest_index,
254  int count);
255 void CustomData_copy_data_layer(const CustomData *source,
256  CustomData *dest,
257  int src_layer_index,
258  int dst_layer_index,
259  int src_index,
260  int dst_index,
261  int count);
262 void CustomData_copy_data_named(const struct CustomData *source,
263  struct CustomData *dest,
264  int source_index,
265  int dest_index,
266  int count);
267 void CustomData_copy_elements(int type, void *src_data_ofs, void *dst_data_ofs, int count);
268 void CustomData_bmesh_copy_data(const struct CustomData *source,
269  struct CustomData *dest,
270  void *src_block,
271  void **dest_block);
273  struct CustomData *dest,
274  void *src_block,
275  void **dest_block,
276  const CustomDataMask mask_exclude);
277 
278 /* Copies data of a single layer of a given type. */
279 void CustomData_copy_layer_type_data(const struct CustomData *source,
280  struct CustomData *destination,
281  int type,
282  int source_index,
283  int destination_index,
284  int count);
285 
286 /* frees data in a CustomData object
287  * return 1 on success, 0 on failure
288  */
289 void CustomData_free_elem(struct CustomData *data, int index, int count);
290 
291 /* interpolates data from one CustomData object to another
292  * objects need not be compatible, each source layer is interpolated to the
293  * first dest layer of correct type (if there is none, the layer is skipped)
294  * if weights == NULL or sub_weights == NULL, they default to all 1's
295  *
296  * src_indices gives the source elements to interpolate from
297  * weights gives the weight for each source element
298  * sub_weights is an array of matrices of weights for sub-elements (matrices
299  * should be source->subElems * source->subElems in size)
300  * count gives the number of source elements to interpolate from
301  * dest_index gives the dest element to write the interpolated value to
302  */
303 void CustomData_interp(const struct CustomData *source,
304  struct CustomData *dest,
305  const int *src_indices,
306  const float *weights,
307  const float *sub_weights,
308  int count,
309  int dest_index);
311  const void **src_blocks,
312  const float *weights,
313  const float *sub_weights,
314  int count,
315  void *dst_block_ofs,
316  int n);
318  const void **src_blocks,
319  const float *weights,
320  const float *sub_weights,
321  int count,
322  void *dst_block);
323 
324 /* swaps the data in the element corners, to new corners with indices as
325  * specified in corner_indices. for edges this is an array of length 2, for
326  * faces an array of length 4 */
327 void CustomData_swap_corners(struct CustomData *data, int index, const int *corner_indices);
328 
329 void CustomData_swap(struct CustomData *data, const int index_a, const int index_b);
330 
331 /* gets a pointer to the data element at index from the first layer of type
332  * returns NULL if there is no layer of type
333  */
334 void *CustomData_get(const struct CustomData *data, int index, int type);
335 void *CustomData_get_n(const struct CustomData *data, int type, int index, int n);
336 void *CustomData_bmesh_get(const struct CustomData *data, void *block, int type);
337 void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int type, int n);
338 
339 /* gets the layer at physical index n, with no type checking.
340  */
341 void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n);
342 
343 bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name);
344 const char *CustomData_get_layer_name(const struct CustomData *data, int type, int n);
345 
346 /* gets a pointer to the active or first layer of type
347  * returns NULL if there is no layer of type
348  */
349 void *CustomData_get_layer(const struct CustomData *data, int type);
350 void *CustomData_get_layer_n(const struct CustomData *data, int type, int n);
351 void *CustomData_get_layer_named(const struct CustomData *data, int type, const char *name);
352 int CustomData_get_offset(const struct CustomData *data, int type);
353 int CustomData_get_n_offset(const struct CustomData *data, int type, int n);
354 
356 int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n);
357 int CustomData_get_named_layer_index(const struct CustomData *data, int type, const char *name);
362 int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name);
367 
368 /* copies the data from source to the data element at index in the first
369  * layer of type
370  * no effect if there is no layer of type
371  */
372 void CustomData_set(const struct CustomData *data, int index, int type, const void *source);
373 
375  void *block,
376  int type,
377  const void *source);
378 
380  struct CustomData *data, void *block, int type, int n, const void *source);
381 /* sets the data of the block at physical layer n. no real type checking
382  * is performed.
383  */
384 void CustomData_bmesh_set_layer_n(struct CustomData *data, void *block, int n, const void *source);
385 
386 /* set the pointer of to the first layer of type. the old data is not freed.
387  * returns the value of ptr if the layer is found, NULL otherwise
388  */
389 void *CustomData_set_layer(const struct CustomData *data, int type, void *ptr);
390 void *CustomData_set_layer_n(const struct CustomData *data, int type, int n, void *ptr);
391 
392 /* sets the nth layer of type as active */
393 void CustomData_set_layer_active(struct CustomData *data, int type, int n);
394 void CustomData_set_layer_render(struct CustomData *data, int type, int n);
395 void CustomData_set_layer_clone(struct CustomData *data, int type, int n);
396 void CustomData_set_layer_stencil(struct CustomData *data, int type, int n);
397 
398 /* same as above but works with an index from CustomData_get_layer_index */
399 void CustomData_set_layer_active_index(struct CustomData *data, int type, int n);
400 void CustomData_set_layer_render_index(struct CustomData *data, int type, int n);
401 void CustomData_set_layer_clone_index(struct CustomData *data, int type, int n);
402 void CustomData_set_layer_stencil_index(struct CustomData *data, int type, int n);
403 
404 /* adds flag to the layer flags */
405 void CustomData_set_layer_flag(struct CustomData *data, int type, int flag);
406 void CustomData_clear_layer_flag(struct CustomData *data, int type, int flag);
407 
408 void CustomData_bmesh_set_default(struct CustomData *data, void **block);
409 void CustomData_bmesh_free_block(struct CustomData *data, void **block);
410 void CustomData_bmesh_free_block_data(struct CustomData *data, void *block);
412  void *block,
413  const CustomDataMask mask_exclude);
414 
415 /* copy custom data to/from layers as in mesh/derivedmesh, to editmesh
416  * blocks of data. the CustomData's must not be compatible */
417 void CustomData_to_bmesh_block(const struct CustomData *source,
418  struct CustomData *dest,
419  int src_index,
420  void **dest_block,
421  bool use_default_init);
422 void CustomData_from_bmesh_block(const struct CustomData *source,
423  struct CustomData *dest,
424  void *src_block,
425  int dest_index);
426 
427 /* query info over types */
428 void CustomData_file_write_info(int type, const char **r_struct_name, int *r_struct_num);
429 int CustomData_sizeof(int type);
430 
431 /* get the name of a layer type */
432 const char *CustomData_layertype_name(int type);
436 
437 /* make sure the name of layer at index is unique */
438 void CustomData_set_layer_unique_name(struct CustomData *data, int index);
439 
441  int type,
442  const char *name,
443  char *outname);
444 
445 /* for file reading compatibility, returns false if the layer was freed,
446  * only after this test passes, layer->data should be assigned */
447 bool CustomData_verify_versions(struct CustomData *data, int index);
448 
449 /*BMesh specific customdata stuff*/
450 void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *ldata, int totloop);
451 void CustomData_from_bmeshpoly(struct CustomData *fdata, struct CustomData *ldata, int total);
452 void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct CustomData *ldata);
454  struct CustomData *ldata);
455 void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype);
456 
457 #ifndef NDEBUG
458 bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *ldata, bool fallback);
459 #endif
460 
461 /* Layer data validation. */
462 bool CustomData_layer_validate(struct CustomDataLayer *layer,
463  const uint totitems,
464  const bool do_fixes);
466 
467 /* External file storage */
468 
470  struct CustomData *data, struct ID *id, int type, int totelem, const char *filename);
471 void CustomData_external_remove(struct CustomData *data, struct ID *id, int type, int totelem);
472 bool CustomData_external_test(struct CustomData *data, int type);
473 
475  struct CustomData *data, struct ID *id, CustomDataMask mask, int totelem, int free);
477  struct ID *id,
479  int totelem);
481  struct ID *id,
483  int totelem);
484 
485 /* Mesh-to-mesh transfer data. */
486 
488 struct MeshPairRemap;
489 
490 typedef void (*cd_datatransfer_interp)(const struct CustomDataTransferLayerMap *laymap,
491  void *dest,
492  const void **sources,
493  const float *weights,
494  const int count,
495  const float mix_factor);
496 
500 enum {
501  CD_FAKE = 1 << 8,
502 
503  /* Vertices. */
504  CD_FAKE_MDEFORMVERT = CD_FAKE | CD_MDEFORMVERT, /* *sigh* due to how vgroups are stored :( . */
506  CD_SHAPEKEY, /* Not available as real CD layer in non-bmesh context. */
507 
508  /* Edges. */
509  CD_FAKE_SEAM = CD_FAKE | 100, /* UV seam flag for edges. */
510  CD_FAKE_CREASE = CD_FAKE | CD_CREASE, /* *sigh*. */
511 
512  /* Multiple types of mesh elements... */
513  CD_FAKE_BWEIGHT = CD_FAKE | CD_BWEIGHT, /* *sigh*. */
514  CD_FAKE_UV = CD_FAKE |
515  CD_MLOOPUV, /* UV flag, because we handle both loop's UVs and poly's textures. */
516 
518  CD_CUSTOMLOOPNORMAL, /* Because we play with clnor and temp lnor layers here. */
519 
520  CD_FAKE_SHARP = CD_FAKE | 200, /* Sharp flag for edges, smooth flag for faces. */
521 };
522 
523 enum {
524  ME_VERT = 1 << 0,
525  ME_EDGE = 1 << 1,
526  ME_POLY = 1 << 2,
527  ME_LOOP = 1 << 3,
528 };
529 
533 enum {
534  CDT_MIX_NOMIX = -1, /* Special case, only used because we abuse 'copy' CD callback. */
542  /* etc. etc. */
543 };
544 
547 
549  int mix_mode;
550  float mix_factor;
552  const float *mix_weights;
553 
555  const void *data_src;
557  void *data_dst;
563  size_t elem_size;
564 
566  size_t data_size;
568  size_t data_offset;
571 
573  void *interp_data;
574 
577 
578 /* Those functions assume src_n and dst_n layers of given type exist in resp. src and dst. */
579 void CustomData_data_transfer(const struct MeshPairRemap *me_remap,
580  const CustomDataTransferLayerMap *laymap);
581 
582 /* .blend file I/O */
584  struct CustomDataLayer **r_write_layers,
585  struct CustomDataLayer *write_layers_buff,
586  size_t write_layers_size);
587 
588 void CustomData_blend_write(struct BlendWriter *writer,
589  struct CustomData *data,
590  CustomDataLayer *layers,
591  int count,
592  CustomDataMask cddata_mask,
593  struct ID *id);
594 void CustomData_blend_read(struct BlendDataReader *reader, struct CustomData *data, int count);
595 
596 #ifdef __cplusplus
597 }
598 #endif
void CustomData_swap(struct CustomData *data, const int index_a, const int index_b)
Definition: customdata.c:3138
const CustomData_MeshMasks CD_MASK_EVERYTHING
Definition: customdata.c:1986
int CustomData_get_active_layer_index(const struct CustomData *data, int type)
void CustomData_copy_data_named(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
bool CustomData_has_math(const struct CustomData *data)
Definition: customdata.c:3843
void CustomData_set_layer_stencil_index(struct CustomData *data, int type, int n)
Definition: customdata.c:2466
void CustomData_free(struct CustomData *data, int totelem)
Definition: customdata.c:2239
void CustomData_bmesh_copy_data_exclude_by_type(const struct CustomData *source, struct CustomData *dest, void *src_block, void **dest_block, const CustomDataMask mask_exclude)
void CustomData_blend_read(struct BlendDataReader *reader, struct CustomData *data, int count)
Definition: customdata.c:5180
const char * CustomData_get_layer_name(const struct CustomData *data, int type, int n)
void CustomData_copy_layer_type_data(const struct CustomData *source, struct CustomData *destination, int type, int source_index, int destination_index, int count)
bool CustomData_free_layer_active(struct CustomData *data, int type, int totelem)
Definition: customdata.c:2707
int CustomData_number_of_layers(const struct CustomData *data, int type)
void CustomData_blend_write(struct BlendWriter *writer, struct CustomData *data, CustomDataLayer *layers, int count, CustomDataMask cddata_mask, struct ID *id)
Definition: customdata.c:5073
const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX
Definition: customdata.c:1926
void * CustomData_set_layer_n(const struct CustomData *data, int type, int n, void *ptr)
Definition: customdata.c:3284
int CustomData_get_clone_layer(const struct CustomData *data, int type)
bool CustomData_free_layer(struct CustomData *data, int type, int totelem, int index)
Definition: customdata.c:2655
void CustomData_set_layer_active(struct CustomData *data, int type, int n)
Definition: customdata.c:2401
eCDAllocType
@ CD_REFERENCE
@ CD_ASSIGN
@ CD_CALLOC
@ CD_DUPLICATE
@ CD_DEFAULT
uint64_t CustomDataMask
void CustomData_data_mix_value(int type, const void *source, void *dest, const int mixmode, const float mixfactor)
Definition: customdata.c:3911
void CustomData_from_bmesh_block(const struct CustomData *source, struct CustomData *dest, void *src_block, int dest_index)
void CustomData_clear_layer_flag(struct CustomData *data, int type, int flag)
Definition: customdata.c:2484
@ CDT_MIX_SUB
@ CDT_MIX_REPLACE_BELOW_THRESHOLD
@ CDT_MIX_REPLACE_ABOVE_THRESHOLD
@ CDT_MIX_ADD
@ CDT_MIX_MUL
@ CDT_MIX_TRANSFER
@ CDT_MIX_MIX
@ CDT_MIX_NOMIX
bool CustomData_layer_has_interp(const struct CustomData *data, int layer_n)
Definition: customdata.c:3832
void CustomData_bmesh_interp_n(struct CustomData *data, const void **src_blocks, const float *weights, const float *sub_weights, int count, void *dst_block_ofs, int n)
Definition: customdata.c:4031
int CustomData_get_render_layer_index(const struct CustomData *data, int type)
void CustomData_free_layers(struct CustomData *data, int type, int totelem)
Definition: customdata.c:2716
int CustomData_get_stencil_layer_index(const struct CustomData *data, int type)
bool CustomData_has_layer(const struct CustomData *data, int type)
bool CustomData_layertype_is_singleton(int type)
Definition: customdata.c:4292
void * CustomData_duplicate_referenced_layer_n(struct CustomData *data, const int type, const int n, const int totelem)
Definition: customdata.c:2796
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
Definition: customdata.c:76
int CustomData_get_named_layer_index(const struct CustomData *data, int type, const char *name)
void CustomData_set_layer_render_index(struct CustomData *data, int type, int n)
Definition: customdata.c:2448
void CustomData_set_only_copy(const struct CustomData *data, CustomDataMask mask)
Definition: customdata.c:2871
void * CustomData_duplicate_referenced_layer_named(struct CustomData *data, const int type, const char *name, const int totelem)
Definition: customdata.c:2807
void CustomData_external_write(struct CustomData *data, struct ID *id, CustomDataMask mask, int totelem, int free)
Definition: customdata.c:4596
void CustomData_set_layer_unique_name(struct CustomData *data, int index)
Definition: customdata.c:4361
bool CustomData_data_equals(int type, const void *data1, const void *data2)
Definition: customdata.c:3929
void * CustomData_set_layer(const struct CustomData *data, int type, void *ptr)
int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n)
Definition: customdata.c:2308
void CustomData_data_transfer(const struct MeshPairRemap *me_remap, const CustomDataTransferLayerMap *laymap)
bool CustomData_layer_validate(struct CustomDataLayer *layer, const uint totitems, const bool do_fixes)
Definition: customdata.c:4460
void CustomData_blend_write_prepare(struct CustomData *data, struct CustomDataLayer **r_write_layers, struct CustomDataLayer *write_layers_buff, size_t write_layers_size)
Definition: customdata.c:4237
bool CustomData_MeshMasks_are_matching(const CustomData_MeshMasks *mask_ref, const CustomData_MeshMasks *mask_required)
Definition: customdata.c:87
void * CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem, const char *name)
Definition: customdata.c:2637
void CustomData_data_add(int type, void *data1, const void *data2)
Definition: customdata.c:3967
bool CustomData_has_referenced(const struct CustomData *data)
Definition: customdata.c:3881
void CustomData_set_layer_clone(struct CustomData *data, int type, int n)
Definition: customdata.c:2419
void CustomData_copy_data_layer(const CustomData *source, CustomData *dest, int src_layer_index, int dst_layer_index, int src_index, int dst_index, int count)
Definition: customdata.c:2892
void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype)
Definition: customdata.c:3482
void CustomData_external_reload(struct CustomData *data, struct ID *id, CustomDataMask mask, int totelem)
const CustomData_MeshMasks CD_MASK_BAREMESH
Definition: customdata.c:1919
int CustomData_get_active_layer(const struct CustomData *data, int type)
void(* cd_datatransfer_interp)(const struct CustomDataTransferLayerMap *laymap, void *dest, const void **sources, const float *weights, const int count, const float mix_factor)
void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct CustomData *ldata)
Definition: customdata.c:3411
void CustomData_interp(const struct CustomData *source, struct CustomData *dest, const int *src_indices, const float *weights, const float *sub_weights, int count, int dest_index)
void * CustomData_get_layer_named(const struct CustomData *data, int type, const char *name)
Definition: customdata.c:3217
bool CustomData_layertype_is_dynamic(int type)
Definition: customdata.c:4303
int CustomData_get_stencil_layer(const struct CustomData *data, int type)
struct CustomDataTransferLayerMap CustomDataTransferLayerMap
bool CustomData_is_referenced_layer(struct CustomData *data, int type)
Definition: customdata.c:2826
int CustomData_layertype_layers_max(const int type)
Definition: customdata.c:4313
void CustomData_set_layer_render(struct CustomData *data, int type, int n)
Definition: customdata.c:2410
void * CustomData_get_n(const struct CustomData *data, int type, int index, int n)
void CustomData_set(const struct CustomData *data, int index, int type, const void *source)
void CustomData_data_copy_value(int type, const void *source, void *dest)
Definition: customdata.c:3893
void CustomData_bmesh_do_versions_update_active_layers(struct CustomData *fdata, struct CustomData *ldata)
Definition: customdata.c:3449
void CustomData_external_add(struct CustomData *data, struct ID *id, int type, int totelem, const char *filename)
void * CustomData_duplicate_referenced_layer(struct CustomData *data, const int type, const int totelem)
Definition: customdata.c:2788
void CustomData_bmesh_set_n(struct CustomData *data, void *block, int type, int n, const void *source)
Definition: customdata.c:3993
void CustomData_layers__print(struct CustomData *data)
Definition: customdata.c:4471
const CustomData_MeshMasks CD_MASK_BMESH
Definition: customdata.c:1964
bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *ldata, bool fallback)
Definition: customdata.c:3377
void CustomData_bmesh_set_default(struct CustomData *data, void **block)
Definition: customdata.c:3703
void CustomData_data_multiply(int type, void *data, float fac)
Definition: customdata.c:3958
const char * CustomData_layertype_name(int type)
Definition: customdata.c:4284
void CustomData_set_layer_clone_index(struct CustomData *data, int type, int n)
Definition: customdata.c:2457
void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *ldata, int totloop)
Definition: customdata.c:3316
bool(* cd_validate)(void *item, const uint totitems, const bool do_fixes)
void * CustomData_get_layer_n(const struct CustomData *data, int type, int n)
void CustomData_bmesh_copy_data(const struct CustomData *source, struct CustomData *dest, void *src_block, void **dest_block)
int CustomData_get_layer_index(const struct CustomData *data, int type)
bool CustomData_bmesh_merge(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, struct BMesh *bm, const char htype)
void CustomData_data_initminmax(int type, void *min, void *max)
Definition: customdata.c:3940
@ ME_VERT
@ ME_POLY
@ ME_LOOP
@ ME_EDGE
void * CustomData_get_layer(const struct CustomData *data, int type)
int CustomData_sizeof(int type)
Definition: customdata.c:4277
void * CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n)
void CustomData_bmesh_free_block_data(struct CustomData *data, void *block)
Definition: customdata.c:3633
void CustomData_file_write_info(int type, const char **r_struct_name, int *r_struct_num)
Definition: customdata.c:4210
int CustomData_get_clone_layer_index(const struct CustomData *data, int type)
bool CustomData_external_test(struct CustomData *data, int type)
Definition: customdata.c:4748
void CustomData_bmesh_free_block_data_exclude_by_type(struct CustomData *data, void *block, const CustomDataMask mask_exclude)
Definition: customdata.c:3669
int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name)
Definition: customdata.c:2365
void CustomData_from_bmeshpoly(struct CustomData *fdata, struct CustomData *ldata, int total)
Definition: customdata.c:3338
void CustomData_free_temporary(struct CustomData *data, int totelem)
Definition: customdata.c:2839
void * CustomData_bmesh_get(const struct CustomData *data, void *block, int type)
void CustomData_set_layer_active_index(struct CustomData *data, int type, int n)
Definition: customdata.c:2439
@ CD_FAKE_UV
@ CD_FAKE_LNOR
@ CD_FAKE_CREASE
@ CD_FAKE
@ CD_FAKE_SHARP
@ CD_FAKE_BWEIGHT
@ CD_FAKE_MDEFORMVERT
@ CD_FAKE_SHAPEKEY
@ CD_FAKE_SEAM
void * CustomData_add_layer(struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem)
Definition: customdata.c:2620
int CustomData_get_n_offset(const struct CustomData *data, int type, int n)
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
Definition: customdata.c:2475
bool CustomData_has_interp(const struct CustomData *data)
Definition: customdata.c:3869
void CustomData_external_read(struct CustomData *data, struct ID *id, CustomDataMask mask, int totelem)
Definition: customdata.c:4523
const CustomData_MeshMasks CD_MASK_EDITMESH
Definition: customdata.c:1943
const CustomData_MeshMasks CD_MASK_DERIVEDMESH
Definition: customdata.c:1952
bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
Definition: customdata.c:2098
int CustomData_number_of_layers_typemask(const struct CustomData *data, CustomDataMask mask)
bool CustomData_layer_has_math(const struct CustomData *data, int layer_n)
Definition: customdata.c:3820
void CustomData_free_elem(struct CustomData *data, int index, int count)
Definition: customdata.c:3004
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
Definition: customdata.c:2193
void CustomData_realloc(struct CustomData *data, int totelem)
Definition: customdata.c:2180
void * CustomData_get(const struct CustomData *data, int index, int type)
void(* cd_copy)(const void *source, void *dest, int count)
void CustomData_free_typemask(struct CustomData *data, int totelem, CustomDataMask mask)
Definition: customdata.c:2253
void CustomData_copy_elements(int type, void *src_data_ofs, void *dst_data_ofs, int count)
Definition: customdata.c:2880
void CustomData_swap_corners(struct CustomData *data, int index, const int *corner_indices)
Definition: customdata.c:3122
void CustomData_duplicate_referenced_layers(CustomData *data, int totelem)
Definition: customdata.c:2818
void CustomData_data_dominmax(int type, const void *data, void *min, void *max)
Definition: customdata.c:3949
void CustomData_set_layer_stencil(struct CustomData *data, int type, int n)
Definition: customdata.c:2428
bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name)
void CustomData_external_remove(struct CustomData *data, struct ID *id, int type, int totelem)
Definition: customdata.c:4724
void(* cd_interp)(const void **sources, const float *weights, const float *sub_weights, int count, void *dest)
void CustomData_bmesh_set_layer_n(struct CustomData *data, void *block, int n, const void *source)
Definition: customdata.c:4010
void CustomData_copy_data(const struct CustomData *source, struct CustomData *dest, int source_index, int dest_index, int count)
bool CustomData_bmesh_has_free(const struct CustomData *data)
Definition: customdata.c:3856
int CustomData_get_offset(const struct CustomData *data, int type)
const CustomData_MeshMasks CD_MASK_MESH
Definition: customdata.c:1933
void CustomData_bmesh_interp(struct CustomData *data, const void **src_blocks, const float *weights, const float *sub_weights, int count, void *dst_block)
Definition: customdata.c:4048
const CustomData_MeshMasks CD_MASK_FACECORNERS
Definition: customdata.c:1977
void CustomData_bmesh_set(const struct CustomData *data, void *block, int type, const void *source)
void customData_mask_layers__print(const struct CustomData_MeshMasks *mask)
void CustomData_validate_layer_name(const struct CustomData *data, int type, const char *name, char *outname)
void CustomData_bmesh_free_block(struct CustomData *data, void **block)
Definition: customdata.c:3606
void CustomData_reset(struct CustomData *data)
Definition: customdata.c:2233
void CustomData_update_typemap(struct CustomData *data)
Definition: customdata.c:2071
void * CustomData_bmesh_get_n(const struct CustomData *data, void *block, int type, int n)
int CustomData_get_render_layer(const struct CustomData *data, int type)
void CustomData_to_bmesh_block(const struct CustomData *source, struct CustomData *dest, int src_index, void **dest_block, bool use_default_init)
bool CustomData_verify_versions(struct CustomData *data, int index)
Definition: customdata.c:4413
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:116
unsigned int uint
Definition: BLI_sys_types.h:83
@ CD_CUSTOMLOOPNORMAL
@ CD_MDEFORMVERT
@ CD_SHAPEKEY
@ CD_BWEIGHT
@ CD_MLOOPUV
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
ATTR_WARN_UNUSED_RESULT BMesh * bm
static const float data2[18 *GP_PRIM_DATABUF_SIZE]
static const float data1[33 *GP_PRIM_DATABUF_SIZE]
int count
#define min(a, b)
Definition: sort.c:51
unsigned __int64 uint64_t
Definition: stdint.h:93
struct CustomDataTransferLayerMap * next
struct CustomDataTransferLayerMap * prev
cd_datatransfer_interp interp
Definition: DNA_ID.h:273
float max
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
PointerRNA * ptr
Definition: wm_files.c:3157