bmesh-decimate now only does CustomData_has_math for loop layers, add CustomData_has_interp() for vert & edges.
This commit is contained in:
@@ -80,11 +80,13 @@ void customData_mask_layers__print(CustomDataMask mask);
|
||||
* the below operations.
|
||||
*/
|
||||
int CustomData_layer_has_math(struct CustomData *data, int layer_n);
|
||||
int CustomData_layer_has_interp(struct CustomData *data, int layer_n);
|
||||
|
||||
/**
|
||||
* Checks if any of the customdata layers has math.
|
||||
*/
|
||||
int CustomData_has_math(struct CustomData *data);
|
||||
int CustomData_has_interp(struct CustomData *data);
|
||||
|
||||
/* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
|
||||
* another, while not overwriting anything else (e.g. flags). probably only
|
||||
|
||||
@@ -2483,6 +2483,17 @@ int CustomData_layer_has_math(struct CustomData *data, int layer_n)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CustomData_layer_has_interp(struct CustomData *data, int layer_n)
|
||||
{
|
||||
const LayerTypeInfo *typeInfo = layerType_getInfo(data->layers[layer_n].type);
|
||||
|
||||
if (typeInfo->interp) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CustomData_has_math(struct CustomData *data)
|
||||
{
|
||||
int i;
|
||||
@@ -2497,6 +2508,20 @@ int CustomData_has_math(struct CustomData *data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CustomData_has_interp(struct CustomData *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* interpolates a layer at a time */
|
||||
for (i = 0; i < data->totlayer; ++i) {
|
||||
if (CustomData_layer_has_interp(data, i)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to
|
||||
* another, while not overwriting anything else (e.g. flags)*/
|
||||
void CustomData_data_copy_value(int type, void *source, void *dest)
|
||||
|
||||
@@ -697,10 +697,10 @@ void BM_mesh_decimate(BMesh *bm, const float factor)
|
||||
|
||||
|
||||
#ifdef USE_CUSTOMDATA
|
||||
/* initialize customdata flag */
|
||||
if (CustomData_has_math(&bm->vdata)) customdata_flag |= CD_DO_VERT;
|
||||
if (CustomData_has_math(&bm->edata)) customdata_flag |= CD_DO_EDGE;
|
||||
if (CustomData_has_math(&bm->ldata)) customdata_flag |= CD_DO_LOOP;
|
||||
/* initialize customdata flag, we only need math for loops */
|
||||
if (CustomData_has_interp(&bm->vdata)) customdata_flag |= CD_DO_VERT;
|
||||
if (CustomData_has_interp(&bm->edata)) customdata_flag |= CD_DO_EDGE;
|
||||
if (CustomData_has_math(&bm->ldata)) customdata_flag |= CD_DO_LOOP;
|
||||
#endif
|
||||
|
||||
/* iterative edge collapse and maintain the eheap */
|
||||
|
||||
Reference in New Issue
Block a user