Fix: Incorrect handling for crease layers

First, there can only be one crease layer, so remove the "default name",
since apparently that's how CustomData tests for that
(see `CustomData_layertype_is_singleton`).

Second, always propagate crease data because it can be used in arbitrary
situations by geometry nodes. That also has to be done for all generic
attribute layers.

Fixes T101340, T101373
This commit is contained in:
2022-09-26 15:42:20 -05:00
parent 8d49a4f36e
commit 57ea827bfb
2 changed files with 5 additions and 4 deletions

View File

@@ -1869,7 +1869,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = {
/* 29: CD_BWEIGHT */
{sizeof(MFloatProperty), "MFloatProperty", 1, nullptr, nullptr, nullptr, layerInterp_bweight},
/* 30: CD_CREASE */
{sizeof(float), "", 0, N_("SubSurfCrease"), nullptr, nullptr, layerInterp_propFloat},
{sizeof(float), "", 0, nullptr, nullptr, nullptr, layerInterp_propFloat},
/* 31: CD_ORIGSPACE_MLOOP */
{sizeof(OrigSpaceLoop),
"OrigSpaceLoop",

View File

@@ -141,9 +141,10 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
CustomData_MeshMasks cddata_masks = scene->customdata_mask;
CustomData_MeshMasks_update(&cddata_masks, &CD_MASK_BAREMESH);
/* Custom attributes should not be removed automatically. They might be used by the render
* engine or scripts. They can still be removed explicitly using geometry nodes. */
cddata_masks.vmask |= CD_MASK_PROP_ALL;
cddata_masks.emask |= CD_MASK_PROP_ALL;
* engine or scripts. They can still be removed explicitly using geometry nodes.
* Crease can be be used in generic situations with geometry nodes as well. */
cddata_masks.vmask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
cddata_masks.emask |= CD_MASK_PROP_ALL | CD_MASK_CREASE;
cddata_masks.fmask |= CD_MASK_PROP_ALL;
cddata_masks.pmask |= CD_MASK_PROP_ALL;
cddata_masks.lmask |= CD_MASK_PROP_ALL;