30 #define DNA_DEPRECATED_ALLOW
68 #define CUSTOMDATA_GROW 5
90 return (((mask_required->
vmask & mask_ref->
vmask) == mask_required->
vmask) &&
145 void (*
swap)(
void *
data,
const int *corner_indices);
161 void (*
copyvalue)(
const void *source,
void *dest,
const int mixmode,
const float mixfactor);
183 for (i = 0; i <
count; i++) {
188 dvert->
totweight,
sizeof(*dw),
"layerCopy_mdeformvert dw");
190 memcpy(dw, dvert->
dw, dvert->
totweight *
sizeof(*dw));
201 for (
int i = 0; i <
count; i++) {
215 const int size =
sizeof(
void *);
217 for (
int i = 0; i <
count; i++) {
232 for (
int i = 0; i <
count; i++) {
241 const float *weights,
242 const float *
UNUSED(sub_weights),
248 struct MDeformWeight_Link {
249 struct MDeformWeight_Link *
next;
254 struct MDeformWeight_Link *dest_dwlink =
NULL;
255 struct MDeformWeight_Link *
node;
259 for (
int i = 0; i <
count; i++) {
261 float interp_weight = weights[i];
263 for (
int j = 0; j < source->
totweight; j++) {
265 float weight = dw->
weight * interp_weight;
267 if (weight == 0.0f) {
282 struct MDeformWeight_Link *tmp_dwlink = alloca(
sizeof(*tmp_dwlink));
283 tmp_dwlink->dw.def_nr = dw->
def_nr;
284 tmp_dwlink->dw.weight = weight;
287 tmp_dwlink->next = dest_dwlink;
288 dest_dwlink = tmp_dwlink;
298 if (dvert->
dw && (dvert->
totweight == totweight)) {
315 if (
node->dw.weight > 1.0f) {
316 node->dw.weight = 1.0f;
322 memset(dvert, 0,
sizeof(*dvert));
327 const float *weights,
328 const float *
UNUSED(sub_weights),
335 float no[3] = {0.0f};
347 static const float no_default[3] = {0.0f, 0.0f, 1.0f};
349 bool has_errors =
false;
351 for (
int i = 0; i < totitems; i++, no++) {
372 const float mixfactor)
374 const float *no_src = source;
375 float *no_dst = dest;
410 for (
int i = 0; i <
count; i++) {
411 dest_tf[i] = source_tf[i];
416 const void **sources,
const float *weights,
const float *sub_weights,
int count,
void *dest)
419 float uv[4][2] = {{0.0f}};
421 const float *sub_weight = sub_weights;
422 for (
int i = 0; i <
count; i++) {
423 const float interp_weight = weights[i];
424 const MTFace *src = sources[i];
426 for (
int j = 0; j < 4; j++) {
428 for (
int k = 0; k < 4; k++, sub_weight++) {
439 *tf = *(
MTFace *)(*sources);
440 memcpy(tf->
uv, uv,
sizeof(tf->
uv));
448 for (
int j = 0; j < 4; j++) {
449 const int source_index = corner_indices[j];
453 memcpy(tf->
uv, uv,
sizeof(tf->
uv));
458 static MTFace default_tf = {{{0, 0}, {1, 0}, {1, 1}, {0, 1}}};
461 for (
int i = 0; i <
count; i++) {
477 const float *weights,
478 const float *
UNUSED(sub_weights),
483 for (
int i = 0; i <
count; i++) {
484 const float interp_weight = weights[i];
485 const float src = *(
const float *)sources[i];
486 result += src * interp_weight;
494 bool has_errors =
false;
496 for (
int i = 0; i < totitems; i++, fp++) {
523 for (
int i = 0; i <
count; i++) {
524 dest_tf[i] = source_tf[i];
529 const void **sources,
const float *weights,
const float *sub_weights,
int count,
void *dest)
532 float uv[4][2] = {{0.0f}};
534 const float *sub_weight = sub_weights;
535 for (
int i = 0; i <
count; i++) {
536 const float interp_weight = weights[i];
539 for (
int j = 0; j < 4; j++) {
541 for (
int k = 0; k < 4; k++, sub_weight++) {
552 memcpy(osf->
uv, uv,
sizeof(osf->
uv));
560 for (
int j = 0; j < 4; j++) {
563 memcpy(osf->
uv, uv,
sizeof(osf->
uv));
568 static OrigSpaceFace default_osf = {{{0, 0}, {1, 0}, {1, 1}, {0, 1}}};
571 for (
int i = 0; i <
count; i++) {
572 osf[i] = default_osf;
581 int nverts = (ci[1] == 3) ? 4 : 3;
583 int cornersize = s->
totdisp / corners;
585 if (corners != nverts) {
597 for (
int S = 0; S < corners; S++) {
598 memcpy(d + cornersize * S, s->
disps + cornersize * ci[S],
sizeof(
float[3]) * cornersize);
611 for (
int i = 0; i <
count; i++) {
631 for (
int i = 0; i <
count; i++) {
649 for (
int i = 0; i <
count; i++) {
654 if (!
cdf_read_data(cdf,
sizeof(
float[3]) * d[i].totdisp, d[i].disps)) {
655 CLOG_ERROR(&
LOG,
"failed to read multires displacement %d/%d %d", i,
count, d[i].totdisp);
667 for (
int i = 0; i <
count; i++) {
668 if (!
cdf_write_data(cdf,
sizeof(
float[3]) * d[i].totdisp, d[i].disps)) {
669 CLOG_ERROR(&
LOG,
"failed to write multires displacement %d/%d %d", i,
count, d[i].totdisp);
682 for (
int i = 0; i <
count; i++) {
683 size +=
sizeof(
float[3]) * d[i].totdisp;
689 const float *weights,
690 const float *
UNUSED(sub_weights),
695 for (
int i = 0; i <
count; i++) {
696 const float interp_weight = weights[i];
697 const float *src = sources[i];
698 mask += (*src) * interp_weight;
700 *(
float *)dest =
mask;
708 for (
int i = 0; i <
count; i++) {
724 for (
int i = 0; i <
count; i++) {
737 const float mixfactor)
741 unsigned char tmp_col[4];
750 const float f = ((
float)m2->
r + (
float)m2->
g + (
float)m2->
b) / 3.0f;
764 unsigned char src[4] = {m1->
r, m1->
g, m1->
b, m1->
a};
765 unsigned char dst[4] = {m2->
r, m2->
g, m2->
b, m2->
a};
780 memcpy(tmp_col, src,
sizeof(tmp_col));
785 m2->
r = (char)dst[0];
786 m2->
g = (char)dst[1];
787 m2->
b = (char)dst[2];
788 m2->
a = (char)dst[3];
802 return r *
r + g * g + b * b +
a *
a < 0.001f;
810 m->
g = (
float)m->
g * fac;
812 m->
a = (
float)m->
a * fac;
874 MLoopCol default_mloopcol = {255, 255, 255, 255};
876 for (
int i = 0; i <
count; i++) {
877 mlcol[i] = default_mloopcol;
882 const float *weights,
883 const float *
UNUSED(sub_weights),
895 for (
int i = 0; i <
count; i++) {
896 const float interp_weight = weights[i];
898 col.r += src->
r * interp_weight;
899 col.g += src->
g * interp_weight;
900 col.b += src->
b * interp_weight;
901 col.a += src->
a * interp_weight;
922 const float mixfactor)
976 const float *weights,
977 const float *
UNUSED(sub_weights),
986 for (
int i = 0; i <
count; i++) {
987 const float interp_weight = weights[i];
988 const MLoopUV *src = sources[i];
990 if (interp_weight > 0.0f) {
997 ((
MLoopUV *)dest)->flag = flag;
1003 bool has_errors =
false;
1005 for (
int i = 0; i < totitems; i++, uv++) {
1020 const int UNUSED(mixmode),
1021 const float UNUSED(mixfactor))
1067 const float *weights,
1068 const float *
UNUSED(sub_weights),
1075 for (
int i = 0; i <
count; i++) {
1076 const float interp_weight = weights[i];
1087 const void **sources,
const float *weights,
const float *sub_weights,
int count,
void *dest)
1095 }
col[4] = {{0.0f}};
1097 const float *sub_weight = sub_weights;
1098 for (
int i = 0; i <
count; i++) {
1099 const float interp_weight = weights[i];
1101 for (
int j = 0; j < 4; j++) {
1103 const MCol *src = sources[i];
1104 for (
int k = 0; k < 4; k++, sub_weight++, src++) {
1105 const float w = (*sub_weight) * interp_weight;
1106 col[j].a += src->
a *
w;
1107 col[j].r += src->
r *
w;
1108 col[j].g += src->
g *
w;
1109 col[j].b += src->
b *
w;
1113 const MCol *src = sources[i];
1114 col[j].a += src[j].
a * interp_weight;
1115 col[j].r += src[j].
r * interp_weight;
1116 col[j].g += src[j].
g * interp_weight;
1117 col[j].b += src[j].
b * interp_weight;
1123 for (
int j = 0; j < 4; j++) {
1139 for (
int j = 0; j < 4; j++) {
1140 col[j] = mcol[corner_indices[j]];
1143 memcpy(mcol,
col,
sizeof(
col));
1148 static MCol default_mcol = {255, 255, 255, 255};
1151 for (
int i = 0; i < 4 *
count; i++) {
1152 mcol[i] = default_mcol;
1162 const float *weights,
1163 const float *
UNUSED(sub_weights),
1167 float **in = (
float **)sources;
1175 for (
int i = 0; i <
count; i++) {
1176 const float interp_weight = weights[i];
1177 f += *in[i] * interp_weight;
1181 *((
float *)dest) = f;
1185 const float *weights,
1186 const float *
UNUSED(sub_weights),
1190 float **in = (
float **)sources;
1199 for (
int i = 0; i <
count; i++) {
1200 const float interp_weight = weights[i];
1212 for (
int i = 0; i <
count; i++) {
1224 const float *weights,
1225 const float *
UNUSED(sub_weights),
1234 for (
int i = 0; i <
count; i++) {
1235 const float interp_weight = weights[i];
1249 short(*flnors)[4][3] =
data;
1257 memcpy(flnors, nors,
sizeof(nors));
1262 int *fmap_num = (
int *)
data;
1263 for (
int i = 0; i <
count; i++) {
1271 const float mixfactor)
1308 memcpy(tmp_col, m1->
color,
sizeof(tmp_col));
1321 for (
int i = 0; i < 4; i++) {
1322 float c = (m1->
color[i] - m2->color[i]);
1326 return tot < 0.001f;
1360 MPropCol default_propcol = {{1.0f, 1.0f, 1.0f, 1.0f}};
1362 for (
int i = 0; i <
count; i++) {
1368 const float *weights,
1369 const float *
UNUSED(sub_weights),
1374 float col[4] = {0.0f, 0.0f, 0.0f, 0.0f};
1375 for (
int i = 0; i <
count; i++) {
1376 const float interp_weight = weights[i];
1389 const float *weights,
1390 const float *
UNUSED(sub_weights),
1395 for (
int i = 0; i <
count; i++) {
1396 const float interp_weight = weights[i];
1397 const vec3f *src = sources[i];
1422 float *values =
data;
1423 bool has_errors =
false;
1424 for (
int i = 0; i < totitems * 3; i++) {
1436 const float *weights,
1437 const float *
UNUSED(sub_weights),
1442 for (
int i = 0; i <
count; i++) {
1443 const float interp_weight = weights[i];
1444 const vec2f *src = sources[i];
1467 float *values =
data;
1468 bool has_errors =
false;
1469 for (
int i = 0; i < totitems * 2; i++) {
1563 {
sizeof(int),
"", 0,
NULL,
NULL,
NULL,
NULL,
NULL,
layerDefault_fmap,
NULL},
1727 N_(
"PreviewLoopCol"),
1876 "CDMStringProperty",
1907 "CDCustomLoopNormal",
1908 "CDSculptFaceGroups",
2025 printf(
"verts mask=0x%lx:\n", (
long unsigned int)
mask->vmask);
2032 printf(
"edges mask=0x%lx:\n", (
long unsigned int)
mask->emask);
2039 printf(
"faces mask=0x%lx:\n", (
long unsigned int)
mask->fmask);
2046 printf(
"loops mask=0x%lx:\n", (
long unsigned int)
mask->lmask);
2053 printf(
"polys mask=0x%lx:\n", (
long unsigned int)
mask->pmask);
2076 data->typemap[i] = -1;
2079 for (
int i = 0; i <
data->totlayer; i++) {
2080 const int type =
data->layers[i].type;
2081 if (
type != lasttype) {
2094 return (memcmp(
data->typemap, data_copy.
typemap,
sizeof(
data->typemap)) == 0);
2106 int lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0;
2107 int number = 0, maxnumber = -1;
2108 bool changed =
false;
2110 for (
int i = 0; i < source->
totlayer; i++) {
2111 layer = &source->
layers[i];
2115 int flag = layer->
flag;
2117 if (
type != lasttype) {
2120 lastactive = layer->
active;
2136 if ((maxnumber != -1) && (number >= maxnumber)) {
2144 switch (alloctype) {
2164 newlayer->
uid = layer->
uid;
2166 newlayer->
active = lastactive;
2182 for (
int i = 0; i <
data->totlayer; i++) {
2215 if (typeInfo->
free) {
2227 if (
data->external) {
2241 for (
int i = 0; i <
data->totlayer; i++) {
2255 for (
int i = 0; i <
data->totlayer; i++) {
2276 for (
int i = 0; i <
data->totlayer; i++) {
2279 data->layers[i].offset = offset;
2280 offset += typeInfo->
size;
2283 data->totsize = offset;
2290 for (
int i = 0; i <
data->totlayer; i++) {
2291 if (
data->layers[i].type ==
type) {
2315 i = (
data->layers[i + n].type ==
type) ? (i + n) : (-1);
2323 for (
int i = 0; i <
data->totlayer; i++) {
2324 if (
data->layers[i].type ==
type) {
2325 if (
STREQ(
data->layers[i].name, name)) {
2336 const int layer_index =
data->typemap[
type];
2338 return (layer_index != -1) ? layer_index +
data->layers[layer_index].active : -1;
2343 const int layer_index =
data->typemap[
type];
2345 return (layer_index != -1) ? layer_index +
data->layers[layer_index].active_rnd : -1;
2350 const int layer_index =
data->typemap[
type];
2352 return (layer_index != -1) ? layer_index +
data->layers[layer_index].active_clone : -1;
2357 const int layer_index =
data->typemap[
type];
2359 return (layer_index != -1) ? layer_index +
data->layers[layer_index].active_mask : -1;
2368 const int layer_index =
data->typemap[
type];
2370 return (named_index != -1) ? named_index - layer_index : -1;
2375 const int layer_index =
data->typemap[
type];
2377 return (layer_index != -1) ?
data->layers[layer_index].active : -1;
2382 const int layer_index =
data->typemap[
type];
2384 return (layer_index != -1) ?
data->layers[layer_index].active_rnd : -1;
2389 const int layer_index =
data->typemap[
type];
2391 return (layer_index != -1) ?
data->layers[layer_index].active_clone : -1;
2396 const int layer_index =
data->typemap[
type];
2398 return (layer_index != -1) ?
data->layers[layer_index].active_mask : -1;
2403 for (
int i = 0; i <
data->totlayer; i++) {
2404 if (
data->layers[i].type ==
type) {
2405 data->layers[i].active = n;
2412 for (
int i = 0; i <
data->totlayer; i++) {
2413 if (
data->layers[i].type ==
type) {
2414 data->layers[i].active_rnd = n;
2421 for (
int i = 0; i <
data->totlayer; i++) {
2422 if (
data->layers[i].type ==
type) {
2423 data->layers[i].active_clone = n;
2430 for (
int i = 0; i <
data->totlayer; i++) {
2431 if (
data->layers[i].type ==
type) {
2432 data->layers[i].active_mask = n;
2441 for (
int i = 0; i <
data->totlayer; i++) {
2442 if (
data->layers[i].type ==
type) {
2443 data->layers[i].active = n - i;
2450 for (
int i = 0; i <
data->totlayer; i++) {
2451 if (
data->layers[i].type ==
type) {
2452 data->layers[i].active_rnd = n - i;
2459 for (
int i = 0; i <
data->totlayer; i++) {
2460 if (
data->layers[i].type ==
type) {
2461 data->layers[i].active_clone = n - i;
2468 for (
int i = 0; i <
data->totlayer; i++) {
2469 if (
data->layers[i].type ==
type) {
2470 data->layers[i].active_mask = n - i;
2477 for (
int i = 0; i <
data->totlayer; i++) {
2478 if (
data->layers[i].type ==
type) {
2479 data->layers[i].flag |= flag;
2486 const int nflag = ~flag;
2488 for (
int i = 0; i <
data->totlayer; i++) {
2489 if (
data->layers[i].type ==
type) {
2490 data->layers[i].flag &= nflag;
2498 (
data->maxlayer + amount),
sizeof(*tmp),
"CustomData->layers");
2503 data->maxlayer += amount;
2505 memcpy(tmp,
data->layers,
sizeof(*tmp) *
data->totlayer);
2521 int flag = 0, index =
data->totlayer;
2522 void *newlayerdata =
NULL;
2533 newlayerdata = layerdata;
2535 else if (totelem > 0 && typeInfo->
size > 0) {
2543 if (!newlayerdata) {
2550 if (typeInfo->
copy) {
2551 typeInfo->
copy(layerdata, newlayerdata, totelem);
2554 memcpy(newlayerdata, layerdata, (
size_t)totelem * typeInfo->
size);
2567 if (index >=
data->maxlayer) {
2569 if (newlayerdata != layerdata) {
2579 for (; index > 0 &&
data->layers[index - 1].type >
type; index--) {
2580 data->layers[index] =
data->layers[index - 1];
2584 data->layers[index].flag = flag;
2585 data->layers[index].data = newlayerdata;
2599 data->layers[index].name[0] =
'\0';
2602 if (index > 0 &&
data->layers[index - 1].type ==
type) {
2603 data->layers[index].active =
data->layers[index - 1].active;
2604 data->layers[index].active_rnd =
data->layers[index - 1].active_rnd;
2605 data->layers[index].active_clone =
data->layers[index - 1].active_clone;
2606 data->layers[index].active_mask =
data->layers[index - 1].active_mask;
2609 data->layers[index].active = 0;
2610 data->layers[index].active_rnd = 0;
2611 data->layers[index].active_clone = 0;
2612 data->layers[index].active_mask = 0;
2617 return &
data->layers[index];
2645 data,
type, alloctype, layerdata, totelem, name);
2658 const int n = index - index_first;
2661 if ((index_first == -1) || (n < 0)) {
2668 for (
int i = index + 1; i <
data->totlayer; i++) {
2669 data->layers[i - 1] =
data->layers[i];
2679 const int index_nonzero = n ? n : 1;
2682 for (layer = &
data->layers[i]; i < data->totlayer && layer->
type ==
type; i++, layer++) {
2683 if (layer->
active >= index_nonzero) {
2733 for (
int i = 0; i <
data->totlayer; i++) {
2734 if (
data->layers[i].type ==
type) {
2746 for (
int i = 0; i <
data->totlayer; i++) {
2756 const int layer_index,
2759 if (layer_index == -1) {
2772 if (typeInfo->
copy) {
2774 (
size_t)totelem, typeInfo->
size,
"CD duplicate ref layer");
2775 typeInfo->
copy(layer->
data, dst_data, totelem);
2776 layer->
data = dst_data;
2820 for (
int i = 0; i <
data->totlayer; i++) {
2830 if (layer_index == -1) {
2842 bool changed =
false;
2843 for (i = 0, j = 0; i <
data->totlayer; i++) {
2873 for (
int i = 0; i <
data->totlayer; i++) {
2884 if (typeInfo->
copy) {
2885 typeInfo->
copy(src_data_ofs, dst_data_ofs,
count);
2888 memcpy(dst_data_ofs, src_data_ofs, (
size_t)
count * typeInfo->
size);
2894 int src_layer_index,
2895 int dst_layer_index,
2902 const void *src_data = source->
layers[src_layer_index].
data;
2903 void *dst_data = dest->
layers[dst_layer_index].
data;
2907 const size_t src_offset = (size_t)src_index * typeInfo->
size;
2908 const size_t dst_offset = (
size_t)dst_index * typeInfo->
size;
2910 if (!
count || !src_data || !dst_data) {
2913 "null data for %s type (%p --> %p), skipping",
2921 if (typeInfo->
copy) {
2936 for (
int src_i = 0; src_i < source->
totlayer; src_i++) {
2953 for (
int src_i = 0; src_i < source->
totlayer; src_i++) {
2984 int destination_index,
2988 if (source_layer_index == -1) {
2992 if (destinaiton_layer_index == -1) {
2998 destinaiton_layer_index,
3006 for (
int i = 0; i <
data->totlayer; i++) {
3010 if (typeInfo->
free) {
3011 size_t offset = (size_t)index * typeInfo->
size;
3019 #define SOURCE_BUF_SIZE 100
3035 const int *src_indices,
3036 const float *weights,
3037 const float *sub_weights,
3046 const void **sources = source_buf;
3055 float *default_weights =
NULL;
3056 if (weights ==
NULL) {
3059 default_weights_buf;
3061 weights = default_weights;
3066 for (
int src_i = 0; src_i < source->
totlayer; src_i++) {
3088 for (
int j = 0; j <
count; j++) {
3110 if (!
ELEM(default_weights,
NULL, default_weights_buf)) {
3124 for (
int i = 0; i <
data->totlayer; i++) {
3127 if (typeInfo->
swap) {
3128 const size_t offset = (size_t)index * typeInfo->
size;
3140 char buff_static[256];
3142 if (index_a == index_b) {
3146 for (
int i = 0; i <
data->totlayer; i++) {
3148 const size_t size = typeInfo->
size;
3149 const size_t offset_a =
size * index_a;
3150 const size_t offset_b =
size * index_b;
3159 if (buff != buff_static) {
3171 if (layer_index == -1) {
3186 int layer_index =
data->typemap[
type];
3187 if (layer_index == -1) {
3199 if (layer_index == -1) {
3203 return data->layers[layer_index].data;
3210 if (layer_index == -1) {
3214 return data->layers[layer_index].data;
3220 if (layer_index == -1) {
3224 return data->layers[layer_index].data;
3231 if (layer_index == -1) {
3235 return data->layers[layer_index].offset;
3242 if (layer_index == -1) {
3246 return data->layers[layer_index].offset;
3254 if ((layer_index == -1) || !name) {
3258 BLI_strncpy(
data->layers[layer_index].name, name,
sizeof(
data->layers[layer_index].name));
3267 return (layer_index == -1) ?
NULL :
data->layers[layer_index].name;
3275 if (layer_index == -1) {
3279 data->layers[layer_index].data =
ptr;
3288 if (layer_index == -1) {
3292 data->layers[layer_index].data =
ptr;
3306 if (typeInfo->
copy) {
3307 typeInfo->
copy(source, dest, 1);
3310 memcpy(dest, source, typeInfo->
size);
3318 for (
int i = 0; i < fdata->
totlayer; i++) {
3343 for (
int i = 0; i < ldata->
totlayer; i++) {
3379 int a_num = 0, b_num = 0;
3380 # define LAYER_CMP(l_a, t_a, l_b, t_b) \
3381 ((a_num += CustomData_number_of_layers(l_a, t_a)) == \
3382 (b_num += CustomData_number_of_layers(l_b, t_b)))
3407 return a_num ? true : fallback;
3509 if (
data->totlayer) {
3608 if (*block ==
NULL) {
3612 for (
int i = 0; i <
data->totlayer; i++) {
3616 if (typeInfo->
free) {
3617 int offset =
data->layers[i].offset;
3623 if (
data->totsize) {
3635 if (block ==
NULL) {
3638 for (
int i = 0; i <
data->totlayer; i++) {
3641 if (typeInfo->
free) {
3642 const size_t offset =
data->layers[i].offset;
3647 if (
data->totsize) {
3648 memset(block, 0,
data->totsize);
3658 if (
data->totsize > 0) {
3673 if (block ==
NULL) {
3676 for (
int i = 0; i <
data->totlayer; i++) {
3679 const size_t offset =
data->layers[i].offset;
3681 if (typeInfo->
free) {
3692 int offset =
data->layers[n].offset;
3705 if (*block ==
NULL) {
3709 for (
int i = 0; i <
data->totlayer; i++) {
3722 const bool no_mask = (mask_exclude == 0);
3724 if (*dest_block ==
NULL) {
3727 memset(*dest_block, 0, dest->
totsize);
3733 for (
int src_i = 0; src_i < source->
totlayer; src_i++) {
3755 if (typeInfo->
copy) {
3756 typeInfo->
copy(src_data, dest_data, 1);
3759 memcpy(dest_data, src_data, typeInfo->
size);
3771 while (dest_i < dest->totlayer) {
3792 if (layer_index == -1) {
3803 if (layer_index == -1) {
3813 if (n < 0 || n >=
data->totlayer) {
3846 for (
int i = 0; i <
data->totlayer; i++) {
3858 for (
int i = 0; i <
data->totlayer; i++) {
3861 if (typeInfo->
free) {
3872 for (
int i = 0; i <
data->totlayer; i++) {
3883 for (
int i = 0; i <
data->totlayer; i++) {
3905 memcpy(dest, source, typeInfo->
size);
3912 int type,
const void *source,
void *dest,
const int mixmode,
const float mixfactor)
3921 typeInfo->
copyvalue(source, dest, mixmode, mixfactor);
3925 memcpy(dest, source, typeInfo->
size);
3933 if (typeInfo->
equal) {
3971 if (typeInfo->
add) {
3985 if (typeInfo->
copy) {
3986 typeInfo->
copy(source, dest, 1);
3989 memcpy(dest, source, typeInfo->
size);
4002 if (typeInfo->
copy) {
4003 typeInfo->
copy(source, dest, 1);
4006 memcpy(dest, source, typeInfo->
size);
4019 if (typeInfo->
copy) {
4020 typeInfo->
copy(source, dest, 1);
4023 memcpy(dest, source, typeInfo->
size);
4032 const void **src_blocks_ofs,
4033 const float *weights,
4034 const float *sub_weights,
4036 void *dst_block_ofs,
4045 typeInfo->
interp(src_blocks_ofs, weights, sub_weights,
count, dst_block_ofs);
4049 const void **src_blocks,
4050 const float *weights,
4051 const float *sub_weights,
4060 const void **sources = (
const void **)source_buf;
4069 float *default_weights =
NULL;
4070 if (weights ==
NULL) {
4073 default_weights_buf;
4075 weights = default_weights;
4079 for (
int i = 0; i <
data->totlayer; i++) {
4083 for (
int j = 0; j <
count; j++) {
4094 if (!
ELEM(default_weights,
NULL, default_weights_buf)) {
4108 bool use_default_init)
4110 if (*dest_block ==
NULL) {
4116 for (
int src_i = 0; src_i < source->
totlayer; src_i++) {
4122 if (use_default_init) {
4136 const void *src_data = source->
layers[src_i].
data;
4140 const size_t src_offset = (size_t)src_index * typeInfo->
size;
4157 if (use_default_init) {
4158 while (dest_i < dest->totlayer) {
4172 for (
int src_i = 0; src_i < source->
totlayer; src_i++) {
4192 (
size_t)dest_index * typeInfo->
size);
4194 if (typeInfo->
copy) {
4195 typeInfo->
copy(src_data, dst_data, 1);
4198 memcpy(dst_data, src_data, typeInfo->
size);
4240 size_t write_layers_size)
4243 const size_t chunk_size = (write_layers_size > 0) ? write_layers_size :
CD_TEMP_CHUNK_SIZE;
4245 const int totlayer =
data->totlayer;
4248 for (i = 0, j = 0; i < totlayer; i++) {
4255 if (
UNLIKELY((
size_t)j >= write_layers_size)) {
4256 if (write_layers == write_layers_buff) {
4258 (write_layers_size + chunk_size),
sizeof(*write_layers), __func__);
4259 if (write_layers_buff) {
4260 memcpy(write_layers, write_layers_buff,
sizeof(*write_layers) * write_layers_size);
4265 sizeof(*write_layers) * (write_layers_size + chunk_size));
4267 write_layers_size += chunk_size;
4269 write_layers[j++] = *layer;
4274 *r_write_layers = write_layers;
4281 return typeInfo->
size;
4331 for (
int i = 0; i <
data->totlayer; i++) {
4371 data_arg.data =
data;
4372 data_arg.type = nlayer->
type;
4373 data_arg.index = index;
4381 if (nlayer->
name[0] ==
'\0') {
4417 bool keeplayer =
true;
4425 if (!typeInfo->
defaultname && (index > 0) &&
data->layers[index - 1].type == layer->
type) {
4440 CLOG_WARN(&
LOG,
".blend file read: removing a data layer that should not have been written");
4445 for (
int i = index + 1; i <
data->totlayer; i++) {
4446 data->layers[i - 1] =
data->layers[i];
4465 return typeInfo->
validate(layer->
data, totitems, do_fixes);
4477 for (i = 0, layer =
data->layers; i < data->totlayer; i++, layer++) {
4480 const char *structname;
4483 printf(
" dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n",
4487 (
const void *)layer->
data,
4507 for (
int i = 0; i <
data->totlayer; i++) {
4515 if (typeInfo->
free) {
4534 for (
int i = 0; i <
data->totlayer; i++) {
4535 layer = &
data->layers[i];
4562 for (
int i = 0; i <
data->totlayer; i++) {
4563 layer = &
data->layers[i];
4577 if (typeInfo->
read(cdf, layer->
data, totelem)) {
4608 for (
int i = 0; i <
data->totlayer; i++) {
4630 for (
int i = 0; i <
data->totlayer; i++) {
4647 CLOG_ERROR(&
LOG,
"Failed to open %s for writing.", filename);
4653 for (i = 0; i <
data->totlayer; i++) {
4661 if (typeInfo->
write(cdf, layer->
data, totelem)) {
4674 if (i !=
data->totlayer) {
4681 for (i = 0; i <
data->totlayer; i++) {
4687 if (typeInfo->
free) {
4705 if (layer_index == -1) {
4717 data->external = external;
4729 if (layer_index == -1) {
4751 if (layer_index == -1) {
4762 #define COPY_BIT_FLAG(_type, _dst, _src, _f) \
4764 const _type _val = *((_type *)(_src)) & ((_type)(_f)); \
4765 *((_type *)(_dst)) &= ~((_type)(_f)); \
4766 *((_type *)(_dst)) |= _val; \
4770 switch (data_size) {
4788 #undef COPY_BIT_FLAG
4793 switch (data_size) {
4810 const void **sources,
4811 const float *weights,
4813 const float mix_factor)
4822 int best_src_idx = 0;
4824 const int data_type = laymap->
data_type;
4825 const int mix_mode = laymap->
mix_mode;
4844 data_size = (size_t)type_info->
size;
4845 interp_cd = type_info->
interp;
4846 copy_cd = type_info->
copy;
4851 if (
count > 1 && !interp_cd) {
4855 float tot_weight_true = 0.0f;
4856 int item_true_idx = -1, item_false_idx = -1;
4858 for (
int i = 0; i <
count; i++) {
4860 tot_weight_true += weights[i];
4867 best_src_idx = (tot_weight_true >= 0.5f) ? item_true_idx : item_false_idx;
4871 float max_weight = 0.0f;
4873 for (
int i = 0; i <
count; i++) {
4874 if (weights[i] > max_weight) {
4875 max_weight = weights[i];
4885 interp_cd(sources, weights,
NULL,
count, tmp_dst);
4887 else if (data_flag) {
4888 copy_bit_flag(tmp_dst, sources[best_src_idx], data_size, data_flag);
4892 copy_cd(sources[best_src_idx], tmp_dst, 1);
4895 memcpy(tmp_dst, sources[best_src_idx], data_size);
4909 else if (!(data_type &
CD_FAKE)) {
4915 if (mix_factor >= 0.5f) {
4916 memcpy(data_dst, tmp_dst, data_size);
4926 const void **sources,
4927 const float *weights,
4929 const float mix_factor)
4934 const int data_type = laymap->
data_type;
4935 const int mix_mode = laymap->
mix_mode;
4951 interp_cd(sources, weights,
NULL,
count, tmp_dst);
4952 if (space_transform) {
4964 const int totelem = me_remap->
items_num;
4966 const int data_type = laymap->
data_type;
4967 const void *data_src = laymap->
data_src;
4976 size_t tmp_buff_size = 32;
4977 const void **tmp_data_src =
NULL;
4985 tmp_data_src =
MEM_malloc_arrayN(tmp_buff_size,
sizeof(*tmp_data_src), __func__);
4997 data_size = (size_t)type_info->
size;
5004 for (
int i = 0; i < totelem; i++, data_dst =
POINTER_OFFSET(data_dst, data_step), mapit++) {
5006 const float mix_factor = laymap->
mix_factor *
5015 if (
UNLIKELY(sources_num > tmp_buff_size)) {
5016 tmp_buff_size = (size_t)sources_num;
5017 tmp_data_src =
MEM_reallocN((
void *)tmp_data_src,
sizeof(*tmp_data_src) * tmp_buff_size);
5020 for (
int j = 0; j < sources_num; j++) {
5021 const size_t src_idx = (size_t)mapit->
indices_src[j];
5022 tmp_data_src[j] =
POINTER_OFFSET(data_src, (data_step * src_idx) + data_offset);
5041 for (
int i = 0; i <
count; i++) {
5058 if (grid_paint_mask) {
5060 for (
int i = 0; i <
count; i++) {
5087 for (
int i = 0; i <
data->totlayer; i++) {
5098 const float *layer_data = layer->
data;
5102 const float *layer_data = layer->
data;
5109 const int *layer_data = layer->
data;
5113 const bool *layer_data = layer->
data;
5117 const char *structname;
5121 int datasize = structnum *
count;
5125 printf(
"%s error: layer '%s':%d - can't be written to file\n",
5133 if (
data->external) {
5141 for (
int i = 0; i <
count; i++) {
5145 if (mdisps[i].totdisp && !mdisps[i].level) {
5150 float gridsize =
sqrtf(mdisps[i].totdisp);
5159 if (!external && !mdisps[i].disps) {
5170 if (grid_paint_mask) {
5171 for (
int i = 0; i <
count; i++) {
5194 while (i < data->totlayer) {
5208 CLOG_WARN(&
LOG,
"Reallocating custom data layer that was not saved correctly.");
typedef float(TangentPoint)[2]
CustomData interface, see also DNA_customdata_types.h.
@ CDT_MIX_REPLACE_BELOW_THRESHOLD
@ CDT_MIX_REPLACE_ABOVE_THRESHOLD
void(* cd_datatransfer_interp)(const struct CustomDataTransferLayerMap *laymap, void *dest, const void **sources, const float *weights, const int count, const float mix_factor)
bool(* cd_validate)(void *item, const uint totitems, const bool do_fixes)
void(* cd_copy)(const void *source, void *dest, int count)
#define CD_TYPE_AS_MASK(_type)
void(* cd_interp)(const void **sources, const float *weights, const float *sub_weights, int count, void *dest)
bool cdf_read_open(CDataFile *cdf, const char *filename)
bool cdf_read_data(CDataFile *cdf, unsigned int size, void *data)
void cdf_read_close(CDataFile *cdf)
bool cdf_write_open(CDataFile *cdf, const char *filename)
CDataFile * cdf_create(int type)
void cdf_write_close(CDataFile *cdf)
void cdf_free(CDataFile *cdf)
bool cdf_read_layer(CDataFile *cdf, CDataFileLayer *blay)
CDataFileLayer * cdf_layer_add(CDataFile *cdf, int type, const char *name, size_t datasize)
CDataFileLayer * cdf_layer_find(CDataFile *cdf, int type, const char *name)
bool cdf_write_layer(CDataFile *cdf, CDataFileLayer *blay)
bool cdf_write_data(CDataFile *cdf, unsigned int size, void *data)
int multires_mdisp_corners(struct MDisps *s)
int BKE_ccg_gridsize(int level)
#define BLI_BITMAP_SIZE(_tot)
void BLI_endian_switch_float_array(float *val, const int size) ATTR_NONNULL(1)
void BLI_kdtree_nd_() free(KDTree *tree)
MINLINE int compare_ff(float a, float b, const float max_diff)
MINLINE unsigned char round_fl_to_uchar_clamp(float a)
MINLINE void blend_color_add_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_interpolate_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4], float t)
MINLINE void blend_color_sub_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_mul_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_mul_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_mix_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_sub_float(float dst[4], const float src1[4], const float src2[4])
MINLINE void blend_color_add_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_mix_byte(unsigned char dst[4], const unsigned char src1[4], const unsigned char src2[4])
MINLINE void blend_color_interpolate_float(float dst[4], const float src1[4], const float src2[4], float t)
void BLI_space_transform_invert_normal(const struct SpaceTransform *data, float no[3])
void copy_vn_fl(float *array_tar, const int size, const float val)
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void add_v4_v4(float r[4], const float a[4])
MINLINE void copy_v4_v4(float r[4], const float a[4])
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t)
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
void copy_vn_i(int *array_tar, const int size, const int val)
MINLINE void madd_v2_v2fl(float r[2], const float a[2], float f)
MINLINE void mul_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
MINLINE void add_v2_v2(float r[2], const float a[2])
void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], const float t)
bool is_finite_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
bool is_finite_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_v3_short(short r[3], const short a[3])
void minmax_v4v4_v4(float min[4], float max[4], const float vec[4])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void zero_v2(float r[2])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void madd_v4_v4fl(float r[4], const float a[4], float f)
MINLINE void zero_v3(float r[3])
MINLINE void copy_v4_fl(float r[4], float f)
void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1
BLI_mempool * BLI_mempool_create(unsigned int esize, unsigned int totelem, unsigned int pchunk, unsigned int flag) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_mempool_alloc(BLI_mempool *pool) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1)
bool BLI_path_abs(char *path, const char *basepath) ATTR_NONNULL()
#define STRNCPY(dst, src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
bool BLI_uniquename_cb(UniquenameCheckCallback unique_check, void *arg, const char *defname, char delim, char *name, size_t name_len)
#define INIT_MINMAX2(min, max)
#define POINTER_OFFSET(v, ofs)
#define BLO_read_data_address(reader, ptr_p)
void BLO_write_float3_array(BlendWriter *writer, uint num, const float *data_ptr)
#define BLO_write_struct_array_at_address(writer, struct_name, array_size, address, data_ptr)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_write_struct_array(writer, struct_name, array_size, data_ptr)
void BLO_write_struct_array_by_name(BlendWriter *writer, const char *struct_name, int array_size, const void *data_ptr)
bool BLO_read_requires_endian_switch(BlendDataReader *reader)
void BLO_write_raw(BlendWriter *writer, size_t size_in_bytes, const void *data_ptr)
bool BLO_write_is_undo(BlendWriter *writer)
#define CLOG_ERROR(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
ID and Library types, which are fundamental for sdna.
#define ID_BLEND_PATH_FROM_GLOBAL(_id)
#define CD_MASK_SCULPT_FACE_SETS
#define CD_MASK_BM_ELEM_PYPTR
#define MAX_CUSTOMDATA_LAYER_NAME
#define CD_MASK_PROP_COLOR
#define CD_MASK_ORIGINDEX
#define CD_MASK_MDEFORMVERT
#define CD_MASK_TESSLOOPNORMAL
#define CD_MASK_MVERT_SKIN
#define CD_MASK_PREVIEW_MCOL
#define CD_MASK_FREESTYLE_FACE
#define CD_MASK_SHAPE_KEYINDEX
#define CD_MASK_ORIGSPACE_MLOOP
#define CD_MASK_CLOTH_ORCO
#define CD_TEMP_CHUNK_SIZE
#define CD_MASK_PREVIEW_MLOOPCOL
#define CD_MASK_GRID_PAINT_MASK
#define CD_MASK_CUSTOMLOOPNORMAL
#define CD_MASK_FREESTYLE_EDGE
#define CD_MASK_ORIGSPACE
#define CD_MASK_MLOOPTANGENT
#define CD_MASK_PAINT_MASK
struct HairMapping HairMapping
struct HairCurve HairCurve
struct FreestyleEdge FreestyleEdge
struct MVertSkin MVertSkin
struct MStringProperty MStringProperty
struct GridPaintMask GridPaintMask
struct MDeformVert MDeformVert
struct OrigSpaceFace OrigSpaceFace
struct OrigSpaceLoop OrigSpaceLoop
struct MIntProperty MIntProperty
struct MFloatProperty MFloatProperty
struct FreestyleFace FreestyleFace
_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 const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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
Read Guarded memory(de)allocation.
#define MEM_reallocN(vmemh, len)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
ATTR_WARN_UNUSED_RESULT BMesh * bm
const BMAllocTemplate bm_mesh_chunksize_default
ATTR_WARN_UNUSED_RESULT const BMLoop * l
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static void layerDefault_origindex(void *data, int count)
bool CustomData_set_layer_name(const CustomData *data, int type, int n, const char *name)
static void customData_free_layer__internal(CustomDataLayer *layer, int totelem)
static void layerInterp_mdeformvert(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
void CustomData_swap(struct CustomData *data, const int index_a, const int index_b)
static void layerAdd_mloopuv(void *data1, const void *data2)
static void layerDoMinMax_propcol(const void *data, void *vmin, void *vmax)
void CustomData_external_read(CustomData *data, ID *id, CustomDataMask mask, int totelem)
const CustomData_MeshMasks CD_MASK_EVERYTHING
static void layerInitMinMax_mloop_origspace(void *vmin, void *vmax)
bool CustomData_has_math(const struct CustomData *data)
void CustomData_bmesh_set(const CustomData *data, void *block, int type, const void *source)
void CustomData_set(const CustomData *data, int index, int type, const void *source)
static bool layerValidate_normal(void *data, const uint totitems, const bool do_fixes)
static void layerSwap_flnor(void *data, const int *corner_indices)
static bool layerValidate_mloopuv(void *data, const uint totitems, const bool do_fixes)
void CustomData_bmesh_set_n(CustomData *data, void *block, int type, int n, const void *source)
void * CustomData_duplicate_referenced_layer(CustomData *data, const int type, const int totelem)
bool CustomData_free_layer_active(CustomData *data, int type, int totelem)
void * CustomData_add_layer(CustomData *data, int type, eCDAllocType alloctype, void *layerdata, int totelem)
static void CustomData_bmesh_alloc_block(CustomData *data, void **block)
static int layerMaxNum_propcol(void)
static void layerInitMinMax_mloopcol(void *vmin, void *vmax)
const CustomData_MeshMasks CD_MASK_BAREMESH_ORIGINDEX
void CustomData_to_bmeshpoly(CustomData *fdata, CustomData *ldata, int totloop)
void * CustomData_set_layer_n(const struct CustomData *data, int type, int n, void *ptr)
void CustomData_bmesh_copy_data(const CustomData *source, CustomData *dest, void *src_block, void **dest_block)
static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES]
void CustomData_free_layers(CustomData *data, int type, int totelem)
static bool layerRead_mdisps(CDataFile *cdf, void *data, int count)
static void layerMultiply_mloopuv(void *data, float fac)
static bool layerEqual_mloopuv(const void *data1, const void *data2)
void customdata_data_transfer_interp_normal_normals(const CustomDataTransferLayerMap *laymap, void *data_dst, const void **sources, const float *weights, const int count, const float mix_factor)
static bool check_bit_flag(const void *data, const size_t data_size, const uint64_t flag)
static void layerInterp_mcol(const void **sources, const float *weights, const float *sub_weights, int count, void *dest)
void CustomData_interp(const CustomData *source, CustomData *dest, const int *src_indices, const float *weights, const float *sub_weights, int count, int dest_index)
static bool layerEqual_mloop_origspace(const void *data1, const void *data2)
bool CustomData_free_layer(CustomData *data, int type, int totelem, int index)
static void write_mdisps(BlendWriter *writer, int count, MDisps *mdlist, int external)
int CustomData_number_of_layers_typemask(const CustomData *data, CustomDataMask mask)
static void layerCopy_propString(const void *source, void *dest, int count)
static void blend_read_mdisps(BlendDataReader *reader, int count, MDisps *mdisps, int external)
static void layerInterp_paint_mask(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
static void layerDoMinMax_mloopuv(const void *data, void *vmin, void *vmax)
void * CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int n)
static int CustomData_get_layer_index__notypemap(const CustomData *data, int type)
void bpy_bm_generic_invalidate(struct BPy_BMGeneric *UNUSED(self))
void CustomData_data_mix_value(int type, const void *source, void *dest, const int mixmode, const float mixfactor)
void CustomData_bmesh_free_block(CustomData *data, void **block)
static void layerDefault_mvert_skin(void *data, int count)
void CustomData_set_layer_render(CustomData *data, int type, int n)
int CustomData_get_named_layer_index(const CustomData *data, int type, const char *name)
static void layerDefault_tface(void *data, int count)
static void customdata_data_transfer_interp_generic(const CustomDataTransferLayerMap *laymap, void *data_dst, const void **sources, const float *weights, const int count, const float mix_factor)
void CustomData_clear_layer_flag(struct CustomData *data, int type, int flag)
static const LayerTypeInfo * layerType_getInfo(int type)
static void * customData_duplicate_referenced_layer_index(CustomData *data, const int layer_index, const int totelem)
int CustomData_get_layer_index(const CustomData *data, int type)
bool CustomData_bmesh_merge(const CustomData *source, CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, BMesh *bm, const char htype)
const char * CustomData_get_layer_name(const CustomData *data, int type, int n)
bool CustomData_layer_has_interp(const struct CustomData *data, int layer_n)
int CustomData_get_stencil_layer_index(const CustomData *data, int type)
bool CustomData_layertype_is_singleton(int type)
void CustomData_MeshMasks_update(CustomData_MeshMasks *mask_dst, const CustomData_MeshMasks *mask_src)
void CustomData_bmesh_init_pool(CustomData *data, int totelem, const char htype)
void CustomData_set_layer_stencil_index(CustomData *data, int type, int n)
void CustomData_set_only_copy(const struct CustomData *data, CustomDataMask mask)
static void layerCopy_propInt(const void *source, void *dest, int count)
static bool layerWrite_mdisps(CDataFile *cdf, const void *data, int count)
static void CustomData_bmesh_set_default_n(CustomData *data, void **block, int n)
int CustomData_get_active_layer(const CustomData *data, int type)
bool CustomData_data_equals(int type, const void *data1, const void *data2)
int CustomData_get_layer_index_n(const struct CustomData *data, int type, int n)
static void layerCopy_mvert_skin(const void *source, void *dest, int count)
void customData_mask_layers__print(const CustomData_MeshMasks *mask)
void CustomData_bmesh_set_layer_n(CustomData *data, void *block, int n, const void *source)
BLI_STATIC_ASSERT(ARRAY_SIZE(((CustomData *) NULL) ->typemap)==CD_NUMTYPES, "size mismatch")
void CustomData_reset(CustomData *data)
void * CustomData_get_n(const CustomData *data, int type, int index, int n)
void * CustomData_bmesh_get(const CustomData *data, void *block, int type)
static bool customdata_unique_check(void *arg, const char *name)
static void layerDoMinMax_mloop_origspace(const void *data, void *vmin, void *vmax)
static void layerSwap_tface(void *data, const int *corner_indices)
bool CustomData_MeshMasks_are_matching(const CustomData_MeshMasks *mask_ref, const CustomData_MeshMasks *mask_required)
void CustomData_from_bmeshpoly(CustomData *fdata, CustomData *ldata, int total)
void CustomData_data_add(int type, void *data1, const void *data2)
bool CustomData_has_referenced(const struct CustomData *data)
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)
static void layerCopy_tface(const void *source, void *dest, int count)
void * CustomData_duplicate_referenced_layer_n(CustomData *data, const int type, const int n, const int totelem)
static const char * layerType_getName(int type)
bool CustomData_layer_validate(CustomDataLayer *layer, const uint totitems, const bool do_fixes)
void CustomData_bmesh_interp(CustomData *data, const void **src_blocks, const float *weights, const float *sub_weights, int count, void *dst_block)
const CustomData_MeshMasks CD_MASK_BAREMESH
static void layerFree_mdisps(void *data, int count, int UNUSED(size))
bool CustomData_has_layer(const CustomData *data, int type)
static void layerInitMinMax_mloopuv(void *vmin, void *vmax)
static void customData_update_offsets(CustomData *data)
static void layerInterp_shapekey(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
static void layerAdd_mloopcol(void *data1, const void *data2)
static void copy_bit_flag(void *dst, const void *src, const size_t data_size, const uint64_t flag)
#define LAYER_CMP(l_a, t_a, l_b, t_b)
static bool customData_resize(CustomData *data, int amount)
void CustomData_external_remove(CustomData *data, ID *id, int type, int totelem)
static void layerDefault_propcol(void *data, int count)
static void layerCopy_propFloat(const void *source, void *dest, int count)
static void layerAdd_mloop_origspace(void *data1, const void *data2)
void CustomData_set_layer_render_index(CustomData *data, int type, int n)
static void layerSwap_origspace_face(void *data, const int *corner_indices)
void CustomData_set_layer_active(CustomData *data, int type, int n)
static void layerMultiply_propfloat3(void *data, float fac)
void * CustomData_get_layer_named(const struct CustomData *data, int type, const char *name)
static void layerInterp_propfloat2(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
bool CustomData_layertype_is_dynamic(int type)
void * CustomData_get_layer(const CustomData *data, int type)
static void layerCopy_mdeformvert(const void *source, void *dest, int count)
bool CustomData_is_referenced_layer(struct CustomData *data, int type)
static void layerMultiply_mloop_origspace(void *data, float fac)
static bool layerEqual_propcol(const void *data1, const void *data2)
int CustomData_layertype_layers_max(const int type)
static void layerInitMinMax_propcol(void *vmin, void *vmax)
void CustomData_free(CustomData *data, int totelem)
static void layerFree_mdeformvert(void *data, int count, int size)
void CustomData_bmesh_interp_n(CustomData *data, const void **src_blocks_ofs, const float *weights, const float *sub_weights, int count, void *dst_block_ofs, int n)
static void layerCopy_mdisps(const void *source, void *dest, int count)
static void layerCopyValue_mloopuv(const void *source, void *dest, const int mixmode, const float mixfactor)
struct LayerTypeInfo LayerTypeInfo
void CustomData_data_copy_value(int type, const void *source, void *dest)
static void layerAdd_propfloat3(void *data1, const void *data2)
static bool layerValidate_propfloat3(void *data, const uint totitems, const bool do_fixes)
int CustomData_get_n_offset(const CustomData *data, int type, int n)
void CustomData_blend_write(BlendWriter *writer, CustomData *data, CustomDataLayer *layers, int count, CustomDataMask cddata_mask, ID *id)
void CustomData_free_temporary(CustomData *data, int totelem)
int CustomData_get_stencil_layer(const CustomData *data, int type)
static void layerInterp_mloopuv(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
int CustomData_get_clone_layer(const CustomData *data, int type)
static void blend_read_paint_mask(BlendDataReader *reader, int count, GridPaintMask *grid_paint_mask)
static void layerCopy_grid_paint_mask(const void *source, void *dest, int count)
const CustomData_MeshMasks CD_MASK_BMESH
static void layerCopy_origspace_face(const void *source, void *dest, int count)
static void customdata_external_filename(char filename[FILE_MAX], ID *id, CustomDataExternal *external)
bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *ldata, bool fallback)
void CustomData_update_typemap(CustomData *data)
void CustomData_blend_read(BlendDataReader *reader, CustomData *data, int count)
void CustomData_data_multiply(int type, void *data, float fac)
void CustomData_bmesh_set_default(CustomData *data, void **block)
const char * CustomData_layertype_name(int type)
static void layerAdd_propcol(void *data1, const void *data2)
void * CustomData_get(const CustomData *data, int index, int type)
static size_t layerFilesize_mdisps(CDataFile *UNUSED(cdf), const void *data, int count)
static void layerCopy_bmesh_elem_py_ptr(const void *UNUSED(source), void *dest, int count)
static void CustomData_external_free(CustomData *data)
void CustomData_layers__print(CustomData *data)
static void layerAdd_propfloat2(void *data1, const void *data2)
static CustomDataLayer * customData_add_layer__internal(CustomData *data, int type, eCDAllocType alloctype, void *layerdata, int totelem, const char *name)
static bool customdata_typemap_is_valid(const CustomData *data)
void CustomData_external_write(CustomData *data, ID *id, CustomDataMask mask, int totelem, int free)
static bool layerEqual_mloopcol(const void *data1, const void *data2)
void CustomData_validate_layer_name(const CustomData *data, int type, const char *name, char *outname)
void * CustomData_add_layer_named(CustomData *data, int type, eCDAllocType alloctype, void *layerdata, int totelem, const char *name)
void * CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n)
void CustomData_data_transfer(const MeshPairRemap *me_remap, const CustomDataTransferLayerMap *laymap)
void CustomData_data_initminmax(int type, void *min, void *max)
static void layerFree_bmesh_elem_py_ptr(void *data, int count, int size)
int CustomData_number_of_layers(const CustomData *data, int type)
int CustomData_get_active_layer_index(const CustomData *data, int type)
void * CustomData_get_layer_n(const CustomData *data, int type, int n)
void CustomData_set_layer_clone(CustomData *data, int type, int n)
int CustomData_sizeof(int type)
void CustomData_set_layer_unique_name(CustomData *data, int index)
static void layerInterp_propfloat3(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
void CustomData_external_reload(CustomData *data, ID *UNUSED(id), CustomDataMask mask, int totelem)
static int layerMaxNum_tface(void)
void CustomData_set_layer_active_index(CustomData *data, int type, int n)
static void layerDefault_mcol(void *data, int count)
static void layerMultiply_propcol(void *data, float fac)
void CustomData_file_write_info(int type, const char **r_struct_name, int *r_struct_num)
void CustomData_free_elem(CustomData *data, int index, int count)
static int layerMaxNum_mloopcol(void)
static void layerInterp_origspace_face(const void **sources, const float *weights, const float *sub_weights, int count, void *dest)
int CustomData_get_named_layer(const struct CustomData *data, int type, const char *name)
void CustomData_copy_data(const CustomData *source, CustomData *dest, int source_index, int dest_index, int count)
static void layerInterp_mvert_skin(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
void CustomData_set_layer_flag(struct CustomData *data, int type, int flag)
int CustomData_get_offset(const CustomData *data, int type)
bool CustomData_external_test(CustomData *data, int type)
void CustomData_bmesh_do_versions_update_active_layers(CustomData *fdata, CustomData *ldata)
static void layerCopyValue_propcol(const void *source, void *dest, const int mixmode, const float mixfactor)
static void layerDefault_origspace_face(void *data, int count)
void CustomData_realloc(CustomData *data, int totelem)
void * CustomData_set_layer(const CustomData *data, int type, void *ptr)
bool CustomData_has_interp(const struct CustomData *data)
static void layerInterp_propcol(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
const CustomData_MeshMasks CD_MASK_EDITMESH
void CustomData_bmesh_copy_data_exclude_by_type(const CustomData *source, CustomData *dest, void *src_block, void **dest_block, const CustomDataMask mask_exclude)
static void layerSwap_mcol(void *data, const int *corner_indices)
static void layerMultiply_propfloat2(void *data, float fac)
static bool layerValidate_propFloat(void *data, const uint totitems, const bool do_fixes)
static void layerInterp_propFloat(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
int CustomData_get_render_layer(const CustomData *data, int type)
const CustomData_MeshMasks CD_MASK_DERIVEDMESH
bool CustomData_merge(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
static void layerInterp_normal(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
static void layerInterp_mloopcol(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
static void layerCopyValue_normal(const void *source, void *dest, const int mixmode, const float mixfactor)
bool CustomData_layer_has_math(const struct CustomData *data, int layer_n)
void CustomData_copy(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, eCDAllocType alloctype, int totelem)
static bool cd_layer_find_dupe(CustomData *data, const char *name, int type, int index)
static void layerDefault_fmap(void *data, int count)
static void layerCopyValue_mloop_origspace(const void *source, void *dest, const int UNUSED(mixmode), const float UNUSED(mixfactor))
static void layerDoMinMax_mloopcol(const void *data, void *vmin, void *vmax)
static void write_grid_paint_mask(BlendWriter *writer, int count, GridPaintMask *grid_paint_mask)
void CustomData_free_typemask(struct CustomData *data, int totelem, CustomDataMask mask)
void CustomData_from_bmesh_block(const CustomData *source, CustomData *dest, void *src_block, int dest_index)
int CustomData_get_clone_layer_index(const CustomData *data, int type)
static void layerInterp_bweight(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
static const char * LAYERTYPENAMES[CD_NUMTYPES]
int CustomData_get_render_layer_index(const CustomData *data, int type)
void CustomData_set_layer_clone_index(CustomData *data, int type, int n)
void CustomData_copy_data_named(const CustomData *source, CustomData *dest, int source_index, int dest_index, int count)
void CustomData_copy_elements(int type, void *src_data_ofs, void *dst_data_ofs, int count)
void CustomData_swap_corners(struct CustomData *data, int index, const int *corner_indices)
void CustomData_duplicate_referenced_layers(CustomData *data, int totelem)
void CustomData_data_dominmax(int type, const void *data, void *min, void *max)
void * CustomData_duplicate_referenced_layer_named(CustomData *data, const int type, const char *name, const int totelem)
static void layerInterp_mloop_origspace(const void **sources, const float *weights, const float *UNUSED(sub_weights), int count, void *dest)
static void layerDefault_mloopcol(void *data, int count)
void CustomData_external_add(CustomData *data, ID *UNUSED(id), int type, int UNUSED(totelem), const char *filename)
bool CustomData_bmesh_has_free(const struct CustomData *data)
void CustomData_to_bmesh_block(const CustomData *source, CustomData *dest, int src_index, void **dest_block, bool use_default_init)
static bool layerValidate_propfloat2(void *data, const uint totitems, const bool do_fixes)
void CustomData_copy_layer_type_data(const CustomData *source, CustomData *destination, int type, int source_index, int destination_index, int count)
const CustomData_MeshMasks CD_MASK_MESH
void CustomData_bmesh_free_block_data(CustomData *data, void *block)
#define COPY_BIT_FLAG(_type, _dst, _src, _f)
void CustomData_set_layer_stencil(CustomData *data, int type, int n)
static void layerFree_grid_paint_mask(void *data, int count, int UNUSED(size))
const CustomData_MeshMasks CD_MASK_FACECORNERS
static void layerCopyValue_mloopcol(const void *source, void *dest, const int mixmode, const float mixfactor)
static void layerSwap_mdisps(void *data, const int *ci)
void CustomData_blend_write_prepare(CustomData *data, CustomDataLayer **r_write_layers, CustomDataLayer *write_layers_buff, size_t write_layers_size)
static void layerMultiply_mloopcol(void *data, float fac)
static void layerInterp_tface(const void **sources, const float *weights, const float *sub_weights, int count, void *dest)
bool CustomData_verify_versions(struct CustomData *data, int index)
void CustomData_bmesh_free_block_data_exclude_by_type(CustomData *data, void *block, const CustomDataMask mask_exclude)
void CustomData_bmesh_update_active_layers(CustomData *fdata, CustomData *ldata)
static const float data2[18 *GP_PRIM_DATABUF_SIZE]
static const float data1[33 *GP_PRIM_DATABUF_SIZE]
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_dupallocN)(const void *vmemh)
void *(* MEM_calloc_arrayN)(size_t len, size_t size, const char *str)
size_t(* MEM_allocN_len)(const void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void update(bNodeTree *ntree)
static PropertyRNA * typemap[IDP_NUMTYPES]
unsigned __int64 uint64_t
const float * mix_weights
cd_datatransfer_interp interp
struct BLI_mempool * pool
CustomDataExternal * external
bool(* write)(CDataFile *cdf, const void *data, int count)
void(* set_default)(void *data, int count)
void(* dominmax)(const void *data1, void *min, void *max)
void(* free)(void *data, int count, int size)
void(* add)(void *data1, const void *data2)
size_t(* filesize)(CDataFile *cdf, const void *data, int count)
void(* copyvalue)(const void *source, void *dest, const int mixmode, const float mixfactor)
bool(* read)(CDataFile *cdf, void *data, int count)
void(* initminmax)(void *min, void *max)
void(* swap)(void *data, const int *corner_indices)
bool(* equal)(const void *data1, const void *data2)
void(* multiply)(void *data, float fac)
MeshPairRemapItem * items
ccl_device_inline float2 interp(const float2 &a, const float2 &b, float t)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)