Fix T59376: UV project modifier not working after modifiers that dont provide a UVMap

This was reported for remesh and skin modifiers.
These dont preserve UV layers (and probably cannot in a reasonable way),
so instead let the UV Project modifier create a new (equally named) UV
layer (as was suggested by @brecht in T59376).

Maniphest Tasks: T59376

Differential Revision: https://developer.blender.org/D10617
This commit is contained in:
2021-03-04 15:27:10 +01:00
parent 63b7ff9f4e
commit 1668f883fb

View File

@@ -135,10 +135,11 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd,
return mesh;
}
/* make sure there are UV Maps available */
/* Create a new layer if no UV Maps are available (e.g. if a preceeding modifier could not
* preserve it). */
if (!CustomData_has_layer(&mesh->ldata, CD_MLOOPUV)) {
return mesh;
CustomData_add_layer_named(
&mesh->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, mesh->totloop, umd->uvlayer_name);
}
/* make sure we're using an existing layer */