Fix T56545: Material referencing missing UV crash

This commit is contained in:
Campbell Barton 2019-01-09 01:04:28 +11:00
parent 22474062b1
commit 369e1d46f0
Notes: blender-bot 2023-02-14 08:47:25 +01:00
Referenced by issue #56545, Normal map node with named UV map crashes material preview
1 changed files with 5 additions and 0 deletions

View File

@ -434,6 +434,11 @@ static void mesh_cd_calc_used_gpu_layers(
layer = (name[0] != '\0') ?
CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name) :
CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
/* Only fallback to orco (below) when we have no UV layers, see: T56545 */
if (layer == -1 && name[0] != '\0') {
layer = CustomData_get_active_layer(cd_ldata, CD_MLOOPUV);
}
}
if (layer != -1) {
cd_lused[CD_TANGENT] |= (1 << layer);