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:
Hans Goudey 2022-09-26 15:42:20 -05:00
parent 8d49a4f36e
commit 57ea827bfb
Notes: blender-bot 2023-07-17 09:32:37 +02:00
Referenced by issue #101373, Regression with Crease Attribute
Referenced by issue #101340, Regression: Crease values are lost after some modifiers
Referenced by issue #105912, Regression: edge crease lost after a texture paint stroke (modifiers present)
Referenced by issue #109691, Regression: Edge Crease behaves differently between Complex and Simple Solidify
Referenced by issue #110021, Mesh Deform Modifier Vertex Count Error
Referenced by pull request #110095, Fix #110021: Deform modifier binding can go wrong in certain stacks
Referenced by commit 2cb9290012, Fix #110021: Deform modifier binding can go wrong in certain stacks
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;