forked from bartvdbraak/blender
Fix T94435: remove anonymous attributes when applying modifier
Differential Revision: https://developer.blender.org/D13994
This commit is contained in:
parent
946c70e6a7
commit
4be87e97f4
@ -253,6 +253,11 @@ bool CustomData_free_layer_active(struct CustomData *data, int type, int totelem
|
||||
*/
|
||||
void CustomData_free_layers(struct CustomData *data, int type, int totelem);
|
||||
|
||||
/**
|
||||
* Free all anonymous attributes.
|
||||
*/
|
||||
void CustomData_free_layers_anonymous(struct CustomData *data, int totelem);
|
||||
|
||||
/**
|
||||
* Returns true if a layer with the specified type exists.
|
||||
*/
|
||||
|
@ -2780,6 +2780,24 @@ void CustomData_free_layers(CustomData *data, int type, int totelem)
|
||||
}
|
||||
}
|
||||
|
||||
void CustomData_free_layers_anonymous(struct CustomData *data, int totelem)
|
||||
{
|
||||
while (true) {
|
||||
bool found_anonymous_layer = false;
|
||||
for (int i = 0; i < data->totlayer; i++) {
|
||||
const CustomDataLayer *layer = &data->layers[i];
|
||||
if (layer->anonymous_id != NULL) {
|
||||
CustomData_free_layer(data, layer->type, totelem, i);
|
||||
found_anonymous_layer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found_anonymous_layer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CustomData_has_layer(const CustomData *data, int type)
|
||||
{
|
||||
return (CustomData_get_layer_index(data, type) != -1);
|
||||
|
@ -763,6 +763,12 @@ static bool modifier_apply_obdata(
|
||||
BKE_object_material_from_eval_data(bmain, ob, &mesh_applied->id);
|
||||
BKE_mesh_nomain_to_mesh(mesh_applied, me, ob, &CD_MASK_MESH, true);
|
||||
|
||||
/* Anonymous attributes shouldn't by available on the applied geometry. */
|
||||
CustomData_free_layers_anonymous(&me->vdata, me->totvert);
|
||||
CustomData_free_layers_anonymous(&me->edata, me->totedge);
|
||||
CustomData_free_layers_anonymous(&me->pdata, me->totpoly);
|
||||
CustomData_free_layers_anonymous(&me->ldata, me->totloop);
|
||||
|
||||
if (md_eval->type == eModifierType_Multires) {
|
||||
multires_customdata_delete(me);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user